Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
JackTan25 committed Dec 15, 2023
1 parent df155ee commit 1265c04
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ impl Processor for RowNumberAndLogSplitProcessor {
fn process(&mut self) -> Result<()> {
if let Some(data_block) = self.input_data.take() {
if data_block.get_meta().is_some() {
if SourceFullMatched::downcast_ref_from(data_block.get_meta().unwrap()).is_some() {
// distributed mode: source as build side
self.output_data_row_number = Some(data_block)
} else if RowIdKind::downcast_ref_from(data_block.get_meta().unwrap()).is_some() {
// distributed mode: source as build side
if SourceFullMatched::downcast_ref_from(data_block.get_meta().unwrap()).is_some()
// distributed mode: target as build side
|| RowIdKind::downcast_ref_from(data_block.get_meta().unwrap()).is_some()
{
self.output_data_row_number = Some(data_block)
} else {
// mutation logs
Expand Down
28 changes: 28 additions & 0 deletions tests/sqllogictests/suites/mode/standalone/explain/merge_into.test
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,34 @@ MERGE INTO salaries2 USING (SELECT * FROM employees2) as employees2 ON salaries2
----
2 2

query T
explain MERGE INTO salaries2 USING (SELECT * FROM employees2) as employees2 ON salaries2.employee_id = employees2.employee_id WHEN MATCHED AND employees2.department = 'HR' THEN UPDATE SET salaries2.salary = salaries2.salary + 1000.00 WHEN MATCHED THEN UPDATE SET salaries2.salary = salaries2.salary + 500.00 WHEN NOT MATCHED THEN INSERT (employee_id, salary) VALUES (employees2.employee_id, 55000.00);
----
MergeInto:
target_table: default.default.salaries2
├── matched update: [condition: eq(employees2.department (#2), 'HR'),update set salary = plus(salaries2.salary (#4), 1000.00)]
├── matched update: [condition: None,update set salary = plus(salaries2.salary (#4), 500.00)]
├── unmatched insert: [condition: None,insert into (employee_id,salary) values(CAST(employees2.employee_id (#0) AS Int32 NULL),CAST(55000.00 AS Decimal(10, 2) NULL))]
└── HashJoin: LEFT OUTER
├── equi conditions: [eq(employees2.employee_id (#0), salaries2.employee_id (#3))]
├── non-equi conditions: []
├── Exchange(Merge)
│ └── EvalScalar
│ ├── scalars: [employees2.employee_id (#0), employees2.employee_name (#1), employees2.department (#2)]
│ └── LogicalGet
│ ├── table: default.default.employees2
│ ├── filters: []
│ ├── order by: []
│ └── limit: NONE
└── LogicalGet
├── table: default.default.salaries2
├── filters: []
├── order by: []
└── limit: NONE

statement ok
INSERT INTO salaries2 VALUES(1, 50000.00),(2, 60000.00);

query T
explain MERGE INTO salaries2 USING (SELECT * FROM employees2) as employees2 ON salaries2.employee_id = employees2.employee_id WHEN MATCHED AND employees2.department = 'HR' THEN UPDATE SET salaries2.salary = salaries2.salary + 1000.00 WHEN MATCHED THEN UPDATE SET salaries2.salary = salaries2.salary + 500.00 WHEN NOT MATCHED THEN INSERT (employee_id, salary) VALUES (employees2.employee_id, 55000.00);
----
Expand Down

0 comments on commit 1265c04

Please sign in to comment.