From 729dc544b8cc421e8a493386978025aa5ad8d113 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Fri, 7 Nov 2025 22:46:40 +0000 Subject: [PATCH 1/3] feat: Preserve source names better for more readable sql --- bigframes/core/compile/sqlglot/sqlglot_ir.py | 4 + bigframes/core/rewrite/select_pullup.py | 42 ++++++- .../test_binary_compiler/test_corr/out.sql | 6 +- .../test_binary_compiler/test_cov/out.sql | 6 +- .../test_row_number/out.sql | 30 ++--- .../test_row_number_with_window/out.sql | 4 +- .../test_nullary_compiler/test_size/out.sql | 30 ++--- .../test_array_agg/out.sql | 4 +- .../test_string_agg/out.sql | 13 ++- .../test_unary_compiler/test_all/out.sql | 4 +- .../test_all/window_out.sql | 6 +- .../test_all/window_partition_out.sql | 8 +- .../test_any_value/out.sql | 4 +- .../test_any_value/window_out.sql | 4 +- .../test_any_value/window_partition_out.sql | 8 +- .../test_approx_quartiles/out.sql | 8 +- .../test_approx_top_count/out.sql | 4 +- .../test_unary_compiler/test_count/out.sql | 4 +- .../test_count/window_out.sql | 4 +- .../test_count/window_partition_out.sql | 6 +- .../test_date_series_diff/out.sql | 4 +- .../test_dense_rank/out.sql | 4 +- .../test_diff/diff_bool.sql | 4 +- .../test_diff/diff_int.sql | 4 +- .../test_unary_compiler/test_first/out.sql | 9 +- .../test_first_non_null/out.sql | 6 +- .../test_unary_compiler/test_last/out.sql | 9 +- .../test_last_non_null/out.sql | 6 +- .../test_unary_compiler/test_max/out.sql | 4 +- .../test_max/window_out.sql | 4 +- .../test_max/window_partition_out.sql | 8 +- .../test_unary_compiler/test_mean/out.sql | 12 +- .../test_mean/window_out.sql | 4 +- .../test_mean/window_partition_out.sql | 8 +- .../test_unary_compiler/test_median/out.sql | 12 +- .../test_unary_compiler/test_min/out.sql | 4 +- .../test_min/window_out.sql | 4 +- .../test_min/window_partition_out.sql | 8 +- .../test_unary_compiler/test_pop_var/out.sql | 8 +- .../test_pop_var/window_out.sql | 4 +- .../test_unary_compiler/test_quantile/out.sql | 6 +- .../test_unary_compiler/test_rank/out.sql | 4 +- .../test_unary_compiler/test_shift/lag.sql | 4 +- .../test_unary_compiler/test_shift/lead.sql | 4 +- .../test_unary_compiler/test_shift/noop.sql | 4 +- .../test_unary_compiler/test_std/out.sql | 12 +- .../test_std/window_out.sql | 4 +- .../test_unary_compiler/test_sum/out.sql | 8 +- .../test_sum/window_out.sql | 8 +- .../test_sum/window_partition_out.sql | 8 +- .../test_time_series_diff/out.sql | 8 +- .../test_unary_compiler/test_var/out.sql | 8 +- .../test_var/window_out.sql | 4 +- .../test_ai_ops/test_ai_classify/out.sql | 4 +- .../test_ai_ops/test_ai_generate/out.sql | 4 +- .../test_ai_ops/test_ai_generate_bool/out.sql | 4 +- .../out.sql | 4 +- .../test_ai_generate_double/out.sql | 4 +- .../out.sql | 4 +- .../test_ai_ops/test_ai_generate_int/out.sql | 4 +- .../out.sql | 4 +- .../test_ai_generate_with_model_param/out.sql | 4 +- .../out.sql | 4 +- .../snapshots/test_ai_ops/test_ai_if/out.sql | 4 +- .../test_ai_ops/test_ai_score/out.sql | 4 +- .../test_array_ops/test_array_index/out.sql | 4 +- .../test_array_slice_with_only_start/out.sql | 4 +- .../out.sql | 4 +- .../test_array_to_string/out.sql | 4 +- .../test_obj_fetch_metadata/out.sql | 8 +- .../test_obj_get_access_url/out.sql | 8 +- .../test_blob_ops/test_obj_make_ref/out.sql | 8 +- .../test_bool_ops/test_and_op/out.sql | 14 +-- .../test_bool_ops/test_or_op/out.sql | 14 +-- .../test_bool_ops/test_xor_op/out.sql | 14 +-- .../test_eq_null_match/out.sql | 6 +- .../test_eq_numeric/out.sql | 14 +-- .../test_ge_numeric/out.sql | 14 +-- .../test_gt_numeric/out.sql | 14 +-- .../test_comparison_ops/test_is_in/out.sql | 20 ++-- .../test_le_numeric/out.sql | 14 +-- .../test_lt_numeric/out.sql | 14 +-- .../test_maximum_op/out.sql | 6 +- .../test_minimum_op/out.sql | 6 +- .../test_ne_numeric/out.sql | 14 +-- .../test_add_timedelta/out.sql | 14 +-- .../test_datetime_ops/test_date/out.sql | 4 +- .../test_datetime_ops/test_day/out.sql | 4 +- .../test_datetime_ops/test_dayofweek/out.sql | 12 +- .../test_datetime_ops/test_dayofyear/out.sql | 4 +- .../test_datetime_ops/test_floor_dt/out.sql | 28 ++--- .../test_datetime_ops/test_hour/out.sql | 4 +- .../test_datetime_ops/test_iso_day/out.sql | 4 +- .../test_datetime_ops/test_iso_week/out.sql | 4 +- .../test_datetime_ops/test_iso_year/out.sql | 4 +- .../test_datetime_ops/test_minute/out.sql | 4 +- .../test_datetime_ops/test_month/out.sql | 4 +- .../test_datetime_ops/test_normalize/out.sql | 4 +- .../test_datetime_ops/test_quarter/out.sql | 4 +- .../test_datetime_ops/test_second/out.sql | 4 +- .../test_datetime_ops/test_strftime/out.sql | 4 +- .../test_sub_timedelta/out.sql | 16 +-- .../test_datetime_ops/test_time/out.sql | 4 +- .../test_to_datetime/out.sql | 4 +- .../test_to_timestamp/out.sql | 4 +- .../test_unix_micros/out.sql | 4 +- .../test_unix_millis/out.sql | 4 +- .../test_unix_seconds/out.sql | 4 +- .../test_datetime_ops/test_year/out.sql | 4 +- .../test_generic_ops/test_astype_bool/out.sql | 10 +- .../test_astype_float/out.sql | 6 +- .../test_astype_from_json/out.sql | 12 +- .../test_generic_ops/test_astype_int/out.sql | 26 ++--- .../test_generic_ops/test_astype_json/out.sql | 20 ++-- .../test_astype_string/out.sql | 10 +- .../test_astype_time_like/out.sql | 10 +- .../test_case_when_op/out.sql | 26 ++--- .../test_generic_ops/test_clip/out.sql | 8 +- .../test_generic_ops/test_coalesce/out.sql | 8 +- .../test_generic_ops/test_hash/out.sql | 4 +- .../test_generic_ops/test_invert/out.sql | 12 +- .../test_generic_ops/test_isnull/out.sql | 4 +- .../test_generic_ops/test_map/out.sql | 4 +- .../test_generic_ops/test_notnull/out.sql | 4 +- .../test_generic_ops/test_row_key/out.sql | 94 ++++++++-------- .../test_sql_scalar_op/out.sql | 6 +- .../test_generic_ops/test_where/out.sql | 8 +- .../test_geo_ops/test_geo_area/out.sql | 4 +- .../test_geo_ops/test_geo_st_astext/out.sql | 4 +- .../test_geo_ops/test_geo_st_boundary/out.sql | 4 +- .../test_geo_ops/test_geo_st_buffer/out.sql | 4 +- .../test_geo_ops/test_geo_st_centroid/out.sql | 4 +- .../test_geo_st_convexhull/out.sql | 4 +- .../test_geo_st_geogfromtext/out.sql | 4 +- .../test_geo_ops/test_geo_st_isclosed/out.sql | 4 +- .../test_geo_ops/test_geo_st_length/out.sql | 4 +- .../snapshots/test_geo_ops/test_geo_x/out.sql | 4 +- .../snapshots/test_geo_ops/test_geo_y/out.sql | 4 +- .../test_json_ops/test_json_extract/out.sql | 4 +- .../test_json_extract_array/out.sql | 4 +- .../test_json_extract_string_array/out.sql | 4 +- .../test_json_ops/test_json_query/out.sql | 4 +- .../test_json_query_array/out.sql | 4 +- .../test_json_ops/test_json_set/out.sql | 4 +- .../test_json_ops/test_json_value/out.sql | 4 +- .../test_json_ops/test_parse_json/out.sql | 4 +- .../test_json_ops/test_to_json_string/out.sql | 4 +- .../test_numeric_ops/test_abs/out.sql | 4 +- .../test_numeric_ops/test_add_numeric/out.sql | 14 +-- .../test_numeric_ops/test_add_string/out.sql | 4 +- .../test_add_timedelta/out.sql | 14 +-- .../test_numeric_ops/test_arccos/out.sql | 8 +- .../test_numeric_ops/test_arccosh/out.sql | 8 +- .../test_numeric_ops/test_arcsin/out.sql | 8 +- .../test_numeric_ops/test_arcsinh/out.sql | 4 +- .../test_numeric_ops/test_arctan/out.sql | 4 +- .../test_numeric_ops/test_arctanh/out.sql | 8 +- .../test_numeric_ops/test_ceil/out.sql | 4 +- .../test_numeric_ops/test_cos/out.sql | 4 +- .../test_numeric_ops/test_cosh/out.sql | 6 +- .../test_numeric_ops/test_div_numeric/out.sql | 18 +-- .../test_div_timedelta/out.sql | 14 +-- .../test_numeric_ops/test_exp/out.sql | 6 +- .../test_numeric_ops/test_expm1/out.sql | 6 +- .../test_numeric_ops/test_floor/out.sql | 4 +- .../test_floordiv_timedelta/out.sql | 12 +- .../test_numeric_ops/test_ln/out.sql | 4 +- .../test_numeric_ops/test_log10/out.sql | 8 +- .../test_numeric_ops/test_log1p/out.sql | 8 +- .../test_numeric_ops/test_mod_numeric/out.sql | 34 +++--- .../test_numeric_ops/test_mul_numeric/out.sql | 14 +-- .../test_mul_timedelta/out.sql | 16 +-- .../test_numeric_ops/test_neg/out.sql | 4 +- .../test_numeric_ops/test_pos/out.sql | 4 +- .../test_numeric_ops/test_round/out.sql | 14 +-- .../test_numeric_ops/test_sin/out.sql | 4 +- .../test_numeric_ops/test_sinh/out.sql | 8 +- .../test_numeric_ops/test_sqrt/out.sql | 4 +- .../test_numeric_ops/test_sub_numeric/out.sql | 14 +-- .../test_sub_timedelta/out.sql | 16 +-- .../test_numeric_ops/test_tan/out.sql | 4 +- .../test_numeric_ops/test_tanh/out.sql | 4 +- .../test_string_ops/test_add_string/out.sql | 4 +- .../test_string_ops/test_capitalize/out.sql | 4 +- .../test_string_ops/test_endswith/out.sql | 6 +- .../test_string_ops/test_isalnum/out.sql | 4 +- .../test_string_ops/test_isalpha/out.sql | 4 +- .../test_string_ops/test_isdecimal/out.sql | 4 +- .../test_string_ops/test_isdigit/out.sql | 4 +- .../test_string_ops/test_islower/out.sql | 4 +- .../test_string_ops/test_isnumeric/out.sql | 4 +- .../test_string_ops/test_isspace/out.sql | 4 +- .../test_string_ops/test_isupper/out.sql | 4 +- .../test_string_ops/test_len/out.sql | 4 +- .../test_string_ops/test_lower/out.sql | 4 +- .../test_string_ops/test_lstrip/out.sql | 4 +- .../test_regex_replace_str/out.sql | 4 +- .../test_string_ops/test_replace_str/out.sql | 4 +- .../test_string_ops/test_reverse/out.sql | 4 +- .../test_string_ops/test_rstrip/out.sql | 4 +- .../test_string_ops/test_startswith/out.sql | 6 +- .../test_string_ops/test_str_contains/out.sql | 4 +- .../test_str_contains_regex/out.sql | 4 +- .../test_string_ops/test_str_extract/out.sql | 4 +- .../test_string_ops/test_str_find/out.sql | 10 +- .../test_string_ops/test_str_get/out.sql | 4 +- .../test_string_ops/test_str_pad/out.sql | 12 +- .../test_string_ops/test_str_repeat/out.sql | 4 +- .../test_string_ops/test_str_slice/out.sql | 4 +- .../test_string_ops/test_strconcat/out.sql | 4 +- .../test_string_ops/test_string_split/out.sql | 4 +- .../test_string_ops/test_strip/out.sql | 4 +- .../test_string_ops/test_upper/out.sql | 4 +- .../test_string_ops/test_zfill/out.sql | 8 +- .../test_struct_ops/test_struct_field/out.sql | 6 +- .../test_struct_ops/test_struct_op/out.sql | 16 +-- .../test_timedelta_floor/out.sql | 4 +- .../test_to_timedelta/out.sql | 10 +- .../test_compile_aggregate/out.sql | 8 +- .../test_compile_aggregate_wo_dropna/out.sql | 8 +- .../test_compile_concat/out.sql | 28 ++--- .../test_compile_concat_filter_sorted/out.sql | 104 +++++++++--------- .../test_compile_explode_dataframe/out.sql | 18 +-- .../test_compile_explode_series/out.sql | 12 +- .../test_compile_filter/out.sql | 12 +- .../test_compile_isin/out.sql | 36 +++--- .../test_compile_isin_not_nullable/out.sql | 34 +++--- .../test_compile_join/out.sql | 16 +-- .../test_compile_join_w_on/bool_col/out.sql | 16 +-- .../float64_col/out.sql | 16 +-- .../test_compile_join_w_on/int64_col/out.sql | 16 +-- .../numeric_col/out.sql | 16 +-- .../test_compile_join_w_on/string_col/out.sql | 25 +++-- .../test_compile_join_w_on/time_col/out.sql | 25 +++-- .../test_compile_readtable/out.sql | 62 +++++------ .../out.sql | 8 +- .../test_compile_readtable_w_limit/out.sql | 10 +- .../out.sql | 10 +- .../test_compile_readtable_w_ordering/out.sql | 10 +- .../out.sql | 34 +++--- .../out.sql | 24 ++-- .../out.sql | 12 +- .../out.sql | 12 +- 243 files changed, 1163 insertions(+), 1066 deletions(-) diff --git a/bigframes/core/compile/sqlglot/sqlglot_ir.py b/bigframes/core/compile/sqlglot/sqlglot_ir.py index c7ee13f4e8..91fea44490 100644 --- a/bigframes/core/compile/sqlglot/sqlglot_ir.py +++ b/bigframes/core/compile/sqlglot/sqlglot_ir.py @@ -134,6 +134,8 @@ def from_table( 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) ] table_expr = sge.Table( @@ -227,6 +229,8 @@ def select( this=expr, alias=sge.to_identifier(id, quoted=self.quoted), ) + if expr.alias_or_name != id + else expr for id, expr in selected_cols ] diff --git a/bigframes/core/rewrite/select_pullup.py b/bigframes/core/rewrite/select_pullup.py index 3a2de1238b..415182f884 100644 --- a/bigframes/core/rewrite/select_pullup.py +++ b/bigframes/core/rewrite/select_pullup.py @@ -13,9 +13,10 @@ # limitations under the License. import dataclasses +import functools from typing import cast -from bigframes.core import expression, nodes +from bigframes.core import expression, identifiers, nodes def defer_selection( @@ -26,12 +27,19 @@ def defer_selection( In many cases, these nodes will be merged or eliminated entirely, simplifying the overall tree. """ - return nodes.bottom_up(root, pull_up_select) + return nodes.bottom_up( + root, functools.partial(pull_up_select, prefer_source_names=True) + ) -def pull_up_select(node: nodes.BigFrameNode) -> nodes.BigFrameNode: +def pull_up_select( + node: nodes.BigFrameNode, prefer_source_names: bool +) -> nodes.BigFrameNode: if isinstance(node, nodes.LeafNode): - return node + if prefer_source_names and isinstance(node, nodes.ReadTableNode): + return pull_up_source_ids(node) + else: + return node if isinstance(node, nodes.JoinNode): return pull_up_selects_under_join(node) if isinstance(node, nodes.ConcatNode): @@ -42,6 +50,32 @@ def pull_up_select(node: nodes.BigFrameNode) -> nodes.BigFrameNode: return node +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 + ] + ) + new_source = dataclasses.replace(node, scan_list=new_scan_list) + new_selection = nodes.SelectionNode( + new_source, + tuple( + nodes.AliasedRef( + expression.DerefOp(identifiers.ColumnId(source_id)), id + ) + for id, source_id in node.scan_list.items + ), + ) + return new_selection + + def pull_up_select_unary(node: nodes.UnaryNode) -> nodes.BigFrameNode: child = node.child if not isinstance(child, nodes.SelectionNode): 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 8922a71de4..5c838f4882 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,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `float64_col` AS `bfcol_1` + `float64_col`, + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - CORR(`bfcol_0`, `bfcol_1`) AS `bfcol_2` + CORR(`int64_col`, `float64_col`) AS `bfcol_2` FROM `bfcte_0` ) 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 6cf189da31..eda082250a 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,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `float64_col` AS `bfcol_1` + `float64_col`, + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - COVAR_SAMP(`bfcol_0`, `bfcol_1`) AS `bfcol_2` + COVAR_SAMP(`int64_col`, `float64_col`) AS `bfcol_2` FROM `bfcte_0` ) 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 b48dcfa01b..78cc44fa54 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,20 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `bytes_col` AS `bfcol_1`, - `date_col` AS `bfcol_2`, - `datetime_col` AS `bfcol_3`, - `geography_col` AS `bfcol_4`, - `int64_col` AS `bfcol_5`, - `int64_too` AS `bfcol_6`, - `numeric_col` AS `bfcol_7`, - `float64_col` AS `bfcol_8`, - `rowindex` AS `bfcol_9`, - `rowindex_2` AS `bfcol_10`, - `string_col` AS `bfcol_11`, - `time_col` AS `bfcol_12`, - `timestamp_col` AS `bfcol_13`, - `duration_col` AS `bfcol_14` + `bool_col`, + `bytes_col`, + `date_col`, + `datetime_col`, + `duration_col`, + `float64_col`, + `geography_col`, + `int64_col`, + `int64_too`, + `numeric_col`, + `rowindex`, + `rowindex_2`, + `string_col`, + `time_col`, + `timestamp_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_with_window/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number_with_window/out.sql index 8dc701e1f9..b63cb1ff61 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number_with_window/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number_with_window/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ROW_NUMBER() OVER (ORDER BY `bfcol_0` ASC NULLS LAST) AS `bfcol_1` + ROW_NUMBER() OVER (ORDER BY `int64_col` ASC NULLS LAST) AS `bfcol_1` FROM `bfcte_0` ) 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 8cda9a3d80..ed8e0c7619 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,20 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `bytes_col` AS `bfcol_1`, - `date_col` AS `bfcol_2`, - `datetime_col` AS `bfcol_3`, - `geography_col` AS `bfcol_4`, - `int64_col` AS `bfcol_5`, - `int64_too` AS `bfcol_6`, - `numeric_col` AS `bfcol_7`, - `float64_col` AS `bfcol_8`, - `rowindex` AS `bfcol_9`, - `rowindex_2` AS `bfcol_10`, - `string_col` AS `bfcol_11`, - `time_col` AS `bfcol_12`, - `timestamp_col` AS `bfcol_13`, - `duration_col` AS `bfcol_14` + `bool_col`, + `bytes_col`, + `date_col`, + `datetime_col`, + `duration_col`, + `float64_col`, + `geography_col`, + `int64_col`, + `int64_too`, + `numeric_col`, + `rowindex`, + `rowindex_2`, + `string_col`, + `time_col`, + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_array_agg/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_array_agg/out.sql index 43e0a03db4..eafbc39daf 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_array_agg/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_array_agg/out.sql @@ -1,10 +1,10 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - ARRAY_AGG(`bfcol_0` IGNORE NULLS ORDER BY `bfcol_0` IS NULL ASC, `bfcol_0` ASC) AS `bfcol_1` + ARRAY_AGG(`int64_col` IGNORE NULLS ORDER BY `int64_col` IS NULL ASC, `int64_col` ASC) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_string_agg/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_string_agg/out.sql index 115d7e37ee..321341d4a0 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_string_agg/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_string_agg/out.sql @@ -1,13 +1,16 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - COALESCE(STRING_AGG(`bfcol_0`, ',' - ORDER BY - `bfcol_0` IS NULL ASC, - `bfcol_0` ASC), '') AS `bfcol_1` + COALESCE( + STRING_AGG(`string_col`, ',' + ORDER BY + `string_col` IS NULL ASC, + `string_col` ASC), + '' + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/out.sql index 7303d758cc..d31b21f56b 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/out.sql @@ -1,10 +1,10 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0` + `bool_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - COALESCE(LOGICAL_AND(`bfcol_0`), TRUE) AS `bfcol_1` + COALESCE(LOGICAL_AND(`bool_col`), TRUE) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_out.sql index a91381d3be..83bd288e73 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_out.sql @@ -1,14 +1,14 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0` + `bool_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, CASE - WHEN `bfcol_0` IS NULL + WHEN `bool_col` IS NULL THEN NULL - ELSE COALESCE(LOGICAL_AND(`bfcol_0`) OVER (), TRUE) + ELSE COALESCE(LOGICAL_AND(`bool_col`) OVER (), TRUE) END AS `bfcol_1` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_partition_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_partition_out.sql index 1a9a020b3e..dc2471148b 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_partition_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_partition_out.sql @@ -1,15 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `string_col` AS `bfcol_1` + `bool_col`, + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, CASE - WHEN `bfcol_0` IS NULL + WHEN `bool_col` IS NULL THEN NULL - ELSE COALESCE(LOGICAL_AND(`bfcol_0`) OVER (PARTITION BY `bfcol_1`), TRUE) + ELSE COALESCE(LOGICAL_AND(`bool_col`) OVER (PARTITION BY `string_col`), TRUE) END AS `bfcol_2` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/out.sql index f95b094a13..4a13901f1c 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/out.sql @@ -1,10 +1,10 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - ANY_VALUE(`bfcol_0`) AS `bfcol_1` + ANY_VALUE(`int64_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/window_out.sql index b262284b88..f179808b57 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/window_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/window_out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE ANY_VALUE(`bfcol_0`) OVER () END AS `bfcol_1` + CASE WHEN `int64_col` IS NULL THEN NULL ELSE ANY_VALUE(`int64_col`) OVER () END AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/window_partition_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/window_partition_out.sql index 66933626b5..e1b3da8a9a 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/window_partition_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/window_partition_out.sql @@ -1,15 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `string_col` AS `bfcol_1` + `int64_col`, + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, CASE - WHEN `bfcol_0` IS NULL + WHEN `int64_col` IS NULL THEN NULL - ELSE ANY_VALUE(`bfcol_0`) OVER (PARTITION BY `bfcol_1`) + ELSE ANY_VALUE(`int64_col`) OVER (PARTITION BY `string_col`) END AS `bfcol_2` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_approx_quartiles/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_approx_quartiles/out.sql index e7bb16e57c..9eabb2d88a 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_approx_quartiles/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_approx_quartiles/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - APPROX_QUANTILES(`bfcol_0`, 4)[OFFSET(1)] AS `bfcol_1`, - APPROX_QUANTILES(`bfcol_0`, 4)[OFFSET(2)] AS `bfcol_2`, - APPROX_QUANTILES(`bfcol_0`, 4)[OFFSET(3)] AS `bfcol_3` + APPROX_QUANTILES(`int64_col`, 4)[OFFSET(1)] AS `bfcol_1`, + APPROX_QUANTILES(`int64_col`, 4)[OFFSET(2)] AS `bfcol_2`, + APPROX_QUANTILES(`int64_col`, 4)[OFFSET(3)] AS `bfcol_3` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_approx_top_count/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_approx_top_count/out.sql index b61a72d1b2..b5e6275381 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_approx_top_count/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_approx_top_count/out.sql @@ -1,10 +1,10 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - APPROX_TOP_COUNT(`bfcol_0`, 10) AS `bfcol_1` + APPROX_TOP_COUNT(`int64_col`, 10) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/out.sql index 01684b4af6..9d18367cf6 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/out.sql @@ -1,10 +1,10 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - COUNT(`bfcol_0`) AS `bfcol_1` + COUNT(`int64_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/window_out.sql index beda182992..0baac95311 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/window_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/window_out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - COUNT(`bfcol_0`) OVER () AS `bfcol_1` + COUNT(`int64_col`) OVER () AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/window_partition_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/window_partition_out.sql index d4a12d73f8..6d3f856459 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/window_partition_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/window_partition_out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `string_col` AS `bfcol_1` + `int64_col`, + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - COUNT(`bfcol_0`) OVER (PARTITION BY `bfcol_1`) AS `bfcol_2` + COUNT(`int64_col`) OVER (PARTITION BY `string_col`) AS `bfcol_2` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_date_series_diff/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_date_series_diff/out.sql index cd1cf3ff3b..84c95fd010 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_date_series_diff/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_date_series_diff/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `date_col` AS `bfcol_0` + `date_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CAST(DATE_DIFF(`bfcol_0`, LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC NULLS LAST), DAY) * 86400000000 AS INT64) AS `bfcol_1` + CAST(DATE_DIFF(`date_col`, LAG(`date_col`, 1) OVER (ORDER BY `date_col` ASC NULLS LAST), DAY) * 86400000000 AS INT64) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_dense_rank/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_dense_rank/out.sql index 0f704dd0cc..76b455a65c 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_dense_rank/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_dense_rank/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - DENSE_RANK() OVER (ORDER BY `bfcol_0` DESC) AS `bfcol_1` + DENSE_RANK() OVER (ORDER BY `int64_col` DESC) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_bool.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_bool.sql index 500056928d..96d23c4747 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_bool.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_bool.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0` + `bool_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_0` <> LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` DESC) AS `bfcol_1` + `bool_col` <> LAG(`bool_col`, 1) OVER (ORDER BY `bool_col` DESC) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_int.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_int.sql index f4fd46ee2d..95d786b951 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_int.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_int.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_0` - LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC NULLS LAST) AS `bfcol_1` + `int64_col` - LAG(`int64_col`, 1) OVER (ORDER BY `int64_col` ASC NULLS LAST) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first/out.sql index df76aa1d33..40c9e6ddd8 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first/out.sql @@ -1,14 +1,17 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, CASE - WHEN `bfcol_0` IS NULL + WHEN `int64_col` IS NULL THEN NULL - ELSE FIRST_VALUE(`bfcol_0`) OVER (ORDER BY `bfcol_0` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) + ELSE FIRST_VALUE(`int64_col`) OVER ( + ORDER BY `int64_col` DESC + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) END AS `bfcol_1` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first_non_null/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first_non_null/out.sql index 70eeefda7b..2ef7b7151e 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first_non_null/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first_non_null/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - FIRST_VALUE(`bfcol_0` IGNORE NULLS) OVER ( - ORDER BY `bfcol_0` ASC NULLS LAST + FIRST_VALUE(`int64_col` IGNORE NULLS) OVER ( + ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS `bfcol_1` FROM `bfcte_0` diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last/out.sql index 4a5af9af32..ebeaa0e338 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last/out.sql @@ -1,14 +1,17 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, CASE - WHEN `bfcol_0` IS NULL + WHEN `int64_col` IS NULL THEN NULL - ELSE LAST_VALUE(`bfcol_0`) OVER (ORDER BY `bfcol_0` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) + ELSE LAST_VALUE(`int64_col`) OVER ( + ORDER BY `int64_col` DESC + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) END AS `bfcol_1` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last_non_null/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last_non_null/out.sql index a246618ff0..c626c263ac 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last_non_null/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last_non_null/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - LAST_VALUE(`bfcol_0` IGNORE NULLS) OVER ( - ORDER BY `bfcol_0` ASC NULLS LAST + LAST_VALUE(`int64_col` IGNORE NULLS) OVER ( + ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS `bfcol_1` FROM `bfcte_0` diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/out.sql index c88fa58d0f..1537d735ea 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/out.sql @@ -1,10 +1,10 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - MAX(`bfcol_0`) AS `bfcol_1` + MAX(`int64_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/window_out.sql index 4c86cb38e0..a234601b6a 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/window_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/window_out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE MAX(`bfcol_0`) OVER () END AS `bfcol_1` + CASE WHEN `int64_col` IS NULL THEN NULL ELSE MAX(`int64_col`) OVER () END AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/window_partition_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/window_partition_out.sql index 64dc97642b..f918500788 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/window_partition_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/window_partition_out.sql @@ -1,15 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `string_col` AS `bfcol_1` + `int64_col`, + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, CASE - WHEN `bfcol_0` IS NULL + WHEN `int64_col` IS NULL THEN NULL - ELSE MAX(`bfcol_0`) OVER (PARTITION BY `bfcol_1`) + ELSE MAX(`int64_col`) OVER (PARTITION BY `string_col`) END AS `bfcol_2` FROM `bfcte_0` ) 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 6d4bb6f89a..0b33d0b1d0 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,15 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `duration_col` AS `bfcol_2` + `bool_col`, + `duration_col`, + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_6`, - `bfcol_0` AS `bfcol_7`, - `bfcol_2` AS `bfcol_8` + `int64_col` AS `bfcol_6`, + `bool_col` AS `bfcol_7`, + `duration_col` AS `bfcol_8` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/window_out.sql index bc89091ca9..73bec9ccce 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/window_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/window_out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE AVG(`bfcol_0`) OVER () END AS `bfcol_1` + CASE WHEN `int64_col` IS NULL THEN NULL ELSE AVG(`int64_col`) OVER () END AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/window_partition_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/window_partition_out.sql index e6c1cf3bb4..d0a8345e12 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/window_partition_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/window_partition_out.sql @@ -1,15 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `string_col` AS `bfcol_1` + `int64_col`, + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, CASE - WHEN `bfcol_0` IS NULL + WHEN `int64_col` IS NULL THEN NULL - ELSE AVG(`bfcol_0`) OVER (PARTITION BY `bfcol_1`) + ELSE AVG(`int64_col`) OVER (PARTITION BY `string_col`) END AS `bfcol_2` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_median/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_median/out.sql index bf7006ef87..bfe94622b3 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_median/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_median/out.sql @@ -1,14 +1,14 @@ WITH `bfcte_0` AS ( SELECT - `date_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `string_col` AS `bfcol_2` + `date_col`, + `int64_col`, + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - APPROX_QUANTILES(`bfcol_1`, 2)[OFFSET(1)] AS `bfcol_3`, - APPROX_QUANTILES(`bfcol_0`, 2)[OFFSET(1)] AS `bfcol_4`, - APPROX_QUANTILES(`bfcol_2`, 2)[OFFSET(1)] AS `bfcol_5` + APPROX_QUANTILES(`int64_col`, 2)[OFFSET(1)] AS `bfcol_3`, + APPROX_QUANTILES(`date_col`, 2)[OFFSET(1)] AS `bfcol_4`, + APPROX_QUANTILES(`string_col`, 2)[OFFSET(1)] AS `bfcol_5` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/out.sql index b067817218..0848313456 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/out.sql @@ -1,10 +1,10 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - MIN(`bfcol_0`) AS `bfcol_1` + MIN(`int64_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/window_out.sql index 0e96b56c50..1d9db63491 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/window_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/window_out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE MIN(`bfcol_0`) OVER () END AS `bfcol_1` + CASE WHEN `int64_col` IS NULL THEN NULL ELSE MIN(`int64_col`) OVER () END AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/window_partition_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/window_partition_out.sql index 4121e80f43..8040f43ca5 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/window_partition_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/window_partition_out.sql @@ -1,15 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `string_col` AS `bfcol_1` + `int64_col`, + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, CASE - WHEN `bfcol_0` IS NULL + WHEN `int64_col` IS NULL THEN NULL - ELSE MIN(`bfcol_0`) OVER (PARTITION BY `bfcol_1`) + ELSE MIN(`int64_col`) OVER (PARTITION BY `string_col`) END AS `bfcol_2` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_pop_var/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_pop_var/out.sql index de422382d1..2d38311f45 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_pop_var/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_pop_var/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1` + `bool_col`, + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - VAR_POP(`bfcol_1`) AS `bfcol_4`, - VAR_POP(CAST(`bfcol_0` AS INT64)) AS `bfcol_5` + VAR_POP(`int64_col`) AS `bfcol_4`, + VAR_POP(CAST(`bool_col` AS INT64)) AS `bfcol_5` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_pop_var/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_pop_var/window_out.sql index fa04dad64e..eae3db0048 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_pop_var/window_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_pop_var/window_out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE VAR_POP(`bfcol_0`) OVER () END AS `bfcol_1` + CASE WHEN `int64_col` IS NULL THEN NULL ELSE VAR_POP(`int64_col`) OVER () END AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_quantile/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_quantile/out.sql index c1b3d1fffa..b79d8d381f 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_quantile/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_quantile/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - PERCENTILE_CONT(`bfcol_0`, 0.5) OVER () AS `bfcol_1`, - CAST(FLOOR(PERCENTILE_CONT(`bfcol_0`, 0.5) OVER ()) AS INT64) AS `bfcol_2` + PERCENTILE_CONT(`int64_col`, 0.5) OVER () AS `bfcol_1`, + CAST(FLOOR(PERCENTILE_CONT(`int64_col`, 0.5) OVER ()) AS INT64) AS `bfcol_2` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_rank/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_rank/out.sql index ca3b9e8e54..96b121bde4 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_rank/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_rank/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - RANK() OVER (ORDER BY `bfcol_0` DESC NULLS FIRST) AS `bfcol_1` + RANK() OVER (ORDER BY `int64_col` DESC NULLS FIRST) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_shift/lag.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_shift/lag.sql index 32e6eabb9b..7d1d62f1ae 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_shift/lag.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_shift/lag.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC) AS `bfcol_1` + LAG(`int64_col`, 1) OVER (ORDER BY `int64_col` ASC) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_shift/lead.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_shift/lead.sql index f0797f1e17..67b40c99db 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_shift/lead.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_shift/lead.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - LEAD(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC) AS `bfcol_1` + LEAD(`int64_col`, 1) OVER (ORDER BY `int64_col` ASC) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_shift/noop.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_shift/noop.sql index fef4a2bde8..0202cf5c21 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_shift/noop.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_shift/noop.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_0` AS `bfcol_1` + `int64_col` AS `bfcol_1` FROM `bfcte_0` ) 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 9bfa6288c3..36a50302a6 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,15 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `duration_col` AS `bfcol_2` + `bool_col`, + `duration_col`, + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_6`, - `bfcol_0` AS `bfcol_7`, - `bfcol_2` AS `bfcol_8` + `int64_col` AS `bfcol_6`, + `bool_col` AS `bfcol_7`, + `duration_col` AS `bfcol_8` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_std/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_std/window_out.sql index e4e4ff0684..cb39f6dbc8 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_std/window_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_std/window_out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE STDDEV(`bfcol_0`) OVER () END AS `bfcol_1` + CASE WHEN `int64_col` IS NULL THEN NULL ELSE STDDEV(`int64_col`) OVER () END AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/out.sql index be684f6768..2bf6c26cd4 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1` + `bool_col`, + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - COALESCE(SUM(`bfcol_1`), 0) AS `bfcol_4`, - COALESCE(SUM(CAST(`bfcol_0` AS INT64)), 0) AS `bfcol_5` + COALESCE(SUM(`int64_col`), 0) AS `bfcol_4`, + COALESCE(SUM(CAST(`bool_col` AS INT64)), 0) AS `bfcol_5` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/window_out.sql index 939b491dd0..401436019e 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/window_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/window_out.sql @@ -1,11 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE COALESCE(SUM(`bfcol_0`) OVER (), 0) END AS `bfcol_1` + CASE + WHEN `int64_col` IS NULL + THEN NULL + ELSE COALESCE(SUM(`int64_col`) OVER (), 0) + END AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/window_partition_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/window_partition_out.sql index a23842867e..f8ada8a5d4 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/window_partition_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/window_partition_out.sql @@ -1,15 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `string_col` AS `bfcol_1` + `int64_col`, + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, CASE - WHEN `bfcol_0` IS NULL + WHEN `int64_col` IS NULL THEN NULL - ELSE COALESCE(SUM(`bfcol_0`) OVER (PARTITION BY `bfcol_1`), 0) + ELSE COALESCE(SUM(`int64_col`) OVER (PARTITION BY `string_col`), 0) END AS `bfcol_2` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_time_series_diff/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_time_series_diff/out.sql index 692685ee4d..645f583dc1 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_time_series_diff/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_time_series_diff/out.sql @@ -1,11 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - TIMESTAMP_DIFF(`bfcol_0`, LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC NULLS LAST), MICROSECOND) AS `bfcol_1` + TIMESTAMP_DIFF( + `timestamp_col`, + LAG(`timestamp_col`, 1) OVER (ORDER BY `timestamp_col` ASC NULLS LAST), + MICROSECOND + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_var/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_var/out.sql index 59ccd59e8f..733a22438c 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_var/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_var/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1` + `bool_col`, + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - VARIANCE(`bfcol_1`) AS `bfcol_4`, - VARIANCE(CAST(`bfcol_0` AS INT64)) AS `bfcol_5` + VARIANCE(`int64_col`) AS `bfcol_4`, + VARIANCE(CAST(`bool_col` AS INT64)) AS `bfcol_5` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_var/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_var/window_out.sql index a65104215b..d300251447 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_var/window_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_var/window_out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE VARIANCE(`bfcol_0`) OVER () END AS `bfcol_1` + CASE WHEN `int64_col` IS NULL THEN NULL ELSE VARIANCE(`int64_col`) OVER () END AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_classify/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_classify/out.sql index bb06760e4d..a40784a3ca 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_classify/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_classify/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, AI.CLASSIFY( - input => (`bfcol_0`), + input => (`string_col`), categories => ['greeting', 'rejection'], connection_id => 'bigframes-dev.us.bigframes-default-connection' ) AS `bfcol_1` diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate/out.sql index 5c4ccefd7b..19f85b181b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, AI.GENERATE( - prompt => (`bfcol_0`, ' is the same as ', `bfcol_0`), + prompt => (`string_col`, ' is the same as ', `string_col`), connection_id => 'bigframes-dev.us.bigframes-default-connection', endpoint => 'gemini-2.5-flash', request_type => 'SHARED' diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool/out.sql index 28905d0349..f844ed1691 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, AI.GENERATE_BOOL( - prompt => (`bfcol_0`, ' is the same as ', `bfcol_0`), + prompt => (`string_col`, ' is the same as ', `string_col`), connection_id => 'bigframes-dev.us.bigframes-default-connection', endpoint => 'gemini-2.5-flash', request_type => 'SHARED' diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool_with_model_param/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool_with_model_param/out.sql index bf52361a52..35538c2ec2 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool_with_model_param/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool_with_model_param/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, AI.GENERATE_BOOL( - prompt => (`bfcol_0`, ' is the same as ', `bfcol_0`), + prompt => (`string_col`, ' is the same as ', `string_col`), connection_id => 'bigframes-dev.us.bigframes-default-connection', request_type => 'SHARED', model_params => JSON '{}' diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double/out.sql index cbb05264e9..fae92515cb 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, AI.GENERATE_DOUBLE( - prompt => (`bfcol_0`, ' is the same as ', `bfcol_0`), + prompt => (`string_col`, ' is the same as ', `string_col`), connection_id => 'bigframes-dev.us.bigframes-default-connection', endpoint => 'gemini-2.5-flash', request_type => 'SHARED' diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double_with_model_param/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double_with_model_param/out.sql index a1c1a18664..f3ddf71014 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double_with_model_param/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double_with_model_param/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, AI.GENERATE_DOUBLE( - prompt => (`bfcol_0`, ' is the same as ', `bfcol_0`), + prompt => (`string_col`, ' is the same as ', `string_col`), connection_id => 'bigframes-dev.us.bigframes-default-connection', request_type => 'SHARED', model_params => JSON '{}' diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int/out.sql index ba5febe0cd..a0c92c959c 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, AI.GENERATE_INT( - prompt => (`bfcol_0`, ' is the same as ', `bfcol_0`), + prompt => (`string_col`, ' is the same as ', `string_col`), connection_id => 'bigframes-dev.us.bigframes-default-connection', endpoint => 'gemini-2.5-flash', request_type => 'SHARED' diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int_with_model_param/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int_with_model_param/out.sql index 996906fe9c..1951e13325 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int_with_model_param/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int_with_model_param/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, AI.GENERATE_INT( - prompt => (`bfcol_0`, ' is the same as ', `bfcol_0`), + prompt => (`string_col`, ' is the same as ', `string_col`), connection_id => 'bigframes-dev.us.bigframes-default-connection', request_type => 'SHARED', model_params => JSON '{}' diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_model_param/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_model_param/out.sql index 8726910619..3419a77c61 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_model_param/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_model_param/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, AI.GENERATE( - prompt => (`bfcol_0`, ' is the same as ', `bfcol_0`), + prompt => (`string_col`, ' is the same as ', `string_col`), connection_id => 'bigframes-dev.us.bigframes-default-connection', request_type => 'SHARED', model_params => JSON '{}' diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_output_schema/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_output_schema/out.sql index 62fc2f9db0..e1e1670f12 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_output_schema/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_output_schema/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, AI.GENERATE( - prompt => (`bfcol_0`, ' is the same as ', `bfcol_0`), + prompt => (`string_col`, ' is the same as ', `string_col`), connection_id => 'bigframes-dev.us.bigframes-default-connection', endpoint => 'gemini-2.5-flash', request_type => 'SHARED', diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_if/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_if/out.sql index d5b6a9330d..275ba8d423 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_if/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_if/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, AI.IF( - prompt => (`bfcol_0`, ' is the same as ', `bfcol_0`), + prompt => (`string_col`, ' is the same as ', `string_col`), connection_id => 'bigframes-dev.us.bigframes-default-connection' ) AS `bfcol_1` FROM `bfcte_0` diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_score/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_score/out.sql index e2be615921..01c71065b9 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_score/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_score/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, AI.SCORE( - prompt => (`bfcol_0`, ' is the same as ', `bfcol_0`), + prompt => (`string_col`, ' is the same as ', `string_col`), connection_id => 'bigframes-dev.us.bigframes-default-connection' ) AS `bfcol_1` FROM `bfcte_0` diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_index/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_index/out.sql index 4398084227..d8e223d5f8 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_index/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_index/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_list_col` AS `bfcol_0` + `string_list_col` FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_0`[SAFE_OFFSET(1)] AS `bfcol_1` + `string_list_col`[SAFE_OFFSET(1)] AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_slice_with_only_start/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_slice_with_only_start/out.sql index 1ffc3ee8f9..0034ffd69c 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_slice_with_only_start/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_slice_with_only_start/out.sql @@ -1,6 +1,6 @@ WITH `bfcte_0` AS ( SELECT - `string_list_col` AS `bfcol_0` + `string_list_col` FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ), `bfcte_1` AS ( SELECT @@ -8,7 +8,7 @@ WITH `bfcte_0` AS ( ARRAY( SELECT el - FROM UNNEST(`bfcol_0`) AS el WITH OFFSET AS slice_idx + FROM UNNEST(`string_list_col`) AS el WITH OFFSET AS slice_idx WHERE slice_idx >= 1 ) AS `bfcol_1` diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_slice_with_start_and_stop/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_slice_with_start_and_stop/out.sql index 878b60e5e2..f0638fa3af 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_slice_with_start_and_stop/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_slice_with_start_and_stop/out.sql @@ -1,6 +1,6 @@ WITH `bfcte_0` AS ( SELECT - `string_list_col` AS `bfcol_0` + `string_list_col` FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ), `bfcte_1` AS ( SELECT @@ -8,7 +8,7 @@ WITH `bfcte_0` AS ( ARRAY( SELECT el - FROM UNNEST(`bfcol_0`) AS el WITH OFFSET AS slice_idx + FROM UNNEST(`string_list_col`) AS el WITH OFFSET AS slice_idx WHERE slice_idx >= 1 AND slice_idx < 5 ) AS `bfcol_1` diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_to_string/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_to_string/out.sql index 4dbd602bea..09446bb8f5 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_to_string/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_to_string/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_list_col` AS `bfcol_0` + `string_list_col` FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ), `bfcte_1` AS ( SELECT *, - ARRAY_TO_STRING(`bfcol_0`, '.') AS `bfcol_1` + ARRAY_TO_STRING(`string_list_col`, '.') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_fetch_metadata/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_fetch_metadata/out.sql index 134fdc363b..bd99b86064 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_fetch_metadata/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_fetch_metadata/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `rowindex` AS `bfcol_0`, - `string_col` AS `bfcol_1` + `rowindex`, + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - OBJ.MAKE_REF(`bfcol_1`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_4` + OBJ.MAKE_REF(`string_col`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_4` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT @@ -20,6 +20,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_2` ) SELECT - `bfcol_0` AS `rowindex`, + `rowindex`, `bfcol_10` AS `version` FROM `bfcte_3` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_get_access_url/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_get_access_url/out.sql index 4a963b4972..c65436e530 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_get_access_url/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_get_access_url/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `rowindex` AS `bfcol_0`, - `string_col` AS `bfcol_1` + `rowindex`, + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - OBJ.MAKE_REF(`bfcol_1`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_4` + OBJ.MAKE_REF(`string_col`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_4` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT @@ -20,6 +20,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_2` ) SELECT - `bfcol_0` AS `rowindex`, + `rowindex`, `bfcol_10` AS `string_col` FROM `bfcte_3` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_make_ref/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_make_ref/out.sql index e3228feaaa..d74449c986 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_make_ref/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_make_ref/out.sql @@ -1,15 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `rowindex` AS `bfcol_0`, - `string_col` AS `bfcol_1` + `rowindex`, + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - OBJ.MAKE_REF(`bfcol_1`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_4` + OBJ.MAKE_REF(`string_col`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_4` FROM `bfcte_0` ) SELECT - `bfcol_0` AS `rowindex`, + `rowindex`, `bfcol_4` AS `string_col` FROM `bfcte_1` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_and_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_and_op/out.sql index 42c5847401..634a936a0e 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_and_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_and_op/out.sql @@ -1,16 +1,16 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` + `bool_col`, + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_0` AS `bfcol_7`, - `bfcol_1` AS `bfcol_8`, - `bfcol_1` & `bfcol_1` AS `bfcol_9` + `rowindex` AS `bfcol_6`, + `bool_col` AS `bfcol_7`, + `int64_col` AS `bfcol_8`, + `int64_col` & `int64_col` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_or_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_or_op/out.sql index d1e7bd1822..0069b07d8f 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_or_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_or_op/out.sql @@ -1,16 +1,16 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` + `bool_col`, + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_0` AS `bfcol_7`, - `bfcol_1` AS `bfcol_8`, - `bfcol_1` | `bfcol_1` AS `bfcol_9` + `rowindex` AS `bfcol_6`, + `bool_col` AS `bfcol_7`, + `int64_col` AS `bfcol_8`, + `int64_col` | `int64_col` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_xor_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_xor_op/out.sql index 7d5f74ede7..e4c87ed720 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_xor_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_xor_op/out.sql @@ -1,16 +1,16 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` + `bool_col`, + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_0` AS `bfcol_7`, - `bfcol_1` AS `bfcol_8`, - `bfcol_1` ^ `bfcol_1` AS `bfcol_9` + `rowindex` AS `bfcol_6`, + `bool_col` AS `bfcol_7`, + `int64_col` AS `bfcol_8`, + `int64_col` ^ `int64_col` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_eq_null_match/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_eq_null_match/out.sql index 90cbcfe5c7..57af99a52b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_eq_null_match/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_eq_null_match/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1` + `bool_col`, + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - COALESCE(CAST(`bfcol_1` AS STRING), '$NULL_SENTINEL$') = COALESCE(CAST(CAST(`bfcol_0` AS INT64) AS STRING), '$NULL_SENTINEL$') AS `bfcol_4` + COALESCE(CAST(`int64_col` AS STRING), '$NULL_SENTINEL$') = COALESCE(CAST(CAST(`bool_col` AS INT64) AS STRING), '$NULL_SENTINEL$') AS `bfcol_4` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_eq_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_eq_numeric/out.sql index 8e3c52310d..9c7c19e61c 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_eq_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_eq_numeric/out.sql @@ -1,16 +1,16 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` + `bool_col`, + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_1` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - `bfcol_1` = `bfcol_1` AS `bfcol_9` + `rowindex` AS `bfcol_6`, + `int64_col` AS `bfcol_7`, + `bool_col` AS `bfcol_8`, + `int64_col` = `int64_col` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_ge_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_ge_numeric/out.sql index 494cb861a7..e99fe49c8e 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_ge_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_ge_numeric/out.sql @@ -1,16 +1,16 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` + `bool_col`, + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_1` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - `bfcol_1` >= `bfcol_1` AS `bfcol_9` + `rowindex` AS `bfcol_6`, + `int64_col` AS `bfcol_7`, + `bool_col` AS `bfcol_8`, + `int64_col` >= `int64_col` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_gt_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_gt_numeric/out.sql index b0c8768850..4e5aba3d31 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_gt_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_gt_numeric/out.sql @@ -1,16 +1,16 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` + `bool_col`, + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_1` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - `bfcol_1` > `bfcol_1` AS `bfcol_9` + `rowindex` AS `bfcol_6`, + `int64_col` AS `bfcol_7`, + `bool_col` AS `bfcol_8`, + `int64_col` > `int64_col` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT 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 7a1a2a743d..197ed279fa 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,23 +1,23 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `float64_col` AS `bfcol_1` + `float64_col`, + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - COALESCE(`bfcol_0` IN (1, 2, 3), FALSE) AS `bfcol_2`, + COALESCE(`int64_col` IN (1, 2, 3), FALSE) AS `bfcol_2`, ( - `bfcol_0` IS NULL - ) OR `bfcol_0` IN (123456) AS `bfcol_3`, - COALESCE(`bfcol_0` IN (1.0, 2.0, 3.0), FALSE) AS `bfcol_4`, + `int64_col` IS NULL + ) OR `int64_col` IN (123456) AS `bfcol_3`, + COALESCE(`int64_col` IN (1.0, 2.0, 3.0), FALSE) AS `bfcol_4`, FALSE AS `bfcol_5`, - COALESCE(`bfcol_0` IN (2.5, 3), FALSE) AS `bfcol_6`, + COALESCE(`int64_col` IN (2.5, 3), FALSE) AS `bfcol_6`, FALSE AS `bfcol_7`, - COALESCE(`bfcol_0` IN (123456), FALSE) AS `bfcol_8`, + COALESCE(`int64_col` IN (123456), FALSE) AS `bfcol_8`, ( - `bfcol_1` IS NULL - ) OR `bfcol_1` IN (1, 2, 3) AS `bfcol_9` + `float64_col` IS NULL + ) OR `float64_col` IN (1, 2, 3) AS `bfcol_9` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_le_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_le_numeric/out.sql index 2f642d8cbb..97a00d1c88 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_le_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_le_numeric/out.sql @@ -1,16 +1,16 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` + `bool_col`, + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_1` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - `bfcol_1` <= `bfcol_1` AS `bfcol_9` + `rowindex` AS `bfcol_6`, + `int64_col` AS `bfcol_7`, + `bool_col` AS `bfcol_8`, + `int64_col` <= `int64_col` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_lt_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_lt_numeric/out.sql index b244e3cbcc..addebd3187 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_lt_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_lt_numeric/out.sql @@ -1,16 +1,16 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` + `bool_col`, + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_1` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - `bfcol_1` < `bfcol_1` AS `bfcol_9` + `rowindex` AS `bfcol_6`, + `int64_col` AS `bfcol_7`, + `bool_col` AS `bfcol_8`, + `int64_col` < `int64_col` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` 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 c0c0f5c97f..bbef212707 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,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `float64_col` AS `bfcol_1` + `float64_col`, + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - GREATEST(`bfcol_0`, `bfcol_1`) AS `bfcol_2` + GREATEST(`int64_col`, `float64_col`) AS `bfcol_2` FROM `bfcte_0` ) 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 429c3d2861..1f00f5892e 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,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `float64_col` AS `bfcol_1` + `float64_col`, + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - LEAST(`bfcol_0`, `bfcol_1`) AS `bfcol_2` + LEAST(`int64_col`, `float64_col`) AS `bfcol_2` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_ne_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_ne_numeric/out.sql index 6fba4b960f..417d24aa72 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_ne_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_ne_numeric/out.sql @@ -1,16 +1,16 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` + `bool_col`, + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_1` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - `bfcol_1` <> `bfcol_1` AS `bfcol_9` + `rowindex` AS `bfcol_6`, + `int64_col` AS `bfcol_7`, + `bool_col` AS `bfcol_8`, + `int64_col` <> `int64_col` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_add_timedelta/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_add_timedelta/out.sql index a47531999b..2fef18eeb8 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_add_timedelta/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_add_timedelta/out.sql @@ -1,16 +1,16 @@ WITH `bfcte_0` AS ( SELECT - `date_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1`, - `timestamp_col` AS `bfcol_2` + `date_col`, + `rowindex`, + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_6`, - `bfcol_2` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - TIMESTAMP_ADD(CAST(`bfcol_0` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `bfcol_9` + `rowindex` AS `bfcol_6`, + `timestamp_col` AS `bfcol_7`, + `date_col` AS `bfcol_8`, + TIMESTAMP_ADD(CAST(`date_col` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_date/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_date/out.sql index 615a4a92bb..b8f46ceafe 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_date/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_date/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - DATE(`bfcol_0`) AS `bfcol_1` + DATE(`timestamp_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_day/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_day/out.sql index 460823fa20..52d80fd2a6 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_day/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_day/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(DAY FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(DAY FROM `timestamp_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_dayofweek/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_dayofweek/out.sql index 55d3832c1f..0119bbb4e9 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_dayofweek/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_dayofweek/out.sql @@ -1,15 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `date_col` AS `bfcol_0`, - `datetime_col` AS `bfcol_1`, - `timestamp_col` AS `bfcol_2` + `date_col`, + `datetime_col`, + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CAST(MOD(EXTRACT(DAYOFWEEK FROM `bfcol_1`) + 5, 7) AS INT64) AS `bfcol_6`, - CAST(MOD(EXTRACT(DAYOFWEEK FROM `bfcol_2`) + 5, 7) AS INT64) AS `bfcol_7`, - CAST(MOD(EXTRACT(DAYOFWEEK FROM `bfcol_0`) + 5, 7) AS INT64) AS `bfcol_8` + CAST(MOD(EXTRACT(DAYOFWEEK FROM `datetime_col`) + 5, 7) AS INT64) AS `bfcol_6`, + CAST(MOD(EXTRACT(DAYOFWEEK FROM `timestamp_col`) + 5, 7) AS INT64) AS `bfcol_7`, + CAST(MOD(EXTRACT(DAYOFWEEK FROM `date_col`) + 5, 7) AS INT64) AS `bfcol_8` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_dayofyear/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_dayofyear/out.sql index 4b60bcc4ca..521419757a 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_dayofyear/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_dayofyear/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(DAYOFYEAR FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(DAYOFYEAR FROM `timestamp_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_floor_dt/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_floor_dt/out.sql index a8877f8cfa..fe76efb609 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_floor_dt/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_floor_dt/out.sql @@ -1,23 +1,23 @@ WITH `bfcte_0` AS ( SELECT - `datetime_col` AS `bfcol_0`, - `timestamp_col` AS `bfcol_1` + `datetime_col`, + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - TIMESTAMP_TRUNC(`bfcol_1`, MICROSECOND) AS `bfcol_2`, - TIMESTAMP_TRUNC(`bfcol_1`, MILLISECOND) AS `bfcol_3`, - TIMESTAMP_TRUNC(`bfcol_1`, SECOND) AS `bfcol_4`, - TIMESTAMP_TRUNC(`bfcol_1`, MINUTE) AS `bfcol_5`, - TIMESTAMP_TRUNC(`bfcol_1`, HOUR) AS `bfcol_6`, - TIMESTAMP_TRUNC(`bfcol_1`, DAY) AS `bfcol_7`, - TIMESTAMP_TRUNC(`bfcol_1`, WEEK(MONDAY)) AS `bfcol_8`, - TIMESTAMP_TRUNC(`bfcol_1`, MONTH) AS `bfcol_9`, - TIMESTAMP_TRUNC(`bfcol_1`, QUARTER) AS `bfcol_10`, - TIMESTAMP_TRUNC(`bfcol_1`, YEAR) AS `bfcol_11`, - TIMESTAMP_TRUNC(`bfcol_0`, MICROSECOND) AS `bfcol_12`, - TIMESTAMP_TRUNC(`bfcol_0`, MICROSECOND) AS `bfcol_13` + TIMESTAMP_TRUNC(`timestamp_col`, MICROSECOND) AS `bfcol_2`, + TIMESTAMP_TRUNC(`timestamp_col`, MILLISECOND) AS `bfcol_3`, + TIMESTAMP_TRUNC(`timestamp_col`, SECOND) AS `bfcol_4`, + TIMESTAMP_TRUNC(`timestamp_col`, MINUTE) AS `bfcol_5`, + TIMESTAMP_TRUNC(`timestamp_col`, HOUR) AS `bfcol_6`, + TIMESTAMP_TRUNC(`timestamp_col`, DAY) AS `bfcol_7`, + TIMESTAMP_TRUNC(`timestamp_col`, WEEK(MONDAY)) AS `bfcol_8`, + TIMESTAMP_TRUNC(`timestamp_col`, MONTH) AS `bfcol_9`, + TIMESTAMP_TRUNC(`timestamp_col`, QUARTER) AS `bfcol_10`, + TIMESTAMP_TRUNC(`timestamp_col`, YEAR) AS `bfcol_11`, + TIMESTAMP_TRUNC(`datetime_col`, MICROSECOND) AS `bfcol_12`, + TIMESTAMP_TRUNC(`datetime_col`, MICROSECOND) AS `bfcol_13` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_hour/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_hour/out.sql index 8cc9b9081f..5fc6621a7c 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_hour/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_hour/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(HOUR FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(HOUR FROM `timestamp_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_iso_day/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_iso_day/out.sql index f7203fc930..9422844b34 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_iso_day/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_iso_day/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CAST(MOD(EXTRACT(DAYOFWEEK FROM `bfcol_0`) + 5, 7) AS INT64) + 1 AS `bfcol_1` + CAST(MOD(EXTRACT(DAYOFWEEK FROM `timestamp_col`) + 5, 7) AS INT64) + 1 AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_iso_week/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_iso_week/out.sql index f22e963bc3..4db49fb10f 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_iso_week/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_iso_week/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(ISOWEEK FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(ISOWEEK FROM `timestamp_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_iso_year/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_iso_year/out.sql index 13b56f709c..8d49933202 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_iso_year/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_iso_year/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(ISOYEAR FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(ISOYEAR FROM `timestamp_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_minute/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_minute/out.sql index 4ef9b8142f..e089a77af5 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_minute/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_minute/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(MINUTE FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(MINUTE FROM `timestamp_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_month/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_month/out.sql index 4912622898..53d135903b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_month/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_month/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(MONTH FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(MONTH FROM `timestamp_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_normalize/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_normalize/out.sql index 3c7efd3098..b542dfea72 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_normalize/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_normalize/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - TIMESTAMP_TRUNC(`bfcol_0`, DAY) AS `bfcol_1` + TIMESTAMP_TRUNC(`timestamp_col`, DAY) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_quarter/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_quarter/out.sql index 2be2866661..4a232cb5a3 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_quarter/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_quarter/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(QUARTER FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(QUARTER FROM `timestamp_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_second/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_second/out.sql index 144b704788..e86d830b73 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_second/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_second/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(SECOND FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(SECOND FROM `timestamp_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_strftime/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_strftime/out.sql index 077c30e7cb..190cd7895b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_strftime/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_strftime/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - FORMAT_TIMESTAMP('%Y-%m-%d', `bfcol_0`) AS `bfcol_1` + FORMAT_TIMESTAMP('%Y-%m-%d', `timestamp_col`) AS `bfcol_1` FROM `bfcte_0` ) 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 2d615fcca6..ebcffd67f6 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,17 +1,17 @@ WITH `bfcte_0` AS ( SELECT - `date_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1`, - `timestamp_col` AS `bfcol_2`, - `duration_col` AS `bfcol_3` + `date_col`, + `duration_col`, + `rowindex`, + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_8`, - `bfcol_2` AS `bfcol_9`, - `bfcol_0` AS `bfcol_10`, - `bfcol_3` AS `bfcol_11` + `rowindex` AS `bfcol_8`, + `timestamp_col` AS `bfcol_9`, + `date_col` AS `bfcol_10`, + `duration_col` AS `bfcol_11` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_time/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_time/out.sql index 6b74efafd5..5a8ab600ba 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_time/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_time/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - TIME(`bfcol_0`) AS `bfcol_1` + TIME(`timestamp_col`) AS `bfcol_1` FROM `bfcte_0` ) 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 096f14cc85..bbba3b1533 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,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CAST(TIMESTAMP_SECONDS(`bfcol_0`) AS DATETIME) AS `bfcol_1` + CAST(TIMESTAMP_SECONDS(`int64_col`) AS DATETIME) AS `bfcol_1` FROM `bfcte_0` ) SELECT 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 b1e66ce3e7..df01fb3269 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,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - TIMESTAMP_SECONDS(`bfcol_0`) AS `bfcol_1` + TIMESTAMP_SECONDS(`int64_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_unix_micros/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_unix_micros/out.sql index dcbf0be5c2..e6515017f2 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_unix_micros/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_unix_micros/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - UNIX_MICROS(`bfcol_0`) AS `bfcol_1` + UNIX_MICROS(`timestamp_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_unix_millis/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_unix_millis/out.sql index ca58fbc97c..caec5effe0 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_unix_millis/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_unix_millis/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - UNIX_MILLIS(`bfcol_0`) AS `bfcol_1` + UNIX_MILLIS(`timestamp_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_unix_seconds/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_unix_seconds/out.sql index 21f0b7b8c8..6dc0ea2a02 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_unix_seconds/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_unix_seconds/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - UNIX_SECONDS(`bfcol_0`) AS `bfcol_1` + UNIX_SECONDS(`timestamp_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_year/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_year/out.sql index 8352a65e9e..1ceb674137 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_year/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_year/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(YEAR FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(YEAR FROM `timestamp_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_bool/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_bool/out.sql index 440aea9161..1f90accd0b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_bool/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_bool/out.sql @@ -1,14 +1,14 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `float64_col` AS `bfcol_1` + `bool_col`, + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_0` AS `bfcol_2`, - `bfcol_1` <> 0 AS `bfcol_3`, - `bfcol_1` <> 0 AS `bfcol_4` + `bool_col` AS `bfcol_2`, + `float64_col` <> 0 AS `bfcol_3`, + `float64_col` <> 0 AS `bfcol_4` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_float/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_float/out.sql index 81a8805f47..32c8da56fa 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_float/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_float/out.sql @@ -1,13 +1,13 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0` + `bool_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CAST(CAST(`bfcol_0` AS INT64) AS FLOAT64) AS `bfcol_1`, + CAST(CAST(`bool_col` AS INT64) AS FLOAT64) AS `bfcol_1`, CAST('1.34235e4' AS FLOAT64) AS `bfcol_2`, - SAFE_CAST(SAFE_CAST(`bfcol_0` AS INT64) AS FLOAT64) AS `bfcol_3` + SAFE_CAST(SAFE_CAST(`bool_col` AS INT64) AS FLOAT64) AS `bfcol_3` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_from_json/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_from_json/out.sql index 25d51b26b3..d1577c0664 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_from_json/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_from_json/out.sql @@ -1,15 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `json_col` AS `bfcol_0` + `json_col` FROM `bigframes-dev`.`sqlglot_test`.`json_types` ), `bfcte_1` AS ( SELECT *, - INT64(`bfcol_0`) AS `bfcol_1`, - FLOAT64(`bfcol_0`) AS `bfcol_2`, - BOOL(`bfcol_0`) AS `bfcol_3`, - STRING(`bfcol_0`) AS `bfcol_4`, - SAFE.INT64(`bfcol_0`) AS `bfcol_5` + INT64(`json_col`) AS `bfcol_1`, + FLOAT64(`json_col`) AS `bfcol_2`, + BOOL(`json_col`) AS `bfcol_3`, + STRING(`json_col`) AS `bfcol_4`, + SAFE.INT64(`json_col`) AS `bfcol_5` FROM `bfcte_0` ) 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 22aa2cf91a..e0fe2af9a9 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,22 +1,22 @@ WITH `bfcte_0` AS ( SELECT - `datetime_col` AS `bfcol_0`, - `numeric_col` AS `bfcol_1`, - `float64_col` AS `bfcol_2`, - `time_col` AS `bfcol_3`, - `timestamp_col` AS `bfcol_4` + `datetime_col`, + `float64_col`, + `numeric_col`, + `time_col`, + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - UNIX_MICROS(CAST(`bfcol_0` AS TIMESTAMP)) AS `bfcol_5`, - UNIX_MICROS(SAFE_CAST(`bfcol_0` AS TIMESTAMP)) AS `bfcol_6`, - TIME_DIFF(CAST(`bfcol_3` AS TIME), '00:00:00', MICROSECOND) AS `bfcol_7`, - TIME_DIFF(SAFE_CAST(`bfcol_3` AS TIME), '00:00:00', MICROSECOND) AS `bfcol_8`, - UNIX_MICROS(`bfcol_4`) AS `bfcol_9`, - CAST(TRUNC(`bfcol_1`) AS INT64) AS `bfcol_10`, - CAST(TRUNC(`bfcol_2`) AS INT64) AS `bfcol_11`, - SAFE_CAST(TRUNC(`bfcol_2`) AS INT64) AS `bfcol_12`, + UNIX_MICROS(CAST(`datetime_col` AS TIMESTAMP)) AS `bfcol_5`, + UNIX_MICROS(SAFE_CAST(`datetime_col` AS TIMESTAMP)) AS `bfcol_6`, + TIME_DIFF(CAST(`time_col` AS TIME), '00:00:00', MICROSECOND) AS `bfcol_7`, + TIME_DIFF(SAFE_CAST(`time_col` AS TIME), '00:00:00', MICROSECOND) AS `bfcol_8`, + UNIX_MICROS(`timestamp_col`) AS `bfcol_9`, + CAST(TRUNC(`numeric_col`) AS INT64) AS `bfcol_10`, + CAST(TRUNC(`float64_col`) AS INT64) AS `bfcol_11`, + SAFE_CAST(TRUNC(`float64_col`) AS INT64) AS `bfcol_12`, CAST('100' AS INT64) AS `bfcol_13` FROM `bfcte_0` ) 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 8230b4a60b..2defc2e72b 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,19 +1,19 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `float64_col` AS `bfcol_2`, - `string_col` AS `bfcol_3` + `bool_col`, + `float64_col`, + `int64_col`, + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - PARSE_JSON(CAST(`bfcol_1` AS STRING)) AS `bfcol_4`, - PARSE_JSON(CAST(`bfcol_2` AS STRING)) AS `bfcol_5`, - PARSE_JSON(CAST(`bfcol_0` AS STRING)) AS `bfcol_6`, - PARSE_JSON(`bfcol_3`) AS `bfcol_7`, - PARSE_JSON(CAST(`bfcol_0` AS STRING)) AS `bfcol_8`, - PARSE_JSON_IN_SAFE(`bfcol_3`) AS `bfcol_9` + PARSE_JSON(CAST(`int64_col` AS STRING)) AS `bfcol_4`, + PARSE_JSON(CAST(`float64_col` AS STRING)) AS `bfcol_5`, + PARSE_JSON(CAST(`bool_col` AS STRING)) AS `bfcol_6`, + PARSE_JSON(`string_col`) AS `bfcol_7`, + PARSE_JSON(CAST(`bool_col` AS STRING)) AS `bfcol_8`, + PARSE_JSON_IN_SAFE(`string_col`) AS `bfcol_9` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_string/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_string/out.sql index f230a3799e..da6eb6ce18 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_string/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_string/out.sql @@ -1,14 +1,14 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1` + `bool_col`, + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CAST(`bfcol_1` AS STRING) AS `bfcol_2`, - INITCAP(CAST(`bfcol_0` AS STRING)) AS `bfcol_3`, - INITCAP(SAFE_CAST(`bfcol_0` AS STRING)) AS `bfcol_4` + CAST(`int64_col` AS STRING) AS `bfcol_2`, + INITCAP(CAST(`bool_col` AS STRING)) AS `bfcol_3`, + INITCAP(SAFE_CAST(`bool_col` AS STRING)) AS `bfcol_4` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_time_like/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_time_like/out.sql index 141b7ffa9a..6523d8376c 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_time_like/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_time_like/out.sql @@ -1,14 +1,14 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CAST(TIMESTAMP_MICROS(`bfcol_0`) AS DATETIME) AS `bfcol_1`, - CAST(TIMESTAMP_MICROS(`bfcol_0`) AS TIME) AS `bfcol_2`, - CAST(TIMESTAMP_MICROS(`bfcol_0`) AS TIMESTAMP) AS `bfcol_3`, - SAFE_CAST(TIMESTAMP_MICROS(`bfcol_0`) AS TIME) AS `bfcol_4` + CAST(TIMESTAMP_MICROS(`int64_col`) AS DATETIME) AS `bfcol_1`, + CAST(TIMESTAMP_MICROS(`int64_col`) AS TIME) AS `bfcol_2`, + CAST(TIMESTAMP_MICROS(`int64_col`) AS TIMESTAMP) AS `bfcol_3`, + SAFE_CAST(TIMESTAMP_MICROS(`int64_col`) AS TIME) AS `bfcol_4` FROM `bfcte_0` ) 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 08db34a632..08a489e240 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,23 +1,23 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `int64_too` AS `bfcol_2`, - `float64_col` AS `bfcol_3` + `bool_col`, + `float64_col`, + `int64_col`, + `int64_too` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` THEN `bfcol_1` END AS `bfcol_4`, - CASE WHEN `bfcol_0` THEN `bfcol_1` WHEN `bfcol_0` THEN `bfcol_2` END AS `bfcol_5`, - CASE WHEN `bfcol_0` THEN `bfcol_0` WHEN `bfcol_0` THEN `bfcol_0` END AS `bfcol_6`, + CASE WHEN `bool_col` THEN `int64_col` END AS `bfcol_4`, + CASE WHEN `bool_col` THEN `int64_col` WHEN `bool_col` THEN `int64_too` END AS `bfcol_5`, + CASE WHEN `bool_col` THEN `bool_col` WHEN `bool_col` THEN `bool_col` END AS `bfcol_6`, CASE - WHEN `bfcol_0` - THEN `bfcol_1` - WHEN `bfcol_0` - THEN CAST(`bfcol_0` AS INT64) - WHEN `bfcol_0` - THEN `bfcol_3` + WHEN `bool_col` + THEN `int64_col` + WHEN `bool_col` + THEN CAST(`bool_col` AS INT64) + WHEN `bool_col` + THEN `float64_col` END AS `bfcol_7` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_clip/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_clip/out.sql index 172e1f53e7..b162593147 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_clip/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_clip/out.sql @@ -1,13 +1,13 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `int64_too` AS `bfcol_1`, - `rowindex` AS `bfcol_2` + `int64_col`, + `int64_too`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - GREATEST(LEAST(`bfcol_2`, `bfcol_1`), `bfcol_0`) AS `bfcol_3` + GREATEST(LEAST(`rowindex`, `int64_too`), `int64_col`) AS `bfcol_3` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_coalesce/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_coalesce/out.sql index 5b11a1ddeb..451de48b64 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_coalesce/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_coalesce/out.sql @@ -1,13 +1,13 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `int64_too` AS `bfcol_1` + `int64_col`, + `int64_too` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_0` AS `bfcol_2`, - COALESCE(`bfcol_1`, `bfcol_0`) AS `bfcol_3` + `int64_col` AS `bfcol_2`, + COALESCE(`int64_too`, `int64_col`) AS `bfcol_3` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_hash/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_hash/out.sql index 14d6df6d22..19fce60091 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_hash/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_hash/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - FARM_FINGERPRINT(`bfcol_0`) AS `bfcol_1` + FARM_FINGERPRINT(`string_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_invert/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_invert/out.sql index bf005efb05..1bd2eb7426 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_invert/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_invert/out.sql @@ -1,20 +1,20 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `bytes_col` AS `bfcol_1`, - `int64_col` AS `bfcol_2` + `bool_col`, + `bytes_col`, + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, ~( - `bfcol_2` + `int64_col` ) AS `bfcol_6`, ~( - `bfcol_1` + `bytes_col` ) AS `bfcol_7`, NOT ( - `bfcol_0` + `bool_col` ) AS `bfcol_8` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_isnull/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_isnull/out.sql index 55a2ebb970..0a549bdd44 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_isnull/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_isnull/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_0` IS NULL AS `bfcol_1` + `float64_col` IS NULL AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_map/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_map/out.sql index a17d6584ce..52a3174cf9 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_map/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_map/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE `bfcol_0` WHEN 'value1' THEN 'mapped1' END AS `bfcol_1` + CASE `string_col` WHEN 'value1' THEN 'mapped1' END AS `bfcol_1` FROM `bfcte_0` ) 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 c1961f9d62..bf3425fe6d 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 @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - NOT `bfcol_0` IS NULL AS `bfcol_1` + NOT `float64_col` IS NULL AS `bfcol_1` FROM `bfcte_0` ) 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 080e35f68e..13b27c2e14 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,20 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `bytes_col` AS `bfcol_1`, - `date_col` AS `bfcol_2`, - `datetime_col` AS `bfcol_3`, - `geography_col` AS `bfcol_4`, - `int64_col` AS `bfcol_5`, - `int64_too` AS `bfcol_6`, - `numeric_col` AS `bfcol_7`, - `float64_col` AS `bfcol_8`, - `rowindex` AS `bfcol_9`, - `rowindex_2` AS `bfcol_10`, - `string_col` AS `bfcol_11`, - `time_col` AS `bfcol_12`, - `timestamp_col` AS `bfcol_13`, - `duration_col` AS `bfcol_14` + `bool_col`, + `bytes_col`, + `date_col`, + `datetime_col`, + `duration_col`, + `float64_col`, + `geography_col`, + `int64_col`, + `int64_too`, + `numeric_col`, + `rowindex`, + `rowindex_2`, + `string_col`, + `time_col`, + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT @@ -22,42 +22,42 @@ WITH `bfcte_0` AS ( CONCAT( CAST(FARM_FINGERPRINT( CONCAT( - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_9` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_0` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_1` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_2` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_3` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(ST_ASTEXT(`bfcol_4`), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_5` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_6` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_7` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_8` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_9` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_10` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(`bfcol_11`, ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_12` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_13` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_14` AS STRING), ''), '\\', '\\\\')) + CONCAT('\\', REPLACE(COALESCE(CAST(`rowindex` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`bool_col` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`bytes_col` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`date_col` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`datetime_col` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(ST_ASTEXT(`geography_col`), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`int64_col` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`int64_too` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`numeric_col` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`float64_col` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`rowindex` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`rowindex_2` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(`string_col`, ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`time_col` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`timestamp_col` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`duration_col` AS STRING), ''), '\\', '\\\\')) ) ) AS STRING), CAST(FARM_FINGERPRINT( CONCAT( - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_9` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_0` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_1` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_2` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_3` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(ST_ASTEXT(`bfcol_4`), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_5` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_6` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_7` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_8` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_9` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_10` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(`bfcol_11`, ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_12` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_13` AS STRING), ''), '\\', '\\\\')), - CONCAT('\\', REPLACE(COALESCE(CAST(`bfcol_14` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`rowindex` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`bool_col` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`bytes_col` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`date_col` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`datetime_col` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(ST_ASTEXT(`geography_col`), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`int64_col` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`int64_too` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`numeric_col` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`float64_col` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`rowindex` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`rowindex_2` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(`string_col`, ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`time_col` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`timestamp_col` AS STRING), ''), '\\', '\\\\')), + CONCAT('\\', REPLACE(COALESCE(CAST(`duration_col` AS STRING), ''), '\\', '\\\\')), '_' ) ) AS STRING), diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_sql_scalar_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_sql_scalar_op/out.sql index a79e006885..611cbf4e7e 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_sql_scalar_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_sql_scalar_op/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `bytes_col` AS `bfcol_1` + `bool_col`, + `bytes_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CAST(`bfcol_0` AS INT64) + BYTE_LENGTH(`bfcol_1`) AS `bfcol_2` + CAST(`bool_col` AS INT64) + BYTE_LENGTH(`bytes_col`) AS `bfcol_2` FROM `bfcte_0` ) 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 678208e9ba..872c794333 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,13 +1,13 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `float64_col` AS `bfcol_2` + `bool_col`, + `float64_col`, + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - IF(`bfcol_0`, `bfcol_1`, `bfcol_2`) AS `bfcol_3` + IF(`bool_col`, `int64_col`, `float64_col`) AS `bfcol_3` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_area/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_area/out.sql index 9b4b6894e0..105b5f1665 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_area/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_area/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` + `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ST_AREA(`bfcol_0`) AS `bfcol_1` + ST_AREA(`geography_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_astext/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_astext/out.sql index 9557e2f1d6..c338baeb5f 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_astext/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_astext/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` + `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ST_ASTEXT(`bfcol_0`) AS `bfcol_1` + ST_ASTEXT(`geography_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_boundary/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_boundary/out.sql index 31c0b45034..2d4ac2e960 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_boundary/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_boundary/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` + `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ST_BOUNDARY(`bfcol_0`) AS `bfcol_1` + ST_BOUNDARY(`geography_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_buffer/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_buffer/out.sql index 9669c39a9f..84b3ab1600 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_buffer/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_buffer/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` + `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ST_BUFFER(`bfcol_0`, 1.0, 8.0, FALSE) AS `bfcol_1` + ST_BUFFER(`geography_col`, 1.0, 8.0, FALSE) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_centroid/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_centroid/out.sql index 97867318ad..733f1e9495 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_centroid/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_centroid/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` + `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ST_CENTROID(`bfcol_0`) AS `bfcol_1` + ST_CENTROID(`geography_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_convexhull/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_convexhull/out.sql index 8bb5801173..11b3b7f691 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_convexhull/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_convexhull/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` + `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ST_CONVEXHULL(`bfcol_0`) AS `bfcol_1` + ST_CONVEXHULL(`geography_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_geogfromtext/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_geogfromtext/out.sql index ba4d9dd182..1bbb114349 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_geogfromtext/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_geogfromtext/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - SAFE.ST_GEOGFROMTEXT(`bfcol_0`) AS `bfcol_1` + SAFE.ST_GEOGFROMTEXT(`string_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_isclosed/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_isclosed/out.sql index d905e8470b..516f175c13 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_isclosed/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_isclosed/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` + `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ST_ISCLOSED(`bfcol_0`) AS `bfcol_1` + ST_ISCLOSED(`geography_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_length/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_length/out.sql index a023691d63..80eef1c906 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_length/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_length/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` + `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ST_LENGTH(`bfcol_0`) AS `bfcol_1` + ST_LENGTH(`geography_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_x/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_x/out.sql index d4c0370ca8..09211270d1 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_x/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_x/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` + `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - SAFE.ST_X(`bfcol_0`) AS `bfcol_1` + SAFE.ST_X(`geography_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_y/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_y/out.sql index 196c2fcad6..625613ae2a 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_y/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_y/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` + `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - SAFE.ST_Y(`bfcol_0`) AS `bfcol_1` + SAFE.ST_Y(`geography_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_extract/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_extract/out.sql index 3d23bd1e3e..435ee96df1 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_extract/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_extract/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `json_col` AS `bfcol_0` + `json_col` FROM `bigframes-dev`.`sqlglot_test`.`json_types` ), `bfcte_1` AS ( SELECT *, - JSON_EXTRACT(`bfcol_0`, '$') AS `bfcol_1` + JSON_EXTRACT(`json_col`, '$') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_extract_array/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_extract_array/out.sql index 1ddb3999b3..6c9c02594d 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_extract_array/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_extract_array/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `json_col` AS `bfcol_0` + `json_col` FROM `bigframes-dev`.`sqlglot_test`.`json_types` ), `bfcte_1` AS ( SELECT *, - JSON_EXTRACT_ARRAY(`bfcol_0`, '$') AS `bfcol_1` + JSON_EXTRACT_ARRAY(`json_col`, '$') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_extract_string_array/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_extract_string_array/out.sql index cbc3df74c0..a3a51be378 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_extract_string_array/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_extract_string_array/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `json_col` AS `bfcol_0` + `json_col` FROM `bigframes-dev`.`sqlglot_test`.`json_types` ), `bfcte_1` AS ( SELECT *, - JSON_EXTRACT_STRING_ARRAY(`bfcol_0`, '$') AS `bfcol_1` + JSON_EXTRACT_STRING_ARRAY(`json_col`, '$') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_query/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_query/out.sql index b5d98b80d2..164fe2e426 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_query/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_query/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `json_col` AS `bfcol_0` + `json_col` FROM `bigframes-dev`.`sqlglot_test`.`json_types` ), `bfcte_1` AS ( SELECT *, - JSON_QUERY(`bfcol_0`, '$') AS `bfcol_1` + JSON_QUERY(`json_col`, '$') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_query_array/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_query_array/out.sql index 1b7a5908eb..4c3fa8e7e9 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_query_array/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_query_array/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `json_col` AS `bfcol_0` + `json_col` FROM `bigframes-dev`.`sqlglot_test`.`json_types` ), `bfcte_1` AS ( SELECT *, - JSON_QUERY_ARRAY(`bfcol_0`, '$') AS `bfcol_1` + JSON_QUERY_ARRAY(`json_col`, '$') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_set/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_set/out.sql index b226066b16..f41979ea2e 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_set/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_set/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `json_col` AS `bfcol_0` + `json_col` FROM `bigframes-dev`.`sqlglot_test`.`json_types` ), `bfcte_1` AS ( SELECT *, - JSON_SET(`bfcol_0`, '$.a', 100) AS `bfcol_1` + JSON_SET(`json_col`, '$.a', 100) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_value/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_value/out.sql index 3a84a1a92a..72f7237240 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_value/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_value/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `json_col` AS `bfcol_0` + `json_col` FROM `bigframes-dev`.`sqlglot_test`.`json_types` ), `bfcte_1` AS ( SELECT *, - JSON_VALUE(`bfcol_0`, '$') AS `bfcol_1` + JSON_VALUE(`json_col`, '$') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_parse_json/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_parse_json/out.sql index cdb091ae39..5f80187ba0 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_parse_json/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_parse_json/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - PARSE_JSON(`bfcol_0`) AS `bfcol_1` + PARSE_JSON(`string_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_to_json_string/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_to_json_string/out.sql index 2786973933..e282c89c80 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_to_json_string/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_to_json_string/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `json_col` AS `bfcol_0` + `json_col` FROM `bigframes-dev`.`sqlglot_test`.`json_types` ), `bfcte_1` AS ( SELECT *, - TO_JSON_STRING(`bfcol_0`) AS `bfcol_1` + TO_JSON_STRING(`json_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_abs/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_abs/out.sql index 6f315f8113..0fb9589387 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_abs/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_abs/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ABS(`bfcol_0`) AS `bfcol_1` + ABS(`float64_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_add_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_add_numeric/out.sql index 44335805e4..1707aad8c1 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_add_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_add_numeric/out.sql @@ -1,16 +1,16 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` + `bool_col`, + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_1` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - `bfcol_1` + `bfcol_1` AS `bfcol_9` + `rowindex` AS `bfcol_6`, + `int64_col` AS `bfcol_7`, + `bool_col` AS `bfcol_8`, + `int64_col` + `int64_col` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_add_string/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_add_string/out.sql index de5129a6a3..cb674787ff 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_add_string/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_add_string/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CONCAT(`bfcol_0`, 'a') AS `bfcol_1` + CONCAT(`string_col`, 'a') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_add_timedelta/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_add_timedelta/out.sql index a47531999b..2fef18eeb8 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_add_timedelta/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_add_timedelta/out.sql @@ -1,16 +1,16 @@ WITH `bfcte_0` AS ( SELECT - `date_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1`, - `timestamp_col` AS `bfcol_2` + `date_col`, + `rowindex`, + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_6`, - `bfcol_2` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - TIMESTAMP_ADD(CAST(`bfcol_0` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `bfcol_9` + `rowindex` AS `bfcol_6`, + `timestamp_col` AS `bfcol_7`, + `date_col` AS `bfcol_8`, + TIMESTAMP_ADD(CAST(`date_col` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arccos/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arccos/out.sql index df695b7fbc..bb1766adf3 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arccos/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arccos/out.sql @@ -1,11 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN ABS(`bfcol_0`) > 1 THEN CAST('NaN' AS FLOAT64) ELSE ACOS(`bfcol_0`) END AS `bfcol_1` + CASE + WHEN ABS(`float64_col`) > 1 + THEN CAST('NaN' AS FLOAT64) + ELSE ACOS(`float64_col`) + END AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arccosh/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arccosh/out.sql index 5272e4a6a8..af556b9c3a 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arccosh/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arccosh/out.sql @@ -1,11 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` < 1 THEN CAST('NaN' AS FLOAT64) ELSE ACOSH(`bfcol_0`) END AS `bfcol_1` + CASE + WHEN `float64_col` < 1 + THEN CAST('NaN' AS FLOAT64) + ELSE ACOSH(`float64_col`) + END AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arcsin/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arcsin/out.sql index 3afc7c64b8..8243232e0b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arcsin/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arcsin/out.sql @@ -1,11 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN ABS(`bfcol_0`) > 1 THEN CAST('NaN' AS FLOAT64) ELSE ASIN(`bfcol_0`) END AS `bfcol_1` + CASE + WHEN ABS(`float64_col`) > 1 + THEN CAST('NaN' AS FLOAT64) + ELSE ASIN(`float64_col`) + END AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arcsinh/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arcsinh/out.sql index 6313e80e5f..e6bf3b339c 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arcsinh/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arcsinh/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ASINH(`bfcol_0`) AS `bfcol_1` + ASINH(`float64_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctan/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctan/out.sql index ec6a22e653..a85ff6403c 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctan/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctan/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ATAN(`bfcol_0`) AS `bfcol_1` + ATAN(`float64_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctanh/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctanh/out.sql index 39b5f565fe..197bf59306 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctanh/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctanh/out.sql @@ -1,11 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN ABS(`bfcol_0`) > 1 THEN CAST('NaN' AS FLOAT64) ELSE ATANH(`bfcol_0`) END AS `bfcol_1` + CASE + WHEN ABS(`float64_col`) > 1 + THEN CAST('NaN' AS FLOAT64) + ELSE ATANH(`float64_col`) + END AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_ceil/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_ceil/out.sql index 0959f3a0ad..922fe5c550 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_ceil/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_ceil/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CEIL(`bfcol_0`) AS `bfcol_1` + CEIL(`float64_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_cos/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_cos/out.sql index 126d2a63f2..0acb2bfa94 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_cos/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_cos/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - COS(`bfcol_0`) AS `bfcol_1` + COS(`float64_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_cosh/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_cosh/out.sql index f44dfaac41..8c84a25047 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_cosh/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_cosh/out.sql @@ -1,14 +1,14 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, CASE - WHEN ABS(`bfcol_0`) > 709.78 + WHEN ABS(`float64_col`) > 709.78 THEN CAST('Infinity' AS FLOAT64) - ELSE COSH(`bfcol_0`) + ELSE COSH(`float64_col`) END AS `bfcol_1` FROM `bfcte_0` ) 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 03d48276a0..db11f1529f 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,18 +1,18 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `float64_col` AS `bfcol_2`, - `rowindex` AS `bfcol_3` + `bool_col`, + `float64_col`, + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_3` AS `bfcol_8`, - `bfcol_1` AS `bfcol_9`, - `bfcol_0` AS `bfcol_10`, - `bfcol_2` AS `bfcol_11`, - IEEE_DIVIDE(`bfcol_1`, `bfcol_1`) AS `bfcol_12` + `rowindex` AS `bfcol_8`, + `int64_col` AS `bfcol_9`, + `bool_col` AS `bfcol_10`, + `float64_col` AS `bfcol_11`, + IEEE_DIVIDE(`int64_col`, `int64_col`) AS `bfcol_12` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_div_timedelta/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_div_timedelta/out.sql index 6e05302fc9..1a82a67368 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_div_timedelta/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_div_timedelta/out.sql @@ -1,16 +1,16 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1`, - `timestamp_col` AS `bfcol_2` + `int64_col`, + `rowindex`, + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_6`, - `bfcol_2` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - CAST(FLOOR(IEEE_DIVIDE(86400000000, `bfcol_0`)) AS INT64) AS `bfcol_9` + `rowindex` AS `bfcol_6`, + `timestamp_col` AS `bfcol_7`, + `int64_col` AS `bfcol_8`, + CAST(FLOOR(IEEE_DIVIDE(86400000000, `int64_col`)) AS INT64) AS `bfcol_9` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_exp/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_exp/out.sql index 6afa3f85a5..610b96cda7 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_exp/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_exp/out.sql @@ -1,14 +1,14 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, CASE - WHEN `bfcol_0` > 709.78 + WHEN `float64_col` > 709.78 THEN CAST('Infinity' AS FLOAT64) - ELSE EXP(`bfcol_0`) + ELSE EXP(`float64_col`) END AS `bfcol_1` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_expm1/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_expm1/out.sql index f3768deb4a..076ad584c2 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_expm1/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_expm1/out.sql @@ -1,14 +1,14 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, CASE - WHEN `bfcol_0` > 709.78 + WHEN `float64_col` > 709.78 THEN CAST('Infinity' AS FLOAT64) - ELSE EXP(`bfcol_0`) + ELSE EXP(`float64_col`) END - 1 AS `bfcol_1` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_floor/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_floor/out.sql index 56be1019e5..e0c2e1072e 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_floor/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_floor/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - FLOOR(`bfcol_0`) AS `bfcol_1` + FLOOR(`float64_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_floordiv_timedelta/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_floordiv_timedelta/out.sql index bc4f94d306..2fe20fb618 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_floordiv_timedelta/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_floordiv_timedelta/out.sql @@ -1,8 +1,8 @@ WITH `bfcte_0` AS ( SELECT - `date_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1`, - `timestamp_col` AS `bfcol_2` + `date_col`, + `rowindex`, + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT @@ -11,8 +11,8 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - `bfcol_1` AS `rowindex`, - `bfcol_2` AS `timestamp_col`, - `bfcol_0` AS `date_col`, + `rowindex`, + `timestamp_col`, + `date_col`, `bfcol_6` AS `timedelta_div_numeric` FROM `bfcte_1` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_ln/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_ln/out.sql index 5d3d1ae09b..776cc33e0f 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_ln/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_ln/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` <= 0 THEN CAST('NaN' AS FLOAT64) ELSE LN(`bfcol_0`) END AS `bfcol_1` + CASE WHEN `float64_col` <= 0 THEN CAST('NaN' AS FLOAT64) ELSE LN(`float64_col`) END AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_log10/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_log10/out.sql index 532776278d..11a318c22d 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_log10/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_log10/out.sql @@ -1,11 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` <= 0 THEN CAST('NaN' AS FLOAT64) ELSE LOG(10, `bfcol_0`) END AS `bfcol_1` + CASE + WHEN `float64_col` <= 0 + THEN CAST('NaN' AS FLOAT64) + ELSE LOG(10, `float64_col`) + END AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_log1p/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_log1p/out.sql index 3904025cf8..4297fff227 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_log1p/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_log1p/out.sql @@ -1,11 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` <= -1 THEN CAST('NaN' AS FLOAT64) ELSE LN(1 + `bfcol_0`) END AS `bfcol_1` + CASE + WHEN `float64_col` <= -1 + THEN CAST('NaN' AS FLOAT64) + ELSE LN(1 + `float64_col`) + END AS `bfcol_1` FROM `bfcte_0` ) SELECT 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 64f456a72d..241ffa0b5e 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,33 +1,33 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `float64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` + `float64_col`, + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_0` AS `bfcol_7`, - `bfcol_1` AS `bfcol_8`, + `rowindex` AS `bfcol_6`, + `int64_col` AS `bfcol_7`, + `float64_col` AS `bfcol_8`, CASE - WHEN `bfcol_0` = CAST(0 AS INT64) - THEN CAST(0 AS INT64) * `bfcol_0` - WHEN `bfcol_0` < CAST(0 AS INT64) + WHEN `int64_col` = CAST(0 AS INT64) + THEN CAST(0 AS INT64) * `int64_col` + WHEN `int64_col` < CAST(0 AS INT64) AND ( - MOD(`bfcol_0`, `bfcol_0`) + MOD(`int64_col`, `int64_col`) ) > CAST(0 AS INT64) - THEN `bfcol_0` + ( - MOD(`bfcol_0`, `bfcol_0`) + THEN `int64_col` + ( + MOD(`int64_col`, `int64_col`) ) - WHEN `bfcol_0` > CAST(0 AS INT64) + WHEN `int64_col` > CAST(0 AS INT64) AND ( - MOD(`bfcol_0`, `bfcol_0`) + MOD(`int64_col`, `int64_col`) ) < CAST(0 AS INT64) - THEN `bfcol_0` + ( - MOD(`bfcol_0`, `bfcol_0`) + THEN `int64_col` + ( + MOD(`int64_col`, `int64_col`) ) - ELSE MOD(`bfcol_0`, `bfcol_0`) + ELSE MOD(`int64_col`, `int64_col`) END AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mul_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mul_numeric/out.sql index a9c81f4744..d0c537e482 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mul_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mul_numeric/out.sql @@ -1,16 +1,16 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` + `bool_col`, + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_1` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - `bfcol_1` * `bfcol_1` AS `bfcol_9` + `rowindex` AS `bfcol_6`, + `int64_col` AS `bfcol_7`, + `bool_col` AS `bfcol_8`, + `int64_col` * `int64_col` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT 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 f8752d0a60..ebdf296b2b 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,17 +1,17 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1`, - `timestamp_col` AS `bfcol_2`, - `duration_col` AS `bfcol_3` + `duration_col`, + `int64_col`, + `rowindex`, + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_8`, - `bfcol_2` AS `bfcol_9`, - `bfcol_0` AS `bfcol_10`, - `bfcol_3` AS `bfcol_11` + `rowindex` AS `bfcol_8`, + `timestamp_col` AS `bfcol_9`, + `int64_col` AS `bfcol_10`, + `duration_col` AS `bfcol_11` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_neg/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_neg/out.sql index 39bdd6da7f..4374af349b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_neg/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_neg/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, -( - `bfcol_0` + `float64_col` ) AS `bfcol_1` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pos/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pos/out.sql index 2d6322a182..1ed016029a 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pos/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pos/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_0` AS `bfcol_1` + `float64_col` AS `bfcol_1` FROM `bfcte_0` ) SELECT 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 8513c8d63f..9ce76f7c63 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,16 +1,16 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `float64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` + `float64_col`, + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_0` AS `bfcol_7`, - `bfcol_1` AS `bfcol_8`, - CAST(ROUND(`bfcol_0`, 0) AS INT64) AS `bfcol_9` + `rowindex` AS `bfcol_6`, + `int64_col` AS `bfcol_7`, + `float64_col` AS `bfcol_8`, + CAST(ROUND(`int64_col`, 0) AS INT64) AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sin/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sin/out.sql index 62a5cff0b5..1699b6d8df 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sin/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sin/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - SIN(`bfcol_0`) AS `bfcol_1` + SIN(`float64_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sinh/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sinh/out.sql index 711dba94a9..c1ea003e2d 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sinh/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sinh/out.sql @@ -1,14 +1,14 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, CASE - WHEN ABS(`bfcol_0`) > 709.78 - THEN SIGN(`bfcol_0`) * CAST('Infinity' AS FLOAT64) - ELSE SINH(`bfcol_0`) + WHEN ABS(`float64_col`) > 709.78 + THEN SIGN(`float64_col`) * CAST('Infinity' AS FLOAT64) + ELSE SINH(`float64_col`) END AS `bfcol_1` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sqrt/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sqrt/out.sql index e6a93e5e6c..152545d550 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sqrt/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sqrt/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` < 0 THEN CAST('NaN' AS FLOAT64) ELSE SQRT(`bfcol_0`) END AS `bfcol_1` + CASE WHEN `float64_col` < 0 THEN CAST('NaN' AS FLOAT64) ELSE SQRT(`float64_col`) END AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sub_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sub_numeric/out.sql index a43fa2df67..7e0f07af7b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sub_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sub_numeric/out.sql @@ -1,16 +1,16 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` + `bool_col`, + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_1` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - `bfcol_1` - `bfcol_1` AS `bfcol_9` + `rowindex` AS `bfcol_6`, + `int64_col` AS `bfcol_7`, + `bool_col` AS `bfcol_8`, + `int64_col` - `int64_col` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT 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 2d615fcca6..ebcffd67f6 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,17 +1,17 @@ WITH `bfcte_0` AS ( SELECT - `date_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1`, - `timestamp_col` AS `bfcol_2`, - `duration_col` AS `bfcol_3` + `date_col`, + `duration_col`, + `rowindex`, + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_8`, - `bfcol_2` AS `bfcol_9`, - `bfcol_0` AS `bfcol_10`, - `bfcol_3` AS `bfcol_11` + `rowindex` AS `bfcol_8`, + `timestamp_col` AS `bfcol_9`, + `date_col` AS `bfcol_10`, + `duration_col` AS `bfcol_11` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_tan/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_tan/out.sql index 5fac274b6b..f09d26a188 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_tan/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_tan/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - TAN(`bfcol_0`) AS `bfcol_1` + TAN(`float64_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_tanh/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_tanh/out.sql index 5d1a5a5320..a5e5a87fbc 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_tanh/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_tanh/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` + `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - TANH(`bfcol_0`) AS `bfcol_1` + TANH(`float64_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_add_string/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_add_string/out.sql index de5129a6a3..cb674787ff 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_add_string/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_add_string/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CONCAT(`bfcol_0`, 'a') AS `bfcol_1` + CONCAT(`string_col`, 'a') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_capitalize/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_capitalize/out.sql index 7af1708347..b429007ffc 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_capitalize/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_capitalize/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - INITCAP(`bfcol_0`) AS `bfcol_1` + INITCAP(`string_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_endswith/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_endswith/out.sql index e3ac5ec033..eeb2574094 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_endswith/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_endswith/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ENDS_WITH(`bfcol_0`, 'ab') AS `bfcol_1`, - ENDS_WITH(`bfcol_0`, 'ab') OR ENDS_WITH(`bfcol_0`, 'cd') AS `bfcol_2`, + ENDS_WITH(`string_col`, 'ab') AS `bfcol_1`, + ENDS_WITH(`string_col`, 'ab') OR ENDS_WITH(`string_col`, 'cd') AS `bfcol_2`, FALSE AS `bfcol_3` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isalnum/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isalnum/out.sql index 02e0094742..61c2643f16 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isalnum/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isalnum/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, '^(\\p{N}|\\p{L})+$') AS `bfcol_1` + REGEXP_CONTAINS(`string_col`, '^(\\p{N}|\\p{L})+$') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isalpha/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isalpha/out.sql index 2615d0452f..2b086f3e3d 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isalpha/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isalpha/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, '^\\p{L}+$') AS `bfcol_1` + REGEXP_CONTAINS(`string_col`, '^\\p{L}+$') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isdecimal/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isdecimal/out.sql index bc1fce3dbc..7355ab7aa7 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isdecimal/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isdecimal/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, '^\\d+$') AS `bfcol_1` + REGEXP_CONTAINS(`string_col`, '^\\d+$') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isdigit/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isdigit/out.sql index 1cb3a883ab..d7dd8c0729 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isdigit/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isdigit/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, '^\\p{Nd}+$') AS `bfcol_1` + REGEXP_CONTAINS(`string_col`, '^\\p{Nd}+$') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_islower/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_islower/out.sql index a621b71a3b..b6ff57797c 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_islower/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_islower/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - LOWER(`bfcol_0`) = `bfcol_0` AND UPPER(`bfcol_0`) <> `bfcol_0` AS `bfcol_1` + LOWER(`string_col`) = `string_col` AND UPPER(`string_col`) <> `string_col` AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isnumeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isnumeric/out.sql index 6566c1dd4c..6143b3685a 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isnumeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isnumeric/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, '^\\pN+$') AS `bfcol_1` + REGEXP_CONTAINS(`string_col`, '^\\pN+$') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isspace/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isspace/out.sql index aff12102be..47ccd642d4 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isspace/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isspace/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, '^\\s+$') AS `bfcol_1` + REGEXP_CONTAINS(`string_col`, '^\\s+$') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isupper/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isupper/out.sql index 03fe005910..54f7b55ce3 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isupper/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isupper/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - UPPER(`bfcol_0`) = `bfcol_0` AND LOWER(`bfcol_0`) <> `bfcol_0` AS `bfcol_1` + UPPER(`string_col`) = `string_col` AND LOWER(`string_col`) <> `string_col` AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_len/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_len/out.sql index 35fd087bc7..63e8e160bf 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_len/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_len/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - LENGTH(`bfcol_0`) AS `bfcol_1` + LENGTH(`string_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_lower/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_lower/out.sql index e730cdee15..0a9623162a 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_lower/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_lower/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - LOWER(`bfcol_0`) AS `bfcol_1` + LOWER(`string_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_lstrip/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_lstrip/out.sql index 49ed89b40b..ebe4c39bbf 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_lstrip/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_lstrip/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - TRIM(`bfcol_0`, ' ') AS `bfcol_1` + TRIM(`string_col`, ' ') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_regex_replace_str/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_regex_replace_str/out.sql index 149df6706c..2fd3365a80 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_regex_replace_str/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_regex_replace_str/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REGEXP_REPLACE(`bfcol_0`, 'e', 'a') AS `bfcol_1` + REGEXP_REPLACE(`string_col`, 'e', 'a') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_replace_str/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_replace_str/out.sql index 3bd7e0e47e..61b2e2f432 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_replace_str/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_replace_str/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REPLACE(`bfcol_0`, 'e', 'a') AS `bfcol_1` + REPLACE(`string_col`, 'e', 'a') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_reverse/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_reverse/out.sql index 1ef1074149..f9d287a591 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_reverse/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_reverse/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REVERSE(`bfcol_0`) AS `bfcol_1` + REVERSE(`string_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_rstrip/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_rstrip/out.sql index 49ed89b40b..ebe4c39bbf 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_rstrip/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_rstrip/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - TRIM(`bfcol_0`, ' ') AS `bfcol_1` + TRIM(`string_col`, ' ') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_startswith/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_startswith/out.sql index 9679c95f75..54c8adb7b8 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_startswith/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_startswith/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - STARTS_WITH(`bfcol_0`, 'ab') AS `bfcol_1`, - STARTS_WITH(`bfcol_0`, 'ab') OR STARTS_WITH(`bfcol_0`, 'cd') AS `bfcol_2`, + STARTS_WITH(`string_col`, 'ab') AS `bfcol_1`, + STARTS_WITH(`string_col`, 'ab') OR STARTS_WITH(`string_col`, 'cd') AS `bfcol_2`, FALSE AS `bfcol_3` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_contains/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_contains/out.sql index a1aa0539ee..e973a97136 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_contains/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_contains/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_0` LIKE '%e%' AS `bfcol_1` + `string_col` LIKE '%e%' AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_contains_regex/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_contains_regex/out.sql index d0383172cb..510e52e254 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_contains_regex/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_contains_regex/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, 'e') AS `bfcol_1` + REGEXP_CONTAINS(`string_col`, 'e') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_extract/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_extract/out.sql index a7fac093e2..3e59f617ac 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_extract/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_extract/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REGEXP_EXTRACT(`bfcol_0`, '([a-z]*)') AS `bfcol_1` + REGEXP_EXTRACT(`string_col`, '([a-z]*)') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_find/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_find/out.sql index b850262d80..82847d5e22 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_find/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_find/out.sql @@ -1,14 +1,14 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - INSTR(`bfcol_0`, 'e', 1) - 1 AS `bfcol_1`, - INSTR(`bfcol_0`, 'e', 3) - 1 AS `bfcol_2`, - INSTR(SUBSTRING(`bfcol_0`, 1, 5), 'e') - 1 AS `bfcol_3`, - INSTR(SUBSTRING(`bfcol_0`, 3, 3), 'e') - 1 AS `bfcol_4` + INSTR(`string_col`, 'e', 1) - 1 AS `bfcol_1`, + INSTR(`string_col`, 'e', 3) - 1 AS `bfcol_2`, + INSTR(SUBSTRING(`string_col`, 1, 5), 'e') - 1 AS `bfcol_3`, + INSTR(SUBSTRING(`string_col`, 3, 3), 'e') - 1 AS `bfcol_4` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_get/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_get/out.sql index 1278c3435d..b2a08e0e9d 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_get/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_get/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - SUBSTRING(`bfcol_0`, 2, 1) AS `bfcol_1` + SUBSTRING(`string_col`, 2, 1) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_pad/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_pad/out.sql index 4226843122..5f157bc5cb 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_pad/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_pad/out.sql @@ -1,19 +1,19 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - LPAD(`bfcol_0`, GREATEST(LENGTH(`bfcol_0`), 10), '-') AS `bfcol_1`, - RPAD(`bfcol_0`, GREATEST(LENGTH(`bfcol_0`), 10), '-') AS `bfcol_2`, + LPAD(`string_col`, GREATEST(LENGTH(`string_col`), 10), '-') AS `bfcol_1`, + RPAD(`string_col`, GREATEST(LENGTH(`string_col`), 10), '-') AS `bfcol_2`, RPAD( LPAD( - `bfcol_0`, - CAST(SAFE_DIVIDE(GREATEST(LENGTH(`bfcol_0`), 10) - LENGTH(`bfcol_0`), 2) AS INT64) + LENGTH(`bfcol_0`), + `string_col`, + CAST(SAFE_DIVIDE(GREATEST(LENGTH(`string_col`), 10) - LENGTH(`string_col`), 2) AS INT64) + LENGTH(`string_col`), '-' ), - GREATEST(LENGTH(`bfcol_0`), 10), + GREATEST(LENGTH(`string_col`), 10), '-' ) AS `bfcol_3` FROM `bfcte_0` diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_repeat/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_repeat/out.sql index 1c94cfafe2..90a52a40b1 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_repeat/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_repeat/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REPEAT(`bfcol_0`, 2) AS `bfcol_1` + REPEAT(`string_col`, 2) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_slice/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_slice/out.sql index 4f97ab3ac6..8bd2a5f7fe 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_slice/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_slice/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - SUBSTRING(`bfcol_0`, 2, 2) AS `bfcol_1` + SUBSTRING(`string_col`, 2, 2) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_strconcat/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_strconcat/out.sql index de5129a6a3..cb674787ff 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_strconcat/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_strconcat/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CONCAT(`bfcol_0`, 'a') AS `bfcol_1` + CONCAT(`string_col`, 'a') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_string_split/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_string_split/out.sql index fea0d6eaf1..37b15a0cf9 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_string_split/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_string_split/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - SPLIT(`bfcol_0`, ',') AS `bfcol_1` + SPLIT(`string_col`, ',') AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_strip/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_strip/out.sql index 311f2c1727..771bb9c49f 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_strip/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_strip/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - TRIM(' ', `bfcol_0`) AS `bfcol_1` + TRIM(' ', `string_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_upper/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_upper/out.sql index d22c8cff5a..aa14c5f05d 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_upper/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_upper/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - UPPER(`bfcol_0`) AS `bfcol_1` + UPPER(`string_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_zfill/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_zfill/out.sql index e5d70ab44b..97651ece49 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_zfill/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_zfill/out.sql @@ -1,14 +1,14 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, CASE - WHEN SUBSTRING(`bfcol_0`, 1, 1) = '-' - THEN CONCAT('-', LPAD(SUBSTRING(`bfcol_0`, 1), 9, '0')) - ELSE LPAD(`bfcol_0`, 10, '0') + WHEN SUBSTRING(`string_col`, 1, 1) = '-' + THEN CONCAT('-', LPAD(SUBSTRING(`string_col`, 1), 9, '0')) + ELSE LPAD(`string_col`, 10, '0') END AS `bfcol_1` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_struct_ops/test_struct_field/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_struct_ops/test_struct_field/out.sql index 60ae78b755..b85e88a90a 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_struct_ops/test_struct_field/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_struct_ops/test_struct_field/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `people` AS `bfcol_0` + `people` FROM `bigframes-dev`.`sqlglot_test`.`nested_structs_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_0`.`name` AS `bfcol_1`, - `bfcol_0`.`name` AS `bfcol_2` + `people`.`name` AS `bfcol_1`, + `people`.`name` AS `bfcol_2` FROM `bfcte_0` ) 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 f7f741a523..575a162080 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,18 +1,18 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `float64_col` AS `bfcol_2`, - `string_col` AS `bfcol_3` + `bool_col`, + `float64_col`, + `int64_col`, + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, STRUCT( - `bfcol_0` AS bool_col, - `bfcol_1` AS int64_col, - `bfcol_2` AS float64_col, - `bfcol_3` AS string_col + `bool_col` AS bool_col, + `int64_col` AS int64_col, + `float64_col` AS float64_col, + `string_col` AS string_col ) AS `bfcol_4` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_timedelta_ops/test_timedelta_floor/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_timedelta_ops/test_timedelta_floor/out.sql index 1a8b9f4e39..432aefd7f6 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_timedelta_ops/test_timedelta_floor/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_timedelta_ops/test_timedelta_floor/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - FLOOR(`bfcol_0`) AS `bfcol_1` + FLOOR(`int64_col`) AS `bfcol_1` FROM `bfcte_0` ) SELECT 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 057e6c778e..3c75cc3e89 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,14 +1,14 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_4`, - `bfcol_0` AS `bfcol_5`, - `bfcol_0` AS `bfcol_6` + `rowindex` AS `bfcol_4`, + `int64_col` AS `bfcol_5`, + `int64_col` AS `bfcol_6` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_aggregate/test_compile_aggregate/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_aggregate/test_compile_aggregate/out.sql index 02bba41a22..949ed82574 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_aggregate/test_compile_aggregate/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_aggregate/test_compile_aggregate/out.sql @@ -1,13 +1,13 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_too` AS `bfcol_1` + `bool_col`, + `int64_too` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_2`, - `bfcol_0` AS `bfcol_3` + `int64_too` AS `bfcol_2`, + `bool_col` AS `bfcol_3` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_aggregate/test_compile_aggregate_wo_dropna/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_aggregate/test_compile_aggregate_wo_dropna/out.sql index b8e127eb77..3c09250858 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_aggregate/test_compile_aggregate_wo_dropna/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_aggregate/test_compile_aggregate_wo_dropna/out.sql @@ -1,13 +1,13 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_too` AS `bfcol_1` + `bool_col`, + `int64_too` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_2`, - `bfcol_0` AS `bfcol_3` + `int64_too` AS `bfcol_2`, + `bool_col` AS `bfcol_3` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat/out.sql index faff452761..f606de4ed3 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat/out.sql @@ -1,8 +1,8 @@ WITH `bfcte_1` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1`, - `string_col` AS `bfcol_2` + `int64_col`, + `rowindex`, + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT @@ -16,18 +16,18 @@ WITH `bfcte_1` AS ( FROM `bfcte_3` ), `bfcte_6` AS ( SELECT - `bfcol_1` AS `bfcol_9`, - `bfcol_1` AS `bfcol_10`, - `bfcol_0` AS `bfcol_11`, - `bfcol_2` AS `bfcol_12`, + `rowindex` AS `bfcol_9`, + `rowindex` AS `bfcol_10`, + `int64_col` AS `bfcol_11`, + `string_col` AS `bfcol_12`, `bfcol_8` AS `bfcol_13`, `bfcol_7` AS `bfcol_14` FROM `bfcte_5` ), `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_15`, - `rowindex` AS `bfcol_16`, - `string_col` AS `bfcol_17` + `int64_col`, + `rowindex`, + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT @@ -41,10 +41,10 @@ WITH `bfcte_1` AS ( FROM `bfcte_2` ), `bfcte_7` AS ( SELECT - `bfcol_16` AS `bfcol_24`, - `bfcol_16` AS `bfcol_25`, - `bfcol_15` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, + `rowindex` AS `bfcol_24`, + `rowindex` AS `bfcol_25`, + `int64_col` AS `bfcol_26`, + `string_col` AS `bfcol_27`, `bfcol_23` AS `bfcol_28`, `bfcol_22` AS `bfcol_29` FROM `bfcte_4` 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 90825afd20..a67d1943a2 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,106 +1,106 @@ -WITH `bfcte_3` AS ( +WITH `bfcte_2` AS ( SELECT - `int64_col` AS `bfcol_0`, - `float64_col` AS `bfcol_1` + `float64_col`, + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_7` AS ( +), `bfcte_6` AS ( SELECT *, - ROW_NUMBER() OVER (ORDER BY `bfcol_0` ASC NULLS LAST) AS `bfcol_4` - FROM `bfcte_3` -), `bfcte_11` AS ( + ROW_NUMBER() OVER (ORDER BY `int64_col` ASC NULLS LAST) AS `bfcol_4` + FROM `bfcte_2` +), `bfcte_10` AS ( SELECT *, 0 AS `bfcol_5` - FROM `bfcte_7` -), `bfcte_14` AS ( + FROM `bfcte_6` +), `bfcte_13` AS ( SELECT - `bfcol_1` AS `bfcol_6`, - `bfcol_0` AS `bfcol_7`, + `float64_col` AS `bfcol_6`, + `int64_col` AS `bfcol_7`, `bfcol_5` AS `bfcol_8`, `bfcol_4` AS `bfcol_9` - FROM `bfcte_11` -), `bfcte_2` AS ( + FROM `bfcte_10` +), `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_10`, - `int64_too` AS `bfcol_11`, - `float64_col` AS `bfcol_12` + `bool_col`, + `float64_col`, + `int64_too` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_6` AS ( +), `bfcte_4` AS ( SELECT * - FROM `bfcte_2` + FROM `bfcte_0` WHERE - `bfcol_10` -), `bfcte_10` AS ( + `bool_col` +), `bfcte_8` AS ( SELECT *, ROW_NUMBER() OVER () AS `bfcol_15` - FROM `bfcte_6` -), `bfcte_13` AS ( + FROM `bfcte_4` +), `bfcte_12` AS ( SELECT *, 1 AS `bfcol_16` - FROM `bfcte_10` -), `bfcte_15` AS ( + FROM `bfcte_8` +), `bfcte_14` AS ( SELECT - `bfcol_12` AS `bfcol_17`, - `bfcol_11` AS `bfcol_18`, + `float64_col` AS `bfcol_17`, + `int64_too` AS `bfcol_18`, `bfcol_16` AS `bfcol_19`, `bfcol_15` AS `bfcol_20` - FROM `bfcte_13` + FROM `bfcte_12` ), `bfcte_1` AS ( SELECT - `int64_col` AS `bfcol_21`, - `float64_col` AS `bfcol_22` + `float64_col`, + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_5` AS ( SELECT *, - ROW_NUMBER() OVER (ORDER BY `bfcol_21` ASC NULLS LAST) AS `bfcol_25` + ROW_NUMBER() OVER (ORDER BY `int64_col` ASC NULLS LAST) AS `bfcol_25` FROM `bfcte_1` ), `bfcte_9` AS ( SELECT *, 2 AS `bfcol_26` FROM `bfcte_5` -), `bfcte_16` AS ( +), `bfcte_15` AS ( SELECT - `bfcol_22` AS `bfcol_27`, - `bfcol_21` AS `bfcol_28`, + `float64_col` AS `bfcol_27`, + `int64_col` AS `bfcol_28`, `bfcol_26` AS `bfcol_29`, `bfcol_25` AS `bfcol_30` FROM `bfcte_9` ), `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_31`, - `int64_too` AS `bfcol_32`, - `float64_col` AS `bfcol_33` + `bool_col`, + `float64_col`, + `int64_too` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_4` AS ( +), `bfcte_3` AS ( SELECT * FROM `bfcte_0` WHERE - `bfcol_31` -), `bfcte_8` AS ( + `bool_col` +), `bfcte_7` AS ( SELECT *, ROW_NUMBER() OVER () AS `bfcol_36` - FROM `bfcte_4` -), `bfcte_12` AS ( + FROM `bfcte_3` +), `bfcte_11` AS ( SELECT *, 3 AS `bfcol_37` - FROM `bfcte_8` -), `bfcte_17` AS ( + FROM `bfcte_7` +), `bfcte_16` AS ( SELECT - `bfcol_33` AS `bfcol_38`, - `bfcol_32` AS `bfcol_39`, + `float64_col` AS `bfcol_38`, + `int64_too` AS `bfcol_39`, `bfcol_37` AS `bfcol_40`, `bfcol_36` AS `bfcol_41` - FROM `bfcte_12` -), `bfcte_18` AS ( + FROM `bfcte_11` +), `bfcte_17` AS ( SELECT * FROM ( @@ -109,34 +109,34 @@ WITH `bfcte_3` AS ( `bfcol_7` AS `bfcol_43`, `bfcol_8` AS `bfcol_44`, `bfcol_9` AS `bfcol_45` - FROM `bfcte_14` + FROM `bfcte_13` UNION ALL SELECT `bfcol_17` AS `bfcol_42`, `bfcol_18` AS `bfcol_43`, `bfcol_19` AS `bfcol_44`, `bfcol_20` AS `bfcol_45` - FROM `bfcte_15` + FROM `bfcte_14` UNION ALL SELECT `bfcol_27` AS `bfcol_42`, `bfcol_28` AS `bfcol_43`, `bfcol_29` AS `bfcol_44`, `bfcol_30` AS `bfcol_45` - FROM `bfcte_16` + FROM `bfcte_15` UNION ALL SELECT `bfcol_38` AS `bfcol_42`, `bfcol_39` AS `bfcol_43`, `bfcol_40` AS `bfcol_44`, `bfcol_41` AS `bfcol_45` - FROM `bfcte_17` + FROM `bfcte_16` ) ) SELECT `bfcol_42` AS `float64_col`, `bfcol_43` AS `int64_col` -FROM `bfcte_18` +FROM `bfcte_17` ORDER BY `bfcol_44` ASC NULLS LAST, `bfcol_45` ASC NULLS LAST \ No newline at end of file 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 679da58f44..e594b67669 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,21 +1,21 @@ WITH `bfcte_0` AS ( SELECT - `rowindex` AS `bfcol_0`, - `int_list_col` AS `bfcol_1`, - `string_list_col` AS `bfcol_2` + `int_list_col`, + `rowindex`, + `string_list_col` FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ), `bfcte_1` AS ( SELECT * - REPLACE (`bfcol_1`[SAFE_OFFSET(`bfcol_13`)] AS `bfcol_1`, `bfcol_2`[SAFE_OFFSET(`bfcol_13`)] AS `bfcol_2`) + REPLACE (`int_list_col`[SAFE_OFFSET(`bfcol_13`)] AS `int_list_col`, `string_list_col`[SAFE_OFFSET(`bfcol_13`)] AS `string_list_col`) FROM `bfcte_0` - CROSS JOIN UNNEST(GENERATE_ARRAY(0, LEAST(ARRAY_LENGTH(`bfcol_1`) - 1, ARRAY_LENGTH(`bfcol_2`) - 1))) AS `bfcol_13` WITH OFFSET AS `bfcol_7` + CROSS JOIN UNNEST(GENERATE_ARRAY(0, LEAST(ARRAY_LENGTH(`int_list_col`) - 1, ARRAY_LENGTH(`string_list_col`) - 1))) AS `bfcol_13` WITH OFFSET AS `bfcol_7` ) SELECT - `bfcol_0` AS `rowindex`, - `bfcol_0` AS `rowindex_1`, - `bfcol_1` AS `int_list_col`, - `bfcol_2` AS `string_list_col` + `rowindex`, + `rowindex` AS `rowindex_1`, + `int_list_col`, + `string_list_col` FROM `bfcte_1` ORDER BY `bfcol_7` ASC NULLS LAST \ No newline at end of file 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 8bfd1eb005..5af0aa0092 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,18 +1,18 @@ WITH `bfcte_0` AS ( SELECT - `rowindex` AS `bfcol_0`, - `int_list_col` AS `bfcol_1` + `int_list_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ), `bfcte_1` AS ( SELECT * - REPLACE (`bfcol_8` AS `bfcol_1`) + REPLACE (`bfcol_8` AS `int_list_col`) FROM `bfcte_0` - CROSS JOIN UNNEST(`bfcol_1`) AS `bfcol_8` WITH OFFSET AS `bfcol_4` + CROSS JOIN UNNEST(`int_list_col`) AS `bfcol_8` WITH OFFSET AS `bfcol_4` ) SELECT - `bfcol_0` AS `rowindex`, - `bfcol_1` AS `int_list_col` + `rowindex`, + `int_list_col` FROM `bfcte_1` ORDER BY `bfcol_4` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_filter/test_compile_filter/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_filter/test_compile_filter/out.sql index 9ca7fb6a74..f5fff16f60 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_filter/test_compile_filter/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_filter/test_compile_filter/out.sql @@ -1,15 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_5`, - `bfcol_1` AS `bfcol_6`, - `bfcol_0` AS `bfcol_7`, - `bfcol_1` >= 1 AS `bfcol_8` + `rowindex` AS `bfcol_5`, + `rowindex` AS `bfcol_6`, + `int64_col` AS `bfcol_7`, + `rowindex` >= 1 AS `bfcol_8` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin/out.sql index e3bb0f9eba..77aef6ad8b 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin/out.sql @@ -1,37 +1,41 @@ WITH `bfcte_1` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` AS ( +), `bfcte_3` AS ( SELECT - `bfcol_1` AS `bfcol_2`, - `bfcol_0` AS `bfcol_3` + `rowindex` AS `bfcol_2`, + `int64_col` AS `bfcol_3` FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - `int64_too` AS `bfcol_4` + `int64_too` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_3` AS ( +), `bfcte_2` AS ( + SELECT + `int64_too` + FROM `bfcte_0` + GROUP BY + `int64_too` +), `bfcte_4` AS ( SELECT - `bfcte_2`.*, + `bfcte_3`.*, EXISTS( SELECT 1 FROM ( SELECT - `bfcol_4` - FROM `bfcte_0` - GROUP BY - `bfcol_4` + `int64_too` AS `bfcol_4` + FROM `bfcte_2` ) AS `bft_0` WHERE - COALESCE(`bfcte_2`.`bfcol_3`, 0) = COALESCE(`bft_0`.`bfcol_4`, 0) - AND COALESCE(`bfcte_2`.`bfcol_3`, 1) = COALESCE(`bft_0`.`bfcol_4`, 1) + COALESCE(`bfcte_3`.`bfcol_3`, 0) = COALESCE(`bft_0`.`bfcol_4`, 0) + AND COALESCE(`bfcte_3`.`bfcol_3`, 1) = COALESCE(`bft_0`.`bfcol_4`, 1) ) AS `bfcol_5` - FROM `bfcte_2` + FROM `bfcte_3` ) SELECT `bfcol_2` AS `rowindex`, `bfcol_5` AS `int64_col` -FROM `bfcte_3` \ No newline at end of file +FROM `bfcte_4` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql index f96a9816dc..8089c5b462 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql @@ -1,30 +1,34 @@ WITH `bfcte_1` AS ( SELECT - `rowindex` AS `bfcol_0`, - `rowindex_2` AS `bfcol_1` + `rowindex`, + `rowindex_2` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` AS ( +), `bfcte_3` AS ( SELECT - `bfcol_0` AS `bfcol_2`, - `bfcol_1` AS `bfcol_3` + `rowindex` AS `bfcol_2`, + `rowindex_2` AS `bfcol_3` FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - `rowindex_2` AS `bfcol_4` + `rowindex_2` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_3` AS ( +), `bfcte_2` AS ( + SELECT + `rowindex_2` + FROM `bfcte_0` + GROUP BY + `rowindex_2` +), `bfcte_4` AS ( SELECT - `bfcte_2`.*, - `bfcte_2`.`bfcol_3` IN (( + `bfcte_3`.*, + `bfcte_3`.`bfcol_3` IN (( SELECT - `bfcol_4` - FROM `bfcte_0` - GROUP BY - `bfcol_4` + `rowindex_2` AS `bfcol_4` + FROM `bfcte_2` )) AS `bfcol_5` - FROM `bfcte_2` + FROM `bfcte_3` ) SELECT `bfcol_2` AS `rowindex`, `bfcol_5` AS `rowindex_2` -FROM `bfcte_3` \ No newline at end of file +FROM `bfcte_4` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join/out.sql index 04ee767f8a..3a7ff60d3e 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join/out.sql @@ -1,22 +1,22 @@ WITH `bfcte_1` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT - `bfcol_1` AS `bfcol_2`, - `bfcol_0` AS `bfcol_3` + `rowindex` AS `bfcol_2`, + `int64_col` AS `bfcol_3` FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_4`, - `int64_too` AS `bfcol_5` + `int64_col`, + `int64_too` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT - `bfcol_4` AS `bfcol_6`, - `bfcol_5` AS `bfcol_7` + `int64_col` AS `bfcol_6`, + `int64_too` AS `bfcol_7` FROM `bfcte_0` ), `bfcte_4` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/bool_col/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/bool_col/out.sql index 05d5fd0695..30f363e900 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/bool_col/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/bool_col/out.sql @@ -1,22 +1,22 @@ WITH `bfcte_1` AS ( SELECT - `bool_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` + `bool_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT - `bfcol_1` AS `bfcol_2`, - `bfcol_0` AS `bfcol_3` + `rowindex` AS `bfcol_2`, + `bool_col` AS `bfcol_3` FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_4`, - `rowindex` AS `bfcol_5` + `bool_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT - `bfcol_5` AS `bfcol_6`, - `bfcol_4` AS `bfcol_7` + `rowindex` AS `bfcol_6`, + `bool_col` AS `bfcol_7` FROM `bfcte_0` ), `bfcte_4` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/float64_col/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/float64_col/out.sql index 9e6a4094b2..9fa7673fb3 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/float64_col/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/float64_col/out.sql @@ -1,22 +1,22 @@ WITH `bfcte_1` AS ( SELECT - `float64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` + `float64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT - `bfcol_1` AS `bfcol_2`, - `bfcol_0` AS `bfcol_3` + `rowindex` AS `bfcol_2`, + `float64_col` AS `bfcol_3` FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_4`, - `rowindex` AS `bfcol_5` + `float64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT - `bfcol_5` AS `bfcol_6`, - `bfcol_4` AS `bfcol_7` + `rowindex` AS `bfcol_6`, + `float64_col` AS `bfcol_7` FROM `bfcte_0` ), `bfcte_4` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/int64_col/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/int64_col/out.sql index bd03e05cba..c9fca069d6 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/int64_col/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/int64_col/out.sql @@ -1,22 +1,22 @@ WITH `bfcte_1` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT - `bfcol_1` AS `bfcol_2`, - `bfcol_0` AS `bfcol_3` + `rowindex` AS `bfcol_2`, + `int64_col` AS `bfcol_3` FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_4`, - `rowindex` AS `bfcol_5` + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT - `bfcol_5` AS `bfcol_6`, - `bfcol_4` AS `bfcol_7` + `rowindex` AS `bfcol_6`, + `int64_col` AS `bfcol_7` FROM `bfcte_0` ), `bfcte_4` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/numeric_col/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/numeric_col/out.sql index 6b77ead97c..88649c6518 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/numeric_col/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/numeric_col/out.sql @@ -1,22 +1,22 @@ WITH `bfcte_1` AS ( SELECT - `numeric_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` + `numeric_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT - `bfcol_1` AS `bfcol_2`, - `bfcol_0` AS `bfcol_3` + `rowindex` AS `bfcol_2`, + `numeric_col` AS `bfcol_3` FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - `numeric_col` AS `bfcol_4`, - `rowindex` AS `bfcol_5` + `numeric_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT - `bfcol_5` AS `bfcol_6`, - `bfcol_4` AS `bfcol_7` + `rowindex` AS `bfcol_6`, + `numeric_col` AS `bfcol_7` FROM `bfcte_0` ), `bfcte_4` AS ( SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/string_col/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/string_col/out.sql index 1903d5fc22..8758ec8340 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/string_col/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/string_col/out.sql @@ -1,23 +1,28 @@ WITH `bfcte_1` AS ( + SELECT + `rowindex`, + `string_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_2` AS ( SELECT `rowindex` AS `bfcol_0`, `string_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - `rowindex` AS `bfcol_2`, - `string_col` AS `bfcol_3` + `rowindex`, + `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` AS ( +), `bfcte_3` AS ( SELECT - `bfcol_2` AS `bfcol_4`, - `bfcol_3` AS `bfcol_5` + `rowindex` AS `bfcol_4`, + `string_col` AS `bfcol_5` FROM `bfcte_0` -), `bfcte_3` AS ( +), `bfcte_4` AS ( SELECT * - FROM `bfcte_1` - INNER JOIN `bfcte_2` + FROM `bfcte_2` + INNER JOIN `bfcte_3` ON COALESCE(CAST(`bfcol_1` AS STRING), '0') = COALESCE(CAST(`bfcol_5` AS STRING), '0') AND COALESCE(CAST(`bfcol_1` AS STRING), '1') = COALESCE(CAST(`bfcol_5` AS STRING), '1') ) @@ -25,4 +30,4 @@ SELECT `bfcol_0` AS `rowindex_x`, `bfcol_1` AS `string_col`, `bfcol_4` AS `rowindex_y` -FROM `bfcte_3` \ No newline at end of file +FROM `bfcte_4` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/time_col/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/time_col/out.sql index 9e3477d4a9..42fc15cd1d 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/time_col/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/time_col/out.sql @@ -1,23 +1,28 @@ WITH `bfcte_1` AS ( + SELECT + `rowindex`, + `time_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_2` AS ( SELECT `rowindex` AS `bfcol_0`, `time_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - `rowindex` AS `bfcol_2`, - `time_col` AS `bfcol_3` + `rowindex`, + `time_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` AS ( +), `bfcte_3` AS ( SELECT - `bfcol_2` AS `bfcol_4`, - `bfcol_3` AS `bfcol_5` + `rowindex` AS `bfcol_4`, + `time_col` AS `bfcol_5` FROM `bfcte_0` -), `bfcte_3` AS ( +), `bfcte_4` AS ( SELECT * - FROM `bfcte_1` - INNER JOIN `bfcte_2` + FROM `bfcte_2` + INNER JOIN `bfcte_3` ON COALESCE(CAST(`bfcol_1` AS STRING), '0') = COALESCE(CAST(`bfcol_5` AS STRING), '0') AND COALESCE(CAST(`bfcol_1` AS STRING), '1') = COALESCE(CAST(`bfcol_5` AS STRING), '1') ) @@ -25,4 +30,4 @@ SELECT `bfcol_0` AS `rowindex_x`, `bfcol_1` AS `time_col`, `bfcol_4` AS `rowindex_y` -FROM `bfcte_3` \ No newline at end of file +FROM `bfcte_4` \ No newline at end of file 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 10c2a2088a..959a31a2a3 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,37 +1,37 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `bytes_col` AS `bfcol_1`, - `date_col` AS `bfcol_2`, - `datetime_col` AS `bfcol_3`, - `geography_col` AS `bfcol_4`, - `int64_col` AS `bfcol_5`, - `int64_too` AS `bfcol_6`, - `numeric_col` AS `bfcol_7`, - `float64_col` AS `bfcol_8`, - `rowindex` AS `bfcol_9`, - `rowindex_2` AS `bfcol_10`, - `string_col` AS `bfcol_11`, - `time_col` AS `bfcol_12`, - `timestamp_col` AS `bfcol_13`, - `duration_col` AS `bfcol_14` + `bool_col`, + `bytes_col`, + `date_col`, + `datetime_col`, + `duration_col`, + `float64_col`, + `geography_col`, + `int64_col`, + `int64_too`, + `numeric_col`, + `rowindex`, + `rowindex_2`, + `string_col`, + `time_col`, + `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - `bfcol_9` AS `rowindex`, - `bfcol_0` AS `bool_col`, - `bfcol_1` AS `bytes_col`, - `bfcol_2` AS `date_col`, - `bfcol_3` AS `datetime_col`, - `bfcol_4` AS `geography_col`, - `bfcol_5` AS `int64_col`, - `bfcol_6` AS `int64_too`, - `bfcol_7` AS `numeric_col`, - `bfcol_8` AS `float64_col`, - `bfcol_9` AS `rowindex_1`, - `bfcol_10` AS `rowindex_2`, - `bfcol_11` AS `string_col`, - `bfcol_12` AS `time_col`, - `bfcol_13` AS `timestamp_col`, - `bfcol_14` AS `duration_col` + `rowindex`, + `bool_col`, + `bytes_col`, + `date_col`, + `datetime_col`, + `geography_col`, + `int64_col`, + `int64_too`, + `numeric_col`, + `float64_col`, + `rowindex` AS `rowindex_1`, + `rowindex_2`, + `string_col`, + `time_col`, + `timestamp_col`, + `duration_col` FROM `bfcte_0` \ No newline at end of file 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 4e8f61d75d..4b5750d7aa 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,10 +1,10 @@ WITH `bfcte_0` AS ( SELECT - `rowindex` AS `bfcol_0`, - `json_col` AS `bfcol_1` + `json_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`json_types` ) SELECT - `bfcol_0` AS `rowindex`, - `bfcol_1` AS `json_col` + `rowindex`, + `json_col` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_limit/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_limit/out.sql index f97eb7bf06..856c7061da 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_limit/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_limit/out.sql @@ -1,13 +1,13 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - `bfcol_1` AS `rowindex`, - `bfcol_0` AS `int64_col` + `rowindex`, + `int64_col` FROM `bfcte_0` ORDER BY - `bfcol_1` ASC NULLS LAST + `rowindex` ASC NULLS LAST LIMIT 10 \ No newline at end of file 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 75c4a86e18..79ae1ac907 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,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `id` AS `bfcol_0`, - `people` AS `bfcol_1` + `id`, + `people` FROM `bigframes-dev`.`sqlglot_test`.`nested_structs_types` ) SELECT - `bfcol_0` AS `id`, - `bfcol_0` AS `id_1`, - `bfcol_1` AS `people` + `id`, + `id` AS `id_1`, + `people` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_ordering/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_ordering/out.sql index 6a16b98baa..edb8d7fbf4 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_ordering/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_ordering/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - `bfcol_1` AS `rowindex`, - `bfcol_0` AS `int64_col` + `rowindex`, + `int64_col` FROM `bfcte_0` ORDER BY - `bfcol_0` ASC NULLS LAST \ No newline at end of file + `int64_col` ASC NULLS LAST \ No newline at end of file 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 2436c01a44..a22c845ef1 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,23 +1,23 @@ WITH `bfcte_0` AS ( SELECT - `rowindex` AS `bfcol_0`, - `int_list_col` AS `bfcol_1`, - `bool_list_col` AS `bfcol_2`, - `float_list_col` AS `bfcol_3`, - `date_list_col` AS `bfcol_4`, - `date_time_list_col` AS `bfcol_5`, - `numeric_list_col` AS `bfcol_6`, - `string_list_col` AS `bfcol_7` + `bool_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` ) SELECT - `bfcol_0` AS `rowindex`, - `bfcol_0` AS `rowindex_1`, - `bfcol_1` AS `int_list_col`, - `bfcol_2` AS `bool_list_col`, - `bfcol_3` AS `float_list_col`, - `bfcol_4` AS `date_list_col`, - `bfcol_5` AS `date_time_list_col`, - `bfcol_6` AS `numeric_list_col`, - `bfcol_7` AS `string_list_col` + `rowindex`, + `rowindex` AS `rowindex_1`, + `int_list_col`, + `bool_list_col`, + `float_list_col`, + `date_list_col`, + `date_time_list_col`, + `numeric_list_col`, + `string_list_col` FROM `bfcte_0` \ No newline at end of file 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 f280933a74..11e3f4773e 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 @@ -1,16 +1,16 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` + `bool_col`, + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_0` AS `bfcol_7`, - `bfcol_1` AS `bfcol_8`, - `bfcol_0` AS `bfcol_9` + `rowindex` AS `bfcol_6`, + `bool_col` AS `bfcol_7`, + `int64_col` AS `bfcol_8`, + `bool_col` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT @@ -24,14 +24,14 @@ WITH `bfcte_0` AS ( CASE WHEN SUM(CAST(NOT `bfcol_7` IS NULL AS INT64)) OVER ( PARTITION BY `bfcol_9` - ORDER BY `bfcol_9` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST + ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW ) < 3 THEN NULL ELSE COALESCE( SUM(CAST(`bfcol_7` AS INT64)) OVER ( PARTITION BY `bfcol_9` - ORDER BY `bfcol_9` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST + ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW ), 0 @@ -50,14 +50,14 @@ WITH `bfcte_0` AS ( CASE WHEN SUM(CAST(NOT `bfcol_8` IS NULL AS INT64)) OVER ( PARTITION BY `bfcol_9` - ORDER BY `bfcol_9` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST + ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW ) < 3 THEN NULL ELSE COALESCE( SUM(`bfcol_8`) OVER ( PARTITION BY `bfcol_9` - ORDER BY `bfcol_9` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST + ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW ), 0 @@ -73,4 +73,4 @@ SELECT FROM `bfcte_5` ORDER BY `bfcol_9` ASC NULLS LAST, - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `rowindex` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_skips_nulls_op/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_skips_nulls_op/out.sql index f22ef37b7e..788eb49ddf 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_skips_nulls_op/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_skips_nulls_op/out.sql @@ -1,24 +1,24 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, CASE - WHEN SUM(CAST(NOT `bfcol_0` IS NULL AS INT64)) OVER (ORDER BY `bfcol_1` ASC NULLS LAST ROWS BETWEEN 2 PRECEDING AND CURRENT ROW) < 3 + WHEN SUM(CAST(NOT `int64_col` IS NULL AS INT64)) OVER (ORDER BY `rowindex` ASC NULLS LAST ROWS BETWEEN 2 PRECEDING AND CURRENT ROW) < 3 THEN NULL ELSE COALESCE( - SUM(`bfcol_0`) OVER (ORDER BY `bfcol_1` ASC NULLS LAST ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM(`int64_col`) OVER (ORDER BY `rowindex` ASC NULLS LAST ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), 0 ) END AS `bfcol_4` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `rowindex`, + `rowindex`, `bfcol_4` AS `int64_col` FROM `bfcte_1` ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `rowindex` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_wo_skips_nulls_op/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_wo_skips_nulls_op/out.sql index dcf52f2e82..5ad435ddbb 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_wo_skips_nulls_op/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_wo_skips_nulls_op/out.sql @@ -1,21 +1,21 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` + `int64_col`, + `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, CASE - WHEN COUNT(CAST(NOT `bfcol_0` IS NULL AS INT64)) OVER (ORDER BY `bfcol_1` ASC NULLS LAST ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) < 5 + WHEN COUNT(CAST(NOT `int64_col` IS NULL AS INT64)) OVER (ORDER BY `rowindex` ASC NULLS LAST ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) < 5 THEN NULL - ELSE COUNT(`bfcol_0`) OVER (ORDER BY `bfcol_1` ASC NULLS LAST ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) + ELSE COUNT(`int64_col`) OVER (ORDER BY `rowindex` ASC NULLS LAST ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) END AS `bfcol_4` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `rowindex`, + `rowindex`, `bfcol_4` AS `int64_col` FROM `bfcte_1` ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `rowindex` ASC NULLS LAST \ No newline at end of file From 993ea75bbbe067036419964a37e5f74b9578ed61 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Mon, 10 Nov 2025 22:45:10 +0000 Subject: [PATCH 2/3] update new snapshots --- .../test_string_agg/out.sql | 5 +--- .../test_unary_compiler/test_first/out.sql | 5 +--- .../test_first_non_null/out.sql | 5 +--- .../test_unary_compiler/test_last/out.sql | 5 +--- .../test_last_non_null/out.sql | 5 +--- .../test_geo_st_difference/out.sql | 4 ++-- .../test_numeric_ops/test_arctan2/out.sql | 10 ++++---- .../test_cosine_distance/out.sql | 8 +++---- .../test_compile_isin_not_nullable/out.sql | 6 ++--- .../out.sql | 24 ++++--------------- .../out.sql | 10 ++------ 11 files changed, 25 insertions(+), 62 deletions(-) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_string_agg/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_string_agg/out.sql index 321341d4a0..2ce4124347 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_string_agg/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_string_agg/out.sql @@ -5,10 +5,7 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT COALESCE( - STRING_AGG(`string_col`, ',' - ORDER BY - `string_col` IS NULL ASC, - `string_col` ASC), + STRING_AGG(`string_col` ORDER BY `string_col` IS NULL ASC, `string_col` ASC, ','), '' ) AS `bfcol_1` FROM `bfcte_0` diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first/out.sql index 40c9e6ddd8..9a1af28e5e 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first/out.sql @@ -8,10 +8,7 @@ WITH `bfcte_0` AS ( CASE WHEN `int64_col` IS NULL THEN NULL - ELSE FIRST_VALUE(`int64_col`) OVER ( - ORDER BY `int64_col` DESC - ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING - ) + ELSE FIRST_VALUE(`int64_col`) OVER (ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) END AS `bfcol_1` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first_non_null/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first_non_null/out.sql index 2ef7b7151e..f574a49d96 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first_non_null/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first_non_null/out.sql @@ -5,10 +5,7 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - FIRST_VALUE(`int64_col` IGNORE NULLS) OVER ( - ORDER BY `int64_col` ASC NULLS LAST - ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING - ) AS `bfcol_1` + FIRST_VALUE(`int64_col` IGNORE NULLS) OVER (ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last/out.sql index ebeaa0e338..7d3ddd46d9 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last/out.sql @@ -8,10 +8,7 @@ WITH `bfcte_0` AS ( CASE WHEN `int64_col` IS NULL THEN NULL - ELSE LAST_VALUE(`int64_col`) OVER ( - ORDER BY `int64_col` DESC - ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING - ) + ELSE LAST_VALUE(`int64_col`) OVER (ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) END AS `bfcol_1` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last_non_null/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last_non_null/out.sql index c626c263ac..0fa48b68a2 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last_non_null/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last_non_null/out.sql @@ -5,10 +5,7 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - LAST_VALUE(`int64_col` IGNORE NULLS) OVER ( - ORDER BY `int64_col` ASC NULLS LAST - ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING - ) AS `bfcol_1` + LAST_VALUE(`int64_col` IGNORE NULLS) OVER (ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_difference/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_difference/out.sql index e57a15443d..4e18216dda 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_difference/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_difference/out.sql @@ -1,11 +1,11 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` + `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ST_DIFFERENCE(`bfcol_0`, `bfcol_0`) AS `bfcol_1` + ST_DIFFERENCE(`geography_col`, `geography_col`) AS `bfcol_1` FROM `bfcte_0` ) 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 d131828a98..28fc8c869d 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,14 +1,14 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `float64_col` AS `bfcol_2` + `bool_col`, + `float64_col`, + `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ATAN2(`bfcol_1`, `bfcol_2`) AS `bfcol_6`, - ATAN2(CAST(`bfcol_0` AS INT64), `bfcol_2`) AS `bfcol_7` + ATAN2(`int64_col`, `float64_col`) AS `bfcol_6`, + ATAN2(CAST(`bool_col` AS INT64), `float64_col`) AS `bfcol_7` FROM `bfcte_0` ) 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 eb46a16a83..ba6b6bfa9f 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,13 +1,13 @@ WITH `bfcte_0` AS ( SELECT - `int_list_col` AS `bfcol_0`, - `float_list_col` AS `bfcol_1` + `float_list_col`, + `int_list_col` FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ), `bfcte_1` AS ( SELECT *, - ML.DISTANCE(`bfcol_0`, `bfcol_0`, 'COSINE') AS `bfcol_2`, - ML.DISTANCE(`bfcol_1`, `bfcol_1`, 'COSINE') AS `bfcol_3` + ML.DISTANCE(`int_list_col`, `int_list_col`, 'COSINE') AS `bfcol_2`, + ML.DISTANCE(`float_list_col`, `float_list_col`, 'COSINE') AS `bfcol_3` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql index 8089c5b462..1246dc44a6 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql @@ -22,9 +22,9 @@ WITH `bfcte_1` AS ( SELECT `bfcte_3`.*, `bfcte_3`.`bfcol_3` IN (( - SELECT - `rowindex_2` AS `bfcol_4` - FROM `bfcte_2` + SELECT + `rowindex_2` AS `bfcol_4` + FROM `bfcte_2` )) AS `bfcol_5` FROM `bfcte_3` ) 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 11e3f4773e..44a0c9ec11 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 @@ -22,18 +22,10 @@ WITH `bfcte_0` AS ( SELECT *, CASE - WHEN SUM(CAST(NOT `bfcol_7` IS NULL AS INT64)) OVER ( - PARTITION BY `bfcol_9` - ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST - ROWS BETWEEN 3 PRECEDING AND CURRENT ROW - ) < 3 + WHEN SUM(CAST(NOT `bfcol_7` IS NULL AS INT64)) OVER (PARTITION BY `bfcol_9` ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW) < 3 THEN NULL ELSE COALESCE( - SUM(CAST(`bfcol_7` AS INT64)) OVER ( - PARTITION BY `bfcol_9` - ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST - ROWS BETWEEN 3 PRECEDING AND CURRENT ROW - ), + SUM(CAST(`bfcol_7` AS INT64)) OVER (PARTITION BY `bfcol_9` ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW), 0 ) END AS `bfcol_15` @@ -48,18 +40,10 @@ WITH `bfcte_0` AS ( SELECT *, CASE - WHEN SUM(CAST(NOT `bfcol_8` IS NULL AS INT64)) OVER ( - PARTITION BY `bfcol_9` - ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST - ROWS BETWEEN 3 PRECEDING AND CURRENT ROW - ) < 3 + WHEN SUM(CAST(NOT `bfcol_8` IS NULL AS INT64)) OVER (PARTITION BY `bfcol_9` ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW) < 3 THEN NULL ELSE COALESCE( - SUM(`bfcol_8`) OVER ( - PARTITION BY `bfcol_9` - ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST - ROWS BETWEEN 3 PRECEDING AND CURRENT ROW - ), + SUM(`bfcol_8`) OVER (PARTITION BY `bfcol_9` ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW), 0 ) END AS `bfcol_21` diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_range_rolling/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_range_rolling/out.sql index 581c81c6b4..d2c7e338bc 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_range_rolling/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_range_rolling/out.sql @@ -6,16 +6,10 @@ WITH `bfcte_0` AS ( SELECT *, CASE - WHEN SUM(CAST(NOT `bfcol_1` IS NULL AS INT64)) OVER ( - ORDER BY UNIX_MICROS(`bfcol_0`) ASC NULLS LAST - RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW - ) < 1 + WHEN SUM(CAST(NOT `bfcol_1` IS NULL AS INT64)) OVER (ORDER BY UNIX_MICROS(`bfcol_0`) ASC NULLS LAST RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW) < 1 THEN NULL ELSE COALESCE( - SUM(`bfcol_1`) OVER ( - ORDER BY UNIX_MICROS(`bfcol_0`) ASC NULLS LAST - RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW - ), + SUM(`bfcol_1`) OVER (ORDER BY UNIX_MICROS(`bfcol_0`) ASC NULLS LAST RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW), 0 ) END AS `bfcol_6` From b214d3f80484376c5d4e2807b6759e4721542052 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Mon, 10 Nov 2025 22:57:14 +0000 Subject: [PATCH 3/3] fix snapshots with new sqlglot version --- .../test_string_agg/out.sql | 5 +++- .../test_unary_compiler/test_first/out.sql | 5 +++- .../test_first_non_null/out.sql | 5 +++- .../test_unary_compiler/test_last/out.sql | 5 +++- .../test_last_non_null/out.sql | 5 +++- .../test_compile_isin_not_nullable/out.sql | 6 ++--- .../out.sql | 24 +++++++++++++++---- .../out.sql | 10 ++++++-- 8 files changed, 51 insertions(+), 14 deletions(-) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_string_agg/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_string_agg/out.sql index 2ce4124347..321341d4a0 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_string_agg/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_string_agg/out.sql @@ -5,7 +5,10 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT COALESCE( - STRING_AGG(`string_col` ORDER BY `string_col` IS NULL ASC, `string_col` ASC, ','), + STRING_AGG(`string_col`, ',' + ORDER BY + `string_col` IS NULL ASC, + `string_col` ASC), '' ) AS `bfcol_1` FROM `bfcte_0` diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first/out.sql index 9a1af28e5e..40c9e6ddd8 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first/out.sql @@ -8,7 +8,10 @@ WITH `bfcte_0` AS ( CASE WHEN `int64_col` IS NULL THEN NULL - ELSE FIRST_VALUE(`int64_col`) OVER (ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) + ELSE FIRST_VALUE(`int64_col`) OVER ( + ORDER BY `int64_col` DESC + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) END AS `bfcol_1` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first_non_null/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first_non_null/out.sql index f574a49d96..2ef7b7151e 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first_non_null/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first_non_null/out.sql @@ -5,7 +5,10 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - FIRST_VALUE(`int64_col` IGNORE NULLS) OVER (ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS `bfcol_1` + FIRST_VALUE(`int64_col` IGNORE NULLS) OVER ( + ORDER BY `int64_col` ASC NULLS LAST + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last/out.sql index 7d3ddd46d9..ebeaa0e338 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last/out.sql @@ -8,7 +8,10 @@ WITH `bfcte_0` AS ( CASE WHEN `int64_col` IS NULL THEN NULL - ELSE LAST_VALUE(`int64_col`) OVER (ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) + ELSE LAST_VALUE(`int64_col`) OVER ( + ORDER BY `int64_col` DESC + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) END AS `bfcol_1` FROM `bfcte_0` ) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last_non_null/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last_non_null/out.sql index 0fa48b68a2..c626c263ac 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last_non_null/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last_non_null/out.sql @@ -5,7 +5,10 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - LAST_VALUE(`int64_col` IGNORE NULLS) OVER (ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS `bfcol_1` + LAST_VALUE(`int64_col` IGNORE NULLS) OVER ( + ORDER BY `int64_col` ASC NULLS LAST + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql index 1246dc44a6..8089c5b462 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql @@ -22,9 +22,9 @@ WITH `bfcte_1` AS ( SELECT `bfcte_3`.*, `bfcte_3`.`bfcol_3` IN (( - SELECT - `rowindex_2` AS `bfcol_4` - FROM `bfcte_2` + SELECT + `rowindex_2` AS `bfcol_4` + FROM `bfcte_2` )) AS `bfcol_5` FROM `bfcte_3` ) 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 44a0c9ec11..11e3f4773e 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 @@ -22,10 +22,18 @@ WITH `bfcte_0` AS ( SELECT *, CASE - WHEN SUM(CAST(NOT `bfcol_7` IS NULL AS INT64)) OVER (PARTITION BY `bfcol_9` ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW) < 3 + WHEN SUM(CAST(NOT `bfcol_7` IS NULL AS INT64)) OVER ( + PARTITION BY `bfcol_9` + ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST + ROWS BETWEEN 3 PRECEDING AND CURRENT ROW + ) < 3 THEN NULL ELSE COALESCE( - SUM(CAST(`bfcol_7` AS INT64)) OVER (PARTITION BY `bfcol_9` ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW), + SUM(CAST(`bfcol_7` AS INT64)) OVER ( + PARTITION BY `bfcol_9` + ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST + ROWS BETWEEN 3 PRECEDING AND CURRENT ROW + ), 0 ) END AS `bfcol_15` @@ -40,10 +48,18 @@ WITH `bfcte_0` AS ( SELECT *, CASE - WHEN SUM(CAST(NOT `bfcol_8` IS NULL AS INT64)) OVER (PARTITION BY `bfcol_9` ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW) < 3 + WHEN SUM(CAST(NOT `bfcol_8` IS NULL AS INT64)) OVER ( + PARTITION BY `bfcol_9` + ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST + ROWS BETWEEN 3 PRECEDING AND CURRENT ROW + ) < 3 THEN NULL ELSE COALESCE( - SUM(`bfcol_8`) OVER (PARTITION BY `bfcol_9` ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW), + SUM(`bfcol_8`) OVER ( + PARTITION BY `bfcol_9` + ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST + ROWS BETWEEN 3 PRECEDING AND CURRENT ROW + ), 0 ) END AS `bfcol_21` diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_range_rolling/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_range_rolling/out.sql index d2c7e338bc..581c81c6b4 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_range_rolling/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_range_rolling/out.sql @@ -6,10 +6,16 @@ WITH `bfcte_0` AS ( SELECT *, CASE - WHEN SUM(CAST(NOT `bfcol_1` IS NULL AS INT64)) OVER (ORDER BY UNIX_MICROS(`bfcol_0`) ASC NULLS LAST RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW) < 1 + WHEN SUM(CAST(NOT `bfcol_1` IS NULL AS INT64)) OVER ( + ORDER BY UNIX_MICROS(`bfcol_0`) ASC NULLS LAST + RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW + ) < 1 THEN NULL ELSE COALESCE( - SUM(`bfcol_1`) OVER (ORDER BY UNIX_MICROS(`bfcol_0`) ASC NULLS LAST RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW), + SUM(`bfcol_1`) OVER ( + ORDER BY UNIX_MICROS(`bfcol_0`) ASC NULLS LAST + RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW + ), 0 ) END AS `bfcol_6`