Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • core/picodata
1 result
Show changes
Commits on Source (23)
Showing
with 322 additions and 152 deletions
......@@ -141,13 +141,14 @@ build-base-image:
stage: build-base-image
<<: *kaniko_image
rules:
- <<: *if-build-base-changes-on-master-branch
- <<: *if-build-base-changes-on-dev-branch
variables:
BASE_IMAGE_TAG: ${PARENT_CI_COMMIT_SHA}
- when: manual
allow_failure: true
variables:
BASE_IMAGE_TAG: ${PARENT_CI_COMMIT_SHA}
BASE_IMAGE_TAG: ${BASE_IMAGE_LATEST}
variables:
DOCKERFILE: docker-build-base/Dockerfile
DESTINATION: ${BASE_IMAGE}:${BASE_IMAGE_TAG}
......
......@@ -27,6 +27,31 @@ with the `YY.MINOR.MICRO` scheme.
PICODATA_PLUGIN_DIR -> PICODATA_SHARE_DIR, config: instance.plugin_dir ->
instance.share_dir)
- The following parameters has been moved from configuration file to `_pico_db_config` system table:
- checkpoint_interval
- checkpoint_count
- max_concurrent_messages
- `max_heartbeat_period` removed from `_pico_db_config`
- Major renaming of parameters from _pico_db_config:
- `max_concurrent_messages` renamed to `iproto_net_msg_max`
- `password_min_length` renamed to `auth_password_length_min`
- `password_enforce_uppercase` renamed to `auth_password_enforce_uppercase`
- `password_enforce_lowercase` renamed to `auth_password_enforce_lowercase`
- `password_enforce_digits` renamed to `auth_password_enforce_digits`
- `password_enforce_specialchars` renamed to `auth_password_enforce_specialchars`
- `max_login_attempts` renamed to `auth_login_attempt_max`
- `auto_offline_timeout` renamed to `governor_auto_offline_timeout`
- `max_pg_statements` renamed to `pg_statement_max`
- `max_pg_portals` renamed to `pg_portal_max`
- `snapshot_chunk_max_size` renamed to `raft_snapshot_chunk_size_max`
- `snapshot_read_view_close_timeout` renamed to `raft_snapshot_read_view_close_timeout`
- `cluster_wal_max_size` renamed to `raft_wal_size_max`
- `cluster_wal_max_count` renamed to `raft_wal_count_max`
- `listen`, `advertise` parameters are renamed to `iproto_listen`, `iproto_advertise`
### CLI
- `picodata expel` takes instance uuid instead of instance name.
......@@ -51,7 +76,7 @@ to 2 and 3.
- New special command `\set delimiter enter` to change the default delimiter to EOL (End Of Line). Introduced a new inner prompt prefix to indicate when input is waiting for a delimiter. EOF is now treated as a delimiter when reading files.
- Now, for instance to join a cluster, it's version must be the same as the cluster's version or one minor version lower. For example, if the cluster's version is 24.7, only instances with versions 24.7 or 24.6 can join.
- Now, for instance to join a cluster, its version must equal to the cluster's version or one minor version greater. For example, if the cluster's version is 24.7, only instances with versions 24.7 or 24.8 can join the cluster.
- Global rename
- Config File Changes:
......@@ -71,6 +96,8 @@ to 2 and 3.
- `vdbe_max_steps` to `sql_vdbe_opcode_max`
- `vtable_max_rows` to `sql_motion_row_max`
- `SCALAR` and `NUMBER` data types are not supported anymore.
### RPC API
- `.proc_expel` and `.proc_expel_redirect` takes instance uuid instead of instance name.
......
......@@ -74,9 +74,6 @@ build-asan-dev: build
# XXX: make sure we pass proper flags to cargo test so resulting picodata binary is reused
# can be reused for python tests without recompilation
# Note: tarantool and tlua are skipped intentionally, no need to run their doc tests in picodata
# Note: gostech-audit-log and picodata-plugin tests simply do not pass:
# https://git.picodata.io/picodata/picodata/picodata/-/issues/1084
# https://git.picodata.io/picodata/picodata/picodata/-/issues/1085
# Note: non-doc tests and doc tests are run separately. This is intended to prevent excessive
# memory usage caused by doc tests compilation model. Doc tests are compiled as part of actual test run.
# So, each parallel thread lanuched by cargo test spawns full blown compiler for each doctest
......@@ -84,16 +81,12 @@ build-asan-dev: build
.PHONY: test
test:
cargo test $(LOCKED) $(MAKE_JOBSERVER_ARGS) $(CARGO_FLAGS) $(CARGO_FLAGS_EXTRA) $(ERROR_INJECTION) \
--exclude gostech-audit-log \
--exclude picodata-plugin \
--exclude sbroad-core \
--exclude tarantool \
--exclude tlua \
--tests
cargo test $(LOCKED) $(MAKE_JOBSERVER_ARGS) $(CARGO_FLAGS) $(CARGO_FLAGS_EXTRA) $(ERROR_INJECTION) \
--exclude gostech-audit-log \
--exclude picodata-plugin \
--exclude sbroad-core \
--exclude tarantool \
--exclude tlua \
......
......@@ -2,13 +2,13 @@
{"id":"1.0.2","message":"instance is starting","severity":"low","time":"2024-03-26T13:02:22.057+0300","title":"local_startup"}
{"id":"1.0.3","initiator":"admin","instance_name":"i1","message":"a new instance `i1` joined the cluster","raft_id":"1","severity":"low","time":"2024-03-26T13:02:22.122+0300","title":"join_instance"}
{"id":"1.0.4","initiator":"admin","instance_name":"i1","message":"current grade of instance `i1` changed to Offline(0)","new_grade":"Offline(0)","raft_id":"1","severity":"medium","time":"2024-03-26T13:02:22.122+0300","title":"change_current_grade"}
{"id":"1.0.5","initiator":"admin","instance_name":"i1","message":"target grade of instance `i1` changed to Offline(0)","new_grade":"Offline(0)","raft_id":"1","severity":"low","time":"2024-03-26T13:02:22.122+0300","title":"change_target_grade"}
{"id":"1.0.4","initiator":"admin","instance_name":"i1","message":"current state of instance `i1` changed to Offline(0)","new_state":"Offline(0)","raft_id":"1","severity":"medium","time":"2024-03-26T13:02:22.122+0300","title":"change_current_state"}
{"id":"1.0.5","initiator":"admin","instance_name":"i1","message":"target state of instance `i1` changed to Offline(0)","new_state":"Offline(0)","raft_id":"1","severity":"low","time":"2024-03-26T13:02:22.122+0300","title":"change_target_state"}
{"id":"1.0.6","initiator":"admin","key":"password_min_length","message":"property `password_min_length` was changed to 8","severity":"high","time":"2024-03-26T13:02:22.123+0300","title":"change_config","value":"8"}
{"id":"1.0.7","initiator":"admin","key":"max_pg_portals","message":"property `max_pg_portals` was changed to 50","severity":"high","time":"2024-03-26T13:02:22.123+0300","title":"change_config","value":"50"}
{"id":"1.0.8","initiator":"admin","key":"snapshot_chunk_max_size","message":"property `snapshot_chunk_max_size` was changed to 16777216","severity":"high","time":"2024-03-26T13:02:22.123+0300","title":"change_config","value":"16777216"}
{"id":"1.0.9","initiator":"admin","instance_name":"i1","message":"target grade of instance `i1` changed to Online(1)","new_grade":"Online(1)","raft_id":"1","severity":"low","time":"2024-03-26T13:02:22.231+0300","title":"change_target_grade"}
{"id":"1.0.10","initiator":"admin","instance_name":"i1","message":"current grade of instance `i1` changed to Replicated(1)","new_grade":"Replicated(1)","raft_id":"1","severity":"medium","time":"2024-03-26T13:02:22.348+0300","title":"change_current_grade"}
{"id":"1.0.9","initiator":"admin","instance_name":"i1","message":"target state of instance `i1` changed to Online(1)","new_state":"Online(1)","raft_id":"1","severity":"low","time":"2024-03-26T13:02:22.231+0300","title":"change_target_state"}
{"id":"1.0.10","initiator":"admin","instance_name":"i1","message":"current state of instance `i1` changed to Replicated(1)","new_state":"Replicated(1)","raft_id":"1","severity":"medium","time":"2024-03-26T13:02:22.348+0300","title":"change_current_state"}
{"id":"1.0.11","initiator":"guest","message":"successfully authenticated user `guest`","severity":"high","time":"2024-03-26T13:02:22.367+0300","title":"auth_ok","user":"guest","verdict":"user is not blocked"}
{"id":"1.0.12","initiator":"guest","message":"successfully authenticated user `guest`","severity":"high","time":"2024-03-26T13:02:22.367+0300","title":"auth_ok","user":"guest","verdict":"user is not blocked"}
{"id":"1.0.13","initiator":"admin","instance_name":"i1","message":"current grade of instance `i1` changed to Online(1)","new_grade":"Online(1)","raft_id":"1","severity":"medium","time":"2024-03-26T13:02:22.485+0300","title":"change_current_grade"}
{"id":"1.0.13","initiator":"admin","instance_name":"i1","message":"current state of instance `i1` changed to Online(1)","new_state":"Online(1)","raft_id":"1","severity":"medium","time":"2024-03-26T13:02:22.485+0300","title":"change_current_state"}
......@@ -489,8 +489,6 @@ mod tests {
tokio::spawn(async move { send_logs(args, lines, receiver).await })
};
const EXPECTED_LINES: usize = 13;
ttime::sleep(time::Duration::from_secs(3)).await;
let _ = sender.send(Ok(()));
......@@ -513,6 +511,7 @@ mod tests {
};
}
const EXPECTED_LINES: usize = 13;
assert_eq!(counter, EXPECTED_LINES);
}
......@@ -548,8 +547,6 @@ mod tests {
tokio::spawn(async move { send_logs(args, lines, receiver).await })
};
const EXPECTED_LINES: usize = 13;
ttime::sleep(time::Duration::from_secs(3)).await;
let _ = sender.send(Ok(()));
......@@ -572,6 +569,7 @@ mod tests {
};
}
const EXPECTED_LINES: usize = 13;
assert_eq!(counter, EXPECTED_LINES);
}
......
......@@ -154,9 +154,11 @@ impl ServiceWorkerManager {
///
/// ```no_run
/// use std::time::Duration;
/// use picodata_plugin::background::{CancellationToken, InternalGlobalWorkerManager, ServiceId, ServiceWorkerManager};
/// use picodata_plugin::background::{CancellationToken, InternalGlobalWorkerManager, ServiceWorkerManager};
/// use picodata_plugin::plugin::interface::ServiceId;
///
/// # let worker_manager = InternalGlobalWorkerManager::instance().get_or_init_manager(ServiceId::new("any_plugin", "any_service", "0.1.0"));
/// # let worker_manager = InternalGlobalWorkerManager::instance()
/// # .get_or_init_manager(ServiceId::new("any_plugin", "any_service", "0.1.0"));
///
/// // this job will print "hello" every second,
/// // and print "bye" after being canceled
......
......@@ -94,13 +94,11 @@
//! This function will open a file, parse data, and send a result using an unbounded channel.
//!
//! ```no_run
//! use std::fs::read_to_string;
//! use std::path::Path;
//! use std::{fs, path::Path};
//! use picodata_plugin::interplay::cbus;
//! use serde_json;
//!
//! fn parse(file: &Path, tx: cbus::unbounded::Sender<serde_json::Value>) {
//! let raw_json = read_to_string(file).unwrap();
//! let raw_json = fs::read_to_string(file).unwrap();
//! let object = serde_json::from_str(&raw_json).unwrap();
//! tx.send(object).unwrap();
//! }
......@@ -109,16 +107,26 @@
//! Second, lets create a function for parse a list of files that may be used in `picodata` runtime.
//!
//! ```no_run
//! use std::path::PathBuf;
//! # use std::{fs, path::Path};
//! # fn parse(file: &Path, tx: unbounded::Sender<serde_json::Value>) {
//! # let raw_json = fs::read_to_string(file).unwrap();
//! # let object = serde_json::from_str(&raw_json).unwrap();
//! # tx.send(object).unwrap();
//! # }
//! use std::{path::PathBuf, sync::OnceLock};
//! use picodata_plugin::interplay::channel::unbounded;
//! use threadpool::ThreadPool;
//!
//! static THREAD_POOL: ThreadPool = ThreadPool::new(16);
//! static THREAD_POOL: OnceLock<ThreadPool> = OnceLock::new();
//!
//! fn parse_files(files: &[PathBuf]) -> Vec<serde_json::Value> {
//! let (tx, rx) = unbounded::channel();
//! for file in files {
//! THREAD_POOL.execute(parse(file, tx.clone()));
//! let file = file.clone();
//! let tx = tx.clone();
//! THREAD_POOL
//! .get_or_init(|| ThreadPool::new(16))
//! .execute(move || parse(&file, tx));
//! }
//!
//! let mut result = Vec::with_capacity(files.len());
......
......@@ -43,12 +43,56 @@ version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"
[[package]]
name = "anstream"
version = "0.6.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"is_terminal_polyfill",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9"
[[package]]
name = "anstyle-parse"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c"
dependencies = [
"windows-sys",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e"
dependencies = [
"anstyle",
"once_cell",
"windows-sys",
]
[[package]]
name = "anyhow"
version = "1.0.95"
......@@ -231,8 +275,10 @@ version = "4.5.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b26884eb4b57140e4d2d93652abfa49498b938b3c9179f9fc487b0acc3edad7"
dependencies = [
"anstream",
"anstyle",
"clap_lex",
"strsim 0.11.1",
]
[[package]]
......@@ -241,6 +287,12 @@ version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
[[package]]
name = "colorchoice"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
[[package]]
name = "constant_time_eq"
version = "0.3.1"
......@@ -368,7 +420,7 @@ dependencies = [
"ident_case",
"proc-macro2 1.0.93",
"quote 1.0.38",
"strsim",
"strsim 0.10.0",
"syn 1.0.109",
]
......@@ -662,6 +714,12 @@ dependencies = [
"windows-sys",
]
[[package]]
name = "is_terminal_polyfill"
version = "1.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
[[package]]
name = "itertools"
version = "0.10.5"
......@@ -1100,6 +1158,7 @@ name = "sbroad-benches"
version = "0.1.0"
dependencies = [
"bincode",
"clap",
"criterion",
"pest",
"pest_derive",
......@@ -1271,6 +1330,12 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "strsim"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "syn"
version = "0.15.44"
......@@ -1477,6 +1542,12 @@ version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"
[[package]]
name = "utf8parse"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
name = "uuid"
version = "0.8.2"
......
......@@ -221,8 +221,6 @@ type ::= 'BOOL'
| 'DOUBLE'
| 'INT'
| 'INTEGER'
| 'NUMBER'
| 'SCALAR'
| 'STRING'
| 'TEXT'
| 'UNSIGNED'
......
......@@ -21,6 +21,7 @@ version = ">=4.0"
features = ["picodata"]
[dev-dependencies]
clap = { version = "4", features = ["default"] }
criterion = "0.5.1"
rand = "0.8"
......
......@@ -11,6 +11,7 @@ use sbroad::executor::engine::helpers::normalize_name_from_sql;
use sbroad::executor::engine::{get_builtin_functions, Metadata};
use sbroad::executor::lru::DEFAULT_CAPACITY;
use sbroad::ir::function::Function;
use sbroad::ir::relation::DerivedType;
use sbroad::ir::relation::{Column, ColumnRole, SpaceEngine, Table, Type};
use sbroad::{debug, warn};
......@@ -138,7 +139,7 @@ impl RouterConfiguration {
} else {
ColumnRole::User
};
let col = Column::new(name, t, role, is_nullable);
let col = Column::new(name, DerivedType::new(t), role, is_nullable);
result.push(col);
}
result
......
use super::*;
use pretty_assertions::assert_eq;
use sbroad::ir::relation::DerivedType;
#[test]
fn test_yaml_schema_parser() {
......@@ -11,16 +12,16 @@ fn test_yaml_schema_parser() {
format:
- name: ID
is_nullable: false
type: number
type: integer
- name: sysFrom
is_nullable: false
type: number
type: integer
- name: FIRST_NAME
is_nullable: false
type: string
- name: sysOp
is_nullable: false
type: number
type: integer
- name: bucket_id
is_nullable: true
type: unsigned
......@@ -30,10 +31,10 @@ fn test_yaml_schema_parser() {
unique: true
parts:
- path: ID
type: number
type: integer
is_nullable: false
- path: sysFrom
type: number
type: integer
is_nullable: false
- type: TREE
name: bucket_id
......@@ -59,7 +60,7 @@ fn test_yaml_schema_parser() {
type: integer
is_nullable: false
- name: sys_op
type: number
type: integer
is_nullable: false
- name: bucket_id
type: unsigned
......@@ -109,7 +110,7 @@ fn test_getting_table_segment() {
type: boolean
is_nullable: false
- name: sys_op
type: number
type: integer
is_nullable: false
- name: detail
type: array
......@@ -145,15 +146,40 @@ fn test_getting_table_segment() {
vec![
Column::new(
"identification_number",
Type::Integer,
DerivedType::new(Type::Integer),
ColumnRole::User,
false,
),
Column::new("product_code", Type::String, ColumnRole::User, false),
Column::new("product_units", Type::Boolean, ColumnRole::User, false),
Column::new("sys_op", Type::Number, ColumnRole::User, false),
Column::new("detail", Type::Array, ColumnRole::User, false),
Column::new("bucket_id", Type::Unsigned, ColumnRole::Sharding, true),
Column::new(
"product_code",
DerivedType::new(Type::String),
ColumnRole::User,
false,
),
Column::new(
"product_units",
DerivedType::new(Type::Boolean),
ColumnRole::User,
false,
),
Column::new(
"sys_op",
DerivedType::new(Type::Integer),
ColumnRole::User,
false,
),
Column::new(
"detail",
DerivedType::new(Type::Array),
ColumnRole::User,
false,
),
Column::new(
"bucket_id",
DerivedType::new(Type::Unsigned),
ColumnRole::Sharding,
true,
),
],
&["identification_number", "product_code"],
&["identification_number"],
......
......@@ -44,7 +44,7 @@ local config = {
},
{
name = "sys_op",
type = "number",
type = "integer",
is_nullable = false,
},
{
......@@ -66,7 +66,7 @@ local config = {
},
{
path = "sys_op",
type = "number",
type = "integer",
is_nullable = false,
}
},
......@@ -103,7 +103,7 @@ local config = {
},
{
name = "sys_op",
type = "number",
type = "integer",
is_nullable = false,
},
{
......@@ -125,7 +125,7 @@ local config = {
},
{
path = "sys_op",
type = "number",
type = "integer",
is_nullable = false,
}
},
......
......@@ -39,7 +39,7 @@ local config = {
},
{
name = "a",
type = "number",
type = "integer",
is_nullable = false,
},
{
......@@ -88,7 +88,7 @@ local config = {
},
{
name = "a",
type = "number",
type = "integer",
is_nullable = false,
},
{
......@@ -642,17 +642,17 @@ local config = {
},
{
name = "sys_op",
type = "number",
type = "integer",
is_nullable = false,
},
{
name = "sys_to",
type = "number",
type = "integer",
is_nullable = false,
},
{
name = "sys_from",
type = "number",
type = "integer",
is_nullable = false,
},
{
......@@ -674,7 +674,7 @@ local config = {
},
{
path = "sys_op",
type = "number",
type = "integer",
is_nullable = false,
}
},
......@@ -1223,17 +1223,17 @@ local config = {
},
{
name = "sys_op",
type = "number",
type = "integer",
is_nullable = false,
},
{
name = "sys_to",
type = "number",
type = "integer",
is_nullable = false,
},
{
name = "sys_from",
type = "number",
type = "integer",
is_nullable = false,
},
{
......@@ -1255,7 +1255,7 @@ local config = {
},
{
path = "sys_op",
type = "number",
type = "integer",
is_nullable = false,
}
},
......
......@@ -34,7 +34,7 @@ schema:
- type: string
name: string_col
is_nullable: false
- type: number
- type: decimal
name: number_col
is_nullable: false
- type: unsigned
......@@ -89,7 +89,7 @@ schema:
- type: string
name: string_col
is_nullable: false
- type: number
- type: decimal
name: number_col
is_nullable: false
- type: unsigned
......@@ -119,10 +119,10 @@ schema:
format:
- is_nullable: false
name: id
type: number
type: integer
- is_nullable: false
name: reqId
type: number
type: integer
- is_nullable: false
name: name
type: string
......@@ -134,10 +134,10 @@ schema:
type: string
- is_nullable: false
name: salary
type: number
type: integer
- is_nullable: false
name: sysOp
type: number
type: integer
- is_nullable: false
name: bucket_id
type: unsigned
......@@ -149,7 +149,7 @@ schema:
parts:
- path: id
is_nullable: false
type: number
type: integer
name: id
type: TREE
- unique: false
......@@ -210,7 +210,7 @@ schema:
type: TREE
col1_col2_transactions_num_actual:
format:
- type: number
- type: integer
name: col1
is_nullable: false
- type: integer
......@@ -238,7 +238,7 @@ schema:
- unique: true
parts:
- path: col1
type: number
type: integer
is_nullable: false
- path: col2
type: integer
......@@ -420,7 +420,7 @@ schema:
- type: integer
name: id
is_nullable: false
- type: number
- type: decimal
name: a
is_nullable: false
- type: unsigned
......@@ -540,10 +540,10 @@ schema:
type: TREE
col1_col2_transactions_num_history:
format:
- type: number
- type: integer
name: id
is_nullable: false
- type: number
- type: integer
name: col1
is_nullable: false
- type: integer
......@@ -574,14 +574,14 @@ schema:
- unique: true
parts:
- path: id
type: number
type: integer
is_nullable: false
name: id
type: TREE
- unique: false
parts:
- path: col1
type: number
type: integer
is_nullable: false
- path: col2
type: integer
......@@ -634,10 +634,10 @@ schema:
format:
- is_nullable: false
name: id
type: number
type: integer
- is_nullable: false
name: reqId
type: number
type: integer
- is_nullable: false
name: name
type: string
......@@ -649,10 +649,10 @@ schema:
type: string
- is_nullable: false
name: salary
type: number
type: integer
- is_nullable: false
name: sysOp
type: number
type: integer
- is_nullable: false
name: bucket_id
type: unsigned
......@@ -666,7 +666,7 @@ schema:
parts:
- path: id
is_nullable: false
type: number
type: integer
name: id
type: TREE
- unique: false
......@@ -876,10 +876,10 @@ schema:
- type: integer
name: id
is_nullable: false
- type: number
- type: integer
name: field1
is_nullable: false
- type: number
- type: integer
name: field2
is_nullable: false
- type: string
......@@ -912,7 +912,7 @@ schema:
- type: integer
name: field12
is_nullable: false
- type: number
- type: integer
name: field13
is_nullable: false
- type: unsigned
......@@ -986,13 +986,13 @@ schema:
- type: unsigned
name: bucket_id
is_nullable: false
- type: number
- type: integer
name: sys_from
is_nullable: false
- type: number
- type: integer
name: sys_to
is_nullable: true
- type: number
- type: integer
name: sys_op
is_nullable: false
temporary: false
......@@ -1007,24 +1007,24 @@ schema:
type: string
- path: sys_from
is_nullable: false
type: number
type: integer
type: TREE
name: id
- unique: false
parts:
- path: sys_from
is_nullable: false
type: number
type: integer
type: TREE
name: x_sys_from
- unique: false
parts:
- path: sys_to
is_nullable: true
type: number
type: integer
- path: sys_op
is_nullable: false
type: number
type: integer
type: TREE
name: x_sys_to
- unique: false
......@@ -1049,13 +1049,13 @@ schema:
- type: unsigned
name: bucket_id
is_nullable: false
- type: number
- type: integer
name: sys_from
is_nullable: false
- type: number
- type: integer
name: sys_to
is_nullable: true
- type: number
- type: integer
name: sys_op
is_nullable: false
temporary: false
......@@ -1070,14 +1070,14 @@ schema:
type: string
- path: sys_from
is_nullable: false
type: number
type: integer
type: TREE
name: id
- unique: false
parts:
- path: sys_from
is_nullable: false
type: number
type: integer
type: TREE
name: x_sys_from
- unique: false
......
......@@ -358,7 +358,7 @@ g.test_decimal_double = function()
t.assert_equals(err, nil)
t.assert_equals(r.metadata, {
{name = "id", type = "integer"},
{name = "a", type = "number"},
{name = "a", type = "decimal"},
{name = "bucket_id", type = "unsigned"},
})
t.assert_items_equals(r.rows, {
......@@ -382,7 +382,7 @@ g.test_bucket_id_in_join = function()
{name = "id", type = "integer"},
{name = "name", type = "string"},
{name = "sysOp", type = "integer"},
{name = "a", type = "number"},
{name = "a", type = "decimal"},
},
rows = {},
})
......@@ -398,7 +398,7 @@ g.test_lowercase1 = function()
t.assert_equals(err, nil)
t.assert_equals(r, {
metadata = {
{name = "id", type = "number"},
{name = "id", type = "integer"},
},
rows = {},
})
......@@ -414,7 +414,7 @@ g.test_lowercase2 = function()
t.assert_equals(err, nil)
t.assert_equals(r, {
metadata = {
{name = "id", type = "number"},
{name = "id", type = "integer"},
},
rows = {},
})
......@@ -867,7 +867,7 @@ g.test_select_without_scan = function ()
t.assert_equals(r, {
metadata = {
{name = "col_1", type = "integer"},
{name = "bar", type = "integer"},
{name = "bar", type = "unsigned"},
{name = "col_2", type = "unsigned"},
},
rows = { {1, 2, 30} },
......
......@@ -60,6 +60,16 @@ arbitrary_projection.test_arbitrary_invalid = function()
select "a" + "b" and true from "arithmetic_space"
]], {} })
t.assert_str_contains(tostring(err), "Type mismatch: can not convert integer(3) to boolean")
local _, err = api:call("sbroad.execute", { [[
SELECT
CASE "id"
WHEN 1 THEN 'first'
ELSE 42
END "case_result"
FROM "arithmetic_space"
]], {} })
t.assert_str_contains(tostring(err), "expected string type, but got unsigned")
end
arbitrary_projection.test_arbitrary_valid = function()
......@@ -196,16 +206,16 @@ arbitrary_projection.test_arbitrary_valid = function()
CASE "id"
WHEN 1 THEN 'first'
WHEN 2 THEN 'second'
ELSE 42
ELSE '42'
END "case_result"
FROM "arithmetic_space"
]], {} })
t.assert_equals(err, nil)
t.assert_equals(r.metadata, {
{name = "case_result", type = "scalar"},
{name = "case_result", type = "string"},
})
t.assert_items_equals(r.rows, {
{'first'}, {42}, {42}, {42}, {42}, {'second'}, {42}, {42}, {42}, {42}
{'first'}, {'42'}, {'42'}, {'42'}, {'42'}, {'second'}, {'42'}, {'42'}, {'42'}, {'42'}
})
local r, err = api:call("sbroad.execute", { [[
......@@ -281,14 +291,14 @@ arbitrary_projection.test_arbitrary_valid = function()
SELECT
"id",
CASE
WHEN false THEN 'never'
WHEN false THEN 0
WHEN "id" < 3 THEN 1
WHEN "id" > 3 AND "id" < 8 THEN 2
ELSE
CASE
WHEN "id" = 8 THEN 3
WHEN "id" = 9 THEN 4
ELSE 0.42
ELSE 0
END
END
FROM "arithmetic_space"
......@@ -296,18 +306,70 @@ arbitrary_projection.test_arbitrary_valid = function()
t.assert_equals(err, nil)
t.assert_equals(r.metadata, {
{name = "id", type = "integer"},
{name = "col_1", type = "scalar"},
{name = "col_1", type = "unsigned"},
})
t.assert_items_equals(r.rows, {
{1, 1},
{5, 2},
{8, 3},
{9, 4},
{10, 0.42},
{10, 0},
{2, 1},
{3, 0.42},
{3, 0},
{4, 2},
{6, 2},
{7, 2},
})
end
arbitrary_projection.test_values = function()
local api = cluster:server("api-1").net_box
local r, err = api:call("sbroad.execute", { [[VALUES (?, ?, ?), (?, ?, ?)]], { 8, 8, box.NULL, 9, 9, 'hello' } })
t.assert_equals(err, nil)
t.assert_items_equals(r["metadata"], {
{name = "COLUMN_4", type = "integer"},
{name = "COLUMN_5", type = "integer"},
{name = "COLUMN_6", type = "string"},
})
t.assert_items_equals(r["rows"], { { 8, 8, box.NULL }, { 9, 9, 'hello' } })
local r, err = api:call("sbroad.execute", { [[VALUES (?, ?, ?), (?, ?, ?)]], { 8, 8, box.NULL, 9, 9, 'hello' } })
t.assert_equals(err, nil)
t.assert_items_equals(r["metadata"], {
{name = "COLUMN_4", type = "integer"},
{name = "COLUMN_5", type = "integer"},
{name = "COLUMN_6", type = "string"},
})
t.assert_items_equals(r["rows"], { { 8, 8, box.NULL }, { 9, 9, 'hello' } })
r, err = api:call(
"sbroad.execute",
{ [[VALUES (?, ?, ?), (?, ?, ?)]], { 9, 9, 'hello', 8, 8, box.NULL } }
)
t.assert_equals(err, nil)
t.assert_items_equals(r["metadata"], {
{name = "COLUMN_4", type = "integer"},
{name = "COLUMN_5", type = "integer"},
{name = "COLUMN_6", type = "string"},
})
t.assert_items_equals(r["rows"], { { 9, 9, 'hello' }, { 8, 8, box.NULL } })
r, err = api:call("sbroad.execute", { [[VALUES (8, 8, null), (9, 9, 'hello')]], {} })
t.assert_equals(err, nil)
t.assert_items_equals(r["metadata"], {
{name = "COLUMN_4", type = "unsigned"},
{name = "COLUMN_5", type = "unsigned"},
{name = "COLUMN_6", type = "string"},
})
t.assert_items_equals(r["rows"], { { 8, 8, box.NULL }, { 9, 9, 'hello' } })
r, err = api:call("sbroad.execute", { [[VALUES (9, 9, 'hello'), (8, 8, null)]], {} })
t.assert_equals(err, nil)
t.assert_items_equals(r["metadata"], {
{name = "COLUMN_4", type = "unsigned"},
{name = "COLUMN_5", type = "unsigned"},
{name = "COLUMN_6", type = "string"},
})
t.assert_items_equals(r["rows"], { { 9, 9, 'hello' }, { 8, 8, box.NULL } })
end
\ No newline at end of file
......@@ -204,15 +204,6 @@ g.test_arithmetic_invalid = function()
tostring(err),
"Type mismatch: can not convert string('123') to integer, decimal, double, datetime or interval"
)
-- arithemic operation on number col
local _, err = api:call("sbroad.execute",
{ [[select "id" from "arithmetic_space" where "number_col" + "number_col" > 0]], {} }
)
t.assert_str_contains(
tostring(err),
"Type mismatch: can not convert number(4.6) to integer, decimal, double, datetime or interval"
)
end
g2.test_arithmetic_invalid = function()
......@@ -269,15 +260,6 @@ g2.test_arithmetic_invalid = function()
tostring(err),
"invalid expression: types string and string are not supported for arithmetic expression"
)
-- arithemic operation on number col
local _, err = api:call("sbroad.execute",
{ [[select "number_col" + "number_col" from "arithmetic_space"]], {} }
)
t.assert_str_contains(
tostring(err),
"invalid expression: types number and number are not supported for arithmetic expression"
)
end
g.test_arithmetic_valid = function()
......
......@@ -31,7 +31,7 @@ g.test_cte = function ()
SELECT b FROM cte
]], })
t.assert_equals(err, nil)
t.assert_items_equals(r["metadata"], { {name = "b", type = "number"} })
t.assert_items_equals(r["metadata"], { {name = "b", type = "decimal"} })
t.assert_items_equals(r["rows"], { {4}, {5} })
-- nested cte
......@@ -41,7 +41,7 @@ g.test_cte = function ()
SELECT * FROM cte2
]], })
t.assert_equals(err, nil)
t.assert_items_equals(r["metadata"], { {name = "b", type = "number"} })
t.assert_items_equals(r["metadata"], { {name = "b", type = "decimal"} })
t.assert_items_equals(r["rows"], { {4}, {5} })
-- reuse cte
......@@ -52,7 +52,7 @@ g.test_cte = function ()
SELECT b FROM cte
]], })
t.assert_equals(err, nil)
t.assert_items_equals(r["metadata"], { {name = "b", type = "number"} })
t.assert_items_equals(r["metadata"], { {name = "b", type = "decimal"} })
t.assert_items_equals(r["rows"], { {4}, {5}, {4}, {5} })
-- inner join table with cte
......@@ -63,7 +63,7 @@ g.test_cte = function ()
t.assert_equals(err, nil)
t.assert_items_equals(
r["metadata"],
{ {name = "b", type = "number"}, {name = "a", type = "number"} }
{ {name = "b", type = "decimal"}, {name = "a", type = "decimal"} }
)
t.assert_items_equals(r["rows"], { {1, 1}, {2, 2} })
......@@ -75,7 +75,7 @@ g.test_cte = function ()
t.assert_equals(err, nil)
t.assert_items_equals(
r["metadata"],
{ {name = "b", type = "number"}, {name = "a", type = "number"} }
{ {name = "b", type = "decimal"}, {name = "a", type = "decimal"} }
)
t.assert_items_equals( r["rows"], { {1, 1}, {2, 2} })
......@@ -89,7 +89,7 @@ g.test_cte = function ()
t.assert_equals(err, nil)
t.assert_items_equals(
r["metadata"],
{ {name = "b", type = "number"} }
{ {name = "b", type = "decimal"} }
)
t.assert_items_equals( r["rows"], { {1}, {2} })
......@@ -99,7 +99,7 @@ g.test_cte = function ()
SELECT count(b) FROM cte
]], })
t.assert_equals(err, nil)
t.assert_items_equals(r["metadata"], { {name = "col_1", type = "integer"} })
t.assert_items_equals(r["metadata"], { {name = "col_1", type = "unsigned"} })
t.assert_items_equals(r["rows"], { {2} })
-- cte in subquery
......@@ -110,7 +110,7 @@ g.test_cte = function ()
t.assert_equals(err, nil)
t.assert_items_equals(
r["metadata"],
{ {name = "id", type = "integer"}, {name = "a", type = "number"} }
{ {name = "id", type = "integer"}, {name = "a", type = "decimal"} }
)
t.assert_items_equals(r["rows"], { {1, 1}, {2, 2}, {3, 3} })
......@@ -140,7 +140,7 @@ g.test_cte = function ()
SELECT b FROM cte2
]], })
t.assert_equals(err, nil)
t.assert_items_equals(r["metadata"], { {name = "b", type = "number"} })
t.assert_items_equals(r["metadata"], { {name = "b", type = "decimal"} })
t.assert_items_equals(r["rows"], { {1}, {2} })
-- join in cte
......@@ -153,7 +153,7 @@ g.test_cte = function ()
SELECT c FROM cte
]], })
t.assert_equals(err, nil)
t.assert_items_equals(r["metadata"], { {name = "c", type = "number"} })
t.assert_items_equals(r["metadata"], { {name = "c", type = "decimal"} })
t.assert_items_equals(r["rows"], { {1} })
-- order by in cte
......@@ -162,7 +162,7 @@ g.test_cte = function ()
SELECT b FROM cte
]], })
t.assert_equals(err, nil)
t.assert_items_equals(r["metadata"], { {name = "b", type = "number"} })
t.assert_items_equals(r["metadata"], { {name = "b", type = "decimal"} })
t.assert_items_equals(r["rows"], { {5}, {4} })
-- randomly distributed cte, used multiple times
......@@ -172,7 +172,7 @@ g.test_cte = function ()
JOIN cte ON true
]], })
t.assert_equals(err, nil)
t.assert_items_equals(r["metadata"], { {name = "c", type = "integer"} })
t.assert_items_equals(r["metadata"], { {name = "c", type = "unsigned"} })
t.assert_items_equals(r["rows"], { {4}, {4} })
-- cte with segment distributed, used multiple times
......@@ -182,7 +182,7 @@ g.test_cte = function ()
JOIN cte ON true
]], })
t.assert_equals(err, nil)
t.assert_items_equals(r["metadata"], { {name = "c", type = "integer"} })
t.assert_items_equals(r["metadata"], { {name = "c", type = "unsigned"} })
t.assert_items_equals(r["rows"], { {1} })
-- globally distributed cte, used multiple times
......@@ -192,7 +192,7 @@ g.test_cte = function ()
JOIN cte ON true
]], })
t.assert_equals(err, nil)
t.assert_items_equals(r["metadata"], { {name = "c", type = "integer"} })
t.assert_items_equals(r["metadata"], { {name = "c", type = "unsigned"} })
t.assert_items_equals(r["rows"], { {1} })
-- cte with "serialize as empty table" opcode in motion
......
......@@ -45,13 +45,13 @@ g.test_insert_after_index = function()
t.assert_equals(err, nil)
t.assert_equals(r, {
metadata = {
{ name = "id", type = "number" },
{ name = "reqId", type = "number" },
{ name = "id", type = "integer" },
{ name = "reqId", type = "integer" },
{ name = "name", type = "string" },
{ name = "department", type = "string" },
{ name = "manager", type = "string" },
{ name = "salary", type = "number" },
{ name = "sysOp", type = "number" }
{ name = "salary", type = "integer" },
{ name = "sysOp", type = "integer" }
},
rows = { },
})
......@@ -63,7 +63,7 @@ g.test_insert_after_index = function()
{
{
name = "id",
parts = {{is_nullable = false, path = "id", type = "number"}},
parts = {{is_nullable = false, path = "id", type = "integer"}},
type = "TREE",
unique = true,
},
......@@ -94,7 +94,7 @@ g.test_insert_after_index = function()
{
name = "id",
parts = {
{is_nullable = false, path = "id", type = "number"}
{is_nullable = false, path = "id", type = "integer"}
},
type = "TREE",
unique = true,
......@@ -134,7 +134,7 @@ g.test_insert_after_index = function()
{
name = "id",
parts = {
{is_nullable = false, path = "id", type = "number"}
{is_nullable = false, path = "id", type = "integer"}
},
type = "TREE",
unique = true,
......@@ -166,13 +166,13 @@ g.test_insert_after_index = function()
t.assert_equals(err, nil)
t.assert_equals(r, {
metadata = {
{ name = "id", type = "number" },
{ name = "reqId", type = "number" },
{ name = "id", type = "integer" },
{ name = "reqId", type = "integer" },
{ name = "name", type = "string" },
{ name = "department", type = "string" },
{ name = "manager", type = "string" },
{ name = "salary", type = "number" },
{ name = "sysOp", type = "number" }
{ name = "salary", type = "integer" },
{ name = "sysOp", type = "integer" }
},
rows = { },
})
......@@ -194,13 +194,13 @@ g.test_insert_after_index = function()
)
t.assert_equals(err, nil)
t.assert_equals(r.metadata, {
{ name = "id", type = "number" },
{ name = "reqId", type = "number" },
{ name = "id", type = "integer" },
{ name = "reqId", type = "integer" },
{ name = "name", type = "string" },
{ name = "department", type = "string" },
{ name = "manager", type = "string" },
{ name = "salary", type = "number" },
{ name = "sysOp", type = "number" }
{ name = "salary", type = "integer" },
{ name = "sysOp", type = "integer" }
})
t.assert_items_equals(r.rows, {
{ 1, 1, "123", "123", "123", 100, 0 },
......