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
Select Git revision
  • 1.2.0-test
  • 1.6.3-unreleased-tt
  • 1.7.2-unreleased-tt
  • 153-arithmetic_operation
  • 159-calculate_bucket_id
  • 211-update_test_app
  • 298-flaky_test
  • 334-query_params_error
  • 337-virtual_table
  • 347-transaction_conflict
  • 461-vdbe-limit
  • 473-support-vinyl-engine-for-create-table
  • 474-inner-join-with-global
  • 492-issue
  • 509-fix-values-indexation
  • 531-issue
  • 543-pg-params-syntax
  • 546-add-uuid-datatype-support
  • 559-bug
  • 660-panic
  • 740-support-current-timestamp-function
  • Implement-authentication-and-termination-with-PG-protocol
  • akudiyar/sbroad-jdbc
  • astrochuk/837-issue
  • astrochuk/862-issue
  • astrochuk/dismiss_receiving_buckets
  • astrochuk/new_vshard_api
  • astrochuk/repro
  • av/better-explain
  • av/fiber-multi-unprepare
  • av/fiber-v2
  • av/fix-buckets-discovery
  • av/fix-params-traversal
  • av/handle-session-drop
  • av/lower-case-2
  • av/new-protocol-v2
  • av/new_protocol
  • av/restore
  • av/return-unprepare-err
  • better
  • bnf-alter-user
  • bucket_ddl
  • calculate_bucket_id_borrow_unmut
  • certification-related-fixes
  • check_lua_cast
  • ci_fix_cache
  • ci_k8s
  • ci_kube
  • compare_parsers
  • cost_based_optimization
  • custom-build
  • debug-simple-exec
  • detached
  • detached2
  • detached3
  • detached4
  • detached5
  • detached6
  • detached7
  • detached8
  • detached9
  • dml-on-global-tables
  • ekhamitov/test-branch
  • f_alexandrov/alter_system
  • fix169
  • fix_storage_err
  • ftelnov/personal
  • get_relations
  • gmoshkin/debuggin
  • gmoshkin/tuple-rust-allocated-hacks
  • grammar_utf8
  • histogram-transformations(ARCHIVE)
  • implement-a-simple-query-flow
  • issue159_fields_order
  • issue180-fix
  • issue192_storage
  • issue199_msgpuck
  • issue230_bytes
  • issue230_dispatch
  • issue230_json
  • issue230_unbind
  • issue280
  • issue334
  • issue386
  • issue81
  • issue_159
  • kbezuglyi/remove_number_and_scalar
  • key_def
  • kv-freeze
  • main
  • max/allow-list-param-values-in-set-command
  • max/backport/cast-constants
  • max/drop-user-cascade
  • max/fix-are_subtrees_equal
  • max/pgproto/implement-sql_describe
  • mimalloc
  • mmd
  • mock-sql-generation
  • opentelemetry
  • optimize-ir
  • 0.1.0
  • 0.2.0
  • 0.2.1
  • 0.3.0
  • 0.3.1
  • 0.3.2
  • 0.3.3
  • 0.3.4
  • 0.3.5
  • 0.3.6
  • 0.3.7
  • 0.3.8
  • 0.3.9
  • 1.0.0
  • 1.0.1
  • 1.0.2
  • 1.1.0
  • 1.2.0
  • 1.2.1
  • 1.3.0
  • 1.4.0
  • 1.4.1
  • 1.4.2
  • 1.4.3
  • 1.4.4
  • 1.4.5
  • 1.4.6
  • 1.4.7
  • 1.5.0
  • 1.5.1
  • 1.6.0
  • 1.6.1
  • 1.6.2
  • 1.6.3
  • 1.6.4
  • 1.7.0
  • 1.7.1
  • 1.7.2
  • 1.7.3
139 results

Target

Select target project
  • core/sbroad
1 result
Select Git revision
  • 1.2.0-test
  • 1.6.3-unreleased-tt
  • 1.7.2-unreleased-tt
  • 153-arithmetic_operation
  • 159-calculate_bucket_id
  • 211-update_test_app
  • 298-flaky_test
  • 334-query_params_error
  • 337-virtual_table
  • 347-transaction_conflict
  • 461-vdbe-limit
  • 473-support-vinyl-engine-for-create-table
  • 474-inner-join-with-global
  • 492-issue
  • 509-fix-values-indexation
  • 531-issue
  • 543-pg-params-syntax
  • 546-add-uuid-datatype-support
  • 559-bug
  • 660-panic
  • 740-support-current-timestamp-function
  • Implement-authentication-and-termination-with-PG-protocol
  • akudiyar/sbroad-jdbc
  • astrochuk/837-issue
  • astrochuk/862-issue
  • astrochuk/dismiss_receiving_buckets
  • astrochuk/new_vshard_api
  • astrochuk/repro
  • av/better-explain
  • av/fiber-multi-unprepare
  • av/fiber-v2
  • av/fix-buckets-discovery
  • av/fix-params-traversal
  • av/handle-session-drop
  • av/lower-case-2
  • av/new-protocol-v2
  • av/new_protocol
  • av/restore
  • av/return-unprepare-err
  • better
  • bnf-alter-user
  • bucket_ddl
  • calculate_bucket_id_borrow_unmut
  • certification-related-fixes
  • check_lua_cast
  • ci_fix_cache
  • ci_k8s
  • ci_kube
  • compare_parsers
  • cost_based_optimization
  • custom-build
  • debug-simple-exec
  • detached
  • detached2
  • detached3
  • detached4
  • detached5
  • detached6
  • detached7
  • detached8
  • detached9
  • dml-on-global-tables
  • ekhamitov/test-branch
  • f_alexandrov/alter_system
  • fix169
  • fix_storage_err
  • ftelnov/personal
  • get_relations
  • gmoshkin/debuggin
  • gmoshkin/tuple-rust-allocated-hacks
  • grammar_utf8
  • histogram-transformations(ARCHIVE)
  • implement-a-simple-query-flow
  • issue159_fields_order
  • issue180-fix
  • issue192_storage
  • issue199_msgpuck
  • issue230_bytes
  • issue230_dispatch
  • issue230_json
  • issue230_unbind
  • issue280
  • issue334
  • issue386
  • issue81
  • issue_159
  • kbezuglyi/remove_number_and_scalar
  • key_def
  • kv-freeze
  • main
  • max/allow-list-param-values-in-set-command
  • max/backport/cast-constants
  • max/drop-user-cascade
  • max/fix-are_subtrees_equal
  • max/pgproto/implement-sql_describe
  • mimalloc
  • mmd
  • mock-sql-generation
  • opentelemetry
  • optimize-ir
  • 0.1.0
  • 0.2.0
  • 0.2.1
  • 0.3.0
  • 0.3.1
  • 0.3.2
  • 0.3.3
  • 0.3.4
  • 0.3.5
  • 0.3.6
  • 0.3.7
  • 0.3.8
  • 0.3.9
  • 1.0.0
  • 1.0.1
  • 1.0.2
  • 1.1.0
  • 1.2.0
  • 1.2.1
  • 1.3.0
  • 1.4.0
  • 1.4.1
  • 1.4.2
  • 1.4.3
  • 1.4.4
  • 1.4.5
  • 1.4.6
  • 1.4.7
  • 1.5.0
  • 1.5.1
  • 1.6.0
  • 1.6.1
  • 1.6.2
  • 1.6.3
  • 1.6.4
  • 1.7.0
  • 1.7.1
  • 1.7.2
  • 1.7.3
139 results
Show changes

Commits on Source 2

......@@ -1652,9 +1652,10 @@ impl Ast for AbstractSyntaxTree {
));
}
let col = self.nodes.get_node(*ast_column_id)?;
let col_name = parse_string_value_node(self, *ast_column_id)?;
let col_name =
normalize_name_from_sql(parse_string_value_node(self, *ast_column_id)?);
if let Type::ColumnName = col.rule {
match names.get(col_name) {
match names.get(col_name.as_str()) {
Some((&ColumnRole::User, pos)) => {
if pk_positions.contains(pos) {
return Err(SbroadError::Invalid(
......@@ -1842,12 +1843,14 @@ impl Ast for AbstractSyntaxTree {
let ast_child = self.nodes.get_node(*ast_child_id)?;
let plan_insert_id = if let Type::TargetColumns = ast_child.rule {
// insert into t (a, b, c) ...
let mut selected_col_names: Vec<&str> =
let mut selected_col_names: Vec<String> =
Vec::with_capacity(ast_child.children.len());
for col_id in &ast_child.children {
let col = self.nodes.get_node(*col_id)?;
if let Type::ColumnName = col.rule {
selected_col_names.push(parse_string_value_node(self, *col_id)?);
selected_col_names.push(normalize_name_from_sql(
parse_string_value_node(self, *col_id)?,
));
} else {
return Err(SbroadError::Invalid(
Entity::Type,
......@@ -1866,9 +1869,7 @@ impl Ast for AbstractSyntaxTree {
if let ColumnRole::Sharding = column.get_role() {
continue;
}
if !column.is_nullable
&& !selected_col_names.contains(&column.name.as_str())
{
if !column.is_nullable && !selected_col_names.contains(&column.name) {
return Err(SbroadError::Invalid(
Entity::Column,
Some(format!(
......
......@@ -2812,7 +2812,13 @@ fn assert_explain_eq(query: &str, params: Vec<Value>, expected: &str) {
assert_eq!(expected, actual);
}
#[cfg(test)]
mod global;
#[cfg(test)]
mod insert;
#[cfg(test)]
mod params;
#[cfg(test)]
mod single;
#[cfg(test)]
mod update;
use crate::ir::transformation::helpers::sql_to_optimized_ir;
use crate::ir::value::Value;
use pretty_assertions::assert_eq;
#[test]
fn insert1() {
let pattern = r#"INSERT INTO "test_space"("id", first_name) VALUES(?, ?)"#;
let plan = sql_to_optimized_ir(pattern, vec![Value::from(1_i64), Value::from("test")]);
let expected_explain = String::from(
r#"insert "test_space" on conflict: fail
motion [policy: segment([ref("COLUMN_1")])]
values
value row (data=ROW(1::integer, 'test'::string))
execution options:
sql_vdbe_max_steps = 45000
vtable_max_rows = 5000
"#,
);
assert_eq!(expected_explain, plan.as_explain().unwrap());
}
#[test]
fn insert2() {
let pattern = r#"INSERT INTO "test_space"("id", "FIRST_NAME") VALUES(1, 'test')"#;
let plan = sql_to_optimized_ir(pattern, vec![]);
let expected_explain = String::from(
r#"insert "test_space" on conflict: fail
motion [policy: segment([ref("COLUMN_1")])]
values
value row (data=ROW(1::unsigned, 'test'::string))
execution options:
sql_vdbe_max_steps = 45000
vtable_max_rows = 5000
"#,
);
assert_eq!(expected_explain, plan.as_explain().unwrap());
}
#[test]
fn insert3() {
let pattern = r#"INSERT INTO "test_space"("id", "sys_op")
SELECT "id", "id" FROM "test_space""#;
let plan = sql_to_optimized_ir(pattern, vec![]);
let expected_explain = String::from(
r#"insert "test_space" on conflict: fail
motion [policy: segment([ref("id")])]
projection ("test_space"."id"::unsigned -> "id", "test_space"."id"::unsigned -> "id")
scan "test_space"
execution options:
sql_vdbe_max_steps = 45000
vtable_max_rows = 5000
"#,
);
assert_eq!(expected_explain, plan.as_explain().unwrap());
}
use crate::ir::transformation::helpers::sql_to_optimized_ir;
use crate::ir::value::Value;
use pretty_assertions::assert_eq;
#[test]
fn update1() {
let pattern = r#"UPDATE "test_space" SET first_name = 'test'"#;
let plan = sql_to_optimized_ir(pattern, vec![]);
let expected_explain = String::from(
r#"update "test_space"
"FIRST_NAME" = COL_0
motion [policy: local]
projection ('test'::string -> COL_0, "test_space"."id"::unsigned -> COL_1)
scan "test_space"
execution options:
sql_vdbe_max_steps = 45000
vtable_max_rows = 5000
"#,
);
assert_eq!(expected_explain, plan.as_explain().unwrap());
}
#[test]
fn update2() {
let pattern = r#"UPDATE "test_space" SET first_name = ?"#;
let plan = sql_to_optimized_ir(pattern, vec![Value::from("test")]);
let expected_explain = String::from(
r#"update "test_space"
"FIRST_NAME" = COL_0
motion [policy: local]
projection ('test'::string -> COL_0, "test_space"."id"::unsigned -> COL_1)
scan "test_space"
execution options:
sql_vdbe_max_steps = 45000
vtable_max_rows = 5000
"#,
);
assert_eq!(expected_explain, plan.as_explain().unwrap());
}
......@@ -1092,6 +1092,7 @@ impl Plan {
strategy: update_kind,
};
let update_id = self.nodes.push(Node::Relational(update_node));
self.replace_parent_in_subtree(upd_output, None, Some(update_id))?;
Ok(update_id)
}
......@@ -1104,7 +1105,7 @@ impl Plan {
&mut self,
relation: &str,
child: usize,
columns: &[&str],
columns: &[String],
conflict_strategy: ConflictStrategy,
) -> Result<usize, SbroadError> {
let rel = self.relations.get(relation).ok_or_else(|| {
......@@ -1125,7 +1126,7 @@ impl Plan {
});
let mut cols: Vec<usize> = Vec::with_capacity(names.len());
for name in columns {
match names.get(name) {
match names.get(name.as_str()) {
Some((&ColumnRole::User, pos)) => cols.push(*pos),
Some((&ColumnRole::Sharding, _)) => {
return Err(SbroadError::FailedTo(
......
......@@ -299,7 +299,7 @@ fn insert() {
assert_eq!(
SbroadError::NotFound(Entity::Table, "t4 among plan relations".into()),
plan.add_insert("t4", scan_t1_id, &["a"], ConflictStrategy::default())
plan.add_insert("t4", scan_t1_id, &["a".into()], ConflictStrategy::default())
.unwrap_err()
);
......@@ -312,7 +312,7 @@ fn insert() {
plan.add_insert(
"t2",
scan_t1_id,
&["a", "b", "c"],
&["a".into(), "b".into(), "c".into()],
ConflictStrategy::default()
)
.unwrap_err()
......@@ -322,11 +322,16 @@ fn insert() {
SbroadError::UnexpectedNumberOfValues(
"invalid number of values: 1. Table t2 expects 2 column(s).".into()
),
plan.add_insert("t2", scan_t1_id, &["a", "b"], ConflictStrategy::default())
plan.add_insert(
"t2",
scan_t1_id,
&["a".into(), "b".into()],
ConflictStrategy::default()
)
.unwrap_err()
);
plan.add_insert("t1", scan_t1_id, &["a"], ConflictStrategy::default())
plan.add_insert("t1", scan_t1_id, &["a".into()], ConflictStrategy::default())
.unwrap();
}
......