From fee9ffe7ec015c62dda28291c66e0c9955eed675 Mon Sep 17 00:00:00 2001 From: Chelsea Lin Date: Tue, 3 Feb 2026 23:01:34 +0000 Subject: [PATCH 1/3] refactor: fix notnull op with bracket --- bigframes/core/compile/sqlglot/expressions/generic_ops.py | 5 ++++- .../snapshots/test_unary_compiler/test_qcut/out.sql | 8 ++++++-- .../snapshots/test_generic_ops/test_notnull/out.sql | 4 +++- .../test_compile_window_w_groupby_rolling/out.sql | 4 +++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/bigframes/core/compile/sqlglot/expressions/generic_ops.py b/bigframes/core/compile/sqlglot/expressions/generic_ops.py index 003a7296fcb..fb0bee3aa49 100644 --- a/bigframes/core/compile/sqlglot/expressions/generic_ops.py +++ b/bigframes/core/compile/sqlglot/expressions/generic_ops.py @@ -125,7 +125,10 @@ def _(expr: TypedExpr, op: ops.MapOp) -> sge.Expression: @register_unary_op(ops.notnull_op) def _(expr: TypedExpr) -> sge.Expression: - return sge.Not(this=sge.Is(this=expr.expr, expression=sge.Null())) + return sge.Is( + this=sge.paren(expr.expr, copy=False), + expression=sg.not_(sge.Null(), copy=False), + ) @register_ternary_op(ops.where_op) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_qcut/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_qcut/out.sql index 1aa2e436caa..e46f6addd28 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_qcut/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_qcut/out.sql @@ -6,7 +6,9 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - NOT `int64_col` IS NULL AS `bfcol_4` + ( + `int64_col` + ) IS NOT NULL AS `bfcol_4` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT @@ -28,7 +30,9 @@ WITH `bfcte_0` AS ( ), `bfcte_4` AS ( SELECT *, - NOT `int64_col` IS NULL AS `bfcol_10` + ( + `int64_col` + ) IS NOT NULL AS `bfcol_10` FROM `bfcte_3` ), `bfcte_5` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_notnull/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_notnull/out.sql index bf3425fe6de..598e9f83dcd 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_notnull/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_notnull/out.sql @@ -5,7 +5,9 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - NOT `float64_col` IS NULL AS `bfcol_1` + ( + `float64_col` + ) IS NOT NULL AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_groupby_rolling/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_groupby_rolling/out.sql index 0dca6d9d49e..a9ee565ba29 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_groupby_rolling/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_groupby_rolling/out.sql @@ -17,7 +17,9 @@ WITH `bfcte_0` AS ( * FROM `bfcte_1` WHERE - NOT `bfcol_9` IS NULL + ( + `bfcol_9` + ) IS NOT NULL ), `bfcte_3` AS ( SELECT *, From 56c28791072e79ffa05b1a1c8c0c8ccea08c4a9a Mon Sep 17 00:00:00 2001 From: Chelsea Lin Date: Wed, 4 Feb 2026 20:07:01 +0000 Subject: [PATCH 2/3] refactor: fix pull_up_select disorder the columns of readtable nodes --- bigframes/core/rewrite/select_pullup.py | 9 ++++----- .../snapshots/test_binary_compiler/test_corr/out.sql | 4 ++-- .../snapshots/test_binary_compiler/test_cov/out.sql | 4 ++-- .../test_nullary_compiler/test_row_number/out.sql | 6 +++--- .../test_nullary_compiler/test_size/out.sql | 6 +++--- .../snapshots/test_unary_compiler/test_mean/out.sql | 4 ++-- .../snapshots/test_unary_compiler/test_std/out.sql | 4 ++-- .../test_array_ops/test_to_array_op/out.sql | 2 +- .../snapshots/test_comparison_ops/test_is_in/out.sql | 4 ++-- .../test_comparison_ops/test_maximum_op/out.sql | 4 ++-- .../test_comparison_ops/test_minimum_op/out.sql | 4 ++-- .../test_datetime_ops/test_sub_timedelta/out.sql | 4 ++-- .../test_datetime_ops/test_to_datetime/out.sql | 2 +- .../test_datetime_ops/test_to_timestamp/out.sql | 4 ++-- .../test_generic_ops/test_astype_int/out.sql | 2 +- .../test_generic_ops/test_astype_json/out.sql | 2 +- .../test_binary_remote_function_op/out.sql | 4 ++-- .../test_generic_ops/test_case_when_op/out.sql | 4 ++-- .../snapshots/test_generic_ops/test_fillna/out.sql | 4 ++-- .../test_nary_remote_function_op/out.sql | 2 +- .../snapshots/test_generic_ops/test_row_key/out.sql | 6 +++--- .../snapshots/test_generic_ops/test_where/out.sql | 4 ++-- .../snapshots/test_numeric_ops/test_arctan2/out.sql | 4 ++-- .../test_numeric_ops/test_cosine_distance/out.sql | 4 ++-- .../test_numeric_ops/test_div_numeric/out.sql | 2 +- .../test_numeric_ops/test_mod_numeric/out.sql | 2 +- .../test_numeric_ops/test_mul_timedelta/out.sql | 4 ++-- .../snapshots/test_numeric_ops/test_pow/out.sql | 2 +- .../snapshots/test_numeric_ops/test_round/out.sql | 2 +- .../test_numeric_ops/test_sub_timedelta/out.sql | 4 ++-- .../test_numeric_ops/test_unsafe_pow_op/out.sql | 4 ++-- .../snapshots/test_struct_ops/test_struct_op/out.sql | 2 +- .../test_timedelta_ops/test_to_timedelta/out.sql | 2 +- .../test_compile_concat_filter_sorted/out.sql | 12 ++++++------ .../test_compile_explode_dataframe/out.sql | 2 +- .../test_compile_explode_series/out.sql | 4 ++-- .../test_compile_readtable/out.sql | 6 +++--- .../test_compile_readtable_w_columns_filters/out.sql | 2 +- .../test_compile_readtable_w_json_types/out.sql | 4 ++-- .../test_compile_readtable_w_repeated_types/out.sql | 6 +++--- .../test_compile_readtable_w_system_time/out.sql | 6 +++--- 41 files changed, 81 insertions(+), 82 deletions(-) diff --git a/bigframes/core/rewrite/select_pullup.py b/bigframes/core/rewrite/select_pullup.py index 415182f8840..a15aba7663f 100644 --- a/bigframes/core/rewrite/select_pullup.py +++ b/bigframes/core/rewrite/select_pullup.py @@ -54,13 +54,12 @@ def pull_up_source_ids(node: nodes.ReadTableNode) -> nodes.BigFrameNode: if all(id.sql == source_id for id, source_id in node.scan_list.items): return node else: - source_ids = sorted( - set(scan_item.source_id for scan_item in node.scan_list.items) - ) new_scan_list = nodes.ScanList.from_items( [ - nodes.ScanItem(identifiers.ColumnId(source_id), source_id) - for source_id in source_ids + nodes.ScanItem( + identifiers.ColumnId(scan_item.source_id), scan_item.source_id + ) + for scan_item in node.scan_list.items ] ) new_source = dataclasses.replace(node, scan_list=new_scan_list) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_corr/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_corr/out.sql index 5c838f48827..08272882e6b 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_corr/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_corr/out.sql @@ -1,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `float64_col`, - `int64_col` + `int64_col`, + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_cov/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_cov/out.sql index eda082250a6..7f4463e3b8e 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_cov/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_cov/out.sql @@ -1,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `float64_col`, - `int64_col` + `int64_col`, + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number/out.sql index f1197465f0d..72db92a65b6 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number/out.sql @@ -4,17 +4,17 @@ WITH `bfcte_0` AS ( `bytes_col`, `date_col`, `datetime_col`, - `duration_col`, - `float64_col`, `geography_col`, `int64_col`, `int64_too`, `numeric_col`, + `float64_col`, `rowindex`, `rowindex_2`, `string_col`, `time_col`, - `timestamp_col` + `timestamp_col`, + `duration_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_size/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_size/out.sql index ed8e0c7619d..d5f599b5da7 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_size/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_size/out.sql @@ -4,17 +4,17 @@ WITH `bfcte_0` AS ( `bytes_col`, `date_col`, `datetime_col`, - `duration_col`, - `float64_col`, `geography_col`, `int64_col`, `int64_too`, `numeric_col`, + `float64_col`, `rowindex`, `rowindex_2`, `string_col`, `time_col`, - `timestamp_col` + `timestamp_col`, + `duration_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/out.sql index 0b33d0b1d0a..2a61c4939e6 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/out.sql @@ -1,8 +1,8 @@ WITH `bfcte_0` AS ( SELECT `bool_col`, - `duration_col`, - `int64_col` + `int64_col`, + `duration_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_std/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_std/out.sql index 36a50302a66..b30ff47d6a3 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_std/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_std/out.sql @@ -1,8 +1,8 @@ WITH `bfcte_0` AS ( SELECT `bool_col`, - `duration_col`, - `int64_col` + `int64_col`, + `duration_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_to_array_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_to_array_op/out.sql index 3e297016584..b0520474913 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_to_array_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_to_array_op/out.sql @@ -1,8 +1,8 @@ WITH `bfcte_0` AS ( SELECT `bool_col`, - `float64_col`, `int64_col`, + `float64_col`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_is_in/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_is_in/out.sql index ec85f060dac..b3505f54349 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_is_in/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_is_in/out.sql @@ -1,8 +1,8 @@ WITH `bfcte_0` AS ( SELECT `bool_col`, - `float64_col`, - `int64_col` + `int64_col`, + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_maximum_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_maximum_op/out.sql index bbef2127070..7081992b542 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_maximum_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_maximum_op/out.sql @@ -1,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `float64_col`, - `int64_col` + `int64_col`, + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_minimum_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_minimum_op/out.sql index 1f00f5892ef..a24aabe4773 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_minimum_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_minimum_op/out.sql @@ -1,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `float64_col`, - `int64_col` + `int64_col`, + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_sub_timedelta/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_sub_timedelta/out.sql index ebcffd67f61..571d9a7e48c 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_sub_timedelta/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_sub_timedelta/out.sql @@ -1,9 +1,9 @@ WITH `bfcte_0` AS ( SELECT `date_col`, - `duration_col`, `rowindex`, - `timestamp_col` + `timestamp_col`, + `duration_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_to_datetime/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_to_datetime/out.sql index a8d40a84867..2aa85978ff5 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_to_datetime/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_to_datetime/out.sql @@ -1,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `float64_col`, `int64_col`, + `float64_col`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_to_timestamp/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_to_timestamp/out.sql index a5f9ee1112b..8f918224fca 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_to_timestamp/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_to_timestamp/out.sql @@ -1,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `float64_col`, - `int64_col` + `int64_col`, + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_int/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_int/out.sql index e0fe2af9a9d..2a55a95f3f9 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_int/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_int/out.sql @@ -1,8 +1,8 @@ WITH `bfcte_0` AS ( SELECT `datetime_col`, - `float64_col`, `numeric_col`, + `float64_col`, `time_col`, `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_json/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_json/out.sql index 4ffaf7256a1..1d2b95c5cab 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_json/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_json/out.sql @@ -1,8 +1,8 @@ WITH `bfcte_0` AS ( SELECT `bool_col`, - `float64_col`, `int64_col`, + `float64_col`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_binary_remote_function_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_binary_remote_function_op/out.sql index 7272a3a5be1..e0c4a1d0bbd 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_binary_remote_function_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_binary_remote_function_op/out.sql @@ -1,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `float64_col`, - `int64_col` + `int64_col`, + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_case_when_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_case_when_op/out.sql index 08a489e2401..aa2a1f9482f 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_case_when_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_case_when_op/out.sql @@ -1,9 +1,9 @@ WITH `bfcte_0` AS ( SELECT `bool_col`, - `float64_col`, `int64_col`, - `int64_too` + `int64_too`, + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_fillna/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_fillna/out.sql index 07f2877e740..f2b68b8f087 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_fillna/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_fillna/out.sql @@ -1,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `float64_col`, - `int64_col` + `int64_col`, + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_nary_remote_function_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_nary_remote_function_op/out.sql index a6641b13db6..bb80e2f720a 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_nary_remote_function_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_nary_remote_function_op/out.sql @@ -1,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `float64_col`, `int64_col`, + `float64_col`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_row_key/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_row_key/out.sql index 13b27c2e146..a5153f850be 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_row_key/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_row_key/out.sql @@ -4,17 +4,17 @@ WITH `bfcte_0` AS ( `bytes_col`, `date_col`, `datetime_col`, - `duration_col`, - `float64_col`, `geography_col`, `int64_col`, `int64_too`, `numeric_col`, + `float64_col`, `rowindex`, `rowindex_2`, `string_col`, `time_col`, - `timestamp_col` + `timestamp_col`, + `duration_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_where/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_where/out.sql index 872c7943335..c708c1f1780 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_where/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_where/out.sql @@ -1,8 +1,8 @@ WITH `bfcte_0` AS ( SELECT `bool_col`, - `float64_col`, - `int64_col` + `int64_col`, + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctan2/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctan2/out.sql index 28fc8c869d7..41447c677fe 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctan2/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctan2/out.sql @@ -1,8 +1,8 @@ WITH `bfcte_0` AS ( SELECT `bool_col`, - `float64_col`, - `int64_col` + `int64_col`, + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_cosine_distance/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_cosine_distance/out.sql index ba6b6bfa9fa..1fc1db6b9ce 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_cosine_distance/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_cosine_distance/out.sql @@ -1,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `float_list_col`, - `int_list_col` + `int_list_col`, + `float_list_col` FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_div_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_div_numeric/out.sql index db11f1529fa..062732b4100 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_div_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_div_numeric/out.sql @@ -1,8 +1,8 @@ WITH `bfcte_0` AS ( SELECT `bool_col`, - `float64_col`, `int64_col`, + `float64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mod_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mod_numeric/out.sql index 241ffa0b5ea..3072a102c2b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mod_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mod_numeric/out.sql @@ -1,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `float64_col`, `int64_col`, + `float64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mul_timedelta/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mul_timedelta/out.sql index ebdf296b2b2..8b74de5a24a 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mul_timedelta/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mul_timedelta/out.sql @@ -1,9 +1,9 @@ WITH `bfcte_0` AS ( SELECT - `duration_col`, `int64_col`, `rowindex`, - `timestamp_col` + `timestamp_col`, + `duration_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pow/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pow/out.sql index 05fbaa12c92..027005b7e5a 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pow/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pow/out.sql @@ -1,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `float64_col`, `int64_col`, + `float64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_round/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_round/out.sql index 9ce76f7c63f..be154f5a0c6 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_round/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_round/out.sql @@ -1,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `float64_col`, `int64_col`, + `float64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sub_timedelta/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sub_timedelta/out.sql index ebcffd67f61..571d9a7e48c 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sub_timedelta/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sub_timedelta/out.sql @@ -1,9 +1,9 @@ WITH `bfcte_0` AS ( SELECT `date_col`, - `duration_col`, `rowindex`, - `timestamp_col` + `timestamp_col`, + `duration_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_unsafe_pow_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_unsafe_pow_op/out.sql index 9957a346654..a9bedd973dc 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_unsafe_pow_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_unsafe_pow_op/out.sql @@ -1,8 +1,8 @@ WITH `bfcte_0` AS ( SELECT `bool_col`, - `float64_col`, - `int64_col` + `int64_col`, + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_struct_ops/test_struct_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_struct_ops/test_struct_op/out.sql index 575a1620806..b49a432b057 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_struct_ops/test_struct_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_struct_ops/test_struct_op/out.sql @@ -1,8 +1,8 @@ WITH `bfcte_0` AS ( SELECT `bool_col`, - `float64_col`, `int64_col`, + `float64_col`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_timedelta_ops/test_to_timedelta/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_timedelta_ops/test_to_timedelta/out.sql index ed7dbc7c8a9..c272f89184e 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_timedelta_ops/test_to_timedelta/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_timedelta_ops/test_to_timedelta/out.sql @@ -1,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `float64_col`, `int64_col`, + `float64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat_filter_sorted/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat_filter_sorted/out.sql index 65b0f9abd5e..08e0299ee85 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat_filter_sorted/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat_filter_sorted/out.sql @@ -1,7 +1,7 @@ WITH `bfcte_2` AS ( SELECT - `float64_col`, - `int64_col` + `int64_col`, + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_6` AS ( SELECT @@ -16,8 +16,8 @@ WITH `bfcte_2` AS ( ), `bfcte_0` AS ( SELECT `bool_col`, - `float64_col`, - `int64_too` + `int64_too`, + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_4` AS ( SELECT @@ -37,8 +37,8 @@ WITH `bfcte_2` AS ( FROM `bfcte_8` ), `bfcte_1` AS ( SELECT - `float64_col`, - `int64_col` + `int64_col`, + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_5` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_dataframe/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_dataframe/out.sql index 5d9019439f2..4f05929e0c7 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_dataframe/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_dataframe/out.sql @@ -1,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `int_list_col`, `rowindex`, + `int_list_col`, `string_list_col` FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ), `bfcte_1` AS ( diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_series/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_series/out.sql index 8ba4559da83..d5b42741d31 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_series/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_series/out.sql @@ -1,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `int_list_col`, - `rowindex` + `rowindex`, + `int_list_col` FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable/out.sql index 959a31a2a35..29a9cfc35c7 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable/out.sql @@ -4,17 +4,17 @@ WITH `bfcte_0` AS ( `bytes_col`, `date_col`, `datetime_col`, - `duration_col`, - `float64_col`, `geography_col`, `int64_col`, `int64_too`, `numeric_col`, + `float64_col`, `rowindex`, `rowindex_2`, `string_col`, `time_col`, - `timestamp_col` + `timestamp_col`, + `duration_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_columns_filters/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_columns_filters/out.sql index 0d8a10c9566..616a2e91df4 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_columns_filters/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_columns_filters/out.sql @@ -1,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `int64_col`, `rowindex`, + `int64_col`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` WHERE diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_json_types/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_json_types/out.sql index 4b5750d7aaf..1f79ac54820 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_json_types/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_json_types/out.sql @@ -1,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `json_col`, - `rowindex` + `rowindex`, + `json_col` FROM `bigframes-dev`.`sqlglot_test`.`json_types` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_repeated_types/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_repeated_types/out.sql index a22c845ef1c..d50969f0c23 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_repeated_types/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_repeated_types/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT + `rowindex`, + `int_list_col`, `bool_list_col`, + `float_list_col`, `date_list_col`, `date_time_list_col`, - `float_list_col`, - `int_list_col`, `numeric_list_col`, - `rowindex`, `string_list_col` FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ) diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_system_time/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_system_time/out.sql index 59c36870803..430c518bd1c 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_system_time/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_system_time/out.sql @@ -4,17 +4,17 @@ WITH `bfcte_0` AS ( `bytes_col`, `date_col`, `datetime_col`, - `duration_col`, - `float64_col`, `geography_col`, `int64_col`, `int64_too`, `numeric_col`, + `float64_col`, `rowindex`, `rowindex_2`, `string_col`, `time_col`, - `timestamp_col` + `timestamp_col`, + `duration_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` FOR SYSTEM_TIME AS OF '2025-11-09T03:04:05.678901+00:00' ) SELECT From f5a227666588b39af643d3d47f80420ad9a6d277 Mon Sep 17 00:00:00 2001 From: Chelsea Lin Date: Wed, 4 Feb 2026 20:45:47 +0000 Subject: [PATCH 3/3] select star if possible when compiling readtable --- bigframes/core/compile/sqlglot/compiler.py | 2 ++ bigframes/core/compile/sqlglot/sqlglot_ir.py | 25 +++++++++++-------- bigframes/core/nodes.py | 6 +++++ .../test_row_number/out.sql | 16 +----------- .../test_nullary_compiler/test_size/out.sql | 16 +----------- .../test_generic_ops/test_row_key/out.sql | 16 +----------- .../test_compile_readtable/out.sql | 16 +----------- .../out.sql | 3 +-- .../out.sql | 3 +-- .../out.sql | 9 +------ .../out.sql | 16 +----------- 11 files changed, 31 insertions(+), 97 deletions(-) diff --git a/bigframes/core/compile/sqlglot/compiler.py b/bigframes/core/compile/sqlglot/compiler.py index f2c94f98c7a..2418fa5f782 100644 --- a/bigframes/core/compile/sqlglot/compiler.py +++ b/bigframes/core/compile/sqlglot/compiler.py @@ -176,12 +176,14 @@ def compile_readlocal(node: nodes.ReadLocalNode, child: ir.SQLGlotIR) -> ir.SQLG @_compile_node.register def compile_readtable(node: nodes.ReadTableNode, child: ir.SQLGlotIR): table = node.source.table + is_star_selection = node.is_star_selection return ir.SQLGlotIR.from_table( table.project_id, table.dataset_id, table.table_id, col_names=[col.source_id for col in node.scan_list.items], alias_names=[col.id.sql for col in node.scan_list.items], + is_star_selection=is_star_selection, uid_gen=child.uid_gen, sql_predicate=node.source.sql_predicate, system_time=node.source.at_time, diff --git a/bigframes/core/compile/sqlglot/sqlglot_ir.py b/bigframes/core/compile/sqlglot/sqlglot_ir.py index ad5da31206a..4d3379084a9 100644 --- a/bigframes/core/compile/sqlglot/sqlglot_ir.py +++ b/bigframes/core/compile/sqlglot/sqlglot_ir.py @@ -118,6 +118,7 @@ def from_table( table_id: str, col_names: typing.Sequence[str], alias_names: typing.Sequence[str], + is_star_selection: bool, uid_gen: guid.SequentialUIDGenerator, sql_predicate: typing.Optional[str] = None, system_time: typing.Optional[datetime.datetime] = None, @@ -134,15 +135,7 @@ def from_table( sql_predicate (typing.Optional[str]): An optional SQL predicate for filtering. system_time (typing.Optional[str]): An optional system time for time-travel queries. """ - selections = [ - sge.Alias( - this=sge.to_identifier(col_name, quoted=cls.quoted), - alias=sge.to_identifier(alias_name, quoted=cls.quoted), - ) - if col_name != alias_name - else sge.to_identifier(col_name, quoted=cls.quoted) - for col_name, alias_name in zip(col_names, alias_names) - ] + version = ( sge.Version( this="TIMESTAMP", @@ -158,7 +151,19 @@ def from_table( catalog=sg.to_identifier(project_id, quoted=cls.quoted), version=version, ) - select_expr = sge.Select().select(*selections).from_(table_expr) + if is_star_selection: + select_expr = sge.Select().select(sge.Star()).from_(table_expr) + else: + selections = [ + sge.Alias( + this=sge.to_identifier(col_name, quoted=cls.quoted), + alias=sge.to_identifier(alias_name, quoted=cls.quoted), + ) + if col_name != alias_name + else sge.to_identifier(col_name, quoted=cls.quoted) + for col_name, alias_name in zip(col_names, alias_names) + ] + select_expr = sge.Select().select(*selections).from_(table_expr) if sql_predicate: select_expr = select_expr.where( sg.parse_one(sql_predicate, dialect="bigquery"), append=False diff --git a/bigframes/core/nodes.py b/bigframes/core/nodes.py index ddccb39ef98..10adf7a6068 100644 --- a/bigframes/core/nodes.py +++ b/bigframes/core/nodes.py @@ -819,6 +819,12 @@ def order_ambiguous(self) -> bool: def explicitly_ordered(self) -> bool: return self.source.ordering is not None + @property + def is_star_selection(self) -> bool: + physical_names = tuple(item.name for item in self.source.table.physical_schema) + scan_names = tuple(item.source_id for item in self.scan_list.items) + return physical_names == scan_names + @functools.cached_property def variables_introduced(self) -> int: return len(self.scan_list.items) + 1 diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number/out.sql index 72db92a65b6..66233f72fcc 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number/out.sql @@ -1,20 +1,6 @@ WITH `bfcte_0` AS ( SELECT - `bool_col`, - `bytes_col`, - `date_col`, - `datetime_col`, - `geography_col`, - `int64_col`, - `int64_too`, - `numeric_col`, - `float64_col`, - `rowindex`, - `rowindex_2`, - `string_col`, - `time_col`, - `timestamp_col`, - `duration_col` + * FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_size/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_size/out.sql index d5f599b5da7..7a4393f8133 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_size/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_size/out.sql @@ -1,20 +1,6 @@ WITH `bfcte_0` AS ( SELECT - `bool_col`, - `bytes_col`, - `date_col`, - `datetime_col`, - `geography_col`, - `int64_col`, - `int64_too`, - `numeric_col`, - `float64_col`, - `rowindex`, - `rowindex_2`, - `string_col`, - `time_col`, - `timestamp_col`, - `duration_col` + * FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_row_key/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_row_key/out.sql index a5153f850be..2674ff9af98 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_row_key/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_row_key/out.sql @@ -1,20 +1,6 @@ WITH `bfcte_0` AS ( SELECT - `bool_col`, - `bytes_col`, - `date_col`, - `datetime_col`, - `geography_col`, - `int64_col`, - `int64_too`, - `numeric_col`, - `float64_col`, - `rowindex`, - `rowindex_2`, - `string_col`, - `time_col`, - `timestamp_col`, - `duration_col` + * FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable/out.sql index 29a9cfc35c7..eb3fcba0033 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable/out.sql @@ -1,20 +1,6 @@ WITH `bfcte_0` AS ( SELECT - `bool_col`, - `bytes_col`, - `date_col`, - `datetime_col`, - `geography_col`, - `int64_col`, - `int64_too`, - `numeric_col`, - `float64_col`, - `rowindex`, - `rowindex_2`, - `string_col`, - `time_col`, - `timestamp_col`, - `duration_col` + * FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_json_types/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_json_types/out.sql index 1f79ac54820..03145e2436a 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_json_types/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_json_types/out.sql @@ -1,7 +1,6 @@ WITH `bfcte_0` AS ( SELECT - `rowindex`, - `json_col` + * FROM `bigframes-dev`.`sqlglot_test`.`json_types` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_nested_structs_types/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_nested_structs_types/out.sql index 79ae1ac9072..5b39ef2c053 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_nested_structs_types/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_nested_structs_types/out.sql @@ -1,7 +1,6 @@ WITH `bfcte_0` AS ( SELECT - `id`, - `people` + * FROM `bigframes-dev`.`sqlglot_test`.`nested_structs_types` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_repeated_types/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_repeated_types/out.sql index d50969f0c23..63c80398abe 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_repeated_types/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_repeated_types/out.sql @@ -1,13 +1,6 @@ WITH `bfcte_0` AS ( SELECT - `rowindex`, - `int_list_col`, - `bool_list_col`, - `float_list_col`, - `date_list_col`, - `date_time_list_col`, - `numeric_list_col`, - `string_list_col` + * FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_system_time/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_system_time/out.sql index 430c518bd1c..808796929ae 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_system_time/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_system_time/out.sql @@ -1,20 +1,6 @@ WITH `bfcte_0` AS ( SELECT - `bool_col`, - `bytes_col`, - `date_col`, - `datetime_col`, - `geography_col`, - `int64_col`, - `int64_too`, - `numeric_col`, - `float64_col`, - `rowindex`, - `rowindex_2`, - `string_col`, - `time_col`, - `timestamp_col`, - `duration_col` + * FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` FOR SYSTEM_TIME AS OF '2025-11-09T03:04:05.678901+00:00' ) SELECT