| # description: Tests for: 'explain mapping for' command. |
| # Mapped fragments need to be placed inside "----" divisors. |
| |
| statement ok |
| CREATE ZONE test_zone (PARTITIONS 7) STORAGE PROFILES ['default']; |
| |
| statement ok |
| CREATE TABLE test_table (c1 INT PRIMARY KEY, c2 INT, c3 INT) ZONE test_zone; |
| |
| explain mapping |
| SELECT /*+ DISABLE_RULE('MapReduceSortAggregateConverterRule', |
| 'ColocatedSortAggregateConverterRule', |
| 'MapReduceHashAggregateConverterRule') */ COUNT(*) FROM SYSTEM.SYSTEM_VIEWS; |
| ---- |
| Fragment#1 root |
| distribution: single |
| executionNodes: [sqllogic0] |
| tree: |
| ColocatedHashAggregate |
| fieldNames: [EXPR$0] |
| group: [] |
| aggregation: [COUNT()] |
| est: (rows=1) |
| SystemViewScan |
| table: SYSTEM.SYSTEM_VIEWS |
| fieldNames: [VIEW_ID, SCHEMA_NAME, VIEW_NAME, VIEW_TYPE, ID, SCHEMA, NAME, TYPE] |
| est: (rows=100) |
| ---- |
| |
| explain mapping |
| SELECT * FROM test_table WHERE c1 = 1 |
| ---- |
| Fragment#0 root |
| distribution: single |
| executionNodes: [sqllogic0] |
| tree: |
| KeyValueGet |
| table: PUBLIC.TEST_TABLE |
| fieldNames: [C1, C2, C3] |
| key: [1] |
| est: (rows=1) |
| ---- |
| |
| explain mapping |
| SELECT /*+ DISABLE_RULE('TableScanToKeyValueGetRule')*/ * FROM test_table WHERE c1 = 1 |
| ---- |
| Fragment#1 root |
| distribution: single |
| executionNodes: [sqllogic0] |
| tree: |
| Receiver |
| fieldNames: [C1, C2, C3] |
| sourceFragmentId: 2 |
| est: (rows=1) |
| |
| Fragment#2 |
| distribution: table PUBLIC.TEST_TABLE in zone TEST_ZONE |
| executionNodes: [sqllogic0] |
| partitions: [TEST_TABLE=[sqllogic0={2}]] |
| tree: |
| Sender |
| distribution: single |
| targetFragmentId: 1 |
| est: (rows=1) |
| TableScan |
| table: PUBLIC.TEST_TABLE |
| predicate: =(C1, 1) |
| fieldNames: [C1, C2, C3] |
| est: (rows=1) |
| ---- |
| |
| explain mapping |
| SELECT * FROM test_table |
| ---- |
| Fragment#1 root |
| distribution: single |
| executionNodes: [sqllogic0] |
| tree: |
| Receiver |
| fieldNames: [C1, C2, C3] |
| sourceFragmentId: 2 |
| est: (rows=1) |
| |
| Fragment#2 |
| distribution: table PUBLIC.TEST_TABLE in zone TEST_ZONE |
| executionNodes: [sqllogic1, sqllogic0] |
| partitions: [TEST_TABLE=[sqllogic1={1, 3, 4, 5, 6}, sqllogic0={0, 2}]] |
| tree: |
| Sender |
| distribution: single |
| targetFragmentId: 1 |
| est: (rows=1) |
| TableScan |
| table: PUBLIC.TEST_TABLE |
| fieldNames: [C1, C2, C3] |
| est: (rows=1) |
| ---- |
| |
| |
| explain mapping |
| SELECT COUNT(*) FROM test_table |
| ---- |
| Fragment#0 root |
| distribution: single |
| executionNodes: [sqllogic0] |
| tree: |
| SelectCount |
| table: PUBLIC.TEST_TABLE |
| fieldNames: [$f0] |
| projection: [$COUNT_ALL] |
| est: (rows=1) |
| ---- |
| |
| explain mapping |
| INSERT INTO test_table VALUES (1, 2, 3) |
| ---- |
| Fragment#0 root |
| distribution: any |
| executionNodes: [sqllogic0] |
| tree: |
| KeyValueModify |
| table: PUBLIC.TEST_TABLE |
| fieldNames: [ROWCOUNT] |
| sourceExpression: [1, 2, 3] |
| type: INSERT |
| est: (rows=1) |
| ---- |
| |
| explain mapping |
| SELECT c1 FROM (VALUES(1), (2)) t(c1) |
| ---- |
| Fragment#1 root |
| distribution: broadcast |
| executionNodes: [sqllogic0] |
| tree: |
| Values |
| fieldNames: [C1] |
| tuples: [[1], [2]] |
| est: (rows=2) |
| ---- |
| |
| explain mapping |
| SELECT * FROM test_table, system.tables WHERE c1 = table_id |
| ---- |
| Fragment#2 root |
| distribution: single |
| executionNodes: [sqllogic0] |
| tree: |
| Project |
| fieldNames: [C1, C2, C3, SCHEMA_NAME, TABLE_NAME, TABLE_ID, TABLE_PK_INDEX_ID, ZONE_NAME, STORAGE_PROFILE, TABLE_COLOCATION_COLUMNS, SCHEMA_ID, ZONE_ID, SCHEMA, NAME, ID, PK_INDEX_ID, COLOCATION_KEY_INDEX, ZONE] |
| projection: [C1, C2, C3, SCHEMA_NAME, TABLE_NAME, TABLE_ID, TABLE_PK_INDEX_ID, ZONE_NAME, STORAGE_PROFILE, TABLE_COLOCATION_COLUMNS, SCHEMA_ID, ZONE_ID, SCHEMA, NAME, ID, PK_INDEX_ID, COLOCATION_KEY_INDEX, ZONE] |
| est: (rows=15) |
| HashJoin |
| predicate: =(C1, TABLE_ID) |
| type: inner |
| est: (rows=15) |
| SystemViewScan |
| table: SYSTEM.TABLES |
| fieldNames: [SCHEMA_NAME, TABLE_NAME, TABLE_ID, TABLE_PK_INDEX_ID, ZONE_NAME, STORAGE_PROFILE, TABLE_COLOCATION_COLUMNS, SCHEMA_ID, ZONE_ID, SCHEMA, NAME, ID, PK_INDEX_ID, COLOCATION_KEY_INDEX, ZONE] |
| est: (rows=100) |
| Receiver |
| fieldNames: [C1, C2, C3] |
| sourceFragmentId: 3 |
| est: (rows=1) |
| |
| Fragment#3 |
| distribution: table PUBLIC.TEST_TABLE in zone TEST_ZONE |
| executionNodes: [sqllogic1, sqllogic0] |
| partitions: [TEST_TABLE=[sqllogic1={1, 3, 4, 5, 6}, sqllogic0={0, 2}]] |
| tree: |
| Sender |
| distribution: single |
| targetFragmentId: 2 |
| est: (rows=1) |
| TableScan |
| table: PUBLIC.TEST_TABLE |
| fieldNames: [C1, C2, C3] |
| est: (rows=1) |
| ---- |
| |
| statement ok |
| CREATE ZONE test_zone2 (PARTITIONS 3) STORAGE PROFILES ['default']; |
| |
| statement ok |
| CREATE TABLE test_table2 (c1 INT, c2 INT, c3 INT PRIMARY KEY) ZONE test_zone2; |
| |
| explain mapping |
| SELECT * FROM test_table t1, test_table2 t2 WHERE t1.c1 = t2.c2 |
| ---- |
| Fragment#2 root |
| distribution: single |
| executionNodes: [sqllogic0] |
| tree: |
| HashJoin |
| predicate: =(C1, C2$0) |
| fieldNames: [C1, C2, C3, C1$0, C2$0, C3$0] |
| type: inner |
| est: (rows=1) |
| Receiver |
| fieldNames: [C1, C2, C3] |
| sourceFragmentId: 3 |
| est: (rows=1) |
| Receiver |
| fieldNames: [C1, C2, C3] |
| sourceFragmentId: 4 |
| est: (rows=1) |
| |
| Fragment#3 |
| distribution: table PUBLIC.TEST_TABLE in zone TEST_ZONE |
| executionNodes: [sqllogic1, sqllogic0] |
| partitions: [TEST_TABLE=[sqllogic1={1, 3, 4, 5, 6}, sqllogic0={0, 2}]] |
| tree: |
| Sender |
| distribution: single |
| targetFragmentId: 2 |
| est: (rows=1) |
| TableScan |
| table: PUBLIC.TEST_TABLE |
| fieldNames: [C1, C2, C3] |
| est: (rows=1) |
| |
| Fragment#4 |
| distribution: table PUBLIC.TEST_TABLE2 in zone TEST_ZONE2 |
| executionNodes: [sqllogic1, sqllogic0] |
| partitions: [TEST_TABLE2=[sqllogic1={1}, sqllogic0={0, 2}]] |
| tree: |
| Sender |
| distribution: single |
| targetFragmentId: 2 |
| est: (rows=1) |
| TableScan |
| table: PUBLIC.TEST_TABLE2 |
| fieldNames: [C1, C2, C3] |
| est: (rows=1) |
| ---- |