File tree Expand file tree Collapse file tree 2 files changed +72
-0
lines changed
tests_metricflow/snapshots/test_cte_column_pruner.py/str Expand file tree Collapse file tree 2 files changed +72
-0
lines changed Original file line number Diff line number Diff line change
1
+ test_name: test_column_reference_expression
2
+ test_filename: test_cte_column_pruner.py
3
+ docstring:
4
+ Test a column reference expression that does not specify a table alias.
5
+ expectation_description:
6
+ `cte_source_0__col_01` should be retained in the CTE.
7
+ ---
8
+ optimizer:
9
+ SqlColumnPrunerOptimizer
10
+
11
+ sql_before_optimizing:
12
+ -- Top-level SELECT
13
+ WITH cte_source_0 AS (
14
+ -- CTE source 0
15
+ SELECT
16
+ test_table_alias.col_0 AS cte_source_0__col_0
17
+ , test_table_alias.col_0 AS cte_source_0__col_1
18
+ FROM test_schema.test_table test_table_alias
19
+ )
20
+
21
+ SELECT
22
+ cte_source_0__col_0 AS top_level__col_0
23
+ FROM cte_source_0 cte_source_0_alias
24
+
25
+ sql_after_optimizing:
26
+ -- Top-level SELECT
27
+ WITH cte_source_0 AS (
28
+ -- CTE source 0
29
+ SELECT
30
+ test_table_alias.col_0 AS cte_source_0__col_0
31
+ FROM test_schema.test_table test_table_alias
32
+ )
33
+
34
+ SELECT
35
+ cte_source_0__col_0 AS top_level__col_0
36
+ FROM cte_source_0 cte_source_0_alias
Original file line number Diff line number Diff line change
1
+ test_name: test_string_expression
2
+ test_filename: test_cte_column_pruner.py
3
+ docstring:
4
+ Test a string expression that references a column in the cte.
5
+ expectation_description:
6
+ `cte_source_0__col_01` should be retained in the CTE.
7
+ ---
8
+ optimizer:
9
+ SqlColumnPrunerOptimizer
10
+
11
+ sql_before_optimizing:
12
+ -- Top-level SELECT
13
+ WITH cte_source_0 AS (
14
+ -- CTE source 0
15
+ SELECT
16
+ test_table_alias.col_0 AS cte_source_0__col_0
17
+ , test_table_alias.col_0 AS cte_source_0__col_1
18
+ FROM test_schema.test_table test_table_alias
19
+ )
20
+
21
+ SELECT
22
+ cte_source_0__col_0 AS top_level__col_0
23
+ FROM cte_source_0 cte_source_0_alias
24
+
25
+ sql_after_optimizing:
26
+ -- Top-level SELECT
27
+ WITH cte_source_0 AS (
28
+ -- CTE source 0
29
+ SELECT
30
+ test_table_alias.col_0 AS cte_source_0__col_0
31
+ FROM test_schema.test_table test_table_alias
32
+ )
33
+
34
+ SELECT
35
+ cte_source_0__col_0 AS top_level__col_0
36
+ FROM cte_source_0 cte_source_0_alias
You can’t perform that action at this time.
0 commit comments