korlov42 commented on code in PR #5746:
URL: https://github.com/apache/ignite-3/pull/5746#discussion_r2075274635


##########
modules/sql-engine/src/integrationTest/sql/group1/explain/scan.test:
##########
@@ -0,0 +1,277 @@
+statement ok
+CREATE TABLE test_table (c1 INT PRIMARY KEY, c2 INT, c3 INT);
+
+# select all, no renames
+plan
+SELECT * FROM test_table
+----
+Exchange
+    distribution: single
+    est. row count: 1
+  TableScan
+      table: [PUBLIC, TEST_TABLE]
+      fields: [C1, C2, C3]
+      est. row count: 1
+
+# select with trimming projection, no renames
+plan
+SELECT c1, c2 FROM test_table
+----
+Exchange
+    distribution: single
+    est. row count: 1
+  TableScan
+      table: [PUBLIC, TEST_TABLE]
+      fields: [C1, C2]
+      est. row count: 1
+
+# select with trimming projection and renames
+plan
+SELECT c1 AS renamed_c1, c2 FROM test_table
+----
+Exchange
+    distribution: single
+    est. row count: 1
+  TableScan
+      table: [PUBLIC, TEST_TABLE]
+      fields: [RENAMED_C1, C2]
+      est. row count: 1
+
+# select with expression projection, no renames
+plan
+SELECT c1 + c3, c2 FROM test_table
+----
+Exchange
+    distribution: single
+    est. row count: 1
+  TableScan
+      table: [PUBLIC, TEST_TABLE]
+      fields: [EXPR$0, C2]
+      projects: [+(C1, C3), C2]
+      est. row count: 1
+
+# select with expression projection and renames
+plan
+SELECT c1 + c3 AS sum_of_c1_and_c3, c2 FROM test_table
+----
+Exchange
+    distribution: single
+    est. row count: 1
+  TableScan
+      table: [PUBLIC, TEST_TABLE]
+      fields: [SUM_OF_C1_AND_C3, C2]
+      projects: [+(C1, C3), C2]
+      est. row count: 1
+
+# Similar set of tests but for IndexScan
+statement ok
+CREATE INDEX test_table_idx ON test_table (c1, c2, c3);
+
+# select all, no renames
+plan
+SELECT /*+ FORCE_INDEX(test_table_idx) */ * FROM test_table
+----
+Exchange
+    distribution: single
+    est. row count: 1
+  IndexScan
+      table: [PUBLIC, TEST_TABLE]
+      index: TEST_TABLE_IDX
+      type: SORTED
+      fields: [C1, C2, C3]
+      collation: [C1 ASC, C2 ASC, C3 ASC]
+      est. row count: 1
+
+# select with trimming projection, no renames
+plan
+SELECT /*+ FORCE_INDEX(test_table_idx) */ c1, c2 FROM test_table
+----
+Exchange
+    distribution: single
+    est. row count: 1
+  IndexScan
+      table: [PUBLIC, TEST_TABLE]
+      index: TEST_TABLE_IDX
+      type: SORTED
+      fields: [C1, C2]
+      collation: [C1 ASC, C2 ASC]
+      est. row count: 1
+
+# select with trimming projection and renames
+plan
+SELECT /*+ FORCE_INDEX(test_table_idx) */ c1 AS renamed_c1, c2 FROM test_table
+----
+Exchange
+    distribution: single
+    est. row count: 1
+  IndexScan
+      table: [PUBLIC, TEST_TABLE]
+      index: TEST_TABLE_IDX
+      type: SORTED
+      fields: [RENAMED_C1, C2]
+      collation: [C1 ASC, C2 ASC]
+      est. row count: 1
+
+# select with expression projection, no renames
+plan
+SELECT /*+ FORCE_INDEX(test_table_idx) */ c1 + c3, c2 FROM test_table
+----
+Exchange
+    distribution: single
+    est. row count: 1
+  IndexScan
+      table: [PUBLIC, TEST_TABLE]
+      index: TEST_TABLE_IDX
+      type: SORTED
+      fields: [EXPR$0, C2]
+      projects: [+(C1, C3), C2]
+      collation: []
+      est. row count: 1
+
+# select with expression projection and renames
+plan
+SELECT /*+ FORCE_INDEX(test_table_idx) */ c1 + c3 AS sum_of_c1_and_c3, c2 FROM 
test_table
+----
+Exchange
+    distribution: single
+    est. row count: 1
+  IndexScan
+      table: [PUBLIC, TEST_TABLE]
+      index: TEST_TABLE_IDX
+      type: SORTED
+      fields: [SUM_OF_C1_AND_C3, C2]
+      projects: [+(C1, C3), C2]
+      collation: []
+      est. row count: 1
+
+# Similar set of tests but for KeyValueGet
+# select all, no renames
+plan
+SELECT * FROM test_table WHERE c1 = 1
+----
+KeyValueGet
+    table: [PUBLIC, TEST_TABLE]
+    fields: [C1, C2, C3]
+    key: [1]
+    est. row count: 1
+
+# select with trimming projection, no renames
+plan
+SELECT c1, c2 FROM test_table WHERE c1 = 1
+----
+KeyValueGet
+    table: [PUBLIC, TEST_TABLE]
+    fields: [C1, C2]
+    key: [1]
+    est. row count: 1
+
+# select with trimming projection and renames
+plan
+SELECT c1 AS renamed_c1, c2 FROM test_table WHERE c1 = 1
+----
+KeyValueGet
+    table: [PUBLIC, TEST_TABLE]
+    fields: [C1, C2]
+    key: [1]
+    est. row count: 1
+
+# select with expression projection, no renames
+plan
+SELECT c1 + c3, c2 FROM test_table WHERE c1 = 1
+----
+KeyValueGet
+    table: [PUBLIC, TEST_TABLE]
+    fields: [EXPR$0, C2]
+    projects: [+(C1, C3), C2]
+    key: [1]
+    est. row count: 1
+
+# select with expression projection and renames
+plan
+SELECT c1 + c3 AS sum_of_c1_and_c3, c2 FROM test_table WHERE c1 = 1
+----
+KeyValueGet

Review Comment:
   good point, new tests has been added



##########
modules/sql-engine/src/integrationTest/sql/group1/explain/scan.test:
##########
@@ -0,0 +1,277 @@
+statement ok
+CREATE TABLE test_table (c1 INT PRIMARY KEY, c2 INT, c3 INT);
+
+# select all, no renames
+plan
+SELECT * FROM test_table
+----
+Exchange
+    distribution: single
+    est. row count: 1
+  TableScan
+      table: [PUBLIC, TEST_TABLE]
+      fields: [C1, C2, C3]
+      est. row count: 1
+
+# select with trimming projection, no renames
+plan
+SELECT c1, c2 FROM test_table
+----
+Exchange
+    distribution: single
+    est. row count: 1
+  TableScan
+      table: [PUBLIC, TEST_TABLE]
+      fields: [C1, C2]
+      est. row count: 1
+
+# select with trimming projection and renames
+plan
+SELECT c1 AS renamed_c1, c2 FROM test_table
+----
+Exchange
+    distribution: single
+    est. row count: 1
+  TableScan
+      table: [PUBLIC, TEST_TABLE]
+      fields: [RENAMED_C1, C2]
+      est. row count: 1
+
+# select with expression projection, no renames
+plan
+SELECT c1 + c3, c2 FROM test_table
+----
+Exchange
+    distribution: single
+    est. row count: 1
+  TableScan
+      table: [PUBLIC, TEST_TABLE]
+      fields: [EXPR$0, C2]
+      projects: [+(C1, C3), C2]
+      est. row count: 1
+
+# select with expression projection and renames
+plan
+SELECT c1 + c3 AS sum_of_c1_and_c3, c2 FROM test_table
+----
+Exchange
+    distribution: single
+    est. row count: 1
+  TableScan
+      table: [PUBLIC, TEST_TABLE]
+      fields: [SUM_OF_C1_AND_C3, C2]
+      projects: [+(C1, C3), C2]
+      est. row count: 1
+
+# Similar set of tests but for IndexScan
+statement ok
+CREATE INDEX test_table_idx ON test_table (c1, c2, c3);
+
+# select all, no renames
+plan
+SELECT /*+ FORCE_INDEX(test_table_idx) */ * FROM test_table
+----
+Exchange
+    distribution: single
+    est. row count: 1
+  IndexScan
+      table: [PUBLIC, TEST_TABLE]
+      index: TEST_TABLE_IDX
+      type: SORTED
+      fields: [C1, C2, C3]
+      collation: [C1 ASC, C2 ASC, C3 ASC]
+      est. row count: 1
+
+# select with trimming projection, no renames
+plan
+SELECT /*+ FORCE_INDEX(test_table_idx) */ c1, c2 FROM test_table
+----
+Exchange
+    distribution: single
+    est. row count: 1
+  IndexScan
+      table: [PUBLIC, TEST_TABLE]
+      index: TEST_TABLE_IDX
+      type: SORTED
+      fields: [C1, C2]
+      collation: [C1 ASC, C2 ASC]
+      est. row count: 1
+
+# select with trimming projection and renames
+plan
+SELECT /*+ FORCE_INDEX(test_table_idx) */ c1 AS renamed_c1, c2 FROM test_table
+----
+Exchange
+    distribution: single
+    est. row count: 1
+  IndexScan
+      table: [PUBLIC, TEST_TABLE]
+      index: TEST_TABLE_IDX
+      type: SORTED
+      fields: [RENAMED_C1, C2]
+      collation: [C1 ASC, C2 ASC]
+      est. row count: 1
+
+# select with expression projection, no renames
+plan
+SELECT /*+ FORCE_INDEX(test_table_idx) */ c1 + c3, c2 FROM test_table
+----
+Exchange
+    distribution: single
+    est. row count: 1
+  IndexScan
+      table: [PUBLIC, TEST_TABLE]
+      index: TEST_TABLE_IDX
+      type: SORTED
+      fields: [EXPR$0, C2]
+      projects: [+(C1, C3), C2]
+      collation: []
+      est. row count: 1
+
+# select with expression projection and renames
+plan
+SELECT /*+ FORCE_INDEX(test_table_idx) */ c1 + c3 AS sum_of_c1_and_c3, c2 FROM 
test_table
+----
+Exchange
+    distribution: single
+    est. row count: 1
+  IndexScan
+      table: [PUBLIC, TEST_TABLE]
+      index: TEST_TABLE_IDX
+      type: SORTED
+      fields: [SUM_OF_C1_AND_C3, C2]
+      projects: [+(C1, C3), C2]
+      collation: []
+      est. row count: 1
+
+# Similar set of tests but for KeyValueGet
+# select all, no renames
+plan
+SELECT * FROM test_table WHERE c1 = 1
+----
+KeyValueGet
+    table: [PUBLIC, TEST_TABLE]
+    fields: [C1, C2, C3]
+    key: [1]
+    est. row count: 1
+
+# select with trimming projection, no renames
+plan
+SELECT c1, c2 FROM test_table WHERE c1 = 1
+----
+KeyValueGet
+    table: [PUBLIC, TEST_TABLE]
+    fields: [C1, C2]
+    key: [1]
+    est. row count: 1
+
+# select with trimming projection and renames
+plan
+SELECT c1 AS renamed_c1, c2 FROM test_table WHERE c1 = 1
+----
+KeyValueGet
+    table: [PUBLIC, TEST_TABLE]
+    fields: [C1, C2]
+    key: [1]
+    est. row count: 1
+
+# select with expression projection, no renames
+plan
+SELECT c1 + c3, c2 FROM test_table WHERE c1 = 1
+----
+KeyValueGet
+    table: [PUBLIC, TEST_TABLE]
+    fields: [EXPR$0, C2]
+    projects: [+(C1, C3), C2]
+    key: [1]
+    est. row count: 1
+
+# select with expression projection and renames
+plan
+SELECT c1 + c3 AS sum_of_c1_and_c3, c2 FROM test_table WHERE c1 = 1
+----
+KeyValueGet

Review Comment:
   good point, new tests have been added



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to