From 6c96c84dc4eb0f0c3a71135784d853a9030c729f Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Thu, 5 Feb 2026 23:15:35 +0000 Subject: [PATCH 1/6] refactor: Define sql nodes and transform --- bigframes/core/compile/compiled.py | 61 +- bigframes/core/compile/sqlglot/compiler.py | 154 ++--- .../compile/sqlglot/expression_compiler.py | 221 +++++++ .../core/compile/sqlglot/scalar_compiler.py | 10 + bigframes/core/rewrite/__init__.py | 9 +- bigframes/core/rewrite/as_sql.py | 213 +++++++ bigframes/core/rewrite/windows.py | 65 ++- bigframes/core/sql_nodes.py | 115 ++++ .../test_binary_compiler/test_corr/out.sql | 1 + .../test_binary_compiler/test_cov/out.sql | 1 + .../test_row_number/out.sql | 10 +- .../test_row_number_with_window/out.sql | 10 +- .../test_nullary_compiler/test_size/out.sql | 1 + .../test_array_agg/out.sql | 1 + .../test_string_agg/out.sql | 1 + .../test_unary_compiler/test_all/out.sql | 1 + .../test_all_w_window/out.sql | 16 +- .../test_unary_compiler/test_any/out.sql | 1 + .../test_any_value/out.sql | 1 + .../test_any_value/window_out.sql | 13 +- .../test_any_value/window_partition_out.sql | 14 +- .../test_any_w_window/out.sql | 16 +- .../test_approx_quartiles/out.sql | 1 + .../test_approx_top_count/out.sql | 1 + .../test_unary_compiler/test_count/out.sql | 1 + .../test_count/window_out.sql | 13 +- .../test_count/window_partition_out.sql | 14 +- .../test_unary_compiler/test_cut/int_bins.sql | 86 ++- .../test_cut/int_bins_labels.sql | 32 +- .../test_cut/interval_bins.sql | 20 +- .../test_cut/interval_bins_labels.sql | 20 +- .../test_dense_rank/out.sql | 10 +- .../test_diff_w_bool/out.sql | 10 +- .../test_diff_w_date/out.sql | 14 +- .../test_diff_w_datetime/out.sql | 18 +- .../test_diff_w_int/out.sql | 10 +- .../test_diff_w_timestamp/out.sql | 18 +- .../test_unary_compiler/test_first/out.sql | 16 +- .../test_first_non_null/out.sql | 16 +- .../test_unary_compiler/test_last/out.sql | 16 +- .../test_last_non_null/out.sql | 16 +- .../test_unary_compiler/test_max/out.sql | 1 + .../test_max/window_out.sql | 13 +- .../test_max/window_partition_out.sql | 14 +- .../test_unary_compiler/test_mean/out.sql | 4 + .../test_mean/window_out.sql | 13 +- .../test_mean/window_partition_out.sql | 14 +- .../test_unary_compiler/test_median/out.sql | 1 + .../test_unary_compiler/test_min/out.sql | 1 + .../test_min/window_out.sql | 13 +- .../test_min/window_partition_out.sql | 14 +- .../test_unary_compiler/test_nunique/out.sql | 1 + .../test_unary_compiler/test_pop_var/out.sql | 1 + .../test_pop_var/window_out.sql | 13 +- .../test_unary_compiler/test_product/out.sql | 1 + .../test_product/window_partition_out.sql | 36 +- .../test_unary_compiler/test_quantile/out.sql | 1 + .../test_unary_compiler/test_rank/out.sql | 10 +- .../test_unary_compiler/test_shift/lag.sql | 10 +- .../test_unary_compiler/test_shift/lead.sql | 10 +- .../test_unary_compiler/test_shift/noop.sql | 10 +- .../test_unary_compiler/test_std/out.sql | 4 + .../test_std/window_out.sql | 13 +- .../test_unary_compiler/test_sum/out.sql | 1 + .../test_sum/window_out.sql | 16 +- .../test_sum/window_partition_out.sql | 17 +- .../test_unary_compiler/test_var/out.sql | 1 + .../test_var/window_out.sql | 13 +- .../test_ai_ops/test_ai_classify/out.sql | 18 +- .../test_ai_ops/test_ai_generate/out.sql | 18 +- .../test_ai_ops/test_ai_generate_bool/out.sql | 18 +- .../out.sql | 20 +- .../out.sql | 18 +- .../test_ai_generate_double/out.sql | 18 +- .../out.sql | 20 +- .../out.sql | 18 +- .../test_ai_ops/test_ai_generate_int/out.sql | 18 +- .../out.sql | 20 +- .../out.sql | 18 +- .../out.sql | 20 +- .../test_ai_generate_with_model_param/out.sql | 18 +- .../out.sql | 20 +- .../snapshots/test_ai_ops/test_ai_if/out.sql | 16 +- .../test_ai_ops/test_ai_score/out.sql | 16 +- .../test_array_ops/test_array_index/out.sql | 10 +- .../test_array_reduce_op/out.sql | 51 +- .../test_array_slice_with_only_start/out.sql | 22 +- .../out.sql | 22 +- .../test_array_to_string/out.sql | 10 +- .../test_array_ops/test_to_array_op/out.sql | 27 +- .../test_obj_fetch_metadata/out.sql | 24 +- .../test_obj_get_access_url/out.sql | 28 +- .../test_blob_ops/test_obj_make_ref/out.sql | 12 +- .../test_bool_ops/test_and_op/out.sql | 42 +- .../test_bool_ops/test_or_op/out.sql | 42 +- .../test_bool_ops/test_xor_op/out.sql | 60 +- .../test_eq_null_match/out.sql | 10 +- .../test_eq_numeric/out.sql | 69 +-- .../test_ge_numeric/out.sql | 55 +- .../test_gt_numeric/out.sql | 55 +- .../test_comparison_ops/test_is_in/out.sql | 41 +- .../test_le_numeric/out.sql | 55 +- .../test_lt_numeric/out.sql | 55 +- .../test_maximum_op/out.sql | 10 +- .../test_minimum_op/out.sql | 10 +- .../test_ne_numeric/out.sql | 73 +-- .../test_add_timedelta/out.sql | 62 +- .../test_datetime_ops/test_date/out.sql | 10 +- .../test_datetime_to_integer_label/out.sql | 57 +- .../test_datetime_ops/test_day/out.sql | 10 +- .../test_datetime_ops/test_dayofweek/out.sql | 16 +- .../test_datetime_ops/test_dayofyear/out.sql | 10 +- .../test_datetime_ops/test_floor_dt/out.sql | 43 +- .../test_datetime_ops/test_hour/out.sql | 10 +- .../out.sql | 14 +- .../out.sql | 78 ++- .../out.sql | 90 ++- .../out.sql | 18 +- .../out.sql | 10 +- .../test_datetime_ops/test_iso_day/out.sql | 10 +- .../test_datetime_ops/test_iso_week/out.sql | 10 +- .../test_datetime_ops/test_iso_year/out.sql | 10 +- .../test_datetime_ops/test_minute/out.sql | 10 +- .../test_datetime_ops/test_month/out.sql | 10 +- .../test_datetime_ops/test_normalize/out.sql | 10 +- .../test_datetime_ops/test_quarter/out.sql | 10 +- .../test_datetime_ops/test_second/out.sql | 10 +- .../test_datetime_ops/test_strftime/out.sql | 19 +- .../test_sub_timedelta/out.sql | 84 +-- .../test_datetime_ops/test_time/out.sql | 10 +- .../test_to_datetime/out.sql | 16 +- .../test_to_timestamp/out.sql | 25 +- .../test_unix_micros/out.sql | 10 +- .../test_unix_millis/out.sql | 10 +- .../test_unix_seconds/out.sql | 10 +- .../test_datetime_ops/test_year/out.sql | 10 +- .../test_generic_ops/test_astype_bool/out.sql | 16 +- .../test_astype_float/out.sql | 16 +- .../test_astype_from_json/out.sql | 22 +- .../test_generic_ops/test_astype_int/out.sql | 34 +- .../test_generic_ops/test_astype_json/out.sql | 25 +- .../test_astype_string/out.sql | 16 +- .../test_astype_time_like/out.sql | 19 +- .../test_binary_remote_function_op/out.sql | 10 +- .../test_case_when_op/out.sql | 33 +- .../test_generic_ops/test_clip/out.sql | 10 +- .../test_generic_ops/test_coalesce/out.sql | 13 +- .../test_generic_ops/test_fillna/out.sql | 10 +- .../test_generic_ops/test_hash/out.sql | 10 +- .../test_generic_ops/test_invert/out.sql | 28 +- .../test_generic_ops/test_isnull/out.sql | 10 +- .../test_generic_ops/test_map/out.sql | 22 +- .../test_nary_remote_function_op/out.sql | 10 +- .../test_generic_ops/test_notnull/out.sql | 10 +- .../test_remote_function_op/out.sql | 21 +- .../test_generic_ops/test_row_key/out.sql | 96 ++-- .../test_sql_scalar_op/out.sql | 10 +- .../test_generic_ops/test_where/out.sql | 10 +- .../test_geo_ops/test_geo_area/out.sql | 10 +- .../test_geo_ops/test_geo_st_astext/out.sql | 10 +- .../test_geo_ops/test_geo_st_boundary/out.sql | 10 +- .../test_geo_ops/test_geo_st_buffer/out.sql | 10 +- .../test_geo_ops/test_geo_st_centroid/out.sql | 10 +- .../test_geo_st_convexhull/out.sql | 10 +- .../test_geo_st_difference/out.sql | 10 +- .../test_geo_ops/test_geo_st_distance/out.sql | 13 +- .../test_geo_st_geogfromtext/out.sql | 10 +- .../test_geo_st_geogpoint/out.sql | 10 +- .../test_geo_st_intersection/out.sql | 10 +- .../test_geo_ops/test_geo_st_isclosed/out.sql | 10 +- .../test_geo_ops/test_geo_st_length/out.sql | 10 +- .../snapshots/test_geo_ops/test_geo_x/out.sql | 10 +- .../snapshots/test_geo_ops/test_geo_y/out.sql | 10 +- .../test_json_ops/test_json_extract/out.sql | 10 +- .../test_json_extract_array/out.sql | 10 +- .../test_json_extract_string_array/out.sql | 10 +- .../test_json_ops/test_json_keys/out.sql | 13 +- .../test_json_ops/test_json_query/out.sql | 10 +- .../test_json_query_array/out.sql | 10 +- .../test_json_ops/test_json_set/out.sql | 10 +- .../test_json_ops/test_json_value/out.sql | 10 +- .../test_json_ops/test_parse_json/out.sql | 10 +- .../test_json_ops/test_to_json/out.sql | 10 +- .../test_json_ops/test_to_json_string/out.sql | 10 +- .../test_numeric_ops/test_abs/out.sql | 10 +- .../test_numeric_ops/test_add_numeric/out.sql | 55 +- .../test_numeric_ops/test_add_string/out.sql | 10 +- .../test_add_timedelta/out.sql | 62 +- .../test_numeric_ops/test_arccos/out.sql | 18 +- .../test_numeric_ops/test_arccosh/out.sql | 18 +- .../test_numeric_ops/test_arcsin/out.sql | 18 +- .../test_numeric_ops/test_arcsinh/out.sql | 10 +- .../test_numeric_ops/test_arctan/out.sql | 10 +- .../test_numeric_ops/test_arctan2/out.sql | 13 +- .../test_numeric_ops/test_arctanh/out.sql | 22 +- .../test_numeric_ops/test_ceil/out.sql | 10 +- .../test_numeric_ops/test_cos/out.sql | 10 +- .../test_numeric_ops/test_cosh/out.sql | 18 +- .../test_cosine_distance/out.sql | 13 +- .../test_numeric_ops/test_div_numeric/out.sql | 127 +--- .../test_div_timedelta/out.sql | 19 +- .../test_euclidean_distance/out.sql | 13 +- .../test_numeric_ops/test_exp/out.sql | 18 +- .../test_numeric_ops/test_expm1/out.sql | 10 +- .../test_numeric_ops/test_floor/out.sql | 10 +- .../test_floordiv_timedelta/out.sql | 16 +- .../test_numeric_ops/test_ln/out.sql | 26 +- .../test_numeric_ops/test_log10/out.sql | 26 +- .../test_numeric_ops/test_log1p/out.sql | 26 +- .../test_manhattan_distance/out.sql | 13 +- .../test_numeric_ops/test_mod_numeric/out.sql | 477 +++++++-------- .../test_numeric_ops/test_mul_numeric/out.sql | 55 +- .../test_mul_timedelta/out.sql | 42 +- .../test_numeric_ops/test_neg/out.sql | 14 +- .../test_numeric_ops/test_pos/out.sql | 10 +- .../test_numeric_ops/test_pow/out.sql | 543 ++++++++---------- .../test_numeric_ops/test_round/out.sql | 84 +-- .../test_numeric_ops/test_sin/out.sql | 10 +- .../test_numeric_ops/test_sinh/out.sql | 18 +- .../test_numeric_ops/test_sqrt/out.sql | 10 +- .../test_numeric_ops/test_sub_numeric/out.sql | 55 +- .../test_sub_timedelta/out.sql | 84 +-- .../test_numeric_ops/test_tan/out.sql | 10 +- .../test_numeric_ops/test_tanh/out.sql | 10 +- .../test_unsafe_pow_op/out.sql | 43 +- .../test_string_ops/test_add_string/out.sql | 10 +- .../test_string_ops/test_capitalize/out.sql | 10 +- .../test_string_ops/test_endswith/out.sql | 16 +- .../test_string_ops/test_isalnum/out.sql | 10 +- .../test_string_ops/test_isalpha/out.sql | 10 +- .../test_string_ops/test_isdecimal/out.sql | 10 +- .../test_string_ops/test_isdigit/out.sql | 16 +- .../test_string_ops/test_islower/out.sql | 10 +- .../test_string_ops/test_isnumeric/out.sql | 10 +- .../test_string_ops/test_isspace/out.sql | 10 +- .../test_string_ops/test_isupper/out.sql | 10 +- .../test_string_ops/test_len/out.sql | 10 +- .../test_string_ops/test_len_w_array/out.sql | 10 +- .../test_string_ops/test_lower/out.sql | 10 +- .../test_string_ops/test_lstrip/out.sql | 10 +- .../test_regex_replace_str/out.sql | 10 +- .../test_string_ops/test_replace_str/out.sql | 10 +- .../test_string_ops/test_reverse/out.sql | 10 +- .../test_string_ops/test_rstrip/out.sql | 10 +- .../test_string_ops/test_startswith/out.sql | 16 +- .../test_string_ops/test_str_contains/out.sql | 10 +- .../test_str_contains_regex/out.sql | 10 +- .../test_string_ops/test_str_extract/out.sql | 29 +- .../test_string_ops/test_str_find/out.sql | 19 +- .../test_string_ops/test_str_get/out.sql | 10 +- .../test_string_ops/test_str_pad/out.sql | 32 +- .../test_string_ops/test_str_repeat/out.sql | 10 +- .../test_string_ops/test_str_slice/out.sql | 10 +- .../test_string_ops/test_strconcat/out.sql | 10 +- .../test_string_ops/test_string_split/out.sql | 10 +- .../test_string_ops/test_strip/out.sql | 10 +- .../test_string_ops/test_upper/out.sql | 10 +- .../test_string_ops/test_zfill/out.sql | 18 +- .../test_struct_ops/test_struct_field/out.sql | 13 +- .../test_struct_ops/test_struct_op/out.sql | 20 +- .../test_timedelta_floor/out.sql | 10 +- .../test_to_timedelta/out.sql | 55 +- .../test_compile_aggregate/out.sql | 7 +- .../test_compile_aggregate_wo_dropna/out.sql | 7 +- .../test_compile_concat/out.sql | 40 +- .../test_compile_concat_filter_sorted/out.sql | 98 +--- .../test_compile_explode_dataframe/out.sql | 11 +- .../test_compile_explode_series/out.sql | 9 +- .../test_compile_filter/out.sql | 23 +- .../test_st_regionstats/out.sql | 74 ++- .../out.sql | 32 +- .../test_compile_geo/test_st_simplify/out.sql | 12 +- .../test_compile_isin/out.sql | 3 + .../test_compile_isin_not_nullable/out.sql | 3 + .../test_compile_join/out.sql | 3 + .../test_compile_join_w_on/bool_col/out.sql | 3 + .../float64_col/out.sql | 3 + .../test_compile_join_w_on/int64_col/out.sql | 3 + .../numeric_col/out.sql | 3 + .../test_compile_join_w_on/string_col/out.sql | 3 + .../test_compile_join_w_on/time_col/out.sql | 3 + .../test_compile_random_sample/out.sql | 5 +- .../test_compile_readlocal/out.sql | 5 +- .../test_compile_readlocal_w_json_df/out.sql | 5 +- .../test_compile_readlocal_w_lists_df/out.sql | 5 +- .../out.sql | 5 +- .../out.sql | 5 +- .../test_compile_readtable/out.sql | 31 +- .../out.sql | 7 +- .../out.sql | 5 +- .../test_compile_readtable_w_limit/out.sql | 7 +- .../out.sql | 5 +- .../test_compile_readtable_w_ordering/out.sql | 9 +- .../out.sql | 17 +- .../out.sql | 31 +- .../out.sql | 112 ++-- .../out.sql | 46 +- .../out.sql | 35 +- .../out.sql | 23 +- 299 files changed, 2877 insertions(+), 4400 deletions(-) create mode 100644 bigframes/core/compile/sqlglot/expression_compiler.py create mode 100644 bigframes/core/rewrite/as_sql.py create mode 100644 bigframes/core/sql_nodes.py diff --git a/bigframes/core/compile/compiled.py b/bigframes/core/compile/compiled.py index f8be331d59b..5bd141a4062 100644 --- a/bigframes/core/compile/compiled.py +++ b/bigframes/core/compile/compiled.py @@ -13,7 +13,6 @@ # limitations under the License. from __future__ import annotations -import functools import itertools import typing from typing import Literal, Optional, Sequence @@ -27,7 +26,7 @@ from google.cloud import bigquery import pyarrow as pa -from bigframes.core import agg_expressions +from bigframes.core import agg_expressions, rewrite import bigframes.core.agg_expressions as ex_types import bigframes.core.compile.googlesql import bigframes.core.compile.ibis_compiler.aggregate_compiler as agg_compiler @@ -38,8 +37,6 @@ import bigframes.core.sql from bigframes.core.window_spec import WindowSpec import bigframes.dtypes -import bigframes.operations as ops -import bigframes.operations.aggregations as agg_ops op_compiler = op_compilers.scalar_op_compiler @@ -424,59 +421,11 @@ def project_window_op( output_name, ) - if expression.op.order_independent and window_spec.is_unbounded: - # notably percentile_cont does not support ordering clause - window_spec = window_spec.without_order() - - # TODO: Turn this logic into a true rewriter - result_expr: ex.Expression = agg_expressions.WindowExpression( - expression, window_spec + rewritten_expr = rewrite.simplify_complex_windows( + agg_expressions.WindowExpression(expression, window_spec) ) - clauses: list[tuple[ex.Expression, ex.Expression]] = [] - if window_spec.min_periods and len(expression.inputs) > 0: - if not expression.op.nulls_count_for_min_values: - is_observation = ops.notnull_op.as_expr() - - # Most operations do not count NULL values towards min_periods - per_col_does_count = ( - ops.notnull_op.as_expr(input) for input in expression.inputs - ) - # All inputs must be non-null for observation to count - is_observation = functools.reduce( - lambda x, y: ops.and_op.as_expr(x, y), per_col_does_count - ) - observation_sentinel = ops.AsTypeOp(bigframes.dtypes.INT_DTYPE).as_expr( - is_observation - ) - observation_count_expr = agg_expressions.WindowExpression( - ex_types.UnaryAggregation(agg_ops.sum_op, observation_sentinel), - window_spec, - ) - else: - # Operations like count treat even NULLs as valid observations for the sake of min_periods - # notnull is just used to convert null values to non-null (FALSE) values to be counted - is_observation = ops.notnull_op.as_expr(expression.inputs[0]) - observation_count_expr = agg_expressions.WindowExpression( - agg_ops.count_op.as_expr(is_observation), - window_spec, - ) - clauses.append( - ( - ops.lt_op.as_expr( - observation_count_expr, ex.const(window_spec.min_periods) - ), - ex.const(None), - ) - ) - if clauses: - case_inputs = [ - *itertools.chain.from_iterable(clauses), - ex.const(True), - result_expr, - ] - result_expr = ops.CaseWhenOp().as_expr(*case_inputs) - - ibis_expr = op_compiler.compile_expression(result_expr, self._ibis_bindings) + + ibis_expr = op_compiler.compile_expression(rewritten_expr, self._ibis_bindings) return UnorderedIR(self._table, (*self.columns, ibis_expr.name(output_name))) diff --git a/bigframes/core/compile/sqlglot/compiler.py b/bigframes/core/compile/sqlglot/compiler.py index f2c94f98c7a..2402bf0f64d 100644 --- a/bigframes/core/compile/sqlglot/compiler.py +++ b/bigframes/core/compile/sqlglot/compiler.py @@ -20,13 +20,13 @@ import bigframes_vendored.sqlglot.expressions as sge from bigframes.core import ( - agg_expressions, expression, guid, identifiers, nodes, pyarrow_utils, rewrite, + sql_nodes, ) from bigframes.core.compile import configs import bigframes.core.compile.sqlglot.aggregate_compiler as aggregate_compiler @@ -104,30 +104,10 @@ def _compile_result_node(root: nodes.ResultNode) -> str: root = typing.cast(nodes.ResultNode, rewrite.defer_selection(root)) # Have to bind schema as the final step before compilation. + # Probably, should defer even further root = typing.cast(nodes.ResultNode, schema_binding.bind_schema_to_tree(root)) - selected_cols: tuple[tuple[str, sge.Expression], ...] = tuple( - (name, scalar_compiler.scalar_op_compiler.compile_expression(ref)) - for ref, name in root.output_cols - ) - sqlglot_ir = compile_node(root.child, uid_gen).select(selected_cols) - - if root.order_by is not None: - ordering_cols = tuple( - sge.Ordered( - this=scalar_compiler.scalar_op_compiler.compile_expression( - ordering.scalar_expression - ), - desc=ordering.direction.is_ascending is False, - nulls_first=ordering.na_last is False, - ) - for ordering in root.order_by.all_ordering_columns - ) - sqlglot_ir = sqlglot_ir.order_by(ordering_cols) - - if root.limit is not None: - sqlglot_ir = sqlglot_ir.limit(root.limit) - + sqlglot_ir = compile_node(rewrite.as_sql_nodes(root), uid_gen) return sqlglot_ir.sql @@ -160,6 +140,37 @@ def _compile_node( raise ValueError(f"Can't compile unrecognized node: {node}") +@_compile_node.register +def compile_sql_select(node: sql_nodes.SelectNode, child: ir.SQLGlotIR): + sqlglot_ir = child + if node.sorting is not None: + ordering_cols = tuple( + sge.Ordered( + this=scalar_compiler.scalar_op_compiler.compile_expression( + ordering.scalar_expression + ), + desc=ordering.direction.is_ascending is False, + nulls_first=ordering.na_last is False, + ) + for ordering in node.sorting + ) + sqlglot_ir = sqlglot_ir.order_by(ordering_cols) + + projected_cols: tuple[tuple[str, sge.Expression], ...] = tuple( + ( + cdef.id.sql, + scalar_compiler.scalar_op_compiler.compile_expression(cdef.expression), + ) + for cdef in node.selections + ) + sqlglot_ir = sqlglot_ir.project(projected_cols) + + if node.limit is not None: + sqlglot_ir = sqlglot_ir.limit(node.limit) + + return sqlglot_ir + + @_compile_node.register def compile_readlocal(node: nodes.ReadLocalNode, child: ir.SQLGlotIR) -> ir.SQLGlotIR: pa_table = node.local_data_source.data @@ -188,30 +199,6 @@ def compile_readtable(node: nodes.ReadTableNode, child: ir.SQLGlotIR): ) -@_compile_node.register -def compile_selection(node: nodes.SelectionNode, child: ir.SQLGlotIR) -> ir.SQLGlotIR: - selected_cols: tuple[tuple[str, sge.Expression], ...] = tuple( - (id.sql, scalar_compiler.scalar_op_compiler.compile_expression(expr)) - for expr, id in node.input_output_pairs - ) - return child.select(selected_cols) - - -@_compile_node.register -def compile_projection(node: nodes.ProjectionNode, child: ir.SQLGlotIR) -> ir.SQLGlotIR: - projected_cols: tuple[tuple[str, sge.Expression], ...] = tuple( - (id.sql, scalar_compiler.scalar_op_compiler.compile_expression(expr)) - for expr, id in node.assignments - ) - return child.project(projected_cols) - - -@_compile_node.register -def compile_filter(node: nodes.FilterNode, child: ir.SQLGlotIR) -> ir.SQLGlotIR: - condition = scalar_compiler.scalar_op_compiler.compile_expression(node.predicate) - return child.filter(tuple([condition])) - - @_compile_node.register def compile_join( node: nodes.JoinNode, left: ir.SQLGlotIR, right: ir.SQLGlotIR @@ -325,79 +312,6 @@ def compile_aggregate(node: nodes.AggregateNode, child: ir.SQLGlotIR) -> ir.SQLG return child.aggregate(aggregations, by_cols, tuple(dropna_cols)) -@_compile_node.register -def compile_window(node: nodes.WindowOpNode, child: ir.SQLGlotIR) -> ir.SQLGlotIR: - window_spec = node.window_spec - result = child - for cdef in node.agg_exprs: - assert isinstance(cdef.expression, agg_expressions.Aggregation) - if cdef.expression.op.order_independent and window_spec.is_unbounded: - # notably percentile_cont does not support ordering clause - window_spec = window_spec.without_order() - - window_op = aggregate_compiler.compile_analytic(cdef.expression, window_spec) - - inputs: tuple[sge.Expression, ...] = tuple( - scalar_compiler.scalar_op_compiler.compile_expression( - expression.DerefOp(column) - ) - for column in cdef.expression.column_references - ) - - clauses: list[tuple[sge.Expression, sge.Expression]] = [] - if window_spec.min_periods and len(inputs) > 0: - if not cdef.expression.op.nulls_count_for_min_values: - # Most operations do not count NULL values towards min_periods - not_null_columns = [ - sge.Not(this=sge.Is(this=column, expression=sge.Null())) - for column in inputs - ] - # All inputs must be non-null for observation to count - if not not_null_columns: - is_observation_expr: sge.Expression = sge.convert(True) - else: - is_observation_expr = not_null_columns[0] - for expr in not_null_columns[1:]: - is_observation_expr = sge.And( - this=is_observation_expr, expression=expr - ) - is_observation = ir._cast(is_observation_expr, "INT64") - observation_count = windows.apply_window_if_present( - sge.func("SUM", is_observation), window_spec - ) - observation_count = sge.func( - "COALESCE", observation_count, sge.convert(0) - ) - else: - # Operations like count treat even NULLs as valid observations - # for the sake of min_periods notnull is just used to convert - # null values to non-null (FALSE) values to be counted. - is_observation = ir._cast( - sge.Not(this=sge.Is(this=inputs[0], expression=sge.Null())), - "INT64", - ) - observation_count = windows.apply_window_if_present( - sge.func("COUNT", is_observation), window_spec - ) - - clauses.append( - ( - observation_count < sge.convert(window_spec.min_periods), - sge.Null(), - ) - ) - if clauses: - when_expressions = [sge.When(this=cond, true=res) for cond, res in clauses] - window_op = sge.Case(ifs=when_expressions, default=window_op) - - # TODO: check if we can directly window the expression. - result = result.window( - window_op=window_op, - output_column_id=cdef.id.sql, - ) - return result - - def _replace_unsupported_ops(node: nodes.BigFrameNode): node = nodes.bottom_up(node, rewrite.rewrite_slice) node = nodes.bottom_up(node, rewrite.rewrite_range_rolling) diff --git a/bigframes/core/compile/sqlglot/expression_compiler.py b/bigframes/core/compile/sqlglot/expression_compiler.py new file mode 100644 index 00000000000..4254bd7afe0 --- /dev/null +++ b/bigframes/core/compile/sqlglot/expression_compiler.py @@ -0,0 +1,221 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from __future__ import annotations + +import functools +import typing + +import bigframes_vendored.sqlglot.expressions as sge + +from bigframes.core.compile.sqlglot.expressions.typed_expr import TypedExpr +import bigframes.core.compile.sqlglot.sqlglot_ir as ir +import bigframes.core.expression as ex +import bigframes.operations as ops + + +class ScalarOpCompiler: + # Mapping of operation name to implemenations + _registry: dict[ + str, + typing.Callable[[typing.Sequence[TypedExpr], ops.RowOp], sge.Expression], + ] = {} + + # A set of SQLGlot classes that may need to be parenthesized + SQLGLOT_NEEDS_PARENS = { + # Numeric operations + sge.Add, + sge.Sub, + sge.Mul, + sge.Div, + sge.Mod, + sge.Pow, + # Comparison operations + sge.GTE, + sge.GT, + sge.LTE, + sge.LT, + sge.EQ, + sge.NEQ, + # Logical operations + sge.And, + sge.Or, + sge.Xor, + # Bitwise operations + sge.BitwiseAnd, + sge.BitwiseOr, + sge.BitwiseXor, + sge.BitwiseLeftShift, + sge.BitwiseRightShift, + sge.BitwiseNot, + # Other operations + sge.Is, + } + + @functools.singledispatchmethod + def compile_expression( + self, + expression: ex.Expression, + ) -> sge.Expression: + """Compiles BigFrames scalar expression into SQLGlot expression.""" + raise NotImplementedError(f"Unrecognized expression: {expression}") + + @compile_expression.register + def _(self, expr: ex.DerefOp) -> sge.Expression: + return sge.Column(this=sge.to_identifier(expr.id.sql, quoted=True)) + + @compile_expression.register + def _(self, expr: ex.ScalarConstantExpression) -> sge.Expression: + return ir._literal(expr.value, expr.dtype) + + @compile_expression.register + def _(self, expr: ex.OpExpression) -> sge.Expression: + # Non-recursively compiles the children scalar expressions. + inputs = tuple( + TypedExpr(self.compile_expression(sub_expr), sub_expr.output_type) + for sub_expr in expr.inputs + ) + return self.compile_row_op(expr.op, inputs) + + def compile_row_op( + self, op: ops.RowOp, inputs: typing.Sequence[TypedExpr] + ) -> sge.Expression: + impl = self._registry[op.name] + return impl(inputs, op) + + def register_unary_op( + self, + op_ref: typing.Union[ops.UnaryOp, type[ops.UnaryOp]], + pass_op: bool = False, + ): + """ + Decorator to register a unary op implementation. + + Args: + op_ref (UnaryOp or UnaryOp type): + Class or instance of operator that is implemented by the decorated function. + pass_op (bool): + Set to true if implementation takes the operator object as the last argument. + This is needed for parameterized ops where parameters are part of op object. + """ + key = typing.cast(str, op_ref.name) + + def decorator(impl: typing.Callable[..., sge.Expression]): + def normalized_impl(args: typing.Sequence[TypedExpr], op: ops.RowOp): + if pass_op: + return impl(args[0], op) + else: + return impl(args[0]) + + self._register(key, normalized_impl) + return impl + + return decorator + + def register_binary_op( + self, + op_ref: typing.Union[ops.BinaryOp, type[ops.BinaryOp]], + pass_op: bool = False, + ): + """ + Decorator to register a binary op implementation. + + Args: + op_ref (BinaryOp or BinaryOp type): + Class or instance of operator that is implemented by the decorated function. + pass_op (bool): + Set to true if implementation takes the operator object as the last argument. + This is needed for parameterized ops where parameters are part of op object. + """ + key = typing.cast(str, op_ref.name) + + def decorator(impl: typing.Callable[..., sge.Expression]): + def normalized_impl(args: typing.Sequence[TypedExpr], op: ops.RowOp): + left = self._add_parentheses(args[0]) + right = self._add_parentheses(args[1]) + if pass_op: + return impl(left, right, op) + else: + return impl(left, right) + + self._register(key, normalized_impl) + return impl + + return decorator + + def register_ternary_op( + self, op_ref: typing.Union[ops.TernaryOp, type[ops.TernaryOp]] + ): + """ + Decorator to register a ternary op implementation. + + Args: + op_ref (TernaryOp or TernaryOp type): + Class or instance of operator that is implemented by the decorated function. + """ + key = typing.cast(str, op_ref.name) + + def decorator(impl: typing.Callable[..., sge.Expression]): + def normalized_impl(args: typing.Sequence[TypedExpr], op: ops.RowOp): + return impl(args[0], args[1], args[2]) + + self._register(key, normalized_impl) + return impl + + return decorator + + def register_nary_op( + self, op_ref: typing.Union[ops.NaryOp, type[ops.NaryOp]], pass_op: bool = False + ): + """ + Decorator to register a nary op implementation. + + Args: + op_ref (NaryOp or NaryOp type): + Class or instance of operator that is implemented by the decorated function. + pass_op (bool): + Set to true if implementation takes the operator object as the last argument. + This is needed for parameterized ops where parameters are part of op object. + """ + key = typing.cast(str, op_ref.name) + + def decorator(impl: typing.Callable[..., sge.Expression]): + def normalized_impl(args: typing.Sequence[TypedExpr], op: ops.RowOp): + if pass_op: + return impl(*args, op=op) + else: + return impl(*args) + + self._register(key, normalized_impl) + return impl + + return decorator + + def _register( + self, + op_name: str, + impl: typing.Callable[[typing.Sequence[TypedExpr], ops.RowOp], sge.Expression], + ): + if op_name in self._registry: + raise ValueError(f"Operation name {op_name} already registered") + self._registry[op_name] = impl + + @classmethod + def _add_parentheses(cls, expr: TypedExpr) -> TypedExpr: + if type(expr.expr) in cls.SQLGLOT_NEEDS_PARENS: + return TypedExpr(sge.paren(expr.expr, copy=False), expr.dtype) + return expr + + +# Singleton compiler +scalar_op_compiler = ScalarOpCompiler() diff --git a/bigframes/core/compile/sqlglot/scalar_compiler.py b/bigframes/core/compile/sqlglot/scalar_compiler.py index 317141b6cc4..78eb5b59b25 100644 --- a/bigframes/core/compile/sqlglot/scalar_compiler.py +++ b/bigframes/core/compile/sqlglot/scalar_compiler.py @@ -18,6 +18,7 @@ import bigframes_vendored.sqlglot.expressions as sge +import bigframes.core.agg_expressions as agg_exprs from bigframes.core.compile.sqlglot.expressions.typed_expr import TypedExpr import bigframes.core.compile.sqlglot.sqlglot_ir as ir import bigframes.core.expression as ex @@ -78,6 +79,15 @@ def _(self, expr: ex.DerefOp) -> sge.Expression: def _(self, expr: ex.ScalarConstantExpression) -> sge.Expression: return ir._literal(expr.value, expr.dtype) + @compile_expression.register + def _(self, expr: agg_exprs.WindowExpression) -> sge.Expression: + import bigframes.core.compile.sqlglot.aggregate_compiler as agg_compile + + return agg_compile.compile_analytic( + expr.analytic_expr, + expr.window, + ) + @compile_expression.register def _(self, expr: ex.OpExpression) -> sge.Expression: # Non-recursively compiles the children scalar expressions. diff --git a/bigframes/core/rewrite/__init__.py b/bigframes/core/rewrite/__init__.py index 4e5295ae9d3..a120612aae5 100644 --- a/bigframes/core/rewrite/__init__.py +++ b/bigframes/core/rewrite/__init__.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from bigframes.core.rewrite.as_sql import as_sql_nodes from bigframes.core.rewrite.fold_row_count import fold_row_counts from bigframes.core.rewrite.identifiers import remap_variables from bigframes.core.rewrite.implicit_align import try_row_join @@ -25,9 +26,14 @@ from bigframes.core.rewrite.select_pullup import defer_selection from bigframes.core.rewrite.slices import pull_out_limit, pull_up_limits, rewrite_slice from bigframes.core.rewrite.timedeltas import rewrite_timedelta_expressions -from bigframes.core.rewrite.windows import pull_out_window_order, rewrite_range_rolling +from bigframes.core.rewrite.windows import ( + pull_out_window_order, + rewrite_range_rolling, + simplify_complex_windows, +) __all__ = [ + "as_sql_nodes", "legacy_join_as_projection", "try_row_join", "rewrite_slice", @@ -44,4 +50,5 @@ "fold_row_counts", "pull_out_window_order", "defer_selection", + "simplify_complex_windows", ] diff --git a/bigframes/core/rewrite/as_sql.py b/bigframes/core/rewrite/as_sql.py new file mode 100644 index 00000000000..307fffa691e --- /dev/null +++ b/bigframes/core/rewrite/as_sql.py @@ -0,0 +1,213 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from __future__ import annotations + +import dataclasses +from typing import Optional, Sequence, Union + +from bigframes.core import ( + agg_expressions, + expression, + identifiers, + nodes, + ordering, + sql_nodes, +) +import bigframes.core.rewrite + + +def _limit(select: sql_nodes.SelectNode, limit: int) -> sql_nodes.SelectNode: + new_limit = limit if select.limit is None else min([select.limit, limit]) + return dataclasses.replace(select, limit=new_limit) + + +def _try_sort( + select: sql_nodes.SelectNode, sort_by: Sequence[ordering.OrderingExpression] +) -> Optional[sql_nodes.SelectNode]: + new_order_exprs = [] + for sort_expr in sort_by: + new_expr = _try_bind( + sort_expr.scalar_expression, select.get_id_mapping(), analytic_allowed=False + ) + if new_expr is None: + return None + new_order_exprs.append( + dataclasses.replace(sort_expr, scalar_expression=new_expr) + ) + return dataclasses.replace(select, sorting=tuple(new_order_exprs)) + + +def _sort( + node: nodes.BigFrameNode, sort_by: Sequence[ordering.OrderingExpression] +) -> sql_nodes.SelectNode: + if isinstance(node, sql_nodes.SelectNode): + merged = _try_sort(node, sort_by) + if merged: + return merged + result = _try_sort(_create_noop_select(node), sort_by) + assert result is not None + return result + + +def _try_bind( + expr: expression.Expression, + bindings: dict[identifiers.ColumnId, expression.Expression], + analytic_allowed: bool = False, # means block binding to an analytic even if original is scalar +) -> Optional[expression.Expression]: + if not expr.is_scalar_expr or not analytic_allowed: + for ref in expr.column_references: + if ref in bindings and not bindings[ref].is_scalar_expr: + return None + return expr.bind_refs(bindings) + + +def _try_add_cdefs( + select: sql_nodes.SelectNode, cdefs: Sequence[nodes.ColumnDef] +) -> Optional[sql_nodes.SelectNode]: + # TODO: add up complexity measure while inlining refs + new_defs = [] + for cdef in cdefs: + cdef_expr = cdef.expression + merged_expr = _try_bind( + cdef_expr, select.get_id_mapping(), analytic_allowed=True + ) + if merged_expr is None: + return None + new_defs.append(nodes.ColumnDef(merged_expr, cdef.id)) + + return dataclasses.replace(select, selections=(*select.selections, *new_defs)) + + +def _add_cdefs( + node: nodes.BigFrameNode, cdefs: Sequence[nodes.ColumnDef] +) -> sql_nodes.SelectNode: + if isinstance(node, sql_nodes.SelectNode): + merged = _try_add_cdefs(node, cdefs) + if merged: + return merged + # Otherwise, wrap the child in a SELECT and add the columns + result = _try_add_cdefs(_create_noop_select(node), cdefs) + assert result is not None + return result + + +def _try_add_filter( + select: sql_nodes.SelectNode, predicates: Sequence[expression.Expression] +) -> Optional[sql_nodes.SelectNode]: + # Constraint: filters can only be merged if they are scalar expression after binding + new_predicates = [] + # bind variables, merge predicates + for predicate in predicates: + merged_pred = _try_bind(predicate, select.get_id_mapping()) + if not merged_pred: + return None + new_predicates.append(merged_pred) + return dataclasses.replace(select, predicates=(*select.predicates, *new_predicates)) + + +def _add_filter( + node: nodes.BigFrameNode, predicates: Sequence[expression.Expression] +) -> sql_nodes.SelectNode: + if isinstance(node, sql_nodes.SelectNode): + result = _try_add_filter(node, predicates) + if result: + return result + new_node = _try_add_filter(_create_noop_select(node), predicates) + assert new_node is not None + return new_node + + +def _create_noop_select(node: nodes.BigFrameNode) -> sql_nodes.SelectNode: + return sql_nodes.SelectNode( + node, + selections=tuple( + nodes.ColumnDef(expression.ResolvedDerefOp.from_field(field), field.id) + for field in node.fields + ), + ) + + +def _try_remap_select_cols( + select: sql_nodes.SelectNode, cols: Sequence[nodes.AliasedRef] +): + new_defs = [] + for aliased_ref in cols: + new_defs.append( + nodes.ColumnDef(select.get_id_mapping()[aliased_ref.ref.id], aliased_ref.id) + ) + + return dataclasses.replace(select, selections=tuple(new_defs)) + + +def _remap_select_cols(node: nodes.BigFrameNode, cols: Sequence[nodes.AliasedRef]): + if isinstance(node, sql_nodes.SelectNode): + result = _try_remap_select_cols(node, cols) + if result: + return result + new_node = _try_remap_select_cols(_create_noop_select(node), cols) + assert new_node is not None + return new_node + + +def _get_added_cdefs(node: Union[nodes.ProjectionNode, nodes.WindowOpNode]): + # TODO: InNode + if isinstance(node, nodes.ProjectionNode): + return tuple(nodes.ColumnDef(expr, id) for expr, id in node.assignments) + if isinstance(node, nodes.WindowOpNode): + new_cdefs = [] + for cdef in node.agg_exprs: + assert isinstance(cdef.expression, agg_expressions.Aggregation) + window_expr = agg_expressions.WindowExpression( + cdef.expression, node.window_spec + ) + # TODO: we probably should do this as another step + rewritten_window_expr = bigframes.core.rewrite.simplify_complex_windows( + window_expr + ) + new_cdefs.append(nodes.ColumnDef(rewritten_window_expr, cdef.id)) + return tuple(new_cdefs) + else: + raise ValueError(f"Unexpected node type: {type(node)}") + + +def _as_sql_node(node: nodes.BigFrameNode) -> nodes.BigFrameNode: + # case one, can be converted to select + if isinstance(node, (nodes.ProjectionNode, nodes.WindowOpNode)): + cdefs = _get_added_cdefs(node) + return _add_cdefs(node.child, cdefs) + elif isinstance(node, (nodes.SelectionNode)): + return _remap_select_cols(node.child, node.input_output_pairs) + elif isinstance(node, nodes.FilterNode): + return _add_filter(node.child, [node.predicate]) + elif isinstance(node, nodes.ResultNode): + result = node.child + if node.order_by is not None: + result = _sort(result, node.order_by.all_ordering_columns) + result = _remap_select_cols( + node.child, + [ + nodes.AliasedRef(ref, identifiers.ColumnId(name)) + for ref, name in node.output_cols + ], + ) + if node.limit is not None: + result = _limit(result, node.limit) # type: ignore + return result + else: + return node + + +def as_sql_nodes(root: nodes.BigFrameNode) -> nodes.BigFrameNode: + # TODO: Aggregations, Unions, Joins, raw data sources + return nodes.bottom_up(root, _as_sql_node) diff --git a/bigframes/core/rewrite/windows.py b/bigframes/core/rewrite/windows.py index 6e9ba0dd3d0..b95a47d72a5 100644 --- a/bigframes/core/rewrite/windows.py +++ b/bigframes/core/rewrite/windows.py @@ -15,9 +15,72 @@ from __future__ import annotations import dataclasses +import functools +import itertools from bigframes import operations as ops -from bigframes.core import guid, identifiers, nodes, ordering +from bigframes.core import ( + agg_expressions, + expression, + guid, + identifiers, + nodes, + ordering, +) +import bigframes.dtypes +from bigframes.operations import aggregations as agg_ops + + +def simplify_complex_windows( + window_expr: agg_expressions.WindowExpression, +) -> expression.Expression: + result_expr: expression.Expression = window_expr + agg_expr = window_expr.analytic_expr + window_spec = window_expr.window + clauses: list[tuple[expression.Expression, expression.Expression]] = [] + if window_spec.min_periods and len(agg_expr.inputs) > 0: + if not agg_expr.op.nulls_count_for_min_values: + is_observation = ops.notnull_op.as_expr() + + # Most operations do not count NULL values towards min_periods + per_col_does_count = ( + ops.notnull_op.as_expr(input) for input in agg_expr.inputs + ) + # All inputs must be non-null for observation to count + is_observation = functools.reduce( + lambda x, y: ops.and_op.as_expr(x, y), per_col_does_count + ) + observation_sentinel = ops.AsTypeOp(bigframes.dtypes.INT_DTYPE).as_expr( + is_observation + ) + observation_count_expr = agg_expressions.WindowExpression( + agg_expressions.UnaryAggregation(agg_ops.sum_op, observation_sentinel), + window_spec, + ) + else: + # Operations like count treat even NULLs as valid observations for the sake of min_periods + # notnull is just used to convert null values to non-null (FALSE) values to be counted + is_observation = ops.notnull_op.as_expr(agg_expr.inputs[0]) + observation_count_expr = agg_expressions.WindowExpression( + agg_ops.count_op.as_expr(is_observation), + window_spec, + ) + clauses.append( + ( + ops.lt_op.as_expr( + observation_count_expr, expression.const(window_spec.min_periods) + ), + expression.const(None), + ) + ) + if clauses: + case_inputs = [ + *itertools.chain.from_iterable(clauses), + expression.const(True), + result_expr, + ] + result_expr = ops.CaseWhenOp().as_expr(*case_inputs) + return result_expr def rewrite_range_rolling(node: nodes.BigFrameNode) -> nodes.BigFrameNode: diff --git a/bigframes/core/sql_nodes.py b/bigframes/core/sql_nodes.py new file mode 100644 index 00000000000..d58add355da --- /dev/null +++ b/bigframes/core/sql_nodes.py @@ -0,0 +1,115 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations + +import dataclasses +import functools +from typing import Mapping, Optional, Sequence, Tuple + +from bigframes.core import identifiers, nodes +import bigframes.core.expression as ex +from bigframes.core.ordering import OrderingExpression +import bigframes.dtypes + +# A fixed number of variable to assume for overhead on some operations +OVERHEAD_VARIABLES = 5 + + +@dataclasses.dataclass(frozen=True, eq=True) +class ColumnDef: + expression: ex.Expression + id: identifiers.ColumnId + + +# TODO: Raw data source node, join node, union node + + +@dataclasses.dataclass(frozen=True) +class SelectNode(nodes.UnaryNode): + selections: tuple[nodes.ColumnDef, ...] = () + predicates: tuple[ex.Expression, ...] = () + sorting: tuple[OrderingExpression, ...] = () + limit: Optional[int] = None + + def __post_init__(self): + try: + self.fields + except Exception: + ... + + @functools.cached_property + def fields(self) -> Sequence[nodes.Field]: + fields = [] + for cdef in self.selections: + bound_expr = ex.bind_schema_fields(cdef.expression, self.child.field_by_id) + field = nodes.Field( + cdef.id, + bigframes.dtypes.dtype_for_etype(bound_expr.output_type), + nullable=bound_expr.nullable, + ) + + # Special case until we get better nullability inference in expression objects themselves + if bound_expr.is_identity and not any( + self.child.field_by_id[id].nullable + for id in cdef.expression.column_references + ): + field = field.with_nonnull() + fields.append(field) + + return tuple(fields) + + @property + def variables_introduced(self) -> int: + # This operation only renames variables, doesn't actually create new ones + return 0 + + @property + def defines_namespace(self) -> bool: + return True + + @property + def row_count(self) -> Optional[int]: + if self.child.row_count is not None: + if self.limit is not None: + return min([self.limit, self.child.row_count]) + return self.child.row_count + + return None + + @property + def node_defined_ids(self) -> Tuple[identifiers.ColumnId, ...]: + return tuple(cdef.id for cdef in self.selections) + + @property + def consumed_ids(self): + raise NotImplementedError() + + @property + def _node_expressions(self): + raise NotImplementedError() + + @functools.cache + def get_id_mapping(self) -> dict[identifiers.ColumnId, ex.Expression]: + return {cdef.id: cdef.expression for cdef in self.selections} + + def remap_vars( + self, mappings: Mapping[identifiers.ColumnId, identifiers.ColumnId] + ) -> SelectNode: + raise NotImplementedError() + + def remap_refs( + self, mappings: Mapping[identifiers.ColumnId, identifiers.ColumnId] + ) -> SelectNode: + raise NotImplementedError() # type: ignore diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_corr/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_corr/out.sql index 5c838f48827..714991256ef 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 @@ -9,5 +9,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT + *, `bfcol_2` AS `corr_col` FROM `bfcte_1` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_cov/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_cov/out.sql index eda082250a6..c25b460ac2f 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 @@ -9,5 +9,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT + *, `bfcol_2` AS `cov_col` FROM `bfcte_1` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number/out.sql index f1197465f0d..804c54d3cc2 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 @@ -16,12 +16,8 @@ WITH `bfcte_0` AS ( `time_col`, `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ROW_NUMBER() OVER () - 1 AS `bfcol_32` - FROM `bfcte_0` ) SELECT - `bfcol_32` AS `row_number` -FROM `bfcte_1` \ No newline at end of file + *, + ROW_NUMBER() OVER () - 1 AS `row_number` +FROM `bfcte_0` \ No newline at end of file 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 bfa67b8a747..c2de57a1162 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ROW_NUMBER() OVER (ORDER BY `int64_col` ASC NULLS LAST) - 1 AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `row_number` -FROM `bfcte_1` \ No newline at end of file + *, + ROW_NUMBER() OVER (ORDER BY `int64_col` ASC NULLS LAST) - 1 AS `row_number` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_size/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_size/out.sql index ed8e0c7619d..b61e19c6197 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 @@ -22,5 +22,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT + *, `bfcol_32` AS `size` FROM `bfcte_1` \ No newline at end of file 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 eafbc39daf8..a27e5feb871 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 @@ -8,5 +8,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT + *, `bfcol_1` AS `int64_col` FROM `bfcte_1` \ No newline at end of file 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 321341d4a0a..d1873661f97 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 @@ -14,5 +14,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT + *, `bfcol_1` AS `string_col` FROM `bfcte_1` \ No newline at end of file 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 0be2fea80b2..7d4b4ddbf8b 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 @@ -10,6 +10,7 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT + *, `bfcol_2` AS `bool_col`, `bfcol_3` AS `int64_col` FROM `bfcte_1` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all_w_window/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all_w_window/out.sql index 829e5a88361..59b43e6f24d 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all_w_window/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all_w_window/out.sql @@ -2,12 +2,14 @@ WITH `bfcte_0` AS ( SELECT `bool_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - COALESCE(LOGICAL_AND(`bool_col`) OVER (), TRUE) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_bool` -FROM `bfcte_1` \ No newline at end of file + *, + COALESCE( + LOGICAL_AND(`bool_col`) OVER ( + ORDER BY `bool_col` ASC NULLS LAST + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ), + TRUE + ) AS `agg_bool` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any/out.sql index ae62e22e36d..be0c8488dcc 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any/out.sql @@ -10,6 +10,7 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT + *, `bfcol_2` AS `bool_col`, `bfcol_3` AS `int64_col` FROM `bfcte_1` \ No newline at end of file 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 4a13901f1c4..b0565c6cedd 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 @@ -8,5 +8,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT + *, `bfcol_1` AS `int64_col` FROM `bfcte_1` \ No newline at end of file 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 ea15243d90a..19da3291a98 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 @@ -2,12 +2,11 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ANY_VALUE(`int64_col`) OVER () AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + ANY_VALUE(`int64_col`) OVER ( + ORDER BY `int64_col` DESC + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file 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 e722318fbce..d53a6eedb1d 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 @@ -3,12 +3,12 @@ WITH `bfcte_0` AS ( `int64_col`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ANY_VALUE(`int64_col`) OVER (PARTITION BY `string_col`) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + ANY_VALUE(`int64_col`) OVER ( + PARTITION BY `string_col` + ORDER BY `int64_col` ASC NULLS LAST + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_w_window/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_w_window/out.sql index 337f0ff9638..df3d30e0376 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_w_window/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_w_window/out.sql @@ -2,12 +2,14 @@ WITH `bfcte_0` AS ( SELECT `bool_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - COALESCE(LOGICAL_OR(`bool_col`) OVER (), FALSE) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_bool` -FROM `bfcte_1` \ No newline at end of file + *, + COALESCE( + LOGICAL_OR(`bool_col`) OVER ( + ORDER BY `bool_col` ASC NULLS LAST + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ), + FALSE + ) AS `agg_bool` +FROM `bfcte_0` \ No newline at end of file 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 9eabb2d88a7..cba8708bec4 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 @@ -10,6 +10,7 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT + *, `bfcol_1` AS `q1`, `bfcol_2` AS `q2`, `bfcol_3` AS `q3` 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 b5e6275381b..6d0ab7a0e57 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 @@ -8,5 +8,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT + *, `bfcol_1` AS `int64_col` FROM `bfcte_1` \ No newline at end of file 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 9d18367cf61..6b7382fb56c 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 @@ -8,5 +8,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT + *, `bfcol_1` AS `int64_col` FROM `bfcte_1` \ No newline at end of file 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 0baac953118..847070788dd 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 @@ -2,12 +2,11 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - COUNT(`int64_col`) OVER () AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + COUNT(`int64_col`) OVER ( + ORDER BY `int64_col` ASC NULLS LAST + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file 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 6d3f8564599..d5aea84b045 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 @@ -3,12 +3,12 @@ WITH `bfcte_0` AS ( `int64_col`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - COUNT(`int64_col`) OVER (PARTITION BY `string_col`) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + COUNT(`int64_col`) OVER ( + PARTITION BY `string_col` + ORDER BY `int64_col` DESC + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins.sql index 015ac327998..3baaaa352d4 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins.sql @@ -2,54 +2,50 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - WHEN `int64_col` <= MIN(`int64_col`) OVER () + ( - 1 * IEEE_DIVIDE(MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER (), 3) - ) - THEN STRUCT( +) +SELECT + *, + CASE + WHEN `int64_col` <= MIN(`int64_col`) OVER () + ( + 1 * IEEE_DIVIDE(MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER (), 3) + ) + THEN STRUCT( + ( + MIN(`int64_col`) OVER () + ( + 0 * IEEE_DIVIDE(MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER (), 3) + ) + ) - ( ( - MIN(`int64_col`) OVER () + ( - 0 * IEEE_DIVIDE(MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER (), 3) - ) - ) - ( - ( - MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER () - ) * 0.001 - ) AS `left_exclusive`, + MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER () + ) * 0.001 + ) AS `left_exclusive`, + MIN(`int64_col`) OVER () + ( + 1 * IEEE_DIVIDE(MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER (), 3) + ) + 0 AS `right_inclusive` + ) + WHEN `int64_col` <= MIN(`int64_col`) OVER () + ( + 2 * IEEE_DIVIDE(MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER (), 3) + ) + THEN STRUCT( + ( MIN(`int64_col`) OVER () + ( 1 * IEEE_DIVIDE(MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER (), 3) - ) + 0 AS `right_inclusive` - ) - WHEN `int64_col` <= MIN(`int64_col`) OVER () + ( + ) + ) - 0 AS `left_exclusive`, + MIN(`int64_col`) OVER () + ( 2 * IEEE_DIVIDE(MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER (), 3) - ) - THEN STRUCT( - ( - MIN(`int64_col`) OVER () + ( - 1 * IEEE_DIVIDE(MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER (), 3) - ) - ) - 0 AS `left_exclusive`, + ) + 0 AS `right_inclusive` + ) + WHEN `int64_col` IS NOT NULL + THEN STRUCT( + ( MIN(`int64_col`) OVER () + ( 2 * IEEE_DIVIDE(MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER (), 3) - ) + 0 AS `right_inclusive` - ) - WHEN `int64_col` IS NOT NULL - THEN STRUCT( - ( - MIN(`int64_col`) OVER () + ( - 2 * IEEE_DIVIDE(MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER (), 3) - ) - ) - 0 AS `left_exclusive`, - MIN(`int64_col`) OVER () + ( - 3 * IEEE_DIVIDE(MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER (), 3) - ) + 0 AS `right_inclusive` - ) - END AS `bfcol_1` - FROM `bfcte_0` -) -SELECT - `bfcol_1` AS `int_bins` -FROM `bfcte_1` \ No newline at end of file + ) + ) - 0 AS `left_exclusive`, + MIN(`int64_col`) OVER () + ( + 3 * IEEE_DIVIDE(MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER (), 3) + ) + 0 AS `right_inclusive` + ) + END AS `int_bins` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins_labels.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins_labels.sql index c98682f2b83..b3e10428af6 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins_labels.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins_labels.sql @@ -2,23 +2,19 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - WHEN `int64_col` < MIN(`int64_col`) OVER () + ( - 1 * IEEE_DIVIDE(MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER (), 3) - ) - THEN 'a' - WHEN `int64_col` < MIN(`int64_col`) OVER () + ( - 2 * IEEE_DIVIDE(MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER (), 3) - ) - THEN 'b' - WHEN `int64_col` IS NOT NULL - THEN 'c' - END AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `int_bins_labels` -FROM `bfcte_1` \ No newline at end of file + *, + CASE + WHEN `int64_col` < MIN(`int64_col`) OVER () + ( + 1 * IEEE_DIVIDE(MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER (), 3) + ) + THEN 'a' + WHEN `int64_col` < MIN(`int64_col`) OVER () + ( + 2 * IEEE_DIVIDE(MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER (), 3) + ) + THEN 'b' + WHEN `int64_col` IS NOT NULL + THEN 'c' + END AS `int_bins_labels` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins.sql index a3e689b11ec..418c34c5120 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins.sql @@ -2,17 +2,13 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - WHEN `int64_col` > 0 AND `int64_col` <= 1 - THEN STRUCT(0 AS `left_exclusive`, 1 AS `right_inclusive`) - WHEN `int64_col` > 1 AND `int64_col` <= 2 - THEN STRUCT(1 AS `left_exclusive`, 2 AS `right_inclusive`) - END AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `interval_bins` -FROM `bfcte_1` \ No newline at end of file + *, + CASE + WHEN `int64_col` > 0 AND `int64_col` <= 1 + THEN STRUCT(0 AS `left_exclusive`, 1 AS `right_inclusive`) + WHEN `int64_col` > 1 AND `int64_col` <= 2 + THEN STRUCT(1 AS `left_exclusive`, 2 AS `right_inclusive`) + END AS `interval_bins` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins_labels.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins_labels.sql index 1a8a92e38ee..3ea9dc1085c 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins_labels.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins_labels.sql @@ -2,17 +2,13 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - WHEN `int64_col` > 0 AND `int64_col` <= 1 - THEN 0 - WHEN `int64_col` > 1 AND `int64_col` <= 2 - THEN 1 - END AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `interval_bins_labels` -FROM `bfcte_1` \ No newline at end of file + *, + CASE + WHEN `int64_col` > 0 AND `int64_col` <= 1 + THEN 0 + WHEN `int64_col` > 1 AND `int64_col` <= 2 + THEN 1 + END AS `interval_bins_labels` +FROM `bfcte_0` \ No newline at end of file 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 76b455a65c9..3c29762ff4f 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - DENSE_RANK() OVER (ORDER BY `int64_col` DESC) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + DENSE_RANK() OVER (ORDER BY `int64_col` DESC) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_bool/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_bool/out.sql index 96d23c4747d..e935a4e71a3 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_bool/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_bool/out.sql @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `bool_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `bool_col` <> LAG(`bool_col`, 1) OVER (ORDER BY `bool_col` DESC) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `diff_bool` -FROM `bfcte_1` \ No newline at end of file + *, + `bool_col` <> LAG(`bool_col`, 1) OVER (ORDER BY `bool_col` DESC) AS `diff_bool` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_date/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_date/out.sql index 4f1729d2e28..56c37f4c467 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_date/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_date/out.sql @@ -2,14 +2,10 @@ WITH `bfcte_0` AS ( SELECT `date_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CAST(FLOOR( - 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 - `bfcol_1` AS `diff_date` -FROM `bfcte_1` \ No newline at end of file + *, + CAST(FLOOR( + DATE_DIFF(`date_col`, LAG(`date_col`, 1) OVER (ORDER BY `date_col` ASC NULLS LAST), DAY) * 86400000000 + ) AS INT64) AS `diff_date` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_datetime/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_datetime/out.sql index 9c279a479d5..10641ba496c 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_datetime/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_datetime/out.sql @@ -2,16 +2,12 @@ WITH `bfcte_0` AS ( SELECT `datetime_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - DATETIME_DIFF( - `datetime_col`, - LAG(`datetime_col`, 1) OVER (ORDER BY `datetime_col` ASC NULLS LAST), - MICROSECOND - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `diff_datetime` -FROM `bfcte_1` \ No newline at end of file + *, + DATETIME_DIFF( + `datetime_col`, + LAG(`datetime_col`, 1) OVER (ORDER BY `datetime_col` ASC NULLS LAST), + MICROSECOND + ) AS `diff_datetime` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_int/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_int/out.sql index 95d786b951e..b6cd3577796 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_int/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_int/out.sql @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `int64_col` - LAG(`int64_col`, 1) OVER (ORDER BY `int64_col` ASC NULLS LAST) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `diff_int` -FROM `bfcte_1` \ No newline at end of file + *, + `int64_col` - LAG(`int64_col`, 1) OVER (ORDER BY `int64_col` ASC NULLS LAST) AS `diff_int` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_timestamp/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_timestamp/out.sql index 1f8b8227b4a..88a1f898370 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_timestamp/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_timestamp/out.sql @@ -2,16 +2,12 @@ WITH `bfcte_0` AS ( SELECT `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - TIMESTAMP_DIFF( - `timestamp_col`, - LAG(`timestamp_col`, 1) OVER (ORDER BY `timestamp_col` DESC), - MICROSECOND - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `diff_timestamp` -FROM `bfcte_1` \ No newline at end of file + *, + TIMESTAMP_DIFF( + `timestamp_col`, + LAG(`timestamp_col`, 1) OVER (ORDER BY `timestamp_col` DESC), + MICROSECOND + ) AS `diff_timestamp` +FROM `bfcte_0` \ No newline at end of file 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 b053178f584..a6f3b20d2cb 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 @@ -2,15 +2,11 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - FIRST_VALUE(`int64_col`) OVER ( - ORDER BY `int64_col` DESC - ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + FIRST_VALUE(`int64_col`) OVER ( + ORDER BY `int64_col` DESC + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file 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 2ef7b7151e2..37d9b004949 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 @@ -2,15 +2,11 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `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` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + FIRST_VALUE(`int64_col` IGNORE NULLS) OVER ( + ORDER BY `int64_col` ASC NULLS LAST + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file 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 61e90ee612e..0d962bdc50b 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 @@ -2,15 +2,11 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - LAST_VALUE(`int64_col`) OVER ( - ORDER BY `int64_col` DESC - ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + LAST_VALUE(`int64_col`) OVER ( + ORDER BY `int64_col` DESC + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file 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 c626c263ace..403e07bd642 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 @@ -2,15 +2,11 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `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` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + LAST_VALUE(`int64_col` IGNORE NULLS) OVER ( + ORDER BY `int64_col` ASC NULLS LAST + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file 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 1537d735ead..ccbf88c6680 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 @@ -8,5 +8,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT + *, `bfcol_1` AS `int64_col` FROM `bfcte_1` \ No newline at end of file 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 f55201418a9..32fdcb2626c 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 @@ -2,12 +2,11 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - MAX(`int64_col`) OVER () AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + MAX(`int64_col`) OVER ( + ORDER BY `int64_col` ASC NULLS LAST + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file 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 ac9b2df84e1..326b4e47b4e 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 @@ -3,12 +3,12 @@ WITH `bfcte_0` AS ( `int64_col`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - MAX(`int64_col`) OVER (PARTITION BY `string_col`) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + MAX(`int64_col`) OVER ( + PARTITION BY `string_col` + ORDER BY `int64_col` DESC + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/out.sql index 0b33d0b1d0a..f8fbb107f33 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 @@ -7,6 +7,9 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, + `bool_col` AS `bool_col`, + `duration_col` AS `duration_col`, + `int64_col` AS `int64_col`, `int64_col` AS `bfcol_6`, `bool_col` AS `bfcol_7`, `duration_col` AS `bfcol_8` @@ -20,6 +23,7 @@ WITH `bfcte_0` AS ( FROM `bfcte_1` ) SELECT + *, `bfcol_12` AS `int64_col`, `bfcol_13` AS `bool_col`, `bfcol_14` AS `duration_col`, 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 fdb59809c31..5811a9e64d1 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 @@ -2,12 +2,11 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - AVG(`int64_col`) OVER () AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + AVG(`int64_col`) OVER ( + ORDER BY `int64_col` DESC + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file 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 d96121e54da..e542dce51da 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 @@ -3,12 +3,12 @@ WITH `bfcte_0` AS ( `int64_col`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - AVG(`int64_col`) OVER (PARTITION BY `string_col`) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + AVG(`int64_col`) OVER ( + PARTITION BY `string_col` + ORDER BY `int64_col` ASC NULLS LAST + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file 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 bfe94622b31..a1524278a31 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 @@ -12,6 +12,7 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT + *, `bfcol_3` AS `int64_col`, `bfcol_4` AS `date_col`, `bfcol_5` AS `string_col` 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 0848313456e..b394ee75e15 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 @@ -8,5 +8,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT + *, `bfcol_1` AS `int64_col` FROM `bfcte_1` \ No newline at end of file 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 cbda2b7d581..b50c5623f9b 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 @@ -2,12 +2,11 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - MIN(`int64_col`) OVER () AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + MIN(`int64_col`) OVER ( + ORDER BY `int64_col` ASC NULLS LAST + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file 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 d601832950e..b26b67cbe9d 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 @@ -3,12 +3,12 @@ WITH `bfcte_0` AS ( `int64_col`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - MIN(`int64_col`) OVER (PARTITION BY `string_col`) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + MIN(`int64_col`) OVER ( + PARTITION BY `string_col` + ORDER BY `int64_col` DESC + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_nunique/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_nunique/out.sql index f0b54934b45..9603f882fe7 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_nunique/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_nunique/out.sql @@ -8,5 +8,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT + *, `bfcol_1` AS `int64_col` FROM `bfcte_1` \ No newline at end of file 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 2d38311f45a..226d722d23c 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 @@ -10,6 +10,7 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT + *, `bfcol_4` AS `int64_col`, `bfcol_5` AS `bool_col` FROM `bfcte_1` \ No newline at end of file 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 430da33e3c3..411b48a0231 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 @@ -2,12 +2,11 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - VAR_POP(`int64_col`) OVER () AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + VAR_POP(`int64_col`) OVER ( + ORDER BY `int64_col` DESC + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_product/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_product/out.sql index 94ca21988e9..4dc6d683572 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_product/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_product/out.sql @@ -12,5 +12,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT + *, `bfcol_1` AS `int64_col` FROM `bfcte_1` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_product/window_partition_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_product/window_partition_out.sql index c5f12f70093..bad5c02c1b4 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_product/window_partition_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_product/window_partition_out.sql @@ -3,25 +3,21 @@ WITH `bfcte_0` AS ( `int64_col`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - WHEN LOGICAL_OR(`int64_col` = 0) OVER (PARTITION BY `string_col`) - THEN 0 - ELSE POWER( - 2, - SUM(IF(`int64_col` = 0, 0, LOG(ABS(`int64_col`), 2))) OVER (PARTITION BY `string_col`) - ) * POWER( - -1, - MOD( - SUM(CASE WHEN SIGN(`int64_col`) = -1 THEN 1 ELSE 0 END) OVER (PARTITION BY `string_col`), - 2 - ) - ) - END AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + CASE + WHEN LOGICAL_OR(`int64_col` = 0) OVER (PARTITION BY `string_col`) + THEN 0 + ELSE POWER( + 2, + SUM(IF(`int64_col` = 0, 0, LOG(ABS(`int64_col`), 2))) OVER (PARTITION BY `string_col`) + ) * POWER( + -1, + MOD( + SUM(CASE WHEN SIGN(`int64_col`) = -1 THEN 1 ELSE 0 END) OVER (PARTITION BY `string_col`), + 2 + ) + ) + END AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file 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 e337356d965..cd08f0a46d9 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 @@ -11,6 +11,7 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT + *, `bfcol_4` AS `int64`, `bfcol_5` AS `bool`, `bfcol_6` AS `int64_w_floor` 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 96b121bde49..7f41d2892a9 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - RANK() OVER (ORDER BY `int64_col` DESC NULLS FIRST) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + RANK() OVER (ORDER BY `int64_col` DESC NULLS FIRST) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file 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 7d1d62f1ae4..88933ef0c53 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - LAG(`int64_col`, 1) OVER (ORDER BY `int64_col` ASC) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `lag` -FROM `bfcte_1` \ No newline at end of file + *, + LAG(`int64_col`, 1) OVER (ORDER BY `int64_col` ASC) AS `lag` +FROM `bfcte_0` \ No newline at end of file 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 67b40c99db0..eee93c1ca1c 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - LEAD(`int64_col`, 1) OVER (ORDER BY `int64_col` ASC) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `lead` -FROM `bfcte_1` \ No newline at end of file + *, + LEAD(`int64_col`, 1) OVER (ORDER BY `int64_col` ASC) AS `lead` +FROM `bfcte_0` \ No newline at end of file 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 0202cf5c214..3b5658e4c1c 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `int64_col` AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `noop` -FROM `bfcte_1` \ No newline at end of file + *, + `int64_col` AS `noop` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_std/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_std/out.sql index 36a50302a66..cffd4b466f9 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 @@ -7,6 +7,9 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, + `bool_col` AS `bool_col`, + `duration_col` AS `duration_col`, + `int64_col` AS `int64_col`, `int64_col` AS `bfcol_6`, `bool_col` AS `bfcol_7`, `duration_col` AS `bfcol_8` @@ -20,6 +23,7 @@ WITH `bfcte_0` AS ( FROM `bfcte_1` ) SELECT + *, `bfcol_12` AS `int64_col`, `bfcol_13` AS `bool_col`, `bfcol_14` AS `duration_col`, 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 80e0cf5bc62..489a54b3c65 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 @@ -2,12 +2,11 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - STDDEV(`int64_col`) OVER () AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + STDDEV(`int64_col`) OVER ( + ORDER BY `int64_col` DESC + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file 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 2bf6c26cd4b..39778e7cf81 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 @@ -10,6 +10,7 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT + *, `bfcol_4` AS `int64_col`, `bfcol_5` AS `bool_col` FROM `bfcte_1` \ No newline at end of file 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 47426abcbd0..c63a6569f6c 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 @@ -2,12 +2,14 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - COALESCE(SUM(`int64_col`) OVER (), 0) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + COALESCE( + SUM(`int64_col`) OVER ( + ORDER BY `int64_col` DESC + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ), + 0 + ) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file 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 fd1bd4f630d..5a19d6fd590 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 @@ -3,12 +3,15 @@ WITH `bfcte_0` AS ( `int64_col`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - COALESCE(SUM(`int64_col`) OVER (PARTITION BY `string_col`), 0) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + COALESCE( + SUM(`int64_col`) OVER ( + PARTITION BY `string_col` + ORDER BY `int64_col` ASC NULLS LAST + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ), + 0 + ) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file 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 733a22438ce..72f587f9c85 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 @@ -10,6 +10,7 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT + *, `bfcol_4` AS `int64_col`, `bfcol_5` AS `bool_col` FROM `bfcte_1` \ No newline at end of file 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 e9d6c1cb932..90845db543d 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 @@ -2,12 +2,11 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - VARIANCE(`int64_col`) OVER () AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + *, + VARIANCE(`int64_col`) OVER ( + ORDER BY `int64_col` DESC + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `agg_int64` +FROM `bfcte_0` \ No newline at end of file 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 a40784a3ca5..a3b41863a46 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 @@ -2,16 +2,12 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - AI.CLASSIFY( - input => (`string_col`), - categories => ['greeting', 'rejection'], - connection_id => 'bigframes-dev.us.bigframes-default-connection' - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + *, + AI.CLASSIFY( + input => (`string_col`), + categories => ['greeting', 'rejection'], + connection_id => 'bigframes-dev.us.bigframes-default-connection' + ) AS `result` +FROM `bfcte_0` \ No newline at end of file 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 ec3515e7ed7..f44921f806a 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 @@ -2,16 +2,12 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - AI.GENERATE( - prompt => (`string_col`, ' is the same as ', `string_col`), - endpoint => 'gemini-2.5-flash', - request_type => 'SHARED' - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + *, + AI.GENERATE( + prompt => (`string_col`, ' is the same as ', `string_col`), + endpoint => 'gemini-2.5-flash', + request_type => 'SHARED' + ) AS `result` +FROM `bfcte_0` \ No newline at end of file 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 3a09da7c3a2..2d70bbc8149 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 @@ -2,16 +2,12 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - AI.GENERATE_BOOL( - prompt => (`string_col`, ' is the same as ', `string_col`), - endpoint => 'gemini-2.5-flash', - request_type => 'SHARED' - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + *, + AI.GENERATE_BOOL( + prompt => (`string_col`, ' is the same as ', `string_col`), + endpoint => 'gemini-2.5-flash', + request_type => 'SHARED' + ) AS `result` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool_with_connection_id/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool_with_connection_id/out.sql index f844ed16918..c2f433a2e36 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool_with_connection_id/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool_with_connection_id/out.sql @@ -2,17 +2,13 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - AI.GENERATE_BOOL( - 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' - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + *, + AI.GENERATE_BOOL( + 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' + ) AS `result` +FROM `bfcte_0` \ No newline at end of file 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 2a81ced7823..4b8ae26fc37 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 @@ -2,16 +2,12 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - AI.GENERATE_BOOL( - prompt => (`string_col`, ' is the same as ', `string_col`), - request_type => 'SHARED', - model_params => JSON '{}' - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + *, + AI.GENERATE_BOOL( + prompt => (`string_col`, ' is the same as ', `string_col`), + request_type => 'SHARED', + model_params => JSON '{}' + ) AS `result` +FROM `bfcte_0` \ No newline at end of file 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 3b894296210..4be491cc23e 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 @@ -2,16 +2,12 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - AI.GENERATE_DOUBLE( - prompt => (`string_col`, ' is the same as ', `string_col`), - endpoint => 'gemini-2.5-flash', - request_type => 'SHARED' - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + *, + AI.GENERATE_DOUBLE( + prompt => (`string_col`, ' is the same as ', `string_col`), + endpoint => 'gemini-2.5-flash', + request_type => 'SHARED' + ) AS `result` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double_with_connection_id/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double_with_connection_id/out.sql index fae92515cbe..5b17e4ca368 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double_with_connection_id/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double_with_connection_id/out.sql @@ -2,17 +2,13 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - AI.GENERATE_DOUBLE( - 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' - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + *, + AI.GENERATE_DOUBLE( + 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' + ) AS `result` +FROM `bfcte_0` \ No newline at end of file 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 480ee09ef65..2d42852e7c3 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 @@ -2,16 +2,12 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - AI.GENERATE_DOUBLE( - prompt => (`string_col`, ' is the same as ', `string_col`), - request_type => 'SHARED', - model_params => JSON '{}' - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + *, + AI.GENERATE_DOUBLE( + prompt => (`string_col`, ' is the same as ', `string_col`), + request_type => 'SHARED', + model_params => JSON '{}' + ) AS `result` +FROM `bfcte_0` \ No newline at end of file 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 f33af547c7f..c591d0489a1 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 @@ -2,16 +2,12 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - AI.GENERATE_INT( - prompt => (`string_col`, ' is the same as ', `string_col`), - endpoint => 'gemini-2.5-flash', - request_type => 'SHARED' - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + *, + AI.GENERATE_INT( + prompt => (`string_col`, ' is the same as ', `string_col`), + endpoint => 'gemini-2.5-flash', + request_type => 'SHARED' + ) AS `result` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int_with_connection_id/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int_with_connection_id/out.sql index a0c92c959c2..e2a882a267e 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int_with_connection_id/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int_with_connection_id/out.sql @@ -2,17 +2,13 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - AI.GENERATE_INT( - 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' - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + *, + AI.GENERATE_INT( + 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' + ) AS `result` +FROM `bfcte_0` \ No newline at end of file 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 2929e57ba0c..a5e040ca481 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 @@ -2,16 +2,12 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - AI.GENERATE_INT( - prompt => (`string_col`, ' is the same as ', `string_col`), - request_type => 'SHARED', - model_params => JSON '{}' - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + *, + AI.GENERATE_INT( + prompt => (`string_col`, ' is the same as ', `string_col`), + request_type => 'SHARED', + model_params => JSON '{}' + ) AS `result` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_connection_id/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_connection_id/out.sql index 19f85b181b2..1da9ee6fd54 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_connection_id/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_connection_id/out.sql @@ -2,17 +2,13 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - AI.GENERATE( - 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' - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + *, + AI.GENERATE( + 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' + ) AS `result` +FROM `bfcte_0` \ No newline at end of file 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 745243db3a0..0d5b8f19708 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 @@ -2,16 +2,12 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - AI.GENERATE( - prompt => (`string_col`, ' is the same as ', `string_col`), - request_type => 'SHARED', - model_params => JSON '{}' - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + *, + AI.GENERATE( + prompt => (`string_col`, ' is the same as ', `string_col`), + request_type => 'SHARED', + model_params => JSON '{}' + ) AS `result` +FROM `bfcte_0` \ No newline at end of file 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 4f7867a0f20..c06c24514f5 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 @@ -2,17 +2,13 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - AI.GENERATE( - prompt => (`string_col`, ' is the same as ', `string_col`), - endpoint => 'gemini-2.5-flash', - request_type => 'SHARED', - output_schema => 'x INT64, y FLOAT64' - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + *, + AI.GENERATE( + prompt => (`string_col`, ' is the same as ', `string_col`), + endpoint => 'gemini-2.5-flash', + request_type => 'SHARED', + output_schema => 'x INT64, y FLOAT64' + ) AS `result` +FROM `bfcte_0` \ No newline at end of file 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 275ba8d4239..937069c2ff7 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 @@ -2,15 +2,11 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - AI.IF( - prompt => (`string_col`, ' is the same as ', `string_col`), - connection_id => 'bigframes-dev.us.bigframes-default-connection' - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + *, + AI.IF( + prompt => (`string_col`, ' is the same as ', `string_col`), + connection_id => 'bigframes-dev.us.bigframes-default-connection' + ) AS `result` +FROM `bfcte_0` \ No newline at end of file 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 01c71065b92..4afa9b285db 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 @@ -2,15 +2,11 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - AI.SCORE( - prompt => (`string_col`, ' is the same as ', `string_col`), - connection_id => 'bigframes-dev.us.bigframes-default-connection' - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + *, + AI.SCORE( + prompt => (`string_col`, ' is the same as ', `string_col`), + connection_id => 'bigframes-dev.us.bigframes-default-connection' + ) AS `result` +FROM `bfcte_0` \ No newline at end of file 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 d8e223d5f85..acdda931204 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_list_col` FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` -), `bfcte_1` AS ( - SELECT - *, - `string_list_col`[SAFE_OFFSET(1)] AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_list_col` -FROM `bfcte_1` \ No newline at end of file + *, + `string_list_col`[SAFE_OFFSET(1)] AS `string_list_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_reduce_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_reduce_op/out.sql index b9f87bfd1ed..ce14c05924b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_reduce_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_reduce_op/out.sql @@ -4,34 +4,27 @@ WITH `bfcte_0` AS ( `float_list_col`, `string_list_col` FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` -), `bfcte_1` AS ( - SELECT - *, - ( - SELECT - COALESCE(SUM(bf_arr_reduce_uid), 0) - FROM UNNEST(`float_list_col`) AS bf_arr_reduce_uid - ) AS `bfcol_3`, - ( - SELECT - STDDEV(bf_arr_reduce_uid) - FROM UNNEST(`float_list_col`) AS bf_arr_reduce_uid - ) AS `bfcol_4`, - ( - SELECT - COUNT(bf_arr_reduce_uid) - FROM UNNEST(`string_list_col`) AS bf_arr_reduce_uid - ) AS `bfcol_5`, - ( - SELECT - COALESCE(LOGICAL_OR(bf_arr_reduce_uid), FALSE) - FROM UNNEST(`bool_list_col`) AS bf_arr_reduce_uid - ) AS `bfcol_6` - FROM `bfcte_0` ) SELECT - `bfcol_3` AS `sum_float`, - `bfcol_4` AS `std_float`, - `bfcol_5` AS `count_str`, - `bfcol_6` AS `any_bool` -FROM `bfcte_1` \ No newline at end of file + *, + ( + SELECT + COALESCE(SUM(bf_arr_reduce_uid), 0) + FROM UNNEST(`float_list_col`) AS bf_arr_reduce_uid + ) AS `sum_float`, + ( + SELECT + STDDEV(bf_arr_reduce_uid) + FROM UNNEST(`float_list_col`) AS bf_arr_reduce_uid + ) AS `std_float`, + ( + SELECT + COUNT(bf_arr_reduce_uid) + FROM UNNEST(`string_list_col`) AS bf_arr_reduce_uid + ) AS `count_str`, + ( + SELECT + COALESCE(LOGICAL_OR(bf_arr_reduce_uid), FALSE) + FROM UNNEST(`bool_list_col`) AS bf_arr_reduce_uid + ) AS `any_bool` +FROM `bfcte_0` \ No newline at end of file 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 0034ffd69cd..4d4126c1b89 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 @@ -2,18 +2,14 @@ WITH `bfcte_0` AS ( SELECT `string_list_col` FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` -), `bfcte_1` AS ( - SELECT - *, - ARRAY( - SELECT - el - FROM UNNEST(`string_list_col`) AS el WITH OFFSET AS slice_idx - WHERE - slice_idx >= 1 - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_list_col` -FROM `bfcte_1` \ No newline at end of file + *, + ARRAY( + SELECT + el + FROM UNNEST(`string_list_col`) AS el WITH OFFSET AS slice_idx + WHERE + slice_idx >= 1 + ) AS `string_list_col` +FROM `bfcte_0` \ No newline at end of file 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 f0638fa3afc..96366ff1870 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 @@ -2,18 +2,14 @@ WITH `bfcte_0` AS ( SELECT `string_list_col` FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` -), `bfcte_1` AS ( - SELECT - *, - ARRAY( - SELECT - el - FROM UNNEST(`string_list_col`) AS el WITH OFFSET AS slice_idx - WHERE - slice_idx >= 1 AND slice_idx < 5 - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_list_col` -FROM `bfcte_1` \ No newline at end of file + *, + ARRAY( + SELECT + el + FROM UNNEST(`string_list_col`) AS el WITH OFFSET AS slice_idx + WHERE + slice_idx >= 1 AND slice_idx < 5 + ) AS `string_list_col` +FROM `bfcte_0` \ No newline at end of file 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 09446bb8f51..48634627ec1 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_list_col` FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` -), `bfcte_1` AS ( - SELECT - *, - ARRAY_TO_STRING(`string_list_col`, '.') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_list_col` -FROM `bfcte_1` \ No newline at end of file + *, + ARRAY_TO_STRING(`string_list_col`, '.') AS `string_list_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_to_array_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_to_array_op/out.sql index 3e297016584..c0f3eff3d05 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_to_array_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_to_array_op/out.sql @@ -5,22 +5,15 @@ WITH `bfcte_0` AS ( `int64_col`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - [COALESCE(`bool_col`, FALSE)] AS `bfcol_8`, - [COALESCE(`int64_col`, 0)] AS `bfcol_9`, - [COALESCE(`string_col`, ''), COALESCE(`string_col`, '')] AS `bfcol_10`, - [ - COALESCE(`int64_col`, 0), - CAST(COALESCE(`bool_col`, FALSE) AS INT64), - COALESCE(`float64_col`, 0.0) - ] AS `bfcol_11` - FROM `bfcte_0` ) SELECT - `bfcol_8` AS `bool_col`, - `bfcol_9` AS `int64_col`, - `bfcol_10` AS `strs_col`, - `bfcol_11` AS `numeric_col` -FROM `bfcte_1` \ No newline at end of file + *, + [COALESCE(`bool_col`, FALSE)] AS `bool_col`, + [COALESCE(`int64_col`, 0)] AS `int64_col`, + [COALESCE(`string_col`, ''), COALESCE(`string_col`, '')] AS `strs_col`, + [ + COALESCE(`int64_col`, 0), + CAST(COALESCE(`bool_col`, FALSE) AS INT64), + COALESCE(`float64_col`, 0.0) + ] AS `numeric_col` +FROM `bfcte_0` \ No newline at end of file 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 bd99b860648..4c66f5930a9 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 @@ -3,23 +3,11 @@ WITH `bfcte_0` AS ( `rowindex`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - OBJ.MAKE_REF(`string_col`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_4` - FROM `bfcte_0` -), `bfcte_2` AS ( - SELECT - *, - OBJ.FETCH_METADATA(`bfcol_4`) AS `bfcol_7` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_7`.`version` AS `bfcol_10` - FROM `bfcte_2` ) SELECT - `rowindex`, - `bfcol_10` AS `version` -FROM `bfcte_3` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + OBJ.FETCH_METADATA( + OBJ.MAKE_REF(`string_col`, 'bigframes-dev.test-region.bigframes-default-connection') + ).`version` AS `version` +FROM `bfcte_0` \ 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 28c2f2ce181..8266609362c 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 @@ -3,23 +3,15 @@ WITH `bfcte_0` AS ( `rowindex`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - OBJ.MAKE_REF(`string_col`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_4` - FROM `bfcte_0` -), `bfcte_2` AS ( - SELECT - *, - OBJ.GET_ACCESS_URL(`bfcol_4`, 'R') AS `bfcol_7` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - JSON_VALUE(`bfcol_7`, '$.access_urls.read_url') AS `bfcol_10` - FROM `bfcte_2` ) SELECT - `rowindex`, - `bfcol_10` AS `string_col` -FROM `bfcte_3` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + JSON_VALUE( + OBJ.GET_ACCESS_URL( + OBJ.MAKE_REF(`string_col`, 'bigframes-dev.test-region.bigframes-default-connection'), + 'R' + ), + '$.access_urls.read_url' + ) AS `string_col` +FROM `bfcte_0` \ 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 d74449c986e..3c37aee576e 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 @@ -3,13 +3,9 @@ WITH `bfcte_0` AS ( `rowindex`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - OBJ.MAKE_REF(`string_col`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_4` - FROM `bfcte_0` ) SELECT - `rowindex`, - `bfcol_4` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + OBJ.MAKE_REF(`string_col`, 'bigframes-dev.test-region.bigframes-default-connection') AS `string_col` +FROM `bfcte_0` \ 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 7e46e10708d..90e227d464f 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 @@ -4,39 +4,13 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - *, - `bfcol_6` AS `bfcol_14`, - `bfcol_7` AS `bfcol_15`, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - `bfcol_7` AND `bfcol_7` AS `bfcol_18` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_14` AS `bfcol_24`, - `bfcol_15` AS `bfcol_25`, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - IF(`bfcol_15` = FALSE, `bfcol_15`, NULL) AS `bfcol_29` - FROM `bfcte_2` ) SELECT - `bfcol_24` AS `rowindex`, - `bfcol_25` AS `bool_col`, - `bfcol_26` AS `int64_col`, - `bfcol_27` AS `int_and_int`, - `bfcol_28` AS `bool_and_bool`, - `bfcol_29` AS `bool_and_null` -FROM `bfcte_3` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `bool_col` AS `bool_col`, + `int64_col` AS `int64_col`, + `int64_col` & `int64_col` AS `int_and_int`, + `bool_col` AND `bool_col` AS `bool_and_bool`, + IF(`bool_col` = FALSE, `bool_col`, NULL) AS `bool_and_null` +FROM `bfcte_0` \ No newline at end of file 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 c8e9cf65a91..191534c76c0 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 @@ -4,39 +4,13 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - *, - `bfcol_6` AS `bfcol_14`, - `bfcol_7` AS `bfcol_15`, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - `bfcol_7` OR `bfcol_7` AS `bfcol_18` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_14` AS `bfcol_24`, - `bfcol_15` AS `bfcol_25`, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - IF(`bfcol_15` = TRUE, `bfcol_15`, NULL) AS `bfcol_29` - FROM `bfcte_2` ) SELECT - `bfcol_24` AS `rowindex`, - `bfcol_25` AS `bool_col`, - `bfcol_26` AS `int64_col`, - `bfcol_27` AS `int_and_int`, - `bfcol_28` AS `bool_and_bool`, - `bfcol_29` AS `bool_and_null` -FROM `bfcte_3` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `bool_col` AS `bool_col`, + `int64_col` AS `int64_col`, + `int64_col` | `int64_col` AS `int_and_int`, + `bool_col` OR `bool_col` AS `bool_and_bool`, + IF(`bool_col` = TRUE, `bool_col`, NULL) AS `bool_and_null` +FROM `bfcte_0` \ No newline at end of file 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 d6a081cbbde..0ae0e97fc20 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 @@ -4,48 +4,22 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - *, - `bfcol_6` AS `bfcol_14`, - `bfcol_7` AS `bfcol_15`, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - ( - `bfcol_7` AND NOT `bfcol_7` - ) OR ( - NOT `bfcol_7` AND `bfcol_7` - ) AS `bfcol_18` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_14` AS `bfcol_24`, - `bfcol_15` AS `bfcol_25`, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - ( - `bfcol_15` AND NOT CAST(NULL AS BOOLEAN) - ) - OR ( - NOT `bfcol_15` AND CAST(NULL AS BOOLEAN) - ) AS `bfcol_29` - FROM `bfcte_2` ) SELECT - `bfcol_24` AS `rowindex`, - `bfcol_25` AS `bool_col`, - `bfcol_26` AS `int64_col`, - `bfcol_27` AS `int_and_int`, - `bfcol_28` AS `bool_and_bool`, - `bfcol_29` AS `bool_and_null` -FROM `bfcte_3` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `bool_col` AS `bool_col`, + `int64_col` AS `int64_col`, + `int64_col` ^ `int64_col` AS `int_and_int`, + ( + `bool_col` AND NOT `bool_col` + ) OR ( + NOT `bool_col` AND `bool_col` + ) AS `bool_and_bool`, + ( + `bool_col` AND NOT CAST(NULL AS BOOLEAN) + ) + OR ( + NOT `bool_col` AND CAST(NULL AS BOOLEAN) + ) AS `bool_and_null` +FROM `bfcte_0` \ No newline at end of file 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 57af99a52bd..b8a259c51bf 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 @@ -3,12 +3,8 @@ WITH `bfcte_0` AS ( `bool_col`, `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - 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 - `bfcol_4` AS `int64_col` -FROM `bfcte_1` \ No newline at end of file + *, + COALESCE(CAST(`int64_col` AS STRING), '$NULL_SENTINEL$') = COALESCE(CAST(CAST(`bool_col` AS INT64) AS STRING), '$NULL_SENTINEL$') AS `int64_col` +FROM `bfcte_0` \ No newline at end of file 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 a21e0089416..775c765d114 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 @@ -4,64 +4,15 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - *, - `bfcol_6` AS `bfcol_14`, - `bfcol_7` AS `bfcol_15`, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - `bfcol_7` = 1 AS `bfcol_18` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_14` AS `bfcol_24`, - `bfcol_15` AS `bfcol_25`, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - `bfcol_15` IS NULL AS `bfcol_29` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - *, - `bfcol_24` AS `bfcol_36`, - `bfcol_25` AS `bfcol_37`, - `bfcol_26` AS `bfcol_38`, - `bfcol_27` AS `bfcol_39`, - `bfcol_28` AS `bfcol_40`, - `bfcol_29` AS `bfcol_41`, - `bfcol_25` = CAST(`bfcol_26` AS INT64) AS `bfcol_42` - FROM `bfcte_3` -), `bfcte_5` AS ( - SELECT - *, - `bfcol_36` AS `bfcol_50`, - `bfcol_37` AS `bfcol_51`, - `bfcol_38` AS `bfcol_52`, - `bfcol_39` AS `bfcol_53`, - `bfcol_40` AS `bfcol_54`, - `bfcol_41` AS `bfcol_55`, - `bfcol_42` AS `bfcol_56`, - CAST(`bfcol_38` AS INT64) = `bfcol_37` AS `bfcol_57` - FROM `bfcte_4` ) SELECT - `bfcol_50` AS `rowindex`, - `bfcol_51` AS `int64_col`, - `bfcol_52` AS `bool_col`, - `bfcol_53` AS `int_eq_int`, - `bfcol_54` AS `int_eq_1`, - `bfcol_55` AS `int_eq_null`, - `bfcol_56` AS `int_eq_bool`, - `bfcol_57` AS `bool_eq_int` -FROM `bfcte_5` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `int64_col` AS `int64_col`, + `bool_col` AS `bool_col`, + `int64_col` = `int64_col` AS `int_eq_int`, + `int64_col` = 1 AS `int_eq_1`, + `int64_col` IS NULL AS `int_eq_null`, + `int64_col` = CAST(`bool_col` AS INT64) AS `int_eq_bool`, + CAST(`bool_col` AS INT64) = `int64_col` AS `bool_eq_int` +FROM `bfcte_0` \ No newline at end of file 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 e99fe49c8e0..ecb863106d5 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 @@ -4,51 +4,14 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - *, - `bfcol_6` AS `bfcol_14`, - `bfcol_7` AS `bfcol_15`, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - `bfcol_7` >= 1 AS `bfcol_18` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_14` AS `bfcol_24`, - `bfcol_15` AS `bfcol_25`, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - `bfcol_15` >= CAST(`bfcol_16` AS INT64) AS `bfcol_29` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - *, - `bfcol_24` AS `bfcol_36`, - `bfcol_25` AS `bfcol_37`, - `bfcol_26` AS `bfcol_38`, - `bfcol_27` AS `bfcol_39`, - `bfcol_28` AS `bfcol_40`, - `bfcol_29` AS `bfcol_41`, - CAST(`bfcol_26` AS INT64) >= `bfcol_25` AS `bfcol_42` - FROM `bfcte_3` ) SELECT - `bfcol_36` AS `rowindex`, - `bfcol_37` AS `int64_col`, - `bfcol_38` AS `bool_col`, - `bfcol_39` AS `int_ge_int`, - `bfcol_40` AS `int_ge_1`, - `bfcol_41` AS `int_ge_bool`, - `bfcol_42` AS `bool_ge_int` -FROM `bfcte_4` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `int64_col` AS `int64_col`, + `bool_col` AS `bool_col`, + `int64_col` >= `int64_col` AS `int_ge_int`, + `int64_col` >= 1 AS `int_ge_1`, + `int64_col` >= CAST(`bool_col` AS INT64) AS `int_ge_bool`, + CAST(`bool_col` AS INT64) >= `int64_col` AS `bool_ge_int` +FROM `bfcte_0` \ No newline at end of file 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 4e5aba3d31e..7a12fdb6374 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 @@ -4,51 +4,14 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - *, - `bfcol_6` AS `bfcol_14`, - `bfcol_7` AS `bfcol_15`, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - `bfcol_7` > 1 AS `bfcol_18` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_14` AS `bfcol_24`, - `bfcol_15` AS `bfcol_25`, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - `bfcol_15` > CAST(`bfcol_16` AS INT64) AS `bfcol_29` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - *, - `bfcol_24` AS `bfcol_36`, - `bfcol_25` AS `bfcol_37`, - `bfcol_26` AS `bfcol_38`, - `bfcol_27` AS `bfcol_39`, - `bfcol_28` AS `bfcol_40`, - `bfcol_29` AS `bfcol_41`, - CAST(`bfcol_26` AS INT64) > `bfcol_25` AS `bfcol_42` - FROM `bfcte_3` ) SELECT - `bfcol_36` AS `rowindex`, - `bfcol_37` AS `int64_col`, - `bfcol_38` AS `bool_col`, - `bfcol_39` AS `int_gt_int`, - `bfcol_40` AS `int_gt_1`, - `bfcol_41` AS `int_gt_bool`, - `bfcol_42` AS `bool_gt_int` -FROM `bfcte_4` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `int64_col` AS `int64_col`, + `bool_col` AS `bool_col`, + `int64_col` > `int64_col` AS `int_gt_int`, + `int64_col` > 1 AS `int_gt_1`, + `int64_col` > CAST(`bool_col` AS INT64) AS `int_gt_bool`, + CAST(`bool_col` AS INT64) > `int64_col` AS `bool_gt_int` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_is_in/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_is_in/out.sql index ec85f060dac..97a82c431e6 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 @@ -4,32 +4,19 @@ WITH `bfcte_0` AS ( `float64_col`, `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - COALESCE(`bool_col` IN (TRUE, FALSE), FALSE) AS `bfcol_3`, - COALESCE(`int64_col` IN (1, 2, 3), FALSE) AS `bfcol_4`, - `int64_col` IS NULL AS `bfcol_5`, - COALESCE(`int64_col` IN (1.0, 2.0, 3.0), FALSE) AS `bfcol_6`, - FALSE AS `bfcol_7`, - COALESCE(`int64_col` IN (2.5, 3), FALSE) AS `bfcol_8`, - FALSE AS `bfcol_9`, - FALSE AS `bfcol_10`, - COALESCE(`int64_col` IN (123456), FALSE) AS `bfcol_11`, - ( - `float64_col` IS NULL - ) OR `float64_col` IN (1, 2, 3) AS `bfcol_12` - FROM `bfcte_0` ) SELECT - `bfcol_3` AS `bools`, - `bfcol_4` AS `ints`, - `bfcol_5` AS `ints_w_null`, - `bfcol_6` AS `floats`, - `bfcol_7` AS `strings`, - `bfcol_8` AS `mixed`, - `bfcol_9` AS `empty`, - `bfcol_10` AS `empty_wo_match_nulls`, - `bfcol_11` AS `ints_wo_match_nulls`, - `bfcol_12` AS `float_in_ints` -FROM `bfcte_1` \ No newline at end of file + *, + COALESCE(`bool_col` IN (TRUE, FALSE), FALSE) AS `bools`, + COALESCE(`int64_col` IN (1, 2, 3), FALSE) AS `ints`, + `int64_col` IS NULL AS `ints_w_null`, + COALESCE(`int64_col` IN (1.0, 2.0, 3.0), FALSE) AS `floats`, + FALSE AS `strings`, + COALESCE(`int64_col` IN (2.5, 3), FALSE) AS `mixed`, + FALSE AS `empty`, + FALSE AS `empty_wo_match_nulls`, + COALESCE(`int64_col` IN (123456), FALSE) AS `ints_wo_match_nulls`, + ( + `float64_col` IS NULL + ) OR `float64_col` IN (1, 2, 3) AS `float_in_ints` +FROM `bfcte_0` \ No newline at end of file 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 97a00d1c88b..406fd7f8826 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 @@ -4,51 +4,14 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - *, - `bfcol_6` AS `bfcol_14`, - `bfcol_7` AS `bfcol_15`, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - `bfcol_7` <= 1 AS `bfcol_18` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_14` AS `bfcol_24`, - `bfcol_15` AS `bfcol_25`, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - `bfcol_15` <= CAST(`bfcol_16` AS INT64) AS `bfcol_29` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - *, - `bfcol_24` AS `bfcol_36`, - `bfcol_25` AS `bfcol_37`, - `bfcol_26` AS `bfcol_38`, - `bfcol_27` AS `bfcol_39`, - `bfcol_28` AS `bfcol_40`, - `bfcol_29` AS `bfcol_41`, - CAST(`bfcol_26` AS INT64) <= `bfcol_25` AS `bfcol_42` - FROM `bfcte_3` ) SELECT - `bfcol_36` AS `rowindex`, - `bfcol_37` AS `int64_col`, - `bfcol_38` AS `bool_col`, - `bfcol_39` AS `int_le_int`, - `bfcol_40` AS `int_le_1`, - `bfcol_41` AS `int_le_bool`, - `bfcol_42` AS `bool_le_int` -FROM `bfcte_4` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `int64_col` AS `int64_col`, + `bool_col` AS `bool_col`, + `int64_col` <= `int64_col` AS `int_le_int`, + `int64_col` <= 1 AS `int_le_1`, + `int64_col` <= CAST(`bool_col` AS INT64) AS `int_le_bool`, + CAST(`bool_col` AS INT64) <= `int64_col` AS `bool_le_int` +FROM `bfcte_0` \ No newline at end of file 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 addebd3187c..dc6bbc8fcfa 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 @@ -4,51 +4,14 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - *, - `bfcol_6` AS `bfcol_14`, - `bfcol_7` AS `bfcol_15`, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - `bfcol_7` < 1 AS `bfcol_18` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_14` AS `bfcol_24`, - `bfcol_15` AS `bfcol_25`, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - `bfcol_15` < CAST(`bfcol_16` AS INT64) AS `bfcol_29` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - *, - `bfcol_24` AS `bfcol_36`, - `bfcol_25` AS `bfcol_37`, - `bfcol_26` AS `bfcol_38`, - `bfcol_27` AS `bfcol_39`, - `bfcol_28` AS `bfcol_40`, - `bfcol_29` AS `bfcol_41`, - CAST(`bfcol_26` AS INT64) < `bfcol_25` AS `bfcol_42` - FROM `bfcte_3` ) SELECT - `bfcol_36` AS `rowindex`, - `bfcol_37` AS `int64_col`, - `bfcol_38` AS `bool_col`, - `bfcol_39` AS `int_lt_int`, - `bfcol_40` AS `int_lt_1`, - `bfcol_41` AS `int_lt_bool`, - `bfcol_42` AS `bool_lt_int` -FROM `bfcte_4` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `int64_col` AS `int64_col`, + `bool_col` AS `bool_col`, + `int64_col` < `int64_col` AS `int_lt_int`, + `int64_col` < 1 AS `int_lt_1`, + `int64_col` < CAST(`bool_col` AS INT64) AS `int_lt_bool`, + CAST(`bool_col` AS INT64) < `int64_col` AS `bool_lt_int` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_maximum_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_maximum_op/out.sql index bbef2127070..4a1d4ddff7e 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 @@ -3,12 +3,8 @@ WITH `bfcte_0` AS ( `float64_col`, `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - GREATEST(`int64_col`, `float64_col`) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `int64_col` -FROM `bfcte_1` \ No newline at end of file + *, + GREATEST(`int64_col`, `float64_col`) AS `int64_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_minimum_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_minimum_op/out.sql index 1f00f5892ef..75c7279dc0f 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 @@ -3,12 +3,8 @@ WITH `bfcte_0` AS ( `float64_col`, `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - LEAST(`int64_col`, `float64_col`) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `int64_col` -FROM `bfcte_1` \ No newline at end of file + *, + LEAST(`int64_col`, `float64_col`) AS `int64_col` +FROM `bfcte_0` \ No newline at end of file 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 1a1ff6e44d2..a591c05c093 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 @@ -4,66 +4,17 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - *, - `bfcol_6` AS `bfcol_14`, - `bfcol_7` AS `bfcol_15`, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - `bfcol_7` <> 1 AS `bfcol_18` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_14` AS `bfcol_24`, - `bfcol_15` AS `bfcol_25`, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - ( - `bfcol_15` - ) IS NOT NULL AS `bfcol_29` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - *, - `bfcol_24` AS `bfcol_36`, - `bfcol_25` AS `bfcol_37`, - `bfcol_26` AS `bfcol_38`, - `bfcol_27` AS `bfcol_39`, - `bfcol_28` AS `bfcol_40`, - `bfcol_29` AS `bfcol_41`, - `bfcol_25` <> CAST(`bfcol_26` AS INT64) AS `bfcol_42` - FROM `bfcte_3` -), `bfcte_5` AS ( - SELECT - *, - `bfcol_36` AS `bfcol_50`, - `bfcol_37` AS `bfcol_51`, - `bfcol_38` AS `bfcol_52`, - `bfcol_39` AS `bfcol_53`, - `bfcol_40` AS `bfcol_54`, - `bfcol_41` AS `bfcol_55`, - `bfcol_42` AS `bfcol_56`, - CAST(`bfcol_38` AS INT64) <> `bfcol_37` AS `bfcol_57` - FROM `bfcte_4` ) SELECT - `bfcol_50` AS `rowindex`, - `bfcol_51` AS `int64_col`, - `bfcol_52` AS `bool_col`, - `bfcol_53` AS `int_ne_int`, - `bfcol_54` AS `int_ne_1`, - `bfcol_55` AS `int_ne_null`, - `bfcol_56` AS `int_ne_bool`, - `bfcol_57` AS `bool_ne_int` -FROM `bfcte_5` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `int64_col` AS `int64_col`, + `bool_col` AS `bool_col`, + `int64_col` <> `int64_col` AS `int_ne_int`, + `int64_col` <> 1 AS `int_ne_1`, + ( + `int64_col` + ) IS NOT NULL AS `int_ne_null`, + `int64_col` <> CAST(`bool_col` AS INT64) AS `int_ne_bool`, + CAST(`bool_col` AS INT64) <> `int64_col` AS `bool_ne_int` +FROM `bfcte_0` \ No newline at end of file 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 2fef18eeb8a..8a37be4cbd7 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 @@ -4,57 +4,15 @@ WITH `bfcte_0` AS ( `rowindex`, `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - *, - `bfcol_6` AS `bfcol_14`, - `bfcol_7` AS `bfcol_15`, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - TIMESTAMP_ADD(`bfcol_7`, INTERVAL 86400000000 MICROSECOND) AS `bfcol_18` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_14` AS `bfcol_24`, - `bfcol_15` AS `bfcol_25`, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - TIMESTAMP_ADD(CAST(`bfcol_16` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `bfcol_29` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - *, - `bfcol_24` AS `bfcol_36`, - `bfcol_25` AS `bfcol_37`, - `bfcol_26` AS `bfcol_38`, - `bfcol_27` AS `bfcol_39`, - `bfcol_28` AS `bfcol_40`, - `bfcol_29` AS `bfcol_41`, - TIMESTAMP_ADD(`bfcol_25`, INTERVAL 86400000000 MICROSECOND) AS `bfcol_42` - FROM `bfcte_3` -), `bfcte_5` AS ( - SELECT - *, - 172800000000 AS `bfcol_50` - FROM `bfcte_4` ) SELECT - `bfcol_36` AS `rowindex`, - `bfcol_37` AS `timestamp_col`, - `bfcol_38` AS `date_col`, - `bfcol_39` AS `date_add_timedelta`, - `bfcol_40` AS `timestamp_add_timedelta`, - `bfcol_41` AS `timedelta_add_date`, - `bfcol_42` AS `timedelta_add_timestamp`, - `bfcol_50` AS `timedelta_add_timedelta` -FROM `bfcte_5` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `timestamp_col` AS `timestamp_col`, + `date_col` AS `date_col`, + TIMESTAMP_ADD(CAST(`date_col` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `date_add_timedelta`, + TIMESTAMP_ADD(`timestamp_col`, INTERVAL 86400000000 MICROSECOND) AS `timestamp_add_timedelta`, + TIMESTAMP_ADD(CAST(`date_col` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `timedelta_add_date`, + TIMESTAMP_ADD(`timestamp_col`, INTERVAL 86400000000 MICROSECOND) AS `timedelta_add_timestamp`, + 172800000000 AS `timedelta_add_timedelta` +FROM `bfcte_0` \ No newline at end of file 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 b8f46ceafef..259af74dad6 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - DATE(`timestamp_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + *, + DATE(`timestamp_col`) AS `timestamp_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_datetime_to_integer_label/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_datetime_to_integer_label/out.sql index 5260dd680a3..3f055c6aa5e 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_datetime_to_integer_label/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_datetime_to_integer_label/out.sql @@ -3,36 +3,31 @@ WITH `bfcte_0` AS ( `datetime_col`, `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CAST(FLOOR( - IEEE_DIVIDE( - UNIX_MICROS(CAST(`datetime_col` AS TIMESTAMP)) - UNIX_MICROS(CAST(`timestamp_col` AS TIMESTAMP)), - 86400000000 - ) - ) AS INT64) AS `bfcol_2`, - CASE - WHEN UNIX_MICROS( - CAST(TIMESTAMP_TRUNC(`datetime_col`, WEEK(MONDAY)) + INTERVAL 6 DAY AS TIMESTAMP) - ) = UNIX_MICROS( - CAST(TIMESTAMP_TRUNC(`timestamp_col`, WEEK(MONDAY)) + INTERVAL 6 DAY AS TIMESTAMP) - ) - THEN 0 - ELSE CAST(FLOOR( - IEEE_DIVIDE( - UNIX_MICROS( - CAST(TIMESTAMP_TRUNC(`datetime_col`, WEEK(MONDAY)) + INTERVAL 6 DAY AS TIMESTAMP) - ) - UNIX_MICROS( - CAST(TIMESTAMP_TRUNC(`timestamp_col`, WEEK(MONDAY)) + INTERVAL 6 DAY AS TIMESTAMP) - ) - 1, - 604800000000 - ) - ) AS INT64) + 1 - END AS `bfcol_3` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `fixed_freq`, - `bfcol_3` AS `non_fixed_freq_weekly` -FROM `bfcte_1` \ No newline at end of file + *, + CAST(FLOOR( + IEEE_DIVIDE( + UNIX_MICROS(CAST(`datetime_col` AS TIMESTAMP)) - UNIX_MICROS(CAST(`timestamp_col` AS TIMESTAMP)), + 86400000000 + ) + ) AS INT64) AS `fixed_freq`, + CASE + WHEN UNIX_MICROS( + CAST(TIMESTAMP_TRUNC(`datetime_col`, WEEK(MONDAY)) + INTERVAL 6 DAY AS TIMESTAMP) + ) = UNIX_MICROS( + CAST(TIMESTAMP_TRUNC(`timestamp_col`, WEEK(MONDAY)) + INTERVAL 6 DAY AS TIMESTAMP) + ) + THEN 0 + ELSE CAST(FLOOR( + IEEE_DIVIDE( + UNIX_MICROS( + CAST(TIMESTAMP_TRUNC(`datetime_col`, WEEK(MONDAY)) + INTERVAL 6 DAY AS TIMESTAMP) + ) - UNIX_MICROS( + CAST(TIMESTAMP_TRUNC(`timestamp_col`, WEEK(MONDAY)) + INTERVAL 6 DAY AS TIMESTAMP) + ) - 1, + 604800000000 + ) + ) AS INT64) + 1 + END AS `non_fixed_freq_weekly` +FROM `bfcte_0` \ No newline at end of file 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 52d80fd2a61..0bdb1ba2a7a 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - EXTRACT(DAY FROM `timestamp_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + *, + EXTRACT(DAY FROM `timestamp_col`) AS `timestamp_col` +FROM `bfcte_0` \ No newline at end of file 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 0119bbb4e9f..f728f16a36b 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 @@ -4,16 +4,10 @@ WITH `bfcte_0` AS ( `datetime_col`, `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - 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 - `bfcol_6` AS `datetime_col`, - `bfcol_7` AS `timestamp_col`, - `bfcol_8` AS `date_col` -FROM `bfcte_1` \ No newline at end of file + *, + CAST(MOD(EXTRACT(DAYOFWEEK FROM `datetime_col`) + 5, 7) AS INT64) AS `datetime_col`, + CAST(MOD(EXTRACT(DAYOFWEEK FROM `timestamp_col`) + 5, 7) AS INT64) AS `timestamp_col`, + CAST(MOD(EXTRACT(DAYOFWEEK FROM `date_col`) + 5, 7) AS INT64) AS `date_col` +FROM `bfcte_0` \ No newline at end of file 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 521419757ab..2058f9994bf 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - EXTRACT(DAYOFYEAR FROM `timestamp_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + *, + EXTRACT(DAYOFYEAR FROM `timestamp_col`) AS `timestamp_col` +FROM `bfcte_0` \ No newline at end of file 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 fe76efb609b..2c60b32582d 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 @@ -3,34 +3,19 @@ WITH `bfcte_0` AS ( `datetime_col`, `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - 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 - `bfcol_2` AS `timestamp_col_us`, - `bfcol_3` AS `timestamp_col_ms`, - `bfcol_4` AS `timestamp_col_s`, - `bfcol_5` AS `timestamp_col_min`, - `bfcol_6` AS `timestamp_col_h`, - `bfcol_7` AS `timestamp_col_D`, - `bfcol_8` AS `timestamp_col_W`, - `bfcol_9` AS `timestamp_col_M`, - `bfcol_10` AS `timestamp_col_Q`, - `bfcol_11` AS `timestamp_col_Y`, - `bfcol_12` AS `datetime_col_q`, - `bfcol_13` AS `datetime_col_us` -FROM `bfcte_1` \ No newline at end of file + *, + TIMESTAMP_TRUNC(`timestamp_col`, MICROSECOND) AS `timestamp_col_us`, + TIMESTAMP_TRUNC(`timestamp_col`, MILLISECOND) AS `timestamp_col_ms`, + TIMESTAMP_TRUNC(`timestamp_col`, SECOND) AS `timestamp_col_s`, + TIMESTAMP_TRUNC(`timestamp_col`, MINUTE) AS `timestamp_col_min`, + TIMESTAMP_TRUNC(`timestamp_col`, HOUR) AS `timestamp_col_h`, + TIMESTAMP_TRUNC(`timestamp_col`, DAY) AS `timestamp_col_D`, + TIMESTAMP_TRUNC(`timestamp_col`, WEEK(MONDAY)) AS `timestamp_col_W`, + TIMESTAMP_TRUNC(`timestamp_col`, MONTH) AS `timestamp_col_M`, + TIMESTAMP_TRUNC(`timestamp_col`, QUARTER) AS `timestamp_col_Q`, + TIMESTAMP_TRUNC(`timestamp_col`, YEAR) AS `timestamp_col_Y`, + TIMESTAMP_TRUNC(`datetime_col`, MICROSECOND) AS `datetime_col_q`, + TIMESTAMP_TRUNC(`datetime_col`, MICROSECOND) AS `datetime_col_us` +FROM `bfcte_0` \ No newline at end of file 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 5fc6621a7ca..8e56bd0d705 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - EXTRACT(HOUR FROM `timestamp_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + *, + EXTRACT(HOUR FROM `timestamp_col`) AS `timestamp_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_fixed/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_fixed/out.sql index 8a759e85f98..bd2087b4bb8 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_fixed/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_fixed/out.sql @@ -3,14 +3,10 @@ WITH `bfcte_0` AS ( `rowindex`, `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CAST(TIMESTAMP_MICROS( - CAST(CAST(`rowindex` AS BIGNUMERIC) * 86400000000 + CAST(UNIX_MICROS(CAST(`timestamp_col` AS TIMESTAMP)) AS BIGNUMERIC) AS INT64) - ) AS TIMESTAMP) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `fixed_freq` -FROM `bfcte_1` \ No newline at end of file + *, + CAST(TIMESTAMP_MICROS( + CAST(CAST(`rowindex` AS BIGNUMERIC) * 86400000000 + CAST(UNIX_MICROS(CAST(`timestamp_col` AS TIMESTAMP)) AS BIGNUMERIC) AS INT64) + ) AS TIMESTAMP) AS `fixed_freq` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_month/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_month/out.sql index a9e64fead63..96619f580b3 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_month/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_month/out.sql @@ -3,48 +3,44 @@ WITH `bfcte_0` AS ( `rowindex`, `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CAST(TIMESTAMP( - DATETIME( - CASE - WHEN MOD( - `rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) * 12 + EXTRACT(MONTH FROM `timestamp_col`) - 1, - 12 - ) + 1 = 12 - THEN CAST(FLOOR( - IEEE_DIVIDE( - `rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) * 12 + EXTRACT(MONTH FROM `timestamp_col`) - 1, - 12 - ) - ) AS INT64) + 1 - ELSE CAST(FLOOR( - IEEE_DIVIDE( - `rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) * 12 + EXTRACT(MONTH FROM `timestamp_col`) - 1, - 12 - ) - ) AS INT64) - END, - CASE - WHEN MOD( +) +SELECT + *, + CAST(TIMESTAMP( + DATETIME( + CASE + WHEN MOD( + `rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) * 12 + EXTRACT(MONTH FROM `timestamp_col`) - 1, + 12 + ) + 1 = 12 + THEN CAST(FLOOR( + IEEE_DIVIDE( `rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) * 12 + EXTRACT(MONTH FROM `timestamp_col`) - 1, 12 - ) + 1 = 12 - THEN 1 - ELSE MOD( + ) + ) AS INT64) + 1 + ELSE CAST(FLOOR( + IEEE_DIVIDE( `rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) * 12 + EXTRACT(MONTH FROM `timestamp_col`) - 1, 12 - ) + 1 + 1 - END, - 1, - 0, - 0, - 0 - ) - ) - INTERVAL 1 DAY AS TIMESTAMP) AS `bfcol_2` - FROM `bfcte_0` -) -SELECT - `bfcol_2` AS `non_fixed_freq_monthly` -FROM `bfcte_1` \ No newline at end of file + ) + ) AS INT64) + END, + CASE + WHEN MOD( + `rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) * 12 + EXTRACT(MONTH FROM `timestamp_col`) - 1, + 12 + ) + 1 = 12 + THEN 1 + ELSE MOD( + `rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) * 12 + EXTRACT(MONTH FROM `timestamp_col`) - 1, + 12 + ) + 1 + 1 + END, + 1, + 0, + 0, + 0 + ) + ) - INTERVAL 1 DAY AS TIMESTAMP) AS `non_fixed_freq_monthly` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_quarter/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_quarter/out.sql index 58064855a9e..b0fc8b145de 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_quarter/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_quarter/out.sql @@ -3,52 +3,48 @@ WITH `bfcte_0` AS ( `rowindex`, `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CAST(DATETIME( - CASE - WHEN ( - MOD( - `rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) * 4 + EXTRACT(QUARTER FROM `timestamp_col`) - 1, - 4 - ) + 1 - ) * 3 = 12 - THEN CAST(FLOOR( - IEEE_DIVIDE( - `rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) * 4 + EXTRACT(QUARTER FROM `timestamp_col`) - 1, - 4 - ) - ) AS INT64) + 1 - ELSE CAST(FLOOR( - IEEE_DIVIDE( - `rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) * 4 + EXTRACT(QUARTER FROM `timestamp_col`) - 1, - 4 - ) - ) AS INT64) - END, - CASE - WHEN ( - MOD( - `rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) * 4 + EXTRACT(QUARTER FROM `timestamp_col`) - 1, - 4 - ) + 1 - ) * 3 = 12 - THEN 1 - ELSE ( - MOD( - `rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) * 4 + EXTRACT(QUARTER FROM `timestamp_col`) - 1, - 4 - ) + 1 - ) * 3 + 1 - END, - 1, - 0, - 0, - 0 - ) - INTERVAL 1 DAY AS TIMESTAMP) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `non_fixed_freq` -FROM `bfcte_1` \ No newline at end of file + *, + CAST(DATETIME( + CASE + WHEN ( + MOD( + `rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) * 4 + EXTRACT(QUARTER FROM `timestamp_col`) - 1, + 4 + ) + 1 + ) * 3 = 12 + THEN CAST(FLOOR( + IEEE_DIVIDE( + `rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) * 4 + EXTRACT(QUARTER FROM `timestamp_col`) - 1, + 4 + ) + ) AS INT64) + 1 + ELSE CAST(FLOOR( + IEEE_DIVIDE( + `rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) * 4 + EXTRACT(QUARTER FROM `timestamp_col`) - 1, + 4 + ) + ) AS INT64) + END, + CASE + WHEN ( + MOD( + `rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) * 4 + EXTRACT(QUARTER FROM `timestamp_col`) - 1, + 4 + ) + 1 + ) * 3 = 12 + THEN 1 + ELSE ( + MOD( + `rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) * 4 + EXTRACT(QUARTER FROM `timestamp_col`) - 1, + 4 + ) + 1 + ) * 3 + 1 + END, + 1, + 0, + 0, + 0 + ) - INTERVAL 1 DAY AS TIMESTAMP) AS `non_fixed_freq` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_week/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_week/out.sql index 142f8561f48..f93473f636b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_week/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_week/out.sql @@ -3,16 +3,12 @@ WITH `bfcte_0` AS ( `rowindex`, `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CAST(TIMESTAMP_MICROS( - CAST(CAST(`rowindex` AS BIGNUMERIC) * 604800000000 + CAST(UNIX_MICROS( - TIMESTAMP_TRUNC(CAST(`timestamp_col` AS TIMESTAMP), WEEK(MONDAY)) + INTERVAL 6 DAY - ) AS BIGNUMERIC) AS INT64) - ) AS TIMESTAMP) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `non_fixed_freq_weekly` -FROM `bfcte_1` \ No newline at end of file + *, + CAST(TIMESTAMP_MICROS( + CAST(CAST(`rowindex` AS BIGNUMERIC) * 604800000000 + CAST(UNIX_MICROS( + TIMESTAMP_TRUNC(CAST(`timestamp_col` AS TIMESTAMP), WEEK(MONDAY)) + INTERVAL 6 DAY + ) AS BIGNUMERIC) AS INT64) + ) AS TIMESTAMP) AS `non_fixed_freq_weekly` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_year/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_year/out.sql index ab77a9d1906..d199abc5ea6 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_year/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_year/out.sql @@ -3,12 +3,8 @@ WITH `bfcte_0` AS ( `rowindex`, `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CAST(TIMESTAMP(DATETIME(`rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) + 1, 1, 1, 0, 0, 0)) - INTERVAL 1 DAY AS TIMESTAMP) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `non_fixed_freq_yearly` -FROM `bfcte_1` \ No newline at end of file + *, + CAST(TIMESTAMP(DATETIME(`rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) + 1, 1, 1, 0, 0, 0)) - INTERVAL 1 DAY AS TIMESTAMP) AS `non_fixed_freq_yearly` +FROM `bfcte_0` \ No newline at end of file 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 9422844b34f..3751efb2d3f 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CAST(MOD(EXTRACT(DAYOFWEEK FROM `timestamp_col`) + 5, 7) AS INT64) + 1 AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + *, + CAST(MOD(EXTRACT(DAYOFWEEK FROM `timestamp_col`) + 5, 7) AS INT64) + 1 AS `timestamp_col` +FROM `bfcte_0` \ No newline at end of file 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 4db49fb10fa..90651af773f 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - EXTRACT(ISOWEEK FROM `timestamp_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + *, + EXTRACT(ISOWEEK FROM `timestamp_col`) AS `timestamp_col` +FROM `bfcte_0` \ No newline at end of file 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 8d49933202c..c47404f235a 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - EXTRACT(ISOYEAR FROM `timestamp_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + *, + EXTRACT(ISOYEAR FROM `timestamp_col`) AS `timestamp_col` +FROM `bfcte_0` \ No newline at end of file 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 e089a77af51..99b3197c6bb 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - EXTRACT(MINUTE FROM `timestamp_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + *, + EXTRACT(MINUTE FROM `timestamp_col`) AS `timestamp_col` +FROM `bfcte_0` \ No newline at end of file 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 53d135903ba..cdac5cf60d4 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - EXTRACT(MONTH FROM `timestamp_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + *, + EXTRACT(MONTH FROM `timestamp_col`) AS `timestamp_col` +FROM `bfcte_0` \ No newline at end of file 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 b542dfea72a..7f1848a1251 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - TIMESTAMP_TRUNC(`timestamp_col`, DAY) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + *, + TIMESTAMP_TRUNC(`timestamp_col`, DAY) AS `timestamp_col` +FROM `bfcte_0` \ No newline at end of file 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 4a232cb5a30..a450792c1b1 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - EXTRACT(QUARTER FROM `timestamp_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + *, + EXTRACT(QUARTER FROM `timestamp_col`) AS `timestamp_col` +FROM `bfcte_0` \ No newline at end of file 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 e86d830b737..29a1f2a6216 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - EXTRACT(SECOND FROM `timestamp_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + *, + EXTRACT(SECOND FROM `timestamp_col`) AS `timestamp_col` +FROM `bfcte_0` \ No newline at end of file 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 1d8f62f948a..36137772e49 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 @@ -5,18 +5,11 @@ WITH `bfcte_0` AS ( `time_col`, `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - FORMAT_DATE('%Y-%m-%d', `date_col`) AS `bfcol_8`, - FORMAT_DATETIME('%Y-%m-%d', `datetime_col`) AS `bfcol_9`, - FORMAT_TIME('%Y-%m-%d', `time_col`) AS `bfcol_10`, - FORMAT_TIMESTAMP('%Y-%m-%d', `timestamp_col`) AS `bfcol_11` - FROM `bfcte_0` ) SELECT - `bfcol_8` AS `date_col`, - `bfcol_9` AS `datetime_col`, - `bfcol_10` AS `time_col`, - `bfcol_11` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + *, + FORMAT_DATE('%Y-%m-%d', `date_col`) AS `date_col`, + FORMAT_DATETIME('%Y-%m-%d', `datetime_col`) AS `datetime_col`, + FORMAT_TIME('%Y-%m-%d', `time_col`) AS `time_col`, + FORMAT_TIMESTAMP('%Y-%m-%d', `timestamp_col`) AS `timestamp_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_sub_timedelta/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_sub_timedelta/out.sql index ebcffd67f61..c5306a9d0b5 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 @@ -5,78 +5,16 @@ WITH `bfcte_0` AS ( `rowindex`, `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - *, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - `bfcol_11` AS `bfcol_18`, - `bfcol_10` AS `bfcol_19`, - TIMESTAMP_SUB(CAST(`bfcol_10` AS DATETIME), INTERVAL `bfcol_11` MICROSECOND) AS `bfcol_20` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - `bfcol_19` AS `bfcol_29`, - `bfcol_20` AS `bfcol_30`, - TIMESTAMP_SUB(`bfcol_17`, INTERVAL `bfcol_18` MICROSECOND) AS `bfcol_31` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - *, - `bfcol_26` AS `bfcol_38`, - `bfcol_27` AS `bfcol_39`, - `bfcol_28` AS `bfcol_40`, - `bfcol_29` AS `bfcol_41`, - `bfcol_30` AS `bfcol_42`, - `bfcol_31` AS `bfcol_43`, - TIMESTAMP_DIFF(CAST(`bfcol_29` AS DATETIME), CAST(`bfcol_29` AS DATETIME), MICROSECOND) AS `bfcol_44` - FROM `bfcte_3` -), `bfcte_5` AS ( - SELECT - *, - `bfcol_38` AS `bfcol_52`, - `bfcol_39` AS `bfcol_53`, - `bfcol_40` AS `bfcol_54`, - `bfcol_41` AS `bfcol_55`, - `bfcol_42` AS `bfcol_56`, - `bfcol_43` AS `bfcol_57`, - `bfcol_44` AS `bfcol_58`, - TIMESTAMP_DIFF(`bfcol_39`, `bfcol_39`, MICROSECOND) AS `bfcol_59` - FROM `bfcte_4` -), `bfcte_6` AS ( - SELECT - *, - `bfcol_52` AS `bfcol_68`, - `bfcol_53` AS `bfcol_69`, - `bfcol_54` AS `bfcol_70`, - `bfcol_55` AS `bfcol_71`, - `bfcol_56` AS `bfcol_72`, - `bfcol_57` AS `bfcol_73`, - `bfcol_58` AS `bfcol_74`, - `bfcol_59` AS `bfcol_75`, - `bfcol_54` - `bfcol_54` AS `bfcol_76` - FROM `bfcte_5` ) SELECT - `bfcol_68` AS `rowindex`, - `bfcol_69` AS `timestamp_col`, - `bfcol_70` AS `duration_col`, - `bfcol_71` AS `date_col`, - `bfcol_72` AS `date_sub_timedelta`, - `bfcol_73` AS `timestamp_sub_timedelta`, - `bfcol_74` AS `timestamp_sub_date`, - `bfcol_75` AS `date_sub_timestamp`, - `bfcol_76` AS `timedelta_sub_timedelta` -FROM `bfcte_6` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `timestamp_col` AS `timestamp_col`, + `duration_col` AS `duration_col`, + `date_col` AS `date_col`, + TIMESTAMP_SUB(CAST(`date_col` AS DATETIME), INTERVAL `duration_col` MICROSECOND) AS `date_sub_timedelta`, + TIMESTAMP_SUB(`timestamp_col`, INTERVAL `duration_col` MICROSECOND) AS `timestamp_sub_timedelta`, + TIMESTAMP_DIFF(CAST(`date_col` AS DATETIME), CAST(`date_col` AS DATETIME), MICROSECOND) AS `timestamp_sub_date`, + TIMESTAMP_DIFF(`timestamp_col`, `timestamp_col`, MICROSECOND) AS `date_sub_timestamp`, + `duration_col` - `duration_col` AS `timedelta_sub_timedelta` +FROM `bfcte_0` \ No newline at end of file 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 5a8ab600bac..b33b1c6a78b 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - TIME(`timestamp_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + *, + TIME(`timestamp_col`) AS `timestamp_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_to_datetime/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_to_datetime/out.sql index a8d40a84867..c063a8a0ae3 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 @@ -4,16 +4,10 @@ WITH `bfcte_0` AS ( `int64_col`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CAST(TIMESTAMP_MICROS(CAST(TRUNC(`int64_col` * 0.001) AS INT64)) AS DATETIME) AS `bfcol_6`, - SAFE_CAST(`string_col` AS DATETIME) AS `bfcol_7`, - CAST(TIMESTAMP_MICROS(CAST(TRUNC(`float64_col` * 0.001) AS INT64)) AS DATETIME) AS `bfcol_8` - FROM `bfcte_0` ) SELECT - `bfcol_6` AS `int64_col`, - `bfcol_7` AS `string_col`, - `bfcol_8` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + CAST(TIMESTAMP_MICROS(CAST(TRUNC(`int64_col` * 0.001) AS INT64)) AS DATETIME) AS `int64_col`, + SAFE_CAST(`string_col` AS DATETIME) AS `string_col`, + CAST(TIMESTAMP_MICROS(CAST(TRUNC(`float64_col` * 0.001) AS INT64)) AS DATETIME) AS `float64_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_to_timestamp/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_to_timestamp/out.sql index a5f9ee1112b..9892c0d608d 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 @@ -3,22 +3,13 @@ WITH `bfcte_0` AS ( `float64_col`, `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CAST(TIMESTAMP_MICROS(CAST(TRUNC(`int64_col` * 0.001) AS INT64)) AS TIMESTAMP) AS `bfcol_2`, - CAST(TIMESTAMP_MICROS(CAST(TRUNC(`float64_col` * 0.001) AS INT64)) AS TIMESTAMP) AS `bfcol_3`, - CAST(TIMESTAMP_MICROS(CAST(TRUNC(`int64_col` * 1000000) AS INT64)) AS TIMESTAMP) AS `bfcol_4`, - CAST(TIMESTAMP_MICROS(CAST(TRUNC(`int64_col` * 1000) AS INT64)) AS TIMESTAMP) AS `bfcol_5`, - CAST(TIMESTAMP_MICROS(CAST(TRUNC(`int64_col`) AS INT64)) AS TIMESTAMP) AS `bfcol_6`, - CAST(TIMESTAMP_MICROS(CAST(TRUNC(`int64_col` * 0.001) AS INT64)) AS TIMESTAMP) AS `bfcol_7` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `int64_col`, - `bfcol_3` AS `float64_col`, - `bfcol_4` AS `int64_col_s`, - `bfcol_5` AS `int64_col_ms`, - `bfcol_6` AS `int64_col_us`, - `bfcol_7` AS `int64_col_ns` -FROM `bfcte_1` \ No newline at end of file + *, + CAST(TIMESTAMP_MICROS(CAST(TRUNC(`int64_col` * 0.001) AS INT64)) AS TIMESTAMP) AS `int64_col`, + CAST(TIMESTAMP_MICROS(CAST(TRUNC(`float64_col` * 0.001) AS INT64)) AS TIMESTAMP) AS `float64_col`, + CAST(TIMESTAMP_MICROS(CAST(TRUNC(`int64_col` * 1000000) AS INT64)) AS TIMESTAMP) AS `int64_col_s`, + CAST(TIMESTAMP_MICROS(CAST(TRUNC(`int64_col` * 1000) AS INT64)) AS TIMESTAMP) AS `int64_col_ms`, + CAST(TIMESTAMP_MICROS(CAST(TRUNC(`int64_col`) AS INT64)) AS TIMESTAMP) AS `int64_col_us`, + CAST(TIMESTAMP_MICROS(CAST(TRUNC(`int64_col` * 0.001) AS INT64)) AS TIMESTAMP) AS `int64_col_ns` +FROM `bfcte_0` \ No newline at end of file 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 e6515017f25..2b09b23feb7 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - UNIX_MICROS(`timestamp_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + *, + UNIX_MICROS(`timestamp_col`) AS `timestamp_col` +FROM `bfcte_0` \ No newline at end of file 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 caec5effe0a..43996423bd0 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - UNIX_MILLIS(`timestamp_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + *, + UNIX_MILLIS(`timestamp_col`) AS `timestamp_col` +FROM `bfcte_0` \ No newline at end of file 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 6dc0ea2a02a..c4155cac311 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - UNIX_SECONDS(`timestamp_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + *, + UNIX_SECONDS(`timestamp_col`) AS `timestamp_col` +FROM `bfcte_0` \ No newline at end of file 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 1ceb674137c..dfa150c2bca 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - EXTRACT(YEAR FROM `timestamp_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + *, + EXTRACT(YEAR FROM `timestamp_col`) AS `timestamp_col` +FROM `bfcte_0` \ No newline at end of file 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 1f90accd0bb..f7868ed36dd 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 @@ -3,16 +3,10 @@ WITH `bfcte_0` AS ( `bool_col`, `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `bool_col` AS `bfcol_2`, - `float64_col` <> 0 AS `bfcol_3`, - `float64_col` <> 0 AS `bfcol_4` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `bool_col`, - `bfcol_3` AS `float64_col`, - `bfcol_4` AS `float64_w_safe` -FROM `bfcte_1` \ No newline at end of file + *, + `bool_col` AS `bool_col`, + `float64_col` <> 0 AS `float64_col`, + `float64_col` <> 0 AS `float64_w_safe` +FROM `bfcte_0` \ No newline at end of file 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 32c8da56fa4..7c8292a0ed5 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 @@ -2,16 +2,10 @@ WITH `bfcte_0` AS ( SELECT `bool_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CAST(CAST(`bool_col` AS INT64) AS FLOAT64) AS `bfcol_1`, - CAST('1.34235e4' AS FLOAT64) AS `bfcol_2`, - SAFE_CAST(SAFE_CAST(`bool_col` AS INT64) AS FLOAT64) AS `bfcol_3` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `bool_col`, - `bfcol_2` AS `str_const`, - `bfcol_3` AS `bool_w_safe` -FROM `bfcte_1` \ No newline at end of file + *, + CAST(CAST(`bool_col` AS INT64) AS FLOAT64) AS `bool_col`, + CAST('1.34235e4' AS FLOAT64) AS `str_const`, + SAFE_CAST(SAFE_CAST(`bool_col` AS INT64) AS FLOAT64) AS `bool_w_safe` +FROM `bfcte_0` \ No newline at end of file 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 d1577c0664d..a3e6ebc35db 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 @@ -2,20 +2,12 @@ WITH `bfcte_0` AS ( SELECT `json_col` FROM `bigframes-dev`.`sqlglot_test`.`json_types` -), `bfcte_1` AS ( - SELECT - *, - 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 - `bfcol_1` AS `int64_col`, - `bfcol_2` AS `float64_col`, - `bfcol_3` AS `bool_col`, - `bfcol_4` AS `string_col`, - `bfcol_5` AS `int64_w_safe` -FROM `bfcte_1` \ No newline at end of file + *, + INT64(`json_col`) AS `int64_col`, + FLOAT64(`json_col`) AS `float64_col`, + BOOL(`json_col`) AS `bool_col`, + STRING(`json_col`) AS `string_col`, + SAFE.INT64(`json_col`) AS `int64_w_safe` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_int/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_int/out.sql index e0fe2af9a9d..984ee9b2410 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 @@ -6,28 +6,16 @@ WITH `bfcte_0` AS ( `time_col`, `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - 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` ) SELECT - `bfcol_5` AS `datetime_col`, - `bfcol_6` AS `datetime_w_safe`, - `bfcol_7` AS `time_col`, - `bfcol_8` AS `time_w_safe`, - `bfcol_9` AS `timestamp_col`, - `bfcol_10` AS `numeric_col`, - `bfcol_11` AS `float64_col`, - `bfcol_12` AS `float64_w_safe`, - `bfcol_13` AS `str_const` -FROM `bfcte_1` \ No newline at end of file + *, + UNIX_MICROS(CAST(`datetime_col` AS TIMESTAMP)) AS `datetime_col`, + UNIX_MICROS(SAFE_CAST(`datetime_col` AS TIMESTAMP)) AS `datetime_w_safe`, + TIME_DIFF(CAST(`time_col` AS TIME), '00:00:00', MICROSECOND) AS `time_col`, + TIME_DIFF(SAFE_CAST(`time_col` AS TIME), '00:00:00', MICROSECOND) AS `time_w_safe`, + UNIX_MICROS(`timestamp_col`) AS `timestamp_col`, + CAST(TRUNC(`numeric_col`) AS INT64) AS `numeric_col`, + CAST(TRUNC(`float64_col`) AS INT64) AS `float64_col`, + SAFE_CAST(TRUNC(`float64_col`) AS INT64) AS `float64_w_safe`, + CAST('100' AS INT64) AS `str_const` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_json/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_json/out.sql index 4ffaf7256a1..e11f66b8125 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 @@ -5,22 +5,13 @@ WITH `bfcte_0` AS ( `int64_col`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - 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`, - SAFE.PARSE_JSON(`string_col`) AS `bfcol_9` - FROM `bfcte_0` ) SELECT - `bfcol_4` AS `int64_col`, - `bfcol_5` AS `float64_col`, - `bfcol_6` AS `bool_col`, - `bfcol_7` AS `string_col`, - `bfcol_8` AS `bool_w_safe`, - `bfcol_9` AS `string_w_safe` -FROM `bfcte_1` \ No newline at end of file + *, + PARSE_JSON(CAST(`int64_col` AS STRING)) AS `int64_col`, + PARSE_JSON(CAST(`float64_col` AS STRING)) AS `float64_col`, + PARSE_JSON(CAST(`bool_col` AS STRING)) AS `bool_col`, + PARSE_JSON(`string_col`) AS `string_col`, + PARSE_JSON(CAST(`bool_col` AS STRING)) AS `bool_w_safe`, + SAFE.PARSE_JSON(`string_col`) AS `string_w_safe` +FROM `bfcte_0` \ No newline at end of file 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 da6eb6ce187..433a2c6eae5 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 @@ -3,16 +3,10 @@ WITH `bfcte_0` AS ( `bool_col`, `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - 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 - `bfcol_2` AS `int64_col`, - `bfcol_3` AS `bool_col`, - `bfcol_4` AS `bool_w_safe` -FROM `bfcte_1` \ No newline at end of file + *, + CAST(`int64_col` AS STRING) AS `int64_col`, + INITCAP(CAST(`bool_col` AS STRING)) AS `bool_col`, + INITCAP(SAFE_CAST(`bool_col` AS STRING)) AS `bool_w_safe` +FROM `bfcte_0` \ No newline at end of file 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 6523d8376cc..4545b6458f6 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 @@ -2,18 +2,11 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - 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 - `bfcol_1` AS `int64_to_datetime`, - `bfcol_2` AS `int64_to_time`, - `bfcol_3` AS `int64_to_timestamp`, - `bfcol_4` AS `int64_to_time_safe` -FROM `bfcte_1` \ No newline at end of file + *, + CAST(TIMESTAMP_MICROS(`int64_col`) AS DATETIME) AS `int64_to_datetime`, + CAST(TIMESTAMP_MICROS(`int64_col`) AS TIME) AS `int64_to_time`, + CAST(TIMESTAMP_MICROS(`int64_col`) AS TIMESTAMP) AS `int64_to_timestamp`, + SAFE_CAST(TIMESTAMP_MICROS(`int64_col`) AS TIME) AS `int64_to_time_safe` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_binary_remote_function_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_binary_remote_function_op/out.sql index 7272a3a5be1..1d0182b2803 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_binary_remote_function_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_binary_remote_function_op/out.sql @@ -3,12 +3,8 @@ WITH `bfcte_0` AS ( `float64_col`, `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `my_project`.`my_dataset`.`my_routine`(`int64_col`, `float64_col`) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `int64_col` -FROM `bfcte_1` \ No newline at end of file + *, + `my_project`.`my_dataset`.`my_routine`(`int64_col`, `float64_col`) AS `int64_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_case_when_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_case_when_op/out.sql index 08a489e2401..25e1448b7af 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 @@ -5,25 +5,18 @@ WITH `bfcte_0` AS ( `int64_col`, `int64_too` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - 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 `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` ) SELECT - `bfcol_4` AS `single_case`, - `bfcol_5` AS `double_case`, - `bfcol_6` AS `bool_types_case`, - `bfcol_7` AS `mixed_types_cast` -FROM `bfcte_1` \ No newline at end of file + *, + CASE WHEN `bool_col` THEN `int64_col` END AS `single_case`, + CASE WHEN `bool_col` THEN `int64_col` WHEN `bool_col` THEN `int64_too` END AS `double_case`, + CASE WHEN `bool_col` THEN `bool_col` WHEN `bool_col` THEN `bool_col` END AS `bool_types_case`, + CASE + WHEN `bool_col` + THEN `int64_col` + WHEN `bool_col` + THEN CAST(`bool_col` AS INT64) + WHEN `bool_col` + THEN `float64_col` + END AS `mixed_types_cast` +FROM `bfcte_0` \ No newline at end of file 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 b1625931478..d413a5d2ba5 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 @@ -4,12 +4,8 @@ WITH `bfcte_0` AS ( `int64_too`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - GREATEST(LEAST(`rowindex`, `int64_too`), `int64_col`) AS `bfcol_3` - FROM `bfcte_0` ) SELECT - `bfcol_3` AS `result_col` -FROM `bfcte_1` \ No newline at end of file + *, + GREATEST(LEAST(`rowindex`, `int64_too`), `int64_col`) AS `result_col` +FROM `bfcte_0` \ No newline at end of file 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 451de48b642..9a5989bafec 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 @@ -3,14 +3,9 @@ WITH `bfcte_0` AS ( `int64_col`, `int64_too` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `int64_col` AS `bfcol_2`, - COALESCE(`int64_too`, `int64_col`) AS `bfcol_3` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `int64_col`, - `bfcol_3` AS `int64_too` -FROM `bfcte_1` \ No newline at end of file + *, + `int64_col` AS `int64_col`, + COALESCE(`int64_too`, `int64_col`) AS `int64_too` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_fillna/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_fillna/out.sql index 07f2877e740..4b431f6806b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_fillna/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_fillna/out.sql @@ -3,12 +3,8 @@ WITH `bfcte_0` AS ( `float64_col`, `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - COALESCE(`int64_col`, `float64_col`) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `int64_col` -FROM `bfcte_1` \ No newline at end of file + *, + COALESCE(`int64_col`, `float64_col`) AS `int64_col` +FROM `bfcte_0` \ No newline at end of file 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 19fce600910..346fd6c9920 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - FARM_FINGERPRINT(`string_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + FARM_FINGERPRINT(`string_col`) AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 1bd2eb7426c..e5be11cea29 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 @@ -4,22 +4,16 @@ WITH `bfcte_0` AS ( `bytes_col`, `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ~( - `int64_col` - ) AS `bfcol_6`, - ~( - `bytes_col` - ) AS `bfcol_7`, - NOT ( - `bool_col` - ) AS `bfcol_8` - FROM `bfcte_0` ) SELECT - `bfcol_6` AS `int64_col`, - `bfcol_7` AS `bytes_col`, - `bfcol_8` AS `bool_col` -FROM `bfcte_1` \ No newline at end of file + *, + ~( + `int64_col` + ) AS `int64_col`, + ~( + `bytes_col` + ) AS `bytes_col`, + NOT ( + `bool_col` + ) AS `bool_col` +FROM `bfcte_0` \ No newline at end of file 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 0a549bdd442..e1a1a8a3b49 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `float64_col` IS NULL AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + `float64_col` IS NULL AS `float64_col` +FROM `bfcte_0` \ No newline at end of file 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 49eada22301..cbc026f65f8 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 @@ -2,18 +2,14 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - WHEN `string_col` = 'value1' - THEN 'mapped1' - WHEN `string_col` IS NULL - THEN 'UNKNOWN' - ELSE `string_col` - END AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + CASE + WHEN `string_col` = 'value1' + THEN 'mapped1' + WHEN `string_col` IS NULL + THEN 'UNKNOWN' + ELSE `string_col` + END AS `string_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_nary_remote_function_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_nary_remote_function_op/out.sql index a6641b13db6..c031e2b8a13 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_nary_remote_function_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_nary_remote_function_op/out.sql @@ -4,12 +4,8 @@ WITH `bfcte_0` AS ( `int64_col`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `my_project`.`my_dataset`.`my_routine`(`int64_col`, `float64_col`, `string_col`) AS `bfcol_3` - FROM `bfcte_0` ) SELECT - `bfcol_3` AS `int64_col` -FROM `bfcte_1` \ No newline at end of file + *, + `my_project`.`my_dataset`.`my_routine`(`int64_col`, `float64_col`, `string_col`) AS `int64_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_notnull/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_notnull/out.sql index bf3425fe6de..a3ccc73b404 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - NOT `float64_col` IS NULL AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + NOT `float64_col` IS NULL AS `float64_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_remote_function_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_remote_function_op/out.sql index dee0d35355b..68062a3c0c5 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_remote_function_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_remote_function_op/out.sql @@ -2,18 +2,13 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `my_project`.`my_dataset`.`my_routine`(`int64_col`) AS `bfcol_1`, - IF( - `int64_col` IS NULL, - `int64_col`, - `my_project`.`my_dataset`.`my_routine`(`int64_col`) - ) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `apply_on_null_true`, - `bfcol_2` AS `apply_on_null_false` -FROM `bfcte_1` \ No newline at end of file + *, + `my_project`.`my_dataset`.`my_routine`(`int64_col`) AS `apply_on_null_true`, + IF( + `int64_col` IS NULL, + `int64_col`, + `my_project`.`my_dataset`.`my_routine`(`int64_col`) + ) AS `apply_on_null_false` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_row_key/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_row_key/out.sql index 13b27c2e146..eeecdf82ed3 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 @@ -16,55 +16,51 @@ WITH `bfcte_0` AS ( `time_col`, `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CONCAT( - CAST(FARM_FINGERPRINT( - CONCAT( - 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(`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(RAND() AS STRING) - ) AS `bfcol_31` - FROM `bfcte_0` ) SELECT - `bfcol_31` AS `row_key` -FROM `bfcte_1` \ No newline at end of file + *, + CONCAT( + CAST(FARM_FINGERPRINT( + CONCAT( + 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(`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(RAND() AS STRING) + ) AS `row_key` +FROM `bfcte_0` \ No newline at end of file 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 611cbf4e7e8..e916878df7f 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 @@ -3,12 +3,8 @@ WITH `bfcte_0` AS ( `bool_col`, `bytes_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CAST(`bool_col` AS INT64) + BYTE_LENGTH(`bytes_col`) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `bool_col` -FROM `bfcte_1` \ No newline at end of file + *, + CAST(`bool_col` AS INT64) + BYTE_LENGTH(`bytes_col`) AS `bool_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_where/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_where/out.sql index 872c7943335..ce0a355597e 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 @@ -4,12 +4,8 @@ WITH `bfcte_0` AS ( `float64_col`, `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - IF(`bool_col`, `int64_col`, `float64_col`) AS `bfcol_3` - FROM `bfcte_0` ) SELECT - `bfcol_3` AS `result_col` -FROM `bfcte_1` \ No newline at end of file + *, + IF(`bool_col`, `int64_col`, `float64_col`) AS `result_col` +FROM `bfcte_0` \ No newline at end of file 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 105b5f1665d..4f2a1e792a0 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ST_AREA(`geography_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + *, + ST_AREA(`geography_col`) AS `geography_col` +FROM `bfcte_0` \ No newline at end of file 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 c338baeb5f1..ad73bba8aba 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ST_ASTEXT(`geography_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + *, + ST_ASTEXT(`geography_col`) AS `geography_col` +FROM `bfcte_0` \ No newline at end of file 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 2d4ac2e9609..a69af6cb96a 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ST_BOUNDARY(`geography_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + *, + ST_BOUNDARY(`geography_col`) AS `geography_col` +FROM `bfcte_0` \ No newline at end of file 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 84b3ab1600e..3574ce6c979 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ST_BUFFER(`geography_col`, 1.0, 8.0, FALSE) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + *, + ST_BUFFER(`geography_col`, 1.0, 8.0, FALSE) AS `geography_col` +FROM `bfcte_0` \ No newline at end of file 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 733f1e9495b..9c55b4e6c10 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ST_CENTROID(`geography_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + *, + ST_CENTROID(`geography_col`) AS `geography_col` +FROM `bfcte_0` \ No newline at end of file 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 11b3b7f6917..c8c566380a0 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ST_CONVEXHULL(`geography_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + *, + ST_CONVEXHULL(`geography_col`) AS `geography_col` +FROM `bfcte_0` \ No newline at end of file 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 4e18216ddac..c824268efb2 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ST_DIFFERENCE(`geography_col`, `geography_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + *, + ST_DIFFERENCE(`geography_col`, `geography_col`) AS `geography_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_distance/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_distance/out.sql index e98a581de72..9da34a13be8 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_distance/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_distance/out.sql @@ -2,14 +2,9 @@ WITH `bfcte_0` AS ( SELECT `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ST_DISTANCE(`geography_col`, `geography_col`, TRUE) AS `bfcol_1`, - ST_DISTANCE(`geography_col`, `geography_col`, FALSE) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `spheroid`, - `bfcol_2` AS `no_spheroid` -FROM `bfcte_1` \ No newline at end of file + *, + ST_DISTANCE(`geography_col`, `geography_col`, TRUE) AS `spheroid`, + ST_DISTANCE(`geography_col`, `geography_col`, FALSE) AS `no_spheroid` +FROM `bfcte_0` \ No newline at end of file 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 1bbb1143493..f35f314175a 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - SAFE.ST_GEOGFROMTEXT(`string_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + SAFE.ST_GEOGFROMTEXT(`string_col`) AS `string_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_geogpoint/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_geogpoint/out.sql index f6c953d161a..f586873b75d 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_geogpoint/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_geogpoint/out.sql @@ -3,12 +3,8 @@ WITH `bfcte_0` AS ( `rowindex`, `rowindex_2` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ST_GEOGPOINT(`rowindex`, `rowindex_2`) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `rowindex` -FROM `bfcte_1` \ No newline at end of file + *, + ST_GEOGPOINT(`rowindex`, `rowindex_2`) AS `rowindex` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_intersection/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_intersection/out.sql index f9290fe01a6..9a3a7336f02 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_intersection/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_intersection/out.sql @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ST_INTERSECTION(`geography_col`, `geography_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + *, + ST_INTERSECTION(`geography_col`, `geography_col`) AS `geography_col` +FROM `bfcte_0` \ No newline at end of file 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 516f175c13b..cd727577bda 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ST_ISCLOSED(`geography_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + *, + ST_ISCLOSED(`geography_col`) AS `geography_col` +FROM `bfcte_0` \ No newline at end of file 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 80eef1c906e..9987345b3d1 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ST_LENGTH(`geography_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + *, + ST_LENGTH(`geography_col`) AS `geography_col` +FROM `bfcte_0` \ No newline at end of file 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 826eb9f209d..30e7bf75392 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ST_X(`geography_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + *, + ST_X(`geography_col`) AS `geography_col` +FROM `bfcte_0` \ No newline at end of file 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 dd411820b28..b4f2c48c21c 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `geography_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ST_Y(`geography_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + *, + ST_Y(`geography_col`) AS `geography_col` +FROM `bfcte_0` \ No newline at end of file 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 435ee96df15..66665ca3d65 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `json_col` FROM `bigframes-dev`.`sqlglot_test`.`json_types` -), `bfcte_1` AS ( - SELECT - *, - JSON_EXTRACT(`json_col`, '$') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `json_col` -FROM `bfcte_1` \ No newline at end of file + *, + JSON_EXTRACT(`json_col`, '$') AS `json_col` +FROM `bfcte_0` \ No newline at end of file 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 6c9c02594d9..028571b9ca6 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `json_col` FROM `bigframes-dev`.`sqlglot_test`.`json_types` -), `bfcte_1` AS ( - SELECT - *, - JSON_EXTRACT_ARRAY(`json_col`, '$') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `json_col` -FROM `bfcte_1` \ No newline at end of file + *, + JSON_EXTRACT_ARRAY(`json_col`, '$') AS `json_col` +FROM `bfcte_0` \ No newline at end of file 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 a3a51be3781..23857e9cf4f 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `json_col` FROM `bigframes-dev`.`sqlglot_test`.`json_types` -), `bfcte_1` AS ( - SELECT - *, - JSON_EXTRACT_STRING_ARRAY(`json_col`, '$') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `json_col` -FROM `bfcte_1` \ No newline at end of file + *, + JSON_EXTRACT_STRING_ARRAY(`json_col`, '$') AS `json_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_keys/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_keys/out.sql index 640f933bb2b..7233fd81b47 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_keys/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_keys/out.sql @@ -2,14 +2,9 @@ WITH `bfcte_0` AS ( SELECT `json_col` FROM `bigframes-dev`.`sqlglot_test`.`json_types` -), `bfcte_1` AS ( - SELECT - *, - JSON_KEYS(`json_col`, NULL) AS `bfcol_1`, - JSON_KEYS(`json_col`, 2) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `json_keys`, - `bfcol_2` AS `json_keys_w_max_depth` -FROM `bfcte_1` \ No newline at end of file + *, + JSON_KEYS(`json_col`, NULL) AS `json_keys`, + JSON_KEYS(`json_col`, 2) AS `json_keys_w_max_depth` +FROM `bfcte_0` \ No newline at end of file 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 164fe2e4267..79c51616742 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `json_col` FROM `bigframes-dev`.`sqlglot_test`.`json_types` -), `bfcte_1` AS ( - SELECT - *, - JSON_QUERY(`json_col`, '$') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `json_col` -FROM `bfcte_1` \ No newline at end of file + *, + JSON_QUERY(`json_col`, '$') AS `json_col` +FROM `bfcte_0` \ No newline at end of file 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 4c3fa8e7e9b..e96554fac41 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `json_col` FROM `bigframes-dev`.`sqlglot_test`.`json_types` -), `bfcte_1` AS ( - SELECT - *, - JSON_QUERY_ARRAY(`json_col`, '$') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `json_col` -FROM `bfcte_1` \ No newline at end of file + *, + JSON_QUERY_ARRAY(`json_col`, '$') AS `json_col` +FROM `bfcte_0` \ No newline at end of file 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 f41979ea2e8..e48c213497d 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `json_col` FROM `bigframes-dev`.`sqlglot_test`.`json_types` -), `bfcte_1` AS ( - SELECT - *, - JSON_SET(`json_col`, '$.a', 100) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `json_col` -FROM `bfcte_1` \ No newline at end of file + *, + JSON_SET(`json_col`, '$.a', 100) AS `json_col` +FROM `bfcte_0` \ No newline at end of file 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 72f72372409..15ba80ad6e8 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `json_col` FROM `bigframes-dev`.`sqlglot_test`.`json_types` -), `bfcte_1` AS ( - SELECT - *, - JSON_VALUE(`json_col`, '$') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `json_col` -FROM `bfcte_1` \ No newline at end of file + *, + JSON_VALUE(`json_col`, '$') AS `json_col` +FROM `bfcte_0` \ No newline at end of file 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 5f80187ba0c..f2dc0af00c5 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - PARSE_JSON(`string_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + PARSE_JSON(`string_col`) AS `string_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_to_json/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_to_json/out.sql index ebca0c51c52..8200825655f 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_to_json/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_to_json/out.sql @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - TO_JSON(`string_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + TO_JSON(`string_col`) AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 e282c89c80e..9663e122f37 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `json_col` FROM `bigframes-dev`.`sqlglot_test`.`json_types` -), `bfcte_1` AS ( - SELECT - *, - TO_JSON_STRING(`json_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `json_col` -FROM `bfcte_1` \ No newline at end of file + *, + TO_JSON_STRING(`json_col`) AS `json_col` +FROM `bfcte_0` \ No newline at end of file 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 0fb9589387a..8b3c8fcc95a 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ABS(`float64_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + ABS(`float64_col`) AS `float64_col` +FROM `bfcte_0` \ No newline at end of file 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 1707aad8c1f..b5a6d824dc5 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 @@ -4,51 +4,14 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - *, - `bfcol_6` AS `bfcol_14`, - `bfcol_7` AS `bfcol_15`, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - `bfcol_7` + 1 AS `bfcol_18` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_14` AS `bfcol_24`, - `bfcol_15` AS `bfcol_25`, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - `bfcol_15` + CAST(`bfcol_16` AS INT64) AS `bfcol_29` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - *, - `bfcol_24` AS `bfcol_36`, - `bfcol_25` AS `bfcol_37`, - `bfcol_26` AS `bfcol_38`, - `bfcol_27` AS `bfcol_39`, - `bfcol_28` AS `bfcol_40`, - `bfcol_29` AS `bfcol_41`, - CAST(`bfcol_26` AS INT64) + `bfcol_25` AS `bfcol_42` - FROM `bfcte_3` ) SELECT - `bfcol_36` AS `rowindex`, - `bfcol_37` AS `int64_col`, - `bfcol_38` AS `bool_col`, - `bfcol_39` AS `int_add_int`, - `bfcol_40` AS `int_add_1`, - `bfcol_41` AS `int_add_bool`, - `bfcol_42` AS `bool_add_int` -FROM `bfcte_4` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `int64_col` AS `int64_col`, + `bool_col` AS `bool_col`, + `int64_col` + `int64_col` AS `int_add_int`, + `int64_col` + 1 AS `int_add_1`, + `int64_col` + CAST(`bool_col` AS INT64) AS `int_add_bool`, + CAST(`bool_col` AS INT64) + `int64_col` AS `bool_add_int` +FROM `bfcte_0` \ No newline at end of file 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 cb674787ff1..2acc0a1057a 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CONCAT(`string_col`, 'a') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + CONCAT(`string_col`, 'a') AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 2fef18eeb8a..8a37be4cbd7 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 @@ -4,57 +4,15 @@ WITH `bfcte_0` AS ( `rowindex`, `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - *, - `bfcol_6` AS `bfcol_14`, - `bfcol_7` AS `bfcol_15`, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - TIMESTAMP_ADD(`bfcol_7`, INTERVAL 86400000000 MICROSECOND) AS `bfcol_18` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_14` AS `bfcol_24`, - `bfcol_15` AS `bfcol_25`, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - TIMESTAMP_ADD(CAST(`bfcol_16` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `bfcol_29` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - *, - `bfcol_24` AS `bfcol_36`, - `bfcol_25` AS `bfcol_37`, - `bfcol_26` AS `bfcol_38`, - `bfcol_27` AS `bfcol_39`, - `bfcol_28` AS `bfcol_40`, - `bfcol_29` AS `bfcol_41`, - TIMESTAMP_ADD(`bfcol_25`, INTERVAL 86400000000 MICROSECOND) AS `bfcol_42` - FROM `bfcte_3` -), `bfcte_5` AS ( - SELECT - *, - 172800000000 AS `bfcol_50` - FROM `bfcte_4` ) SELECT - `bfcol_36` AS `rowindex`, - `bfcol_37` AS `timestamp_col`, - `bfcol_38` AS `date_col`, - `bfcol_39` AS `date_add_timedelta`, - `bfcol_40` AS `timestamp_add_timedelta`, - `bfcol_41` AS `timedelta_add_date`, - `bfcol_42` AS `timedelta_add_timestamp`, - `bfcol_50` AS `timedelta_add_timedelta` -FROM `bfcte_5` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `timestamp_col` AS `timestamp_col`, + `date_col` AS `date_col`, + TIMESTAMP_ADD(CAST(`date_col` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `date_add_timedelta`, + TIMESTAMP_ADD(`timestamp_col`, INTERVAL 86400000000 MICROSECOND) AS `timestamp_add_timedelta`, + TIMESTAMP_ADD(CAST(`date_col` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `timedelta_add_date`, + TIMESTAMP_ADD(`timestamp_col`, INTERVAL 86400000000 MICROSECOND) AS `timedelta_add_timestamp`, + 172800000000 AS `timedelta_add_timedelta` +FROM `bfcte_0` \ No newline at end of file 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 bb1766adf35..0bece99be32 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 @@ -2,16 +2,12 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - WHEN ABS(`float64_col`) > 1 - THEN CAST('NaN' AS FLOAT64) - ELSE ACOS(`float64_col`) - END AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + CASE + WHEN ABS(`float64_col`) > 1 + THEN CAST('NaN' AS FLOAT64) + ELSE ACOS(`float64_col`) + END AS `float64_col` +FROM `bfcte_0` \ No newline at end of file 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 af556b9c3a3..ab10f757a5f 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 @@ -2,16 +2,12 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - WHEN `float64_col` < 1 - THEN CAST('NaN' AS FLOAT64) - ELSE ACOSH(`float64_col`) - END AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + CASE + WHEN `float64_col` < 1 + THEN CAST('NaN' AS FLOAT64) + ELSE ACOSH(`float64_col`) + END AS `float64_col` +FROM `bfcte_0` \ No newline at end of file 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 8243232e0b5..af706cc476f 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 @@ -2,16 +2,12 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - WHEN ABS(`float64_col`) > 1 - THEN CAST('NaN' AS FLOAT64) - ELSE ASIN(`float64_col`) - END AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + CASE + WHEN ABS(`float64_col`) > 1 + THEN CAST('NaN' AS FLOAT64) + ELSE ASIN(`float64_col`) + END AS `float64_col` +FROM `bfcte_0` \ No newline at end of file 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 e6bf3b339c0..a6881bdb71a 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ASINH(`float64_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + ASINH(`float64_col`) AS `float64_col` +FROM `bfcte_0` \ No newline at end of file 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 a85ff6403cb..c2a8291fd32 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ATAN(`float64_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + ATAN(`float64_col`) AS `float64_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctan2/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctan2/out.sql index 28fc8c869d7..ba355d0c4bb 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 @@ -4,14 +4,9 @@ WITH `bfcte_0` AS ( `float64_col`, `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - ATAN2(`int64_col`, `float64_col`) AS `bfcol_6`, - ATAN2(CAST(`bool_col` AS INT64), `float64_col`) AS `bfcol_7` - FROM `bfcte_0` ) SELECT - `bfcol_6` AS `int64_col`, - `bfcol_7` AS `bool_col` -FROM `bfcte_1` \ No newline at end of file + *, + ATAN2(`int64_col`, `float64_col`) AS `int64_col`, + ATAN2(CAST(`bool_col` AS INT64), `float64_col`) AS `bool_col` +FROM `bfcte_0` \ No newline at end of file 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 dc6de62e7bc..70be6c5f4a5 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 @@ -2,18 +2,14 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - WHEN ABS(`float64_col`) < 1 - THEN ATANH(`float64_col`) - WHEN ABS(`float64_col`) > 1 - THEN CAST('NaN' AS FLOAT64) - ELSE CAST('Infinity' AS FLOAT64) * `float64_col` - END AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + CASE + WHEN ABS(`float64_col`) < 1 + THEN ATANH(`float64_col`) + WHEN ABS(`float64_col`) > 1 + THEN CAST('NaN' AS FLOAT64) + ELSE CAST('Infinity' AS FLOAT64) * `float64_col` + END AS `float64_col` +FROM `bfcte_0` \ No newline at end of file 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 922fe5c5508..d94deca246f 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CEIL(`float64_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + CEIL(`float64_col`) AS `float64_col` +FROM `bfcte_0` \ No newline at end of file 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 0acb2bfa944..6d7563340c9 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - COS(`float64_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + COS(`float64_col`) AS `float64_col` +FROM `bfcte_0` \ No newline at end of file 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 8c84a250475..c5041210cce 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 @@ -2,16 +2,12 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - WHEN ABS(`float64_col`) > 709.78 - THEN CAST('Infinity' AS FLOAT64) - ELSE COSH(`float64_col`) - END AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + CASE + WHEN ABS(`float64_col`) > 709.78 + THEN CAST('Infinity' AS FLOAT64) + ELSE COSH(`float64_col`) + END AS `float64_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_cosine_distance/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_cosine_distance/out.sql index ba6b6bfa9fa..c75973082c5 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 @@ -3,14 +3,9 @@ WITH `bfcte_0` AS ( `float_list_col`, `int_list_col` FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` -), `bfcte_1` AS ( - SELECT - *, - 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 - `bfcol_2` AS `int_list_col`, - `bfcol_3` AS `float_list_col` -FROM `bfcte_1` \ No newline at end of file + *, + ML.DISTANCE(`int_list_col`, `int_list_col`, 'COSINE') AS `int_list_col`, + ML.DISTANCE(`float_list_col`, `float_list_col`, 'COSINE') AS `float_list_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_div_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_div_numeric/out.sql index db11f1529fa..e52c24f895e 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 @@ -5,118 +5,19 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - *, - `bfcol_8` AS `bfcol_18`, - `bfcol_9` AS `bfcol_19`, - `bfcol_10` AS `bfcol_20`, - `bfcol_11` AS `bfcol_21`, - `bfcol_12` AS `bfcol_22`, - IEEE_DIVIDE(`bfcol_9`, 1) AS `bfcol_23` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_18` AS `bfcol_30`, - `bfcol_19` AS `bfcol_31`, - `bfcol_20` AS `bfcol_32`, - `bfcol_21` AS `bfcol_33`, - `bfcol_22` AS `bfcol_34`, - `bfcol_23` AS `bfcol_35`, - IEEE_DIVIDE(`bfcol_19`, 0.0) AS `bfcol_36` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - *, - `bfcol_30` AS `bfcol_44`, - `bfcol_31` AS `bfcol_45`, - `bfcol_32` AS `bfcol_46`, - `bfcol_33` AS `bfcol_47`, - `bfcol_34` AS `bfcol_48`, - `bfcol_35` AS `bfcol_49`, - `bfcol_36` AS `bfcol_50`, - IEEE_DIVIDE(`bfcol_31`, `bfcol_33`) AS `bfcol_51` - FROM `bfcte_3` -), `bfcte_5` AS ( - SELECT - *, - `bfcol_44` AS `bfcol_60`, - `bfcol_45` AS `bfcol_61`, - `bfcol_46` AS `bfcol_62`, - `bfcol_47` AS `bfcol_63`, - `bfcol_48` AS `bfcol_64`, - `bfcol_49` AS `bfcol_65`, - `bfcol_50` AS `bfcol_66`, - `bfcol_51` AS `bfcol_67`, - IEEE_DIVIDE(`bfcol_47`, `bfcol_45`) AS `bfcol_68` - FROM `bfcte_4` -), `bfcte_6` AS ( - SELECT - *, - `bfcol_60` AS `bfcol_78`, - `bfcol_61` AS `bfcol_79`, - `bfcol_62` AS `bfcol_80`, - `bfcol_63` AS `bfcol_81`, - `bfcol_64` AS `bfcol_82`, - `bfcol_65` AS `bfcol_83`, - `bfcol_66` AS `bfcol_84`, - `bfcol_67` AS `bfcol_85`, - `bfcol_68` AS `bfcol_86`, - IEEE_DIVIDE(`bfcol_63`, 0.0) AS `bfcol_87` - FROM `bfcte_5` -), `bfcte_7` AS ( - SELECT - *, - `bfcol_78` AS `bfcol_98`, - `bfcol_79` AS `bfcol_99`, - `bfcol_80` AS `bfcol_100`, - `bfcol_81` AS `bfcol_101`, - `bfcol_82` AS `bfcol_102`, - `bfcol_83` AS `bfcol_103`, - `bfcol_84` AS `bfcol_104`, - `bfcol_85` AS `bfcol_105`, - `bfcol_86` AS `bfcol_106`, - `bfcol_87` AS `bfcol_107`, - IEEE_DIVIDE(`bfcol_79`, CAST(`bfcol_80` AS INT64)) AS `bfcol_108` - FROM `bfcte_6` -), `bfcte_8` AS ( - SELECT - *, - `bfcol_98` AS `bfcol_120`, - `bfcol_99` AS `bfcol_121`, - `bfcol_100` AS `bfcol_122`, - `bfcol_101` AS `bfcol_123`, - `bfcol_102` AS `bfcol_124`, - `bfcol_103` AS `bfcol_125`, - `bfcol_104` AS `bfcol_126`, - `bfcol_105` AS `bfcol_127`, - `bfcol_106` AS `bfcol_128`, - `bfcol_107` AS `bfcol_129`, - `bfcol_108` AS `bfcol_130`, - IEEE_DIVIDE(CAST(`bfcol_100` AS INT64), `bfcol_99`) AS `bfcol_131` - FROM `bfcte_7` ) SELECT - `bfcol_120` AS `rowindex`, - `bfcol_121` AS `int64_col`, - `bfcol_122` AS `bool_col`, - `bfcol_123` AS `float64_col`, - `bfcol_124` AS `int_div_int`, - `bfcol_125` AS `int_div_1`, - `bfcol_126` AS `int_div_0`, - `bfcol_127` AS `int_div_float`, - `bfcol_128` AS `float_div_int`, - `bfcol_129` AS `float_div_0`, - `bfcol_130` AS `int_div_bool`, - `bfcol_131` AS `bool_div_int` -FROM `bfcte_8` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `int64_col` AS `int64_col`, + `bool_col` AS `bool_col`, + `float64_col` AS `float64_col`, + IEEE_DIVIDE(`int64_col`, `int64_col`) AS `int_div_int`, + IEEE_DIVIDE(`int64_col`, 1) AS `int_div_1`, + IEEE_DIVIDE(`int64_col`, 0.0) AS `int_div_0`, + IEEE_DIVIDE(`int64_col`, `float64_col`) AS `int_div_float`, + IEEE_DIVIDE(`float64_col`, `int64_col`) AS `float_div_int`, + IEEE_DIVIDE(`float64_col`, 0.0) AS `float_div_0`, + IEEE_DIVIDE(`int64_col`, CAST(`bool_col` AS INT64)) AS `int_div_bool`, + IEEE_DIVIDE(CAST(`bool_col` AS INT64), `int64_col`) AS `bool_div_int` +FROM `bfcte_0` \ No newline at end of file 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 1a82a67368c..ed56a4e36a0 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 @@ -4,18 +4,11 @@ WITH `bfcte_0` AS ( `rowindex`, `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - `bfcol_6` AS `rowindex`, - `bfcol_7` AS `timestamp_col`, - `bfcol_8` AS `int64_col`, - `bfcol_9` AS `timedelta_div_numeric` -FROM `bfcte_1` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `timestamp_col` AS `timestamp_col`, + `int64_col` AS `int64_col`, + CAST(FLOOR(IEEE_DIVIDE(86400000000, `int64_col`)) AS INT64) AS `timedelta_div_numeric` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_euclidean_distance/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_euclidean_distance/out.sql index 3327a99f4b6..21d91bf3c24 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_euclidean_distance/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_euclidean_distance/out.sql @@ -3,14 +3,9 @@ WITH `bfcte_0` AS ( `int_list_col`, `numeric_list_col` FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` -), `bfcte_1` AS ( - SELECT - *, - ML.DISTANCE(`int_list_col`, `int_list_col`, 'EUCLIDEAN') AS `bfcol_2`, - ML.DISTANCE(`numeric_list_col`, `numeric_list_col`, 'EUCLIDEAN') AS `bfcol_3` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `int_list_col`, - `bfcol_3` AS `numeric_list_col` -FROM `bfcte_1` \ No newline at end of file + *, + ML.DISTANCE(`int_list_col`, `int_list_col`, 'EUCLIDEAN') AS `int_list_col`, + ML.DISTANCE(`numeric_list_col`, `numeric_list_col`, 'EUCLIDEAN') AS `numeric_list_col` +FROM `bfcte_0` \ No newline at end of file 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 610b96cda70..fd48355dc99 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 @@ -2,16 +2,12 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - WHEN `float64_col` > 709.78 - THEN CAST('Infinity' AS FLOAT64) - ELSE EXP(`float64_col`) - END AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + CASE + WHEN `float64_col` > 709.78 + THEN CAST('Infinity' AS FLOAT64) + ELSE EXP(`float64_col`) + END AS `float64_col` +FROM `bfcte_0` \ No newline at end of file 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 13038bf8e85..9a38580ee57 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - IF(`float64_col` > 709.78, CAST('Infinity' AS FLOAT64), EXP(`float64_col`) - 1) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + IF(`float64_col` > 709.78, CAST('Infinity' AS FLOAT64), EXP(`float64_col`) - 1) AS `float64_col` +FROM `bfcte_0` \ No newline at end of file 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 e0c2e1072e8..edc4628ac0b 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - FLOOR(`float64_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + FLOOR(`float64_col`) AS `float64_col` +FROM `bfcte_0` \ No newline at end of file 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 2fe20fb6188..7e926366626 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 @@ -4,15 +4,11 @@ WITH `bfcte_0` AS ( `rowindex`, `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - 43200000000 AS `bfcol_6` - FROM `bfcte_0` ) SELECT - `rowindex`, - `timestamp_col`, - `date_col`, - `bfcol_6` AS `timedelta_div_numeric` -FROM `bfcte_1` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `timestamp_col` AS `timestamp_col`, + `date_col` AS `date_col`, + 43200000000 AS `timedelta_div_numeric` +FROM `bfcte_0` \ 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 bd4cfa7c9a3..e569a004120 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 @@ -2,20 +2,16 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - WHEN `float64_col` IS NULL - THEN NULL - WHEN `float64_col` > 0 - THEN LN(`float64_col`) - WHEN `float64_col` < 0 - THEN CAST('NaN' AS FLOAT64) - ELSE CAST('-Infinity' AS FLOAT64) - END AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + CASE + WHEN `float64_col` IS NULL + THEN NULL + WHEN `float64_col` > 0 + THEN LN(`float64_col`) + WHEN `float64_col` < 0 + THEN CAST('NaN' AS FLOAT64) + ELSE CAST('-Infinity' AS FLOAT64) + END AS `float64_col` +FROM `bfcte_0` \ No newline at end of file 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 c5bbff0e624..a521506ce60 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 @@ -2,20 +2,16 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - WHEN `float64_col` IS NULL - THEN NULL - WHEN `float64_col` > 0 - THEN LOG(`float64_col`, 10) - WHEN `float64_col` < 0 - THEN CAST('NaN' AS FLOAT64) - ELSE CAST('-Infinity' AS FLOAT64) - END AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + CASE + WHEN `float64_col` IS NULL + THEN NULL + WHEN `float64_col` > 0 + THEN LOG(`float64_col`, 10) + WHEN `float64_col` < 0 + THEN CAST('NaN' AS FLOAT64) + ELSE CAST('-Infinity' AS FLOAT64) + END AS `float64_col` +FROM `bfcte_0` \ No newline at end of file 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 22e67e24eed..c7475f1aa4b 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 @@ -2,20 +2,16 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - WHEN `float64_col` IS NULL - THEN NULL - WHEN `float64_col` > -1 - THEN LN(1 + `float64_col`) - WHEN `float64_col` < -1 - THEN CAST('NaN' AS FLOAT64) - ELSE CAST('-Infinity' AS FLOAT64) - END AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + CASE + WHEN `float64_col` IS NULL + THEN NULL + WHEN `float64_col` > -1 + THEN LN(1 + `float64_col`) + WHEN `float64_col` < -1 + THEN CAST('NaN' AS FLOAT64) + ELSE CAST('-Infinity' AS FLOAT64) + END AS `float64_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_manhattan_distance/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_manhattan_distance/out.sql index 185bb7b277c..9f8a442d136 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_manhattan_distance/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_manhattan_distance/out.sql @@ -3,14 +3,9 @@ WITH `bfcte_0` AS ( `float_list_col`, `numeric_list_col` FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` -), `bfcte_1` AS ( - SELECT - *, - ML.DISTANCE(`float_list_col`, `float_list_col`, 'MANHATTAN') AS `bfcol_2`, - ML.DISTANCE(`numeric_list_col`, `numeric_list_col`, 'MANHATTAN') AS `bfcol_3` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float_list_col`, - `bfcol_3` AS `numeric_list_col` -FROM `bfcte_1` \ No newline at end of file + *, + ML.DISTANCE(`float_list_col`, `float_list_col`, 'MANHATTAN') AS `float_list_col`, + ML.DISTANCE(`numeric_list_col`, `numeric_list_col`, 'MANHATTAN') AS `numeric_list_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mod_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mod_numeric/out.sql index 241ffa0b5ea..d3f4c6132aa 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 @@ -4,289 +4,198 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `rowindex` AS `bfcol_6`, - `int64_col` AS `bfcol_7`, - `float64_col` AS `bfcol_8`, - CASE - WHEN `int64_col` = CAST(0 AS INT64) - THEN CAST(0 AS INT64) * `int64_col` - WHEN `int64_col` < CAST(0 AS INT64) - AND ( - MOD(`int64_col`, `int64_col`) - ) > CAST(0 AS INT64) - THEN `int64_col` + ( - MOD(`int64_col`, `int64_col`) - ) - WHEN `int64_col` > CAST(0 AS INT64) - AND ( - MOD(`int64_col`, `int64_col`) - ) < CAST(0 AS INT64) - THEN `int64_col` + ( - MOD(`int64_col`, `int64_col`) - ) - ELSE MOD(`int64_col`, `int64_col`) - END AS `bfcol_9` - FROM `bfcte_0` -), `bfcte_2` AS ( - SELECT - *, - `bfcol_6` AS `bfcol_14`, - `bfcol_7` AS `bfcol_15`, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - CASE - WHEN -( - `bfcol_7` - ) = CAST(0 AS INT64) - THEN CAST(0 AS INT64) * `bfcol_7` - WHEN -( - `bfcol_7` - ) < CAST(0 AS INT64) - AND ( - MOD(`bfcol_7`, -( - `bfcol_7` - )) - ) > CAST(0 AS INT64) - THEN -( - `bfcol_7` - ) + ( - MOD(`bfcol_7`, -( - `bfcol_7` - )) - ) - WHEN -( - `bfcol_7` - ) > CAST(0 AS INT64) - AND ( - MOD(`bfcol_7`, -( - `bfcol_7` - )) - ) < CAST(0 AS INT64) - THEN -( - `bfcol_7` - ) + ( - MOD(`bfcol_7`, -( - `bfcol_7` - )) - ) - ELSE MOD(`bfcol_7`, -( - `bfcol_7` - )) - END AS `bfcol_18` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_14` AS `bfcol_24`, - `bfcol_15` AS `bfcol_25`, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - CASE - WHEN 1 = CAST(0 AS INT64) - THEN CAST(0 AS INT64) * `bfcol_15` - WHEN 1 < CAST(0 AS INT64) AND ( - MOD(`bfcol_15`, 1) - ) > CAST(0 AS INT64) - THEN 1 + ( - MOD(`bfcol_15`, 1) - ) - WHEN 1 > CAST(0 AS INT64) AND ( - MOD(`bfcol_15`, 1) - ) < CAST(0 AS INT64) - THEN 1 + ( - MOD(`bfcol_15`, 1) - ) - ELSE MOD(`bfcol_15`, 1) - END AS `bfcol_29` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - *, - `bfcol_24` AS `bfcol_36`, - `bfcol_25` AS `bfcol_37`, - `bfcol_26` AS `bfcol_38`, - `bfcol_27` AS `bfcol_39`, - `bfcol_28` AS `bfcol_40`, - `bfcol_29` AS `bfcol_41`, - CASE - WHEN 0 = CAST(0 AS INT64) - THEN CAST(0 AS INT64) * `bfcol_25` - WHEN 0 < CAST(0 AS INT64) AND ( - MOD(`bfcol_25`, 0) - ) > CAST(0 AS INT64) - THEN 0 + ( - MOD(`bfcol_25`, 0) - ) - WHEN 0 > CAST(0 AS INT64) AND ( - MOD(`bfcol_25`, 0) - ) < CAST(0 AS INT64) - THEN 0 + ( - MOD(`bfcol_25`, 0) - ) - ELSE MOD(`bfcol_25`, 0) - END AS `bfcol_42` - FROM `bfcte_3` -), `bfcte_5` AS ( - SELECT - *, - `bfcol_36` AS `bfcol_50`, - `bfcol_37` AS `bfcol_51`, - `bfcol_38` AS `bfcol_52`, - `bfcol_39` AS `bfcol_53`, - `bfcol_40` AS `bfcol_54`, - `bfcol_41` AS `bfcol_55`, - `bfcol_42` AS `bfcol_56`, - CASE - WHEN CAST(`bfcol_38` AS BIGNUMERIC) = CAST(0 AS INT64) - THEN CAST('NaN' AS FLOAT64) * CAST(`bfcol_38` AS BIGNUMERIC) - WHEN CAST(`bfcol_38` AS BIGNUMERIC) < CAST(0 AS INT64) - AND ( - MOD(CAST(`bfcol_38` AS BIGNUMERIC), CAST(`bfcol_38` AS BIGNUMERIC)) - ) > CAST(0 AS INT64) - THEN CAST(`bfcol_38` AS BIGNUMERIC) + ( - MOD(CAST(`bfcol_38` AS BIGNUMERIC), CAST(`bfcol_38` AS BIGNUMERIC)) - ) - WHEN CAST(`bfcol_38` AS BIGNUMERIC) > CAST(0 AS INT64) - AND ( - MOD(CAST(`bfcol_38` AS BIGNUMERIC), CAST(`bfcol_38` AS BIGNUMERIC)) - ) < CAST(0 AS INT64) - THEN CAST(`bfcol_38` AS BIGNUMERIC) + ( - MOD(CAST(`bfcol_38` AS BIGNUMERIC), CAST(`bfcol_38` AS BIGNUMERIC)) - ) - ELSE MOD(CAST(`bfcol_38` AS BIGNUMERIC), CAST(`bfcol_38` AS BIGNUMERIC)) - END AS `bfcol_57` - FROM `bfcte_4` -), `bfcte_6` AS ( - SELECT - *, - `bfcol_50` AS `bfcol_66`, - `bfcol_51` AS `bfcol_67`, - `bfcol_52` AS `bfcol_68`, - `bfcol_53` AS `bfcol_69`, - `bfcol_54` AS `bfcol_70`, - `bfcol_55` AS `bfcol_71`, - `bfcol_56` AS `bfcol_72`, - `bfcol_57` AS `bfcol_73`, - CASE - WHEN CAST(-( - `bfcol_52` - ) AS BIGNUMERIC) = CAST(0 AS INT64) - THEN CAST('NaN' AS FLOAT64) * CAST(`bfcol_52` AS BIGNUMERIC) - WHEN CAST(-( - `bfcol_52` - ) AS BIGNUMERIC) < CAST(0 AS INT64) - AND ( - MOD(CAST(`bfcol_52` AS BIGNUMERIC), CAST(-( - `bfcol_52` - ) AS BIGNUMERIC)) - ) > CAST(0 AS INT64) - THEN CAST(-( - `bfcol_52` - ) AS BIGNUMERIC) + ( - MOD(CAST(`bfcol_52` AS BIGNUMERIC), CAST(-( - `bfcol_52` - ) AS BIGNUMERIC)) - ) - WHEN CAST(-( - `bfcol_52` - ) AS BIGNUMERIC) > CAST(0 AS INT64) - AND ( - MOD(CAST(`bfcol_52` AS BIGNUMERIC), CAST(-( - `bfcol_52` - ) AS BIGNUMERIC)) - ) < CAST(0 AS INT64) - THEN CAST(-( - `bfcol_52` - ) AS BIGNUMERIC) + ( - MOD(CAST(`bfcol_52` AS BIGNUMERIC), CAST(-( - `bfcol_52` - ) AS BIGNUMERIC)) - ) - ELSE MOD(CAST(`bfcol_52` AS BIGNUMERIC), CAST(-( - `bfcol_52` - ) AS BIGNUMERIC)) - END AS `bfcol_74` - FROM `bfcte_5` -), `bfcte_7` AS ( - SELECT - *, - `bfcol_66` AS `bfcol_84`, - `bfcol_67` AS `bfcol_85`, - `bfcol_68` AS `bfcol_86`, - `bfcol_69` AS `bfcol_87`, - `bfcol_70` AS `bfcol_88`, - `bfcol_71` AS `bfcol_89`, - `bfcol_72` AS `bfcol_90`, - `bfcol_73` AS `bfcol_91`, - `bfcol_74` AS `bfcol_92`, - CASE - WHEN CAST(1 AS BIGNUMERIC) = CAST(0 AS INT64) - THEN CAST('NaN' AS FLOAT64) * CAST(`bfcol_68` AS BIGNUMERIC) - WHEN CAST(1 AS BIGNUMERIC) < CAST(0 AS INT64) - AND ( - MOD(CAST(`bfcol_68` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) - ) > CAST(0 AS INT64) - THEN CAST(1 AS BIGNUMERIC) + ( - MOD(CAST(`bfcol_68` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) - ) - WHEN CAST(1 AS BIGNUMERIC) > CAST(0 AS INT64) - AND ( - MOD(CAST(`bfcol_68` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) - ) < CAST(0 AS INT64) - THEN CAST(1 AS BIGNUMERIC) + ( - MOD(CAST(`bfcol_68` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) - ) - ELSE MOD(CAST(`bfcol_68` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) - END AS `bfcol_93` - FROM `bfcte_6` -), `bfcte_8` AS ( - SELECT - *, - `bfcol_84` AS `bfcol_104`, - `bfcol_85` AS `bfcol_105`, - `bfcol_86` AS `bfcol_106`, - `bfcol_87` AS `bfcol_107`, - `bfcol_88` AS `bfcol_108`, - `bfcol_89` AS `bfcol_109`, - `bfcol_90` AS `bfcol_110`, - `bfcol_91` AS `bfcol_111`, - `bfcol_92` AS `bfcol_112`, - `bfcol_93` AS `bfcol_113`, - CASE - WHEN CAST(0 AS BIGNUMERIC) = CAST(0 AS INT64) - THEN CAST('NaN' AS FLOAT64) * CAST(`bfcol_86` AS BIGNUMERIC) - WHEN CAST(0 AS BIGNUMERIC) < CAST(0 AS INT64) - AND ( - MOD(CAST(`bfcol_86` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) - ) > CAST(0 AS INT64) - THEN CAST(0 AS BIGNUMERIC) + ( - MOD(CAST(`bfcol_86` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) - ) - WHEN CAST(0 AS BIGNUMERIC) > CAST(0 AS INT64) - AND ( - MOD(CAST(`bfcol_86` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) - ) < CAST(0 AS INT64) - THEN CAST(0 AS BIGNUMERIC) + ( - MOD(CAST(`bfcol_86` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) - ) - ELSE MOD(CAST(`bfcol_86` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) - END AS `bfcol_114` - FROM `bfcte_7` ) SELECT - `bfcol_104` AS `rowindex`, - `bfcol_105` AS `int64_col`, - `bfcol_106` AS `float64_col`, - `bfcol_107` AS `int_mod_int`, - `bfcol_108` AS `int_mod_int_neg`, - `bfcol_109` AS `int_mod_1`, - `bfcol_110` AS `int_mod_0`, - `bfcol_111` AS `float_mod_float`, - `bfcol_112` AS `float_mod_float_neg`, - `bfcol_113` AS `float_mod_1`, - `bfcol_114` AS `float_mod_0` -FROM `bfcte_8` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `int64_col` AS `int64_col`, + `float64_col` AS `float64_col`, + CASE + WHEN `int64_col` = CAST(0 AS INT64) + THEN CAST(0 AS INT64) * `int64_col` + WHEN `int64_col` < CAST(0 AS INT64) + AND ( + MOD(`int64_col`, `int64_col`) + ) > CAST(0 AS INT64) + THEN `int64_col` + ( + MOD(`int64_col`, `int64_col`) + ) + WHEN `int64_col` > CAST(0 AS INT64) + AND ( + MOD(`int64_col`, `int64_col`) + ) < CAST(0 AS INT64) + THEN `int64_col` + ( + MOD(`int64_col`, `int64_col`) + ) + ELSE MOD(`int64_col`, `int64_col`) + END AS `int_mod_int`, + CASE + WHEN -( + `int64_col` + ) = CAST(0 AS INT64) + THEN CAST(0 AS INT64) * `int64_col` + WHEN -( + `int64_col` + ) < CAST(0 AS INT64) + AND ( + MOD(`int64_col`, -( + `int64_col` + )) + ) > CAST(0 AS INT64) + THEN -( + `int64_col` + ) + ( + MOD(`int64_col`, -( + `int64_col` + )) + ) + WHEN -( + `int64_col` + ) > CAST(0 AS INT64) + AND ( + MOD(`int64_col`, -( + `int64_col` + )) + ) < CAST(0 AS INT64) + THEN -( + `int64_col` + ) + ( + MOD(`int64_col`, -( + `int64_col` + )) + ) + ELSE MOD(`int64_col`, -( + `int64_col` + )) + END AS `int_mod_int_neg`, + CASE + WHEN 1 = CAST(0 AS INT64) + THEN CAST(0 AS INT64) * `int64_col` + WHEN 1 < CAST(0 AS INT64) AND ( + MOD(`int64_col`, 1) + ) > CAST(0 AS INT64) + THEN 1 + ( + MOD(`int64_col`, 1) + ) + WHEN 1 > CAST(0 AS INT64) AND ( + MOD(`int64_col`, 1) + ) < CAST(0 AS INT64) + THEN 1 + ( + MOD(`int64_col`, 1) + ) + ELSE MOD(`int64_col`, 1) + END AS `int_mod_1`, + CASE + WHEN 0 = CAST(0 AS INT64) + THEN CAST(0 AS INT64) * `int64_col` + WHEN 0 < CAST(0 AS INT64) AND ( + MOD(`int64_col`, 0) + ) > CAST(0 AS INT64) + THEN 0 + ( + MOD(`int64_col`, 0) + ) + WHEN 0 > CAST(0 AS INT64) AND ( + MOD(`int64_col`, 0) + ) < CAST(0 AS INT64) + THEN 0 + ( + MOD(`int64_col`, 0) + ) + ELSE MOD(`int64_col`, 0) + END AS `int_mod_0`, + CASE + WHEN CAST(`float64_col` AS BIGNUMERIC) = CAST(0 AS INT64) + THEN CAST('NaN' AS FLOAT64) * CAST(`float64_col` AS BIGNUMERIC) + WHEN CAST(`float64_col` AS BIGNUMERIC) < CAST(0 AS INT64) + AND ( + MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(`float64_col` AS BIGNUMERIC)) + ) > CAST(0 AS INT64) + THEN CAST(`float64_col` AS BIGNUMERIC) + ( + MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(`float64_col` AS BIGNUMERIC)) + ) + WHEN CAST(`float64_col` AS BIGNUMERIC) > CAST(0 AS INT64) + AND ( + MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(`float64_col` AS BIGNUMERIC)) + ) < CAST(0 AS INT64) + THEN CAST(`float64_col` AS BIGNUMERIC) + ( + MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(`float64_col` AS BIGNUMERIC)) + ) + ELSE MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(`float64_col` AS BIGNUMERIC)) + END AS `float_mod_float`, + CASE + WHEN CAST(-( + `float64_col` + ) AS BIGNUMERIC) = CAST(0 AS INT64) + THEN CAST('NaN' AS FLOAT64) * CAST(`float64_col` AS BIGNUMERIC) + WHEN CAST(-( + `float64_col` + ) AS BIGNUMERIC) < CAST(0 AS INT64) + AND ( + MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(-( + `float64_col` + ) AS BIGNUMERIC)) + ) > CAST(0 AS INT64) + THEN CAST(-( + `float64_col` + ) AS BIGNUMERIC) + ( + MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(-( + `float64_col` + ) AS BIGNUMERIC)) + ) + WHEN CAST(-( + `float64_col` + ) AS BIGNUMERIC) > CAST(0 AS INT64) + AND ( + MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(-( + `float64_col` + ) AS BIGNUMERIC)) + ) < CAST(0 AS INT64) + THEN CAST(-( + `float64_col` + ) AS BIGNUMERIC) + ( + MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(-( + `float64_col` + ) AS BIGNUMERIC)) + ) + ELSE MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(-( + `float64_col` + ) AS BIGNUMERIC)) + END AS `float_mod_float_neg`, + CASE + WHEN CAST(1 AS BIGNUMERIC) = CAST(0 AS INT64) + THEN CAST('NaN' AS FLOAT64) * CAST(`float64_col` AS BIGNUMERIC) + WHEN CAST(1 AS BIGNUMERIC) < CAST(0 AS INT64) + AND ( + MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) + ) > CAST(0 AS INT64) + THEN CAST(1 AS BIGNUMERIC) + ( + MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) + ) + WHEN CAST(1 AS BIGNUMERIC) > CAST(0 AS INT64) + AND ( + MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) + ) < CAST(0 AS INT64) + THEN CAST(1 AS BIGNUMERIC) + ( + MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) + ) + ELSE MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) + END AS `float_mod_1`, + CASE + WHEN CAST(0 AS BIGNUMERIC) = CAST(0 AS INT64) + THEN CAST('NaN' AS FLOAT64) * CAST(`float64_col` AS BIGNUMERIC) + WHEN CAST(0 AS BIGNUMERIC) < CAST(0 AS INT64) + AND ( + MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) + ) > CAST(0 AS INT64) + THEN CAST(0 AS BIGNUMERIC) + ( + MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) + ) + WHEN CAST(0 AS BIGNUMERIC) > CAST(0 AS INT64) + AND ( + MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) + ) < CAST(0 AS INT64) + THEN CAST(0 AS BIGNUMERIC) + ( + MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) + ) + ELSE MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) + END AS `float_mod_0` +FROM `bfcte_0` \ No newline at end of file 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 d0c537e4820..ecf03d0fa27 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 @@ -4,51 +4,14 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - *, - `bfcol_6` AS `bfcol_14`, - `bfcol_7` AS `bfcol_15`, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - `bfcol_7` * 1 AS `bfcol_18` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_14` AS `bfcol_24`, - `bfcol_15` AS `bfcol_25`, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - `bfcol_15` * CAST(`bfcol_16` AS INT64) AS `bfcol_29` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - *, - `bfcol_24` AS `bfcol_36`, - `bfcol_25` AS `bfcol_37`, - `bfcol_26` AS `bfcol_38`, - `bfcol_27` AS `bfcol_39`, - `bfcol_28` AS `bfcol_40`, - `bfcol_29` AS `bfcol_41`, - CAST(`bfcol_26` AS INT64) * `bfcol_25` AS `bfcol_42` - FROM `bfcte_3` ) SELECT - `bfcol_36` AS `rowindex`, - `bfcol_37` AS `int64_col`, - `bfcol_38` AS `bool_col`, - `bfcol_39` AS `int_mul_int`, - `bfcol_40` AS `int_mul_1`, - `bfcol_41` AS `int_mul_bool`, - `bfcol_42` AS `bool_mul_int` -FROM `bfcte_4` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `int64_col` AS `int64_col`, + `bool_col` AS `bool_col`, + `int64_col` * `int64_col` AS `int_mul_int`, + `int64_col` * 1 AS `int_mul_1`, + `int64_col` * CAST(`bool_col` AS INT64) AS `int_mul_bool`, + CAST(`bool_col` AS INT64) * `int64_col` AS `bool_mul_int` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mul_timedelta/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mul_timedelta/out.sql index ebdf296b2b2..35d76d618f5 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 @@ -5,39 +5,13 @@ WITH `bfcte_0` AS ( `rowindex`, `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - *, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - `bfcol_10` AS `bfcol_18`, - `bfcol_11` AS `bfcol_19`, - CAST(FLOOR(`bfcol_11` * `bfcol_10`) AS INT64) AS `bfcol_20` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - `bfcol_19` AS `bfcol_29`, - `bfcol_20` AS `bfcol_30`, - CAST(FLOOR(`bfcol_18` * `bfcol_19`) AS INT64) AS `bfcol_31` - FROM `bfcte_2` ) SELECT - `bfcol_26` AS `rowindex`, - `bfcol_27` AS `timestamp_col`, - `bfcol_28` AS `int64_col`, - `bfcol_29` AS `duration_col`, - `bfcol_30` AS `timedelta_mul_numeric`, - `bfcol_31` AS `numeric_mul_timedelta` -FROM `bfcte_3` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `timestamp_col` AS `timestamp_col`, + `int64_col` AS `int64_col`, + `duration_col` AS `duration_col`, + CAST(FLOOR(`duration_col` * `int64_col`) AS INT64) AS `timedelta_mul_numeric`, + CAST(FLOOR(`int64_col` * `duration_col`) AS INT64) AS `numeric_mul_timedelta` +FROM `bfcte_0` \ No newline at end of file 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 4374af349b7..f9e0d2f7d94 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 @@ -2,14 +2,10 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - -( - `float64_col` - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + -( + `float64_col` + ) AS `float64_col` +FROM `bfcte_0` \ No newline at end of file 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 1ed016029a2..0b09db469e9 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `float64_col` AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + `float64_col` AS `float64_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pow/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pow/out.sql index 05fbaa12c92..0bb9389bb19 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pow/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pow/out.sql @@ -4,326 +4,239 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `rowindex` AS `bfcol_6`, - `int64_col` AS `bfcol_7`, - `float64_col` AS `bfcol_8`, - CASE - WHEN `int64_col` <> 0 AND `int64_col` * LN(ABS(`int64_col`)) > 43.66827237527655 - THEN NULL - ELSE CAST(POWER(CAST(`int64_col` AS NUMERIC), `int64_col`) AS INT64) - END AS `bfcol_9` - FROM `bfcte_0` -), `bfcte_2` AS ( - SELECT - *, - `bfcol_6` AS `bfcol_14`, - `bfcol_7` AS `bfcol_15`, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - CASE - WHEN `bfcol_8` = CAST(0 AS INT64) - THEN 1 - WHEN `bfcol_7` = 1 - THEN 1 - WHEN `bfcol_7` = CAST(0 AS INT64) AND `bfcol_8` < CAST(0 AS INT64) - THEN CAST('Infinity' AS FLOAT64) - WHEN ABS(`bfcol_7`) = CAST('Infinity' AS FLOAT64) - THEN POWER( - `bfcol_7`, - CASE - WHEN ABS(`bfcol_8`) > 9007199254740992 - THEN CAST('Infinity' AS FLOAT64) * SIGN(`bfcol_8`) - ELSE `bfcol_8` - END - ) - WHEN ABS(`bfcol_8`) > 9007199254740992 - THEN POWER( - `bfcol_7`, - CASE - WHEN ABS(`bfcol_8`) > 9007199254740992 - THEN CAST('Infinity' AS FLOAT64) * SIGN(`bfcol_8`) - ELSE `bfcol_8` - END - ) - WHEN `bfcol_7` < CAST(0 AS INT64) AND NOT CAST(`bfcol_8` AS INT64) = `bfcol_8` - THEN CAST('NaN' AS FLOAT64) - WHEN `bfcol_7` <> CAST(0 AS INT64) AND `bfcol_8` * LN(ABS(`bfcol_7`)) > 709.78 - THEN CAST('Infinity' AS FLOAT64) * CASE - WHEN `bfcol_7` < CAST(0 AS INT64) AND MOD(CAST(`bfcol_8` AS INT64), 2) = 1 - THEN -1 - ELSE 1 +) +SELECT + *, + `rowindex` AS `rowindex`, + `int64_col` AS `int64_col`, + `float64_col` AS `float64_col`, + CASE + WHEN `int64_col` <> 0 AND `int64_col` * LN(ABS(`int64_col`)) > 43.66827237527655 + THEN NULL + ELSE CAST(POWER(CAST(`int64_col` AS NUMERIC), `int64_col`) AS INT64) + END AS `int_pow_int`, + CASE + WHEN `float64_col` = CAST(0 AS INT64) + THEN 1 + WHEN `int64_col` = 1 + THEN 1 + WHEN `int64_col` = CAST(0 AS INT64) AND `float64_col` < CAST(0 AS INT64) + THEN CAST('Infinity' AS FLOAT64) + WHEN ABS(`int64_col`) = CAST('Infinity' AS FLOAT64) + THEN POWER( + `int64_col`, + CASE + WHEN ABS(`float64_col`) > 9007199254740992 + THEN CAST('Infinity' AS FLOAT64) * SIGN(`float64_col`) + ELSE `float64_col` END - ELSE POWER( - `bfcol_7`, - CASE - WHEN ABS(`bfcol_8`) > 9007199254740992 - THEN CAST('Infinity' AS FLOAT64) * SIGN(`bfcol_8`) - ELSE `bfcol_8` - END - ) - END AS `bfcol_18` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_14` AS `bfcol_24`, - `bfcol_15` AS `bfcol_25`, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - CASE - WHEN `bfcol_15` = CAST(0 AS INT64) - THEN 1 - WHEN `bfcol_16` = 1 - THEN 1 - WHEN `bfcol_16` = CAST(0 AS INT64) AND `bfcol_15` < CAST(0 AS INT64) - THEN CAST('Infinity' AS FLOAT64) - WHEN ABS(`bfcol_16`) = CAST('Infinity' AS FLOAT64) - THEN POWER( - `bfcol_16`, - CASE - WHEN ABS(`bfcol_15`) > 9007199254740992 - THEN CAST('Infinity' AS FLOAT64) * SIGN(`bfcol_15`) - ELSE `bfcol_15` - END - ) - WHEN ABS(`bfcol_15`) > 9007199254740992 - THEN POWER( - `bfcol_16`, - CASE - WHEN ABS(`bfcol_15`) > 9007199254740992 - THEN CAST('Infinity' AS FLOAT64) * SIGN(`bfcol_15`) - ELSE `bfcol_15` - END - ) - WHEN `bfcol_16` < CAST(0 AS INT64) AND NOT CAST(`bfcol_15` AS INT64) = `bfcol_15` - THEN CAST('NaN' AS FLOAT64) - WHEN `bfcol_16` <> CAST(0 AS INT64) AND `bfcol_15` * LN(ABS(`bfcol_16`)) > 709.78 - THEN CAST('Infinity' AS FLOAT64) * CASE - WHEN `bfcol_16` < CAST(0 AS INT64) AND MOD(CAST(`bfcol_15` AS INT64), 2) = 1 - THEN -1 - ELSE 1 + ) + WHEN ABS(`float64_col`) > 9007199254740992 + THEN POWER( + `int64_col`, + CASE + WHEN ABS(`float64_col`) > 9007199254740992 + THEN CAST('Infinity' AS FLOAT64) * SIGN(`float64_col`) + ELSE `float64_col` END - ELSE POWER( - `bfcol_16`, - CASE - WHEN ABS(`bfcol_15`) > 9007199254740992 - THEN CAST('Infinity' AS FLOAT64) * SIGN(`bfcol_15`) - ELSE `bfcol_15` - END - ) - END AS `bfcol_29` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - *, - `bfcol_24` AS `bfcol_36`, - `bfcol_25` AS `bfcol_37`, - `bfcol_26` AS `bfcol_38`, - `bfcol_27` AS `bfcol_39`, - `bfcol_28` AS `bfcol_40`, - `bfcol_29` AS `bfcol_41`, - CASE - WHEN `bfcol_26` = CAST(0 AS INT64) - THEN 1 - WHEN `bfcol_26` = 1 - THEN 1 - WHEN `bfcol_26` = CAST(0 AS INT64) AND `bfcol_26` < CAST(0 AS INT64) - THEN CAST('Infinity' AS FLOAT64) - WHEN ABS(`bfcol_26`) = CAST('Infinity' AS FLOAT64) - THEN POWER( - `bfcol_26`, - CASE - WHEN ABS(`bfcol_26`) > 9007199254740992 - THEN CAST('Infinity' AS FLOAT64) * SIGN(`bfcol_26`) - ELSE `bfcol_26` - END - ) - WHEN ABS(`bfcol_26`) > 9007199254740992 - THEN POWER( - `bfcol_26`, - CASE - WHEN ABS(`bfcol_26`) > 9007199254740992 - THEN CAST('Infinity' AS FLOAT64) * SIGN(`bfcol_26`) - ELSE `bfcol_26` - END - ) - WHEN `bfcol_26` < CAST(0 AS INT64) AND NOT CAST(`bfcol_26` AS INT64) = `bfcol_26` - THEN CAST('NaN' AS FLOAT64) - WHEN `bfcol_26` <> CAST(0 AS INT64) AND `bfcol_26` * LN(ABS(`bfcol_26`)) > 709.78 - THEN CAST('Infinity' AS FLOAT64) * CASE - WHEN `bfcol_26` < CAST(0 AS INT64) AND MOD(CAST(`bfcol_26` AS INT64), 2) = 1 - THEN -1 + ) + WHEN `int64_col` < CAST(0 AS INT64) + AND NOT CAST(`float64_col` AS INT64) = `float64_col` + THEN CAST('NaN' AS FLOAT64) + WHEN `int64_col` <> CAST(0 AS INT64) AND `float64_col` * LN(ABS(`int64_col`)) > 709.78 + THEN CAST('Infinity' AS FLOAT64) * CASE + WHEN `int64_col` < CAST(0 AS INT64) AND MOD(CAST(`float64_col` AS INT64), 2) = 1 + THEN -1 + ELSE 1 + END + ELSE POWER( + `int64_col`, + CASE + WHEN ABS(`float64_col`) > 9007199254740992 + THEN CAST('Infinity' AS FLOAT64) * SIGN(`float64_col`) + ELSE `float64_col` + END + ) + END AS `int_pow_float`, + CASE + WHEN `int64_col` = CAST(0 AS INT64) + THEN 1 + WHEN `float64_col` = 1 + THEN 1 + WHEN `float64_col` = CAST(0 AS INT64) AND `int64_col` < CAST(0 AS INT64) + THEN CAST('Infinity' AS FLOAT64) + WHEN ABS(`float64_col`) = CAST('Infinity' AS FLOAT64) + THEN POWER( + `float64_col`, + CASE + WHEN ABS(`int64_col`) > 9007199254740992 + THEN CAST('Infinity' AS FLOAT64) * SIGN(`int64_col`) + ELSE `int64_col` + END + ) + WHEN ABS(`int64_col`) > 9007199254740992 + THEN POWER( + `float64_col`, + CASE + WHEN ABS(`int64_col`) > 9007199254740992 + THEN CAST('Infinity' AS FLOAT64) * SIGN(`int64_col`) + ELSE `int64_col` + END + ) + WHEN `float64_col` < CAST(0 AS INT64) AND NOT CAST(`int64_col` AS INT64) = `int64_col` + THEN CAST('NaN' AS FLOAT64) + WHEN `float64_col` <> CAST(0 AS INT64) + AND `int64_col` * LN(ABS(`float64_col`)) > 709.78 + THEN CAST('Infinity' AS FLOAT64) * CASE + WHEN `float64_col` < CAST(0 AS INT64) AND MOD(CAST(`int64_col` AS INT64), 2) = 1 + THEN -1 + ELSE 1 + END + ELSE POWER( + `float64_col`, + CASE + WHEN ABS(`int64_col`) > 9007199254740992 + THEN CAST('Infinity' AS FLOAT64) * SIGN(`int64_col`) + ELSE `int64_col` + END + ) + END AS `float_pow_int`, + CASE + WHEN `float64_col` = CAST(0 AS INT64) + THEN 1 + WHEN `float64_col` = 1 + THEN 1 + WHEN `float64_col` = CAST(0 AS INT64) AND `float64_col` < CAST(0 AS INT64) + THEN CAST('Infinity' AS FLOAT64) + WHEN ABS(`float64_col`) = CAST('Infinity' AS FLOAT64) + THEN POWER( + `float64_col`, + CASE + WHEN ABS(`float64_col`) > 9007199254740992 + THEN CAST('Infinity' AS FLOAT64) * SIGN(`float64_col`) + ELSE `float64_col` + END + ) + WHEN ABS(`float64_col`) > 9007199254740992 + THEN POWER( + `float64_col`, + CASE + WHEN ABS(`float64_col`) > 9007199254740992 + THEN CAST('Infinity' AS FLOAT64) * SIGN(`float64_col`) + ELSE `float64_col` + END + ) + WHEN `float64_col` < CAST(0 AS INT64) + AND NOT CAST(`float64_col` AS INT64) = `float64_col` + THEN CAST('NaN' AS FLOAT64) + WHEN `float64_col` <> CAST(0 AS INT64) + AND `float64_col` * LN(ABS(`float64_col`)) > 709.78 + THEN CAST('Infinity' AS FLOAT64) * CASE + WHEN `float64_col` < CAST(0 AS INT64) AND MOD(CAST(`float64_col` AS INT64), 2) = 1 + THEN -1 + ELSE 1 + END + ELSE POWER( + `float64_col`, + CASE + WHEN ABS(`float64_col`) > 9007199254740992 + THEN CAST('Infinity' AS FLOAT64) * SIGN(`float64_col`) + ELSE `float64_col` + END + ) + END AS `float_pow_float`, + CASE + WHEN `int64_col` <> 0 AND 0 * LN(ABS(`int64_col`)) > 43.66827237527655 + THEN NULL + ELSE CAST(POWER(CAST(`int64_col` AS NUMERIC), 0) AS INT64) + END AS `int_pow_0`, + CASE + WHEN 0 = CAST(0 AS INT64) + THEN 1 + WHEN `float64_col` = 1 + THEN 1 + WHEN `float64_col` = CAST(0 AS INT64) AND 0 < CAST(0 AS INT64) + THEN CAST('Infinity' AS FLOAT64) + WHEN ABS(`float64_col`) = CAST('Infinity' AS FLOAT64) + THEN POWER( + `float64_col`, + CASE + WHEN ABS(0) > 9007199254740992 + THEN CAST('Infinity' AS FLOAT64) * SIGN(0) + ELSE 0 + END + ) + WHEN ABS(0) > 9007199254740992 + THEN POWER( + `float64_col`, + CASE + WHEN ABS(0) > 9007199254740992 + THEN CAST('Infinity' AS FLOAT64) * SIGN(0) + ELSE 0 + END + ) + WHEN `float64_col` < CAST(0 AS INT64) AND NOT CAST(0 AS INT64) = 0 + THEN CAST('NaN' AS FLOAT64) + WHEN `float64_col` <> CAST(0 AS INT64) AND 0 * LN(ABS(`float64_col`)) > 709.78 + THEN CAST('Infinity' AS FLOAT64) * CASE + WHEN `float64_col` < CAST(0 AS INT64) AND MOD(CAST(0 AS INT64), 2) = 1 + THEN -1 + ELSE 1 + END + ELSE POWER( + `float64_col`, + CASE + WHEN ABS(0) > 9007199254740992 + THEN CAST('Infinity' AS FLOAT64) * SIGN(0) + ELSE 0 + END + ) + END AS `float_pow_0`, + CASE + WHEN `int64_col` <> 0 AND 1 * LN(ABS(`int64_col`)) > 43.66827237527655 + THEN NULL + ELSE CAST(POWER(CAST(`int64_col` AS NUMERIC), 1) AS INT64) + END AS `int_pow_1`, + CASE + WHEN 1 = CAST(0 AS INT64) + THEN 1 + WHEN `float64_col` = 1 + THEN 1 + WHEN `float64_col` = CAST(0 AS INT64) AND 1 < CAST(0 AS INT64) + THEN CAST('Infinity' AS FLOAT64) + WHEN ABS(`float64_col`) = CAST('Infinity' AS FLOAT64) + THEN POWER( + `float64_col`, + CASE + WHEN ABS(1) > 9007199254740992 + THEN CAST('Infinity' AS FLOAT64) * SIGN(1) ELSE 1 END - ELSE POWER( - `bfcol_26`, - CASE - WHEN ABS(`bfcol_26`) > 9007199254740992 - THEN CAST('Infinity' AS FLOAT64) * SIGN(`bfcol_26`) - ELSE `bfcol_26` - END - ) - END AS `bfcol_42` - FROM `bfcte_3` -), `bfcte_5` AS ( - SELECT - *, - `bfcol_36` AS `bfcol_50`, - `bfcol_37` AS `bfcol_51`, - `bfcol_38` AS `bfcol_52`, - `bfcol_39` AS `bfcol_53`, - `bfcol_40` AS `bfcol_54`, - `bfcol_41` AS `bfcol_55`, - `bfcol_42` AS `bfcol_56`, - CASE - WHEN `bfcol_37` <> 0 AND 0 * LN(ABS(`bfcol_37`)) > 43.66827237527655 - THEN NULL - ELSE CAST(POWER(CAST(`bfcol_37` AS NUMERIC), 0) AS INT64) - END AS `bfcol_57` - FROM `bfcte_4` -), `bfcte_6` AS ( - SELECT - *, - `bfcol_50` AS `bfcol_66`, - `bfcol_51` AS `bfcol_67`, - `bfcol_52` AS `bfcol_68`, - `bfcol_53` AS `bfcol_69`, - `bfcol_54` AS `bfcol_70`, - `bfcol_55` AS `bfcol_71`, - `bfcol_56` AS `bfcol_72`, - `bfcol_57` AS `bfcol_73`, - CASE - WHEN 0 = CAST(0 AS INT64) - THEN 1 - WHEN `bfcol_52` = 1 - THEN 1 - WHEN `bfcol_52` = CAST(0 AS INT64) AND 0 < CAST(0 AS INT64) - THEN CAST('Infinity' AS FLOAT64) - WHEN ABS(`bfcol_52`) = CAST('Infinity' AS FLOAT64) - THEN POWER( - `bfcol_52`, - CASE - WHEN ABS(0) > 9007199254740992 - THEN CAST('Infinity' AS FLOAT64) * SIGN(0) - ELSE 0 - END - ) - WHEN ABS(0) > 9007199254740992 - THEN POWER( - `bfcol_52`, - CASE - WHEN ABS(0) > 9007199254740992 - THEN CAST('Infinity' AS FLOAT64) * SIGN(0) - ELSE 0 - END - ) - WHEN `bfcol_52` < CAST(0 AS INT64) AND NOT CAST(0 AS INT64) = 0 - THEN CAST('NaN' AS FLOAT64) - WHEN `bfcol_52` <> CAST(0 AS INT64) AND 0 * LN(ABS(`bfcol_52`)) > 709.78 - THEN CAST('Infinity' AS FLOAT64) * CASE - WHEN `bfcol_52` < CAST(0 AS INT64) AND MOD(CAST(0 AS INT64), 2) = 1 - THEN -1 + ) + WHEN ABS(1) > 9007199254740992 + THEN POWER( + `float64_col`, + CASE + WHEN ABS(1) > 9007199254740992 + THEN CAST('Infinity' AS FLOAT64) * SIGN(1) ELSE 1 END - ELSE POWER( - `bfcol_52`, - CASE - WHEN ABS(0) > 9007199254740992 - THEN CAST('Infinity' AS FLOAT64) * SIGN(0) - ELSE 0 - END - ) - END AS `bfcol_74` - FROM `bfcte_5` -), `bfcte_7` AS ( - SELECT - *, - `bfcol_66` AS `bfcol_84`, - `bfcol_67` AS `bfcol_85`, - `bfcol_68` AS `bfcol_86`, - `bfcol_69` AS `bfcol_87`, - `bfcol_70` AS `bfcol_88`, - `bfcol_71` AS `bfcol_89`, - `bfcol_72` AS `bfcol_90`, - `bfcol_73` AS `bfcol_91`, - `bfcol_74` AS `bfcol_92`, - CASE - WHEN `bfcol_67` <> 0 AND 1 * LN(ABS(`bfcol_67`)) > 43.66827237527655 - THEN NULL - ELSE CAST(POWER(CAST(`bfcol_67` AS NUMERIC), 1) AS INT64) - END AS `bfcol_93` - FROM `bfcte_6` -), `bfcte_8` AS ( - SELECT - *, - `bfcol_84` AS `bfcol_104`, - `bfcol_85` AS `bfcol_105`, - `bfcol_86` AS `bfcol_106`, - `bfcol_87` AS `bfcol_107`, - `bfcol_88` AS `bfcol_108`, - `bfcol_89` AS `bfcol_109`, - `bfcol_90` AS `bfcol_110`, - `bfcol_91` AS `bfcol_111`, - `bfcol_92` AS `bfcol_112`, - `bfcol_93` AS `bfcol_113`, - CASE - WHEN 1 = CAST(0 AS INT64) - THEN 1 - WHEN `bfcol_86` = 1 - THEN 1 - WHEN `bfcol_86` = CAST(0 AS INT64) AND 1 < CAST(0 AS INT64) - THEN CAST('Infinity' AS FLOAT64) - WHEN ABS(`bfcol_86`) = CAST('Infinity' AS FLOAT64) - THEN POWER( - `bfcol_86`, - CASE - WHEN ABS(1) > 9007199254740992 - THEN CAST('Infinity' AS FLOAT64) * SIGN(1) - ELSE 1 - END - ) - WHEN ABS(1) > 9007199254740992 - THEN POWER( - `bfcol_86`, - CASE - WHEN ABS(1) > 9007199254740992 - THEN CAST('Infinity' AS FLOAT64) * SIGN(1) - ELSE 1 - END - ) - WHEN `bfcol_86` < CAST(0 AS INT64) AND NOT CAST(1 AS INT64) = 1 - THEN CAST('NaN' AS FLOAT64) - WHEN `bfcol_86` <> CAST(0 AS INT64) AND 1 * LN(ABS(`bfcol_86`)) > 709.78 - THEN CAST('Infinity' AS FLOAT64) * CASE - WHEN `bfcol_86` < CAST(0 AS INT64) AND MOD(CAST(1 AS INT64), 2) = 1 - THEN -1 + ) + WHEN `float64_col` < CAST(0 AS INT64) AND NOT CAST(1 AS INT64) = 1 + THEN CAST('NaN' AS FLOAT64) + WHEN `float64_col` <> CAST(0 AS INT64) AND 1 * LN(ABS(`float64_col`)) > 709.78 + THEN CAST('Infinity' AS FLOAT64) * CASE + WHEN `float64_col` < CAST(0 AS INT64) AND MOD(CAST(1 AS INT64), 2) = 1 + THEN -1 + ELSE 1 + END + ELSE POWER( + `float64_col`, + CASE + WHEN ABS(1) > 9007199254740992 + THEN CAST('Infinity' AS FLOAT64) * SIGN(1) ELSE 1 END - ELSE POWER( - `bfcol_86`, - CASE - WHEN ABS(1) > 9007199254740992 - THEN CAST('Infinity' AS FLOAT64) * SIGN(1) - ELSE 1 - END - ) - END AS `bfcol_114` - FROM `bfcte_7` -) -SELECT - `bfcol_104` AS `rowindex`, - `bfcol_105` AS `int64_col`, - `bfcol_106` AS `float64_col`, - `bfcol_107` AS `int_pow_int`, - `bfcol_108` AS `int_pow_float`, - `bfcol_109` AS `float_pow_int`, - `bfcol_110` AS `float_pow_float`, - `bfcol_111` AS `int_pow_0`, - `bfcol_112` AS `float_pow_0`, - `bfcol_113` AS `int_pow_1`, - `bfcol_114` AS `float_pow_1` -FROM `bfcte_8` \ No newline at end of file + ) + END AS `float_pow_1` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_round/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_round/out.sql index 9ce76f7c63f..e789156797b 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 @@ -4,78 +4,16 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - *, - `bfcol_6` AS `bfcol_14`, - `bfcol_7` AS `bfcol_15`, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - CAST(ROUND(`bfcol_7`, 1) AS INT64) AS `bfcol_18` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_14` AS `bfcol_24`, - `bfcol_15` AS `bfcol_25`, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - CAST(ROUND(`bfcol_15`, -1) AS INT64) AS `bfcol_29` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - *, - `bfcol_24` AS `bfcol_36`, - `bfcol_25` AS `bfcol_37`, - `bfcol_26` AS `bfcol_38`, - `bfcol_27` AS `bfcol_39`, - `bfcol_28` AS `bfcol_40`, - `bfcol_29` AS `bfcol_41`, - ROUND(`bfcol_26`, 0) AS `bfcol_42` - FROM `bfcte_3` -), `bfcte_5` AS ( - SELECT - *, - `bfcol_36` AS `bfcol_50`, - `bfcol_37` AS `bfcol_51`, - `bfcol_38` AS `bfcol_52`, - `bfcol_39` AS `bfcol_53`, - `bfcol_40` AS `bfcol_54`, - `bfcol_41` AS `bfcol_55`, - `bfcol_42` AS `bfcol_56`, - ROUND(`bfcol_38`, 1) AS `bfcol_57` - FROM `bfcte_4` -), `bfcte_6` AS ( - SELECT - *, - `bfcol_50` AS `bfcol_66`, - `bfcol_51` AS `bfcol_67`, - `bfcol_52` AS `bfcol_68`, - `bfcol_53` AS `bfcol_69`, - `bfcol_54` AS `bfcol_70`, - `bfcol_55` AS `bfcol_71`, - `bfcol_56` AS `bfcol_72`, - `bfcol_57` AS `bfcol_73`, - ROUND(`bfcol_52`, -1) AS `bfcol_74` - FROM `bfcte_5` ) SELECT - `bfcol_66` AS `rowindex`, - `bfcol_67` AS `int64_col`, - `bfcol_68` AS `float64_col`, - `bfcol_69` AS `int_round_0`, - `bfcol_70` AS `int_round_1`, - `bfcol_71` AS `int_round_m1`, - `bfcol_72` AS `float_round_0`, - `bfcol_73` AS `float_round_1`, - `bfcol_74` AS `float_round_m1` -FROM `bfcte_6` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `int64_col` AS `int64_col`, + `float64_col` AS `float64_col`, + CAST(ROUND(`int64_col`, 0) AS INT64) AS `int_round_0`, + CAST(ROUND(`int64_col`, 1) AS INT64) AS `int_round_1`, + CAST(ROUND(`int64_col`, -1) AS INT64) AS `int_round_m1`, + ROUND(`float64_col`, 0) AS `float_round_0`, + ROUND(`float64_col`, 1) AS `float_round_1`, + ROUND(`float64_col`, -1) AS `float_round_m1` +FROM `bfcte_0` \ No newline at end of file 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 1699b6d8df8..544cf2dbff0 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - SIN(`float64_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + SIN(`float64_col`) AS `float64_col` +FROM `bfcte_0` \ No newline at end of file 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 c1ea003e2d3..1ac71692afb 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 @@ -2,16 +2,12 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - 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` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + CASE + WHEN ABS(`float64_col`) > 709.78 + THEN SIGN(`float64_col`) * CAST('Infinity' AS FLOAT64) + ELSE SINH(`float64_col`) + END AS `float64_col` +FROM `bfcte_0` \ No newline at end of file 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 152545d5505..6aad0dac445 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE WHEN `float64_col` < 0 THEN CAST('NaN' AS FLOAT64) ELSE SQRT(`float64_col`) END AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + CASE WHEN `float64_col` < 0 THEN CAST('NaN' AS FLOAT64) ELSE SQRT(`float64_col`) END AS `float64_col` +FROM `bfcte_0` \ No newline at end of file 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 7e0f07af7b7..dd6157b0025 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 @@ -4,51 +4,14 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - *, - `bfcol_6` AS `bfcol_14`, - `bfcol_7` AS `bfcol_15`, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - `bfcol_7` - 1 AS `bfcol_18` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_14` AS `bfcol_24`, - `bfcol_15` AS `bfcol_25`, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - `bfcol_15` - CAST(`bfcol_16` AS INT64) AS `bfcol_29` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - *, - `bfcol_24` AS `bfcol_36`, - `bfcol_25` AS `bfcol_37`, - `bfcol_26` AS `bfcol_38`, - `bfcol_27` AS `bfcol_39`, - `bfcol_28` AS `bfcol_40`, - `bfcol_29` AS `bfcol_41`, - CAST(`bfcol_26` AS INT64) - `bfcol_25` AS `bfcol_42` - FROM `bfcte_3` ) SELECT - `bfcol_36` AS `rowindex`, - `bfcol_37` AS `int64_col`, - `bfcol_38` AS `bool_col`, - `bfcol_39` AS `int_add_int`, - `bfcol_40` AS `int_add_1`, - `bfcol_41` AS `int_add_bool`, - `bfcol_42` AS `bool_add_int` -FROM `bfcte_4` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `int64_col` AS `int64_col`, + `bool_col` AS `bool_col`, + `int64_col` - `int64_col` AS `int_add_int`, + `int64_col` - 1 AS `int_add_1`, + `int64_col` - CAST(`bool_col` AS INT64) AS `int_add_bool`, + CAST(`bool_col` AS INT64) - `int64_col` AS `bool_add_int` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sub_timedelta/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sub_timedelta/out.sql index ebcffd67f61..c5306a9d0b5 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 @@ -5,78 +5,16 @@ WITH `bfcte_0` AS ( `rowindex`, `timestamp_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - *, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - `bfcol_11` AS `bfcol_18`, - `bfcol_10` AS `bfcol_19`, - TIMESTAMP_SUB(CAST(`bfcol_10` AS DATETIME), INTERVAL `bfcol_11` MICROSECOND) AS `bfcol_20` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - `bfcol_19` AS `bfcol_29`, - `bfcol_20` AS `bfcol_30`, - TIMESTAMP_SUB(`bfcol_17`, INTERVAL `bfcol_18` MICROSECOND) AS `bfcol_31` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - *, - `bfcol_26` AS `bfcol_38`, - `bfcol_27` AS `bfcol_39`, - `bfcol_28` AS `bfcol_40`, - `bfcol_29` AS `bfcol_41`, - `bfcol_30` AS `bfcol_42`, - `bfcol_31` AS `bfcol_43`, - TIMESTAMP_DIFF(CAST(`bfcol_29` AS DATETIME), CAST(`bfcol_29` AS DATETIME), MICROSECOND) AS `bfcol_44` - FROM `bfcte_3` -), `bfcte_5` AS ( - SELECT - *, - `bfcol_38` AS `bfcol_52`, - `bfcol_39` AS `bfcol_53`, - `bfcol_40` AS `bfcol_54`, - `bfcol_41` AS `bfcol_55`, - `bfcol_42` AS `bfcol_56`, - `bfcol_43` AS `bfcol_57`, - `bfcol_44` AS `bfcol_58`, - TIMESTAMP_DIFF(`bfcol_39`, `bfcol_39`, MICROSECOND) AS `bfcol_59` - FROM `bfcte_4` -), `bfcte_6` AS ( - SELECT - *, - `bfcol_52` AS `bfcol_68`, - `bfcol_53` AS `bfcol_69`, - `bfcol_54` AS `bfcol_70`, - `bfcol_55` AS `bfcol_71`, - `bfcol_56` AS `bfcol_72`, - `bfcol_57` AS `bfcol_73`, - `bfcol_58` AS `bfcol_74`, - `bfcol_59` AS `bfcol_75`, - `bfcol_54` - `bfcol_54` AS `bfcol_76` - FROM `bfcte_5` ) SELECT - `bfcol_68` AS `rowindex`, - `bfcol_69` AS `timestamp_col`, - `bfcol_70` AS `duration_col`, - `bfcol_71` AS `date_col`, - `bfcol_72` AS `date_sub_timedelta`, - `bfcol_73` AS `timestamp_sub_timedelta`, - `bfcol_74` AS `timestamp_sub_date`, - `bfcol_75` AS `date_sub_timestamp`, - `bfcol_76` AS `timedelta_sub_timedelta` -FROM `bfcte_6` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `timestamp_col` AS `timestamp_col`, + `duration_col` AS `duration_col`, + `date_col` AS `date_col`, + TIMESTAMP_SUB(CAST(`date_col` AS DATETIME), INTERVAL `duration_col` MICROSECOND) AS `date_sub_timedelta`, + TIMESTAMP_SUB(`timestamp_col`, INTERVAL `duration_col` MICROSECOND) AS `timestamp_sub_timedelta`, + TIMESTAMP_DIFF(CAST(`date_col` AS DATETIME), CAST(`date_col` AS DATETIME), MICROSECOND) AS `timestamp_sub_date`, + TIMESTAMP_DIFF(`timestamp_col`, `timestamp_col`, MICROSECOND) AS `date_sub_timestamp`, + `duration_col` - `duration_col` AS `timedelta_sub_timedelta` +FROM `bfcte_0` \ No newline at end of file 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 f09d26a188a..f63d14fc316 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - TAN(`float64_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + TAN(`float64_col`) AS `float64_col` +FROM `bfcte_0` \ No newline at end of file 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 a5e5a87fbc4..bf397b55ecf 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `float64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - TANH(`float64_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + *, + TANH(`float64_col`) AS `float64_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_unsafe_pow_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_unsafe_pow_op/out.sql index 9957a346654..a21e05c708a 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_unsafe_pow_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_unsafe_pow_op/out.sql @@ -4,40 +4,13 @@ WITH `bfcte_0` AS ( `float64_col`, `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `bool_col` AS `bfcol_3`, - `int64_col` AS `bfcol_4`, - `float64_col` AS `bfcol_5`, - ( - `int64_col` >= 0 - ) AND ( - `int64_col` <= 10 - ) AS `bfcol_6` - FROM `bfcte_0` -), `bfcte_2` AS ( - SELECT - * - FROM `bfcte_1` - WHERE - `bfcol_6` -), `bfcte_3` AS ( - SELECT - *, - POWER(`bfcol_4`, `bfcol_4`) AS `bfcol_14`, - POWER(`bfcol_4`, `bfcol_5`) AS `bfcol_15`, - POWER(`bfcol_5`, `bfcol_4`) AS `bfcol_16`, - POWER(`bfcol_5`, `bfcol_5`) AS `bfcol_17`, - POWER(`bfcol_4`, CAST(`bfcol_3` AS INT64)) AS `bfcol_18`, - POWER(CAST(`bfcol_3` AS INT64), `bfcol_4`) AS `bfcol_19` - FROM `bfcte_2` ) SELECT - `bfcol_14` AS `int_pow_int`, - `bfcol_15` AS `int_pow_float`, - `bfcol_16` AS `float_pow_int`, - `bfcol_17` AS `float_pow_float`, - `bfcol_18` AS `int_pow_bool`, - `bfcol_19` AS `bool_pow_int` -FROM `bfcte_3` \ No newline at end of file + *, + POWER(`int64_col`, `int64_col`) AS `int_pow_int`, + POWER(`int64_col`, `float64_col`) AS `int_pow_float`, + POWER(`float64_col`, `int64_col`) AS `float_pow_int`, + POWER(`float64_col`, `float64_col`) AS `float_pow_float`, + POWER(`int64_col`, CAST(`bool_col` AS INT64)) AS `int_pow_bool`, + POWER(CAST(`bool_col` AS INT64), `int64_col`) AS `bool_pow_int` +FROM `bfcte_0` \ No newline at end of file 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 cb674787ff1..2acc0a1057a 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CONCAT(`string_col`, 'a') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + CONCAT(`string_col`, 'a') AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 dd1f1473f41..bdcc3f8a8a5 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - INITCAP(`string_col`, '') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + INITCAP(`string_col`, '') AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 eeb25740946..a1fc43ec710 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 @@ -2,16 +2,10 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - 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` ) SELECT - `bfcol_1` AS `single`, - `bfcol_2` AS `double`, - `bfcol_3` AS `empty` -FROM `bfcte_1` \ No newline at end of file + *, + ENDS_WITH(`string_col`, 'ab') AS `single`, + ENDS_WITH(`string_col`, 'ab') OR ENDS_WITH(`string_col`, 'cd') AS `double`, + FALSE AS `empty` +FROM `bfcte_0` \ No newline at end of file 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 61c2643f161..8a724f0884f 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - REGEXP_CONTAINS(`string_col`, '^(\\p{N}|\\p{L})+$') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + REGEXP_CONTAINS(`string_col`, '^(\\p{N}|\\p{L})+$') AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 2b086f3e3d9..ece586a2589 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - REGEXP_CONTAINS(`string_col`, '^\\p{L}+$') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + REGEXP_CONTAINS(`string_col`, '^\\p{L}+$') AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 d4dddc348f0..4006a36d56a 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - REGEXP_CONTAINS(`string_col`, '^(\\p{Nd})+$') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + REGEXP_CONTAINS(`string_col`, '^(\\p{Nd})+$') AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 eba0e51ed09..c53446715f1 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 @@ -2,15 +2,11 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - REGEXP_CONTAINS( - `string_col`, - '^[\\p{Nd}\\x{00B9}\\x{00B2}\\x{00B3}\\x{2070}\\x{2074}-\\x{2079}\\x{2080}-\\x{2089}]+$' - ) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + REGEXP_CONTAINS( + `string_col`, + '^[\\p{Nd}\\x{00B9}\\x{00B2}\\x{00B3}\\x{2070}\\x{2074}-\\x{2079}\\x{2080}-\\x{2089}]+$' + ) AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 b6ff57797c6..aa08afb0c5e 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - LOWER(`string_col`) = `string_col` AND UPPER(`string_col`) <> `string_col` AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + LOWER(`string_col`) = `string_col` AND UPPER(`string_col`) <> `string_col` AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 6143b3685a2..f4b99d8ab94 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - REGEXP_CONTAINS(`string_col`, '^\\pN+$') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + REGEXP_CONTAINS(`string_col`, '^\\pN+$') AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 47ccd642d40..39e4571fbe7 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - REGEXP_CONTAINS(`string_col`, '^\\s+$') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + REGEXP_CONTAINS(`string_col`, '^\\s+$') AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 54f7b55ce3d..fb51a4a824e 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - UPPER(`string_col`) = `string_col` AND LOWER(`string_col`) <> `string_col` AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + UPPER(`string_col`) = `string_col` AND LOWER(`string_col`) <> `string_col` AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 63e8e160bfc..b939a50f4a6 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - LENGTH(`string_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + LENGTH(`string_col`) AS `string_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_len_w_array/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_len_w_array/out.sql index 609c4131e65..bb4837484b2 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_len_w_array/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_len_w_array/out.sql @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `int_list_col` FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` -), `bfcte_1` AS ( - SELECT - *, - ARRAY_LENGTH(`int_list_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `int_list_col` -FROM `bfcte_1` \ No newline at end of file + *, + ARRAY_LENGTH(`int_list_col`) AS `int_list_col` +FROM `bfcte_0` \ No newline at end of file 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 0a9623162aa..7698dcb1b90 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - LOWER(`string_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + LOWER(`string_col`) AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 1b73ee32585..659e7e471d8 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - LTRIM(`string_col`, ' ') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + LTRIM(`string_col`, ' ') AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 2fd3365a803..2ce5206cd2c 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - REGEXP_REPLACE(`string_col`, 'e', 'a') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + REGEXP_REPLACE(`string_col`, 'e', 'a') AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 61b2e2f432d..25254b42bef 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - REPLACE(`string_col`, 'e', 'a') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + REPLACE(`string_col`, 'e', 'a') AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 f9d287a5917..b3abbf00478 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - REVERSE(`string_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + REVERSE(`string_col`) AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 72bdbba29f1..4cd3f1e5b5b 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - RTRIM(`string_col`, ' ') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + RTRIM(`string_col`, ' ') AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 54c8adb7b86..fa7fafb8b70 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 @@ -2,16 +2,10 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - 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` ) SELECT - `bfcol_1` AS `single`, - `bfcol_2` AS `double`, - `bfcol_3` AS `empty` -FROM `bfcte_1` \ No newline at end of file + *, + STARTS_WITH(`string_col`, 'ab') AS `single`, + STARTS_WITH(`string_col`, 'ab') OR STARTS_WITH(`string_col`, 'cd') AS `double`, + FALSE AS `empty` +FROM `bfcte_0` \ No newline at end of file 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 e973a97136b..6dc99718f1e 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `string_col` LIKE '%e%' AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + `string_col` LIKE '%e%' AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 510e52e254c..dde561a9ce0 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - REGEXP_CONTAINS(`string_col`, 'e') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + REGEXP_CONTAINS(`string_col`, 'e') AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 3a6d48a18c5..7b6364dcccb 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 @@ -2,22 +2,17 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - IF( - REGEXP_CONTAINS(`string_col`, '([a-z]*)'), - REGEXP_REPLACE(`string_col`, CONCAT('.*?(', '([a-z]*)', ').*'), '\\1'), - NULL - ) AS `bfcol_1`, - IF( - REGEXP_CONTAINS(`string_col`, '([a-z]*)'), - REGEXP_REPLACE(`string_col`, CONCAT('.*?', '([a-z]*)', '.*'), '\\1'), - NULL - ) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `zero`, - `bfcol_2` AS `one` -FROM `bfcte_1` \ No newline at end of file + *, + IF( + REGEXP_CONTAINS(`string_col`, '([a-z]*)'), + REGEXP_REPLACE(`string_col`, CONCAT('.*?(', '([a-z]*)', ').*'), '\\1'), + NULL + ) AS `zero`, + IF( + REGEXP_CONTAINS(`string_col`, '([a-z]*)'), + REGEXP_REPLACE(`string_col`, CONCAT('.*?', '([a-z]*)', '.*'), '\\1'), + NULL + ) AS `one` +FROM `bfcte_0` \ No newline at end of file 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 82847d5e22c..3143e763f77 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 @@ -2,18 +2,11 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - 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 - `bfcol_1` AS `none_none`, - `bfcol_2` AS `start_none`, - `bfcol_3` AS `none_end`, - `bfcol_4` AS `start_end` -FROM `bfcte_1` \ No newline at end of file + *, + INSTR(`string_col`, 'e', 1) - 1 AS `none_none`, + INSTR(`string_col`, 'e', 3) - 1 AS `start_none`, + INSTR(SUBSTRING(`string_col`, 1, 5), 'e') - 1 AS `none_end`, + INSTR(SUBSTRING(`string_col`, 3, 3), 'e') - 1 AS `start_end` +FROM `bfcte_0` \ No newline at end of file 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 f868b730327..c18668b5ba3 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - IF(SUBSTRING(`string_col`, 2, 1) <> '', SUBSTRING(`string_col`, 2, 1), NULL) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + IF(SUBSTRING(`string_col`, 2, 1) <> '', SUBSTRING(`string_col`, 2, 1), NULL) AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 2bb6042fe99..7456982cc58 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 @@ -2,24 +2,18 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - LPAD(`string_col`, GREATEST(LENGTH(`string_col`), 10), '-') AS `bfcol_1`, - RPAD(`string_col`, GREATEST(LENGTH(`string_col`), 10), '-') AS `bfcol_2`, - RPAD( - LPAD( - `string_col`, - CAST(FLOOR(SAFE_DIVIDE(GREATEST(LENGTH(`string_col`), 10) - LENGTH(`string_col`), 2)) AS INT64) + LENGTH(`string_col`), - '-' - ), - GREATEST(LENGTH(`string_col`), 10), - '-' - ) AS `bfcol_3` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `left`, - `bfcol_2` AS `right`, - `bfcol_3` AS `both` -FROM `bfcte_1` \ No newline at end of file + *, + LPAD(`string_col`, GREATEST(LENGTH(`string_col`), 10), '-') AS `left`, + RPAD(`string_col`, GREATEST(LENGTH(`string_col`), 10), '-') AS `right`, + RPAD( + LPAD( + `string_col`, + CAST(FLOOR(SAFE_DIVIDE(GREATEST(LENGTH(`string_col`), 10) - LENGTH(`string_col`), 2)) AS INT64) + LENGTH(`string_col`), + '-' + ), + GREATEST(LENGTH(`string_col`), 10), + '-' + ) AS `both` +FROM `bfcte_0` \ No newline at end of file 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 90a52a40b14..eea25de07d4 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - REPEAT(`string_col`, 2) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + REPEAT(`string_col`, 2) AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 8bd2a5f7feb..6ccaa676e08 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - SUBSTRING(`string_col`, 2, 2) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + SUBSTRING(`string_col`, 2, 2) AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 cb674787ff1..2acc0a1057a 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CONCAT(`string_col`, 'a') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + CONCAT(`string_col`, 'a') AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 37b15a0cf91..919b145949d 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - SPLIT(`string_col`, ',') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + SPLIT(`string_col`, ',') AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 ebe4c39bbf5..06a8f9c43e7 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - TRIM(`string_col`, ' ') AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + TRIM(`string_col`, ' ') AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 aa14c5f05d8..77bc7a5db61 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - UPPER(`string_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + UPPER(`string_col`) AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 79c4f695aaf..4b8afb716cd 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 @@ -2,16 +2,12 @@ WITH `bfcte_0` AS ( SELECT `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - WHEN STARTS_WITH(`string_col`, '-') - THEN CONCAT('-', LPAD(SUBSTRING(`string_col`, 2), GREATEST(LENGTH(`string_col`), 10) - 1, '0')) - ELSE LPAD(`string_col`, GREATEST(LENGTH(`string_col`), 10), '0') - END AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + *, + CASE + WHEN STARTS_WITH(`string_col`, '-') + THEN CONCAT('-', LPAD(SUBSTRING(`string_col`, 2), GREATEST(LENGTH(`string_col`), 10) - 1, '0')) + ELSE LPAD(`string_col`, GREATEST(LENGTH(`string_col`), 10), '0') + END AS `string_col` +FROM `bfcte_0` \ No newline at end of file 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 b85e88a90a5..1c84a4c7a45 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 @@ -2,14 +2,9 @@ WITH `bfcte_0` AS ( SELECT `people` FROM `bigframes-dev`.`sqlglot_test`.`nested_structs_types` -), `bfcte_1` AS ( - SELECT - *, - `people`.`name` AS `bfcol_1`, - `people`.`name` AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string`, - `bfcol_2` AS `int` -FROM `bfcte_1` \ No newline at end of file + *, + `people`.`name` AS `string`, + `people`.`name` AS `int` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_struct_ops/test_struct_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_struct_ops/test_struct_op/out.sql index 575a1620806..0c51de1b191 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 @@ -5,17 +5,13 @@ WITH `bfcte_0` AS ( `int64_col`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - STRUCT( - `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` ) SELECT - `bfcol_4` AS `result_col` -FROM `bfcte_1` \ No newline at end of file + *, + STRUCT( + `bool_col` AS bool_col, + `int64_col` AS int64_col, + `float64_col` AS float64_col, + `string_col` AS string_col + ) AS `result_col` +FROM `bfcte_0` \ No newline at end of file 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 432aefd7f69..dbd4ffddc20 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 @@ -2,12 +2,8 @@ WITH `bfcte_0` AS ( SELECT `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - FLOOR(`int64_col`) AS `bfcol_1` - FROM `bfcte_0` ) SELECT - `bfcol_1` AS `int64_col` -FROM `bfcte_1` \ No newline at end of file + *, + FLOOR(`int64_col`) AS `int64_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_timedelta_ops/test_to_timedelta/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_timedelta_ops/test_to_timedelta/out.sql index ed7dbc7c8a9..ad377ef9d9e 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 @@ -4,51 +4,14 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `rowindex` AS `bfcol_6`, - `int64_col` AS `bfcol_7`, - `float64_col` AS `bfcol_8`, - `int64_col` AS `bfcol_9` - FROM `bfcte_0` -), `bfcte_2` AS ( - SELECT - *, - `bfcol_6` AS `bfcol_14`, - `bfcol_7` AS `bfcol_15`, - `bfcol_8` AS `bfcol_16`, - `bfcol_9` AS `bfcol_17`, - CAST(FLOOR(`bfcol_8` * 1000000) AS INT64) AS `bfcol_18` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_14` AS `bfcol_24`, - `bfcol_15` AS `bfcol_25`, - `bfcol_16` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_18` AS `bfcol_28`, - `bfcol_15` * 3600000000 AS `bfcol_29` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - *, - `bfcol_24` AS `bfcol_36`, - `bfcol_25` AS `bfcol_37`, - `bfcol_26` AS `bfcol_38`, - `bfcol_27` AS `bfcol_39`, - `bfcol_28` AS `bfcol_40`, - `bfcol_29` AS `bfcol_41`, - `bfcol_27` AS `bfcol_42` - FROM `bfcte_3` ) SELECT - `bfcol_36` AS `rowindex`, - `bfcol_37` AS `int64_col`, - `bfcol_38` AS `float64_col`, - `bfcol_39` AS `duration_us`, - `bfcol_40` AS `duration_s`, - `bfcol_41` AS `duration_w`, - `bfcol_42` AS `duration_on_duration` -FROM `bfcte_4` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `int64_col` AS `int64_col`, + `float64_col` AS `float64_col`, + `int64_col` AS `duration_us`, + CAST(FLOOR(`float64_col` * 1000000) AS INT64) AS `duration_s`, + `int64_col` * 3600000000 AS `duration_w`, + `int64_col` AS `duration_on_duration` +FROM `bfcte_0` \ No newline at end of file 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 949ed82574d..ba19ac8be1e 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 @@ -6,6 +6,8 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, + `bool_col` AS `bool_col`, + `int64_too` AS `int64_too`, `int64_too` AS `bfcol_2`, `bool_col` AS `bfcol_3` FROM `bfcte_0` @@ -20,8 +22,7 @@ WITH `bfcte_0` AS ( `bfcol_3` ) SELECT + *, `bfcol_3` AS `bool_col`, `bfcol_6` AS `int64_too` -FROM `bfcte_2` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file +FROM `bfcte_2` \ No newline at end of file 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 3c09250858d..c7df8d27127 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 @@ -6,6 +6,8 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, + `bool_col` AS `bool_col`, + `int64_too` AS `int64_too`, `int64_too` AS `bfcol_2`, `bool_col` AS `bfcol_3` FROM `bfcte_0` @@ -18,8 +20,7 @@ WITH `bfcte_0` AS ( `bfcol_3` ) SELECT + *, `bfcol_3` AS `bool_col`, `bfcol_6` AS `int64_too` -FROM `bfcte_2` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file +FROM `bfcte_2` \ No newline at end of file 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 db1da10086f..5285dd26842 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 @@ -4,16 +4,6 @@ WITH `bfcte_1` AS ( `rowindex`, `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_3` AS ( - SELECT - *, - ROW_NUMBER() OVER () - 1 AS `bfcol_7` - FROM `bfcte_1` -), `bfcte_5` AS ( - SELECT - *, - 0 AS `bfcol_8` - FROM `bfcte_3` ), `bfcte_0` AS ( SELECT `int64_col`, @@ -21,16 +11,6 @@ WITH `bfcte_1` AS ( `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( - SELECT - *, - ROW_NUMBER() OVER () - 1 AS `bfcol_22` - FROM `bfcte_0` -), `bfcte_4` AS ( - SELECT - *, - 1 AS `bfcol_23` - FROM `bfcte_2` -), `bfcte_6` AS ( SELECT `bfcol_9` AS `bfcol_30`, `bfcol_10` AS `bfcol_31`, @@ -41,33 +21,33 @@ WITH `bfcte_1` AS ( FROM ( ( SELECT + *, `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` + 0 AS `bfcol_13`, + ROW_NUMBER() OVER () - 1 AS `bfcol_14` + FROM `bfcte_1` ) UNION ALL ( SELECT + *, `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` + 1 AS `bfcol_28`, + ROW_NUMBER() OVER () - 1 AS `bfcol_29` + FROM `bfcte_0` ) ) ) SELECT + *, `bfcol_30` AS `rowindex`, `bfcol_31` AS `rowindex_1`, `bfcol_32` AS `int64_col`, `bfcol_33` AS `string_col` -FROM `bfcte_6` -ORDER BY - `bfcol_34` ASC NULLS LAST, - `bfcol_35` ASC NULLS LAST \ No newline at end of file +FROM `bfcte_2` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat_filter_sorted/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat_filter_sorted/out.sql index 65b0f9abd5e..b54a7c5bd0e 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,72 +1,26 @@ -WITH `bfcte_2` AS ( +WITH `bfcte_3` AS ( SELECT `float64_col`, `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_6` AS ( - SELECT - *, - ROW_NUMBER() OVER (ORDER BY `int64_col` ASC NULLS LAST) - 1 AS `bfcol_4` - FROM `bfcte_2` -), `bfcte_10` AS ( - SELECT - *, - 0 AS `bfcol_5` - FROM `bfcte_6` -), `bfcte_0` AS ( +), `bfcte_1` AS ( SELECT `bool_col`, `float64_col`, `int64_too` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_4` AS ( - SELECT - * - FROM `bfcte_0` - WHERE - `bool_col` -), `bfcte_8` AS ( - SELECT - *, - ROW_NUMBER() OVER () - 1 AS `bfcol_15` - FROM `bfcte_4` -), `bfcte_12` AS ( - SELECT - *, - 1 AS `bfcol_16` - FROM `bfcte_8` -), `bfcte_1` AS ( +), `bfcte_2` AS ( SELECT `float64_col`, `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_5` AS ( - SELECT - *, - ROW_NUMBER() OVER (ORDER BY `int64_col` ASC NULLS LAST) - 1 AS `bfcol_25` - FROM `bfcte_1` -), `bfcte_9` AS ( - SELECT - *, - 2 AS `bfcol_26` - FROM `bfcte_5` -), `bfcte_3` AS ( - SELECT - * - FROM `bfcte_0` - WHERE - `bool_col` -), `bfcte_7` AS ( - SELECT - *, - ROW_NUMBER() OVER () - 1 AS `bfcol_36` - FROM `bfcte_3` -), `bfcte_11` AS ( +), `bfcte_0` AS ( SELECT - *, - 3 AS `bfcol_37` - FROM `bfcte_7` -), `bfcte_13` AS ( + `bool_col`, + `float64_col`, + `int64_too` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_4` AS ( SELECT `bfcol_6` AS `bfcol_42`, `bfcol_7` AS `bfcol_43`, @@ -75,45 +29,47 @@ WITH `bfcte_2` AS ( FROM ( ( SELECT + *, `float64_col` AS `bfcol_6`, `int64_col` AS `bfcol_7`, - `bfcol_5` AS `bfcol_8`, - `bfcol_4` AS `bfcol_9` - FROM `bfcte_10` + 0 AS `bfcol_8`, + ROW_NUMBER() OVER (ORDER BY `int64_col` ASC NULLS LAST) - 1 AS `bfcol_9` + FROM `bfcte_3` ) UNION ALL ( SELECT + *, `float64_col` AS `bfcol_17`, `int64_too` AS `bfcol_18`, - `bfcol_16` AS `bfcol_19`, - `bfcol_15` AS `bfcol_20` - FROM `bfcte_12` + 1 AS `bfcol_19`, + ROW_NUMBER() OVER () - 1 AS `bfcol_20` + FROM `bfcte_1` ) UNION ALL ( SELECT + *, `float64_col` AS `bfcol_27`, `int64_col` AS `bfcol_28`, - `bfcol_26` AS `bfcol_29`, - `bfcol_25` AS `bfcol_30` - FROM `bfcte_9` + 2 AS `bfcol_29`, + ROW_NUMBER() OVER (ORDER BY `int64_col` ASC NULLS LAST) - 1 AS `bfcol_30` + FROM `bfcte_2` ) UNION ALL ( SELECT + *, `float64_col` AS `bfcol_38`, `int64_too` AS `bfcol_39`, - `bfcol_37` AS `bfcol_40`, - `bfcol_36` AS `bfcol_41` - FROM `bfcte_11` + 3 AS `bfcol_40`, + ROW_NUMBER() OVER () - 1 AS `bfcol_41` + FROM `bfcte_0` ) ) ) SELECT + *, `bfcol_42` AS `float64_col`, `bfcol_43` AS `int64_col` -FROM `bfcte_13` -ORDER BY - `bfcol_44` ASC NULLS LAST, - `bfcol_45` ASC NULLS LAST \ 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_explode/test_compile_explode_dataframe/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_dataframe/out.sql index 5d9019439f2..8cb6a643e26 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 @@ -12,10 +12,9 @@ WITH `bfcte_0` AS ( LEFT 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 - `rowindex`, + *, + `rowindex` AS `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 + `int_list_col` AS `int_list_col`, + `string_list_col` AS `string_list_col` +FROM `bfcte_1` \ 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 8ba4559da83..fc39add1e09 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 @@ -11,8 +11,7 @@ WITH `bfcte_0` AS ( LEFT JOIN UNNEST(`int_list_col`) AS `bfcol_8` WITH OFFSET AS `bfcol_4` ) SELECT - `rowindex`, - `int_list_col` -FROM `bfcte_1` -ORDER BY - `bfcol_4` ASC NULLS LAST \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `int_list_col` AS `int_list_col` +FROM `bfcte_1` \ 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 f5fff16f602..f69b4b9de1f 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 @@ -3,23 +3,10 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - * - FROM `bfcte_1` - WHERE - `bfcol_8` ) SELECT - `bfcol_5` AS `rowindex`, - `bfcol_6` AS `rowindex_1`, - `bfcol_7` AS `int64_col` -FROM `bfcte_2` \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `rowindex` AS `rowindex_1`, + `int64_col` AS `int64_col` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats/out.sql index 63076077cf5..728f773bf59 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats/out.sql @@ -2,35 +2,49 @@ WITH `bfcte_0` AS ( SELECT * FROM UNNEST(ARRAY>[STRUCT('POINT(1 1)', 0)]) -), `bfcte_1` AS ( - SELECT - *, - ST_REGIONSTATS( - `bfcol_0`, - 'ee://some/raster/uri', - band => 'band1', - include => 'some equation', - options => JSON '{"scale": 100}' - ) AS `bfcol_2` - FROM `bfcte_0` -), `bfcte_2` AS ( - SELECT - *, - `bfcol_2`.`min` AS `bfcol_5`, - `bfcol_2`.`max` AS `bfcol_6`, - `bfcol_2`.`sum` AS `bfcol_7`, - `bfcol_2`.`count` AS `bfcol_8`, - `bfcol_2`.`mean` AS `bfcol_9`, - `bfcol_2`.`area` AS `bfcol_10` - FROM `bfcte_1` ) SELECT - `bfcol_5` AS `min`, - `bfcol_6` AS `max`, - `bfcol_7` AS `sum`, - `bfcol_8` AS `count`, - `bfcol_9` AS `mean`, - `bfcol_10` AS `area` -FROM `bfcte_2` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + *, + ST_REGIONSTATS( + `bfcol_0`, + 'ee://some/raster/uri', + band => 'band1', + include => 'some equation', + options => JSON '{"scale": 100}' + ).`min` AS `min`, + ST_REGIONSTATS( + `bfcol_0`, + 'ee://some/raster/uri', + band => 'band1', + include => 'some equation', + options => JSON '{"scale": 100}' + ).`max` AS `max`, + ST_REGIONSTATS( + `bfcol_0`, + 'ee://some/raster/uri', + band => 'band1', + include => 'some equation', + options => JSON '{"scale": 100}' + ).`sum` AS `sum`, + ST_REGIONSTATS( + `bfcol_0`, + 'ee://some/raster/uri', + band => 'band1', + include => 'some equation', + options => JSON '{"scale": 100}' + ).`count` AS `count`, + ST_REGIONSTATS( + `bfcol_0`, + 'ee://some/raster/uri', + band => 'band1', + include => 'some equation', + options => JSON '{"scale": 100}' + ).`mean` AS `mean`, + ST_REGIONSTATS( + `bfcol_0`, + 'ee://some/raster/uri', + band => 'band1', + include => 'some equation', + options => JSON '{"scale": 100}' + ).`area` AS `area` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats_without_optional_args/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats_without_optional_args/out.sql index f7947119611..cbeaf97f0b3 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats_without_optional_args/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats_without_optional_args/out.sql @@ -2,29 +2,13 @@ WITH `bfcte_0` AS ( SELECT * FROM UNNEST(ARRAY>[STRUCT('POINT(1 1)', 0)]) -), `bfcte_1` AS ( - SELECT - *, - ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri') AS `bfcol_2` - FROM `bfcte_0` -), `bfcte_2` AS ( - SELECT - *, - `bfcol_2`.`min` AS `bfcol_5`, - `bfcol_2`.`max` AS `bfcol_6`, - `bfcol_2`.`sum` AS `bfcol_7`, - `bfcol_2`.`count` AS `bfcol_8`, - `bfcol_2`.`mean` AS `bfcol_9`, - `bfcol_2`.`area` AS `bfcol_10` - FROM `bfcte_1` ) SELECT - `bfcol_5` AS `min`, - `bfcol_6` AS `max`, - `bfcol_7` AS `sum`, - `bfcol_8` AS `count`, - `bfcol_9` AS `mean`, - `bfcol_10` AS `area` -FROM `bfcte_2` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + *, + ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`min` AS `min`, + ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`max` AS `max`, + ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`sum` AS `sum`, + ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`count` AS `count`, + ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`mean` AS `mean`, + ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`area` AS `area` +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_simplify/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_simplify/out.sql index b8dd1587a86..a1b8ffaf782 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_simplify/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_simplify/out.sql @@ -2,14 +2,8 @@ WITH `bfcte_0` AS ( SELECT * FROM UNNEST(ARRAY>[STRUCT('POINT(1 1)', 0)]) -), `bfcte_1` AS ( - SELECT - *, - ST_SIMPLIFY(`bfcol_0`, 123.125) AS `bfcol_2` - FROM `bfcte_0` ) SELECT - `bfcol_2` AS `0` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + *, + ST_SIMPLIFY(`bfcol_0`, 123.125) AS `0` +FROM `bfcte_0` \ No newline at end of file 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 77aef6ad8bb..eb03d1ffc77 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 @@ -5,6 +5,7 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT + *, `rowindex` AS `bfcol_2`, `int64_col` AS `bfcol_3` FROM `bfcte_1` @@ -26,6 +27,7 @@ WITH `bfcte_1` AS ( 1 FROM ( SELECT + *, `int64_too` AS `bfcol_4` FROM `bfcte_2` ) AS `bft_0` @@ -36,6 +38,7 @@ WITH `bfcte_1` AS ( FROM `bfcte_3` ) SELECT + *, `bfcol_2` AS `rowindex`, `bfcol_5` AS `int64_col` 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 8089c5b462b..0d59abe7da9 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 @@ -5,6 +5,7 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT + *, `rowindex` AS `bfcol_2`, `rowindex_2` AS `bfcol_3` FROM `bfcte_1` @@ -23,12 +24,14 @@ WITH `bfcte_1` AS ( `bfcte_3`.*, `bfcte_3`.`bfcol_3` IN (( SELECT + *, `rowindex_2` AS `bfcol_4` FROM `bfcte_2` )) AS `bfcol_5` FROM `bfcte_3` ) SELECT + *, `bfcol_2` AS `rowindex`, `bfcol_5` AS `rowindex_2` 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 3a7ff60d3ee..3494677c81c 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 @@ -5,6 +5,7 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT + *, `rowindex` AS `bfcol_2`, `int64_col` AS `bfcol_3` FROM `bfcte_1` @@ -15,6 +16,7 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT + *, `int64_col` AS `bfcol_6`, `int64_too` AS `bfcol_7` FROM `bfcte_0` @@ -27,6 +29,7 @@ WITH `bfcte_1` AS ( AND COALESCE(`bfcol_2`, 1) = COALESCE(`bfcol_6`, 1) ) SELECT + *, `bfcol_3` AS `int64_col`, `bfcol_7` AS `int64_too` 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/bool_col/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/bool_col/out.sql index 30f363e900e..79d447cac87 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 @@ -5,6 +5,7 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT + *, `rowindex` AS `bfcol_2`, `bool_col` AS `bfcol_3` FROM `bfcte_1` @@ -15,6 +16,7 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT + *, `rowindex` AS `bfcol_6`, `bool_col` AS `bfcol_7` FROM `bfcte_0` @@ -27,6 +29,7 @@ WITH `bfcte_1` AS ( AND COALESCE(CAST(`bfcol_3` AS STRING), '1') = COALESCE(CAST(`bfcol_7` AS STRING), '1') ) SELECT + *, `bfcol_2` AS `rowindex_x`, `bfcol_3` AS `bool_col`, `bfcol_6` AS `rowindex_y` 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 9fa7673fb31..2bec1fddc69 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 @@ -5,6 +5,7 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT + *, `rowindex` AS `bfcol_2`, `float64_col` AS `bfcol_3` FROM `bfcte_1` @@ -15,6 +16,7 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT + *, `rowindex` AS `bfcol_6`, `float64_col` AS `bfcol_7` FROM `bfcte_0` @@ -27,6 +29,7 @@ WITH `bfcte_1` AS ( AND IF(IS_NAN(`bfcol_3`), 3, COALESCE(`bfcol_3`, 1)) = IF(IS_NAN(`bfcol_7`), 3, COALESCE(`bfcol_7`, 1)) ) SELECT + *, `bfcol_2` AS `rowindex_x`, `bfcol_3` AS `float64_col`, `bfcol_6` AS `rowindex_y` 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 c9fca069d6a..1063b09d344 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 @@ -5,6 +5,7 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT + *, `rowindex` AS `bfcol_2`, `int64_col` AS `bfcol_3` FROM `bfcte_1` @@ -15,6 +16,7 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT + *, `rowindex` AS `bfcol_6`, `int64_col` AS `bfcol_7` FROM `bfcte_0` @@ -27,6 +29,7 @@ WITH `bfcte_1` AS ( AND COALESCE(`bfcol_3`, 1) = COALESCE(`bfcol_7`, 1) ) SELECT + *, `bfcol_2` AS `rowindex_x`, `bfcol_3` AS `int64_col`, `bfcol_6` AS `rowindex_y` 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 88649c65188..191a785f452 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 @@ -5,6 +5,7 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT + *, `rowindex` AS `bfcol_2`, `numeric_col` AS `bfcol_3` FROM `bfcte_1` @@ -15,6 +16,7 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT + *, `rowindex` AS `bfcol_6`, `numeric_col` AS `bfcol_7` FROM `bfcte_0` @@ -27,6 +29,7 @@ WITH `bfcte_1` AS ( AND COALESCE(`bfcol_3`, CAST(1 AS NUMERIC)) = COALESCE(`bfcol_7`, CAST(1 AS NUMERIC)) ) SELECT + *, `bfcol_2` AS `rowindex_x`, `bfcol_3` AS `numeric_col`, `bfcol_6` AS `rowindex_y` 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 8758ec8340e..4bbcd729b1c 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 @@ -5,6 +5,7 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT + *, `rowindex` AS `bfcol_0`, `string_col` AS `bfcol_1` FROM `bfcte_1` @@ -15,6 +16,7 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT + *, `rowindex` AS `bfcol_4`, `string_col` AS `bfcol_5` FROM `bfcte_0` @@ -27,6 +29,7 @@ WITH `bfcte_1` AS ( AND COALESCE(CAST(`bfcol_1` AS STRING), '1') = COALESCE(CAST(`bfcol_5` AS STRING), '1') ) SELECT + *, `bfcol_0` AS `rowindex_x`, `bfcol_1` AS `string_col`, `bfcol_4` AS `rowindex_y` 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 42fc15cd1d4..17ccff058cf 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 @@ -5,6 +5,7 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT + *, `rowindex` AS `bfcol_0`, `time_col` AS `bfcol_1` FROM `bfcte_1` @@ -15,6 +16,7 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT + *, `rowindex` AS `bfcol_4`, `time_col` AS `bfcol_5` FROM `bfcte_0` @@ -27,6 +29,7 @@ WITH `bfcte_1` AS ( AND COALESCE(CAST(`bfcol_1` AS STRING), '1') = COALESCE(CAST(`bfcol_5` AS STRING), '1') ) SELECT + *, `bfcol_0` AS `rowindex_x`, `bfcol_1` AS `time_col`, `bfcol_4` AS `rowindex_y` diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_random_sample/test_compile_random_sample/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_random_sample/test_compile_random_sample/out.sql index aae34716d86..02dbd3adc5c 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_random_sample/test_compile_random_sample/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_random_sample/test_compile_random_sample/out.sql @@ -164,6 +164,7 @@ WITH `bfcte_0` AS ( `bfcol_16` < 0.1 ) SELECT + *, `bfcol_0` AS `bool_col`, `bfcol_1` AS `bytes_col`, `bfcol_2` AS `date_col`, @@ -179,6 +180,4 @@ SELECT `bfcol_12` AS `time_col`, `bfcol_13` AS `timestamp_col`, `bfcol_14` AS `duration_col` -FROM `bfcte_1` -ORDER BY - `bfcol_15` ASC NULLS LAST \ No newline at end of file +FROM `bfcte_1` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal/out.sql index 2b080b0b7ce..2663f8f6c26 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal/out.sql @@ -166,6 +166,7 @@ WITH `bfcte_0` AS ( )]) ) SELECT + *, `bfcol_0` AS `rowindex`, `bfcol_1` AS `bool_col`, `bfcol_2` AS `bytes_col`, @@ -182,6 +183,4 @@ SELECT `bfcol_13` AS `time_col`, `bfcol_14` AS `timestamp_col`, `bfcol_15` AS `duration_col` -FROM `bfcte_0` -ORDER BY - `bfcol_16` ASC NULLS LAST \ No newline at end of file +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_json_df/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_json_df/out.sql index 4e21266b87b..b201b79b770 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_json_df/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_json_df/out.sql @@ -4,8 +4,7 @@ WITH `bfcte_0` AS ( FROM UNNEST(ARRAY>[STRUCT(0, PARSE_JSON('null'), 0), STRUCT(1, PARSE_JSON('true'), 1), STRUCT(2, PARSE_JSON('100'), 2), STRUCT(3, PARSE_JSON('0.98'), 3), STRUCT(4, PARSE_JSON('"a string"'), 4), STRUCT(5, PARSE_JSON('[]'), 5), STRUCT(6, PARSE_JSON('[1,2,3]'), 6), STRUCT(7, PARSE_JSON('[{"a":1},{"a":2},{"a":null},{}]'), 7), STRUCT(8, PARSE_JSON('"100"'), 8), STRUCT(9, PARSE_JSON('{"date":"2024-07-16"}'), 9), STRUCT(10, PARSE_JSON('{"int_value":2,"null_filed":null}'), 10), STRUCT(11, PARSE_JSON('{"list_data":[10,20,30]}'), 11)]) ) SELECT + *, `bfcol_0` AS `rowindex`, `bfcol_1` AS `json_col` -FROM `bfcte_0` -ORDER BY - `bfcol_2` ASC NULLS LAST \ No newline at end of file +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_lists_df/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_lists_df/out.sql index 923476aafd4..5a9df6bea46 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_lists_df/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_lists_df/out.sql @@ -34,6 +34,7 @@ WITH `bfcte_0` AS ( )]) ) SELECT + *, `bfcol_0` AS `rowindex`, `bfcol_1` AS `int_list_col`, `bfcol_2` AS `bool_list_col`, @@ -42,6 +43,4 @@ SELECT `bfcol_5` AS `date_time_list_col`, `bfcol_6` AS `numeric_list_col`, `bfcol_7` AS `string_list_col` -FROM `bfcte_0` -ORDER BY - `bfcol_8` ASC NULLS LAST \ No newline at end of file +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_special_values/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_special_values/out.sql index ba5e0c8f1cf..2ddf958efca 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_special_values/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_special_values/out.sql @@ -13,6 +13,7 @@ WITH `bfcte_0` AS ( ), STRUCT(1.0, 1.0, 1.0, 1.0, STRUCT(1 AS `foo`), STRUCT(1 AS `foo`), [1, 2], 1), STRUCT(2.0, 2.0, 2.0, 2.0, STRUCT(2 AS `foo`), STRUCT(2 AS `foo`), [3, 4], 2)]) ) SELECT + *, `bfcol_0` AS `col_none`, `bfcol_1` AS `col_inf`, `bfcol_2` AS `col_neginf`, @@ -20,6 +21,4 @@ SELECT `bfcol_4` AS `col_struct_none`, `bfcol_5` AS `col_struct_w_none`, `bfcol_6` AS `col_list_none` -FROM `bfcte_0` -ORDER BY - `bfcol_7` ASC NULLS LAST \ No newline at end of file +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_structs_df/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_structs_df/out.sql index 7ded9cf5fff..6b360de47c3 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_structs_df/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_structs_df/out.sql @@ -20,8 +20,7 @@ WITH `bfcte_0` AS ( )]) ) SELECT + *, `bfcol_0` AS `id`, `bfcol_1` AS `person` -FROM `bfcte_0` -ORDER BY - `bfcol_2` ASC NULLS LAST \ No newline at end of file +FROM `bfcte_0` \ 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 959a31a2a35..778c752668f 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 @@ -18,20 +18,21 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - `rowindex`, - `bool_col`, - `bytes_col`, - `date_col`, - `datetime_col`, - `geography_col`, - `int64_col`, - `int64_too`, - `numeric_col`, - `float64_col`, + *, + `rowindex` AS `rowindex`, + `bool_col` AS `bool_col`, + `bytes_col` AS `bytes_col`, + `date_col` AS `date_col`, + `datetime_col` AS `datetime_col`, + `geography_col` AS `geography_col`, + `int64_col` AS `int64_col`, + `int64_too` AS `int64_too`, + `numeric_col` AS `numeric_col`, + `float64_col` AS `float64_col`, `rowindex` AS `rowindex_1`, - `rowindex_2`, - `string_col`, - `time_col`, - `timestamp_col`, - `duration_col` + `rowindex_2` AS `rowindex_2`, + `string_col` AS `string_col`, + `time_col` AS `time_col`, + `timestamp_col` AS `timestamp_col`, + `duration_col` AS `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_columns_filters/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_columns_filters/out.sql index 0d8a10c9566..74a8473d3b0 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_columns_filters/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_columns_filters/out.sql @@ -8,7 +8,8 @@ WITH `bfcte_0` AS ( `rowindex` > 0 AND `string_col` IN ('Hello, World!') ) SELECT - `rowindex`, - `int64_col`, - `string_col` + *, + `rowindex` AS `rowindex`, + `int64_col` AS `int64_col`, + `string_col` AS `string_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 4b5750d7aaf..d1d9425e976 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 @@ -5,6 +5,7 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`json_types` ) SELECT - `rowindex`, - `json_col` + *, + `rowindex` AS `rowindex`, + `json_col` AS `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 856c7061dac..4d2aa555be9 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 @@ -5,9 +5,8 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - `rowindex`, - `int64_col` + *, + `rowindex` AS `rowindex`, + `int64_col` AS `int64_col` FROM `bfcte_0` -ORDER BY - `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 79ae1ac9072..5684d7ae13f 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 @@ -5,7 +5,8 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`nested_structs_types` ) SELECT - `id`, + *, + `id` AS `id`, `id` AS `id_1`, - `people` + `people` AS `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 edb8d7fbf4b..0cdb7136456 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 @@ -5,8 +5,7 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - `rowindex`, - `int64_col` -FROM `bfcte_0` -ORDER BY - `int64_col` ASC NULLS LAST \ No newline at end of file + *, + `rowindex` AS `rowindex`, + `int64_col` AS `int64_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_repeated_types/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_repeated_types/out.sql index a22c845ef1c..5f1e6d50bf8 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 @@ -11,13 +11,14 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ) SELECT - `rowindex`, + *, + `rowindex` AS `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` + `int_list_col` AS `int_list_col`, + `bool_list_col` AS `bool_list_col`, + `float_list_col` AS `float_list_col`, + `date_list_col` AS `date_list_col`, + `date_time_list_col` AS `date_time_list_col`, + `numeric_list_col` AS `numeric_list_col`, + `string_list_col` AS `string_list_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_system_time/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_system_time/out.sql index 59c36870803..77408078bda 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_system_time/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_system_time/out.sql @@ -18,19 +18,20 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` FOR SYSTEM_TIME AS OF '2025-11-09T03:04:05.678901+00:00' ) SELECT - `bool_col`, - `bytes_col`, - `date_col`, - `datetime_col`, - `geography_col`, - `int64_col`, - `int64_too`, - `numeric_col`, - `float64_col`, - `rowindex`, - `rowindex_2`, - `string_col`, - `time_col`, - `timestamp_col`, - `duration_col` + *, + `bool_col` AS `bool_col`, + `bytes_col` AS `bytes_col`, + `date_col` AS `date_col`, + `datetime_col` AS `datetime_col`, + `geography_col` AS `geography_col`, + `int64_col` AS `int64_col`, + `int64_too` AS `int64_too`, + `numeric_col` AS `numeric_col`, + `float64_col` AS `float64_col`, + `rowindex` AS `rowindex`, + `rowindex_2` AS `rowindex_2`, + `string_col` AS `string_col`, + `time_col` AS `time_col`, + `timestamp_col` AS `timestamp_col`, + `duration_col` AS `duration_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 0dca6d9d49e..464eecdb159 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 @@ -4,73 +4,49 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `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 - * - FROM `bfcte_1` - WHERE - NOT `bfcol_9` IS NULL -), `bfcte_3` AS ( - SELECT - *, - CASE - WHEN COALESCE( - 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 - ), - 0 - ) < 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 - ), - 0 - ) - END AS `bfcol_15` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - *, - CASE - WHEN COALESCE( - 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 - ), - 0 - ) < 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 - ), - 0 - ) - END AS `bfcol_16` - FROM `bfcte_3` ) SELECT - `bfcol_9` AS `bool_col`, - `bfcol_6` AS `rowindex`, - `bfcol_15` AS `bool_col_1`, - `bfcol_16` AS `int64_col` -FROM `bfcte_4` -ORDER BY - `bfcol_9` ASC NULLS LAST, - `rowindex` ASC NULLS LAST \ No newline at end of file + *, + `bool_col` AS `bool_col`, + `rowindex` AS `rowindex`, + CASE + WHEN COALESCE( + SUM(CAST(NOT `bool_col` IS NULL AS INT64)) OVER ( + PARTITION BY `bool_col` + ORDER BY `bool_col` ASC NULLS LAST, `rowindex` ASC NULLS LAST + ROWS BETWEEN 3 PRECEDING AND CURRENT ROW + ), + 0 + ) < 3 + THEN NULL + WHEN TRUE + THEN COALESCE( + SUM(CAST(`bool_col` AS INT64)) OVER ( + PARTITION BY `bool_col` + ORDER BY `bool_col` ASC NULLS LAST, `rowindex` ASC NULLS LAST + ROWS BETWEEN 3 PRECEDING AND CURRENT ROW + ), + 0 + ) + END AS `bool_col_1`, + CASE + WHEN COALESCE( + SUM(CAST(NOT `int64_col` IS NULL AS INT64)) OVER ( + PARTITION BY `bool_col` + ORDER BY `bool_col` ASC NULLS LAST, `rowindex` ASC NULLS LAST + ROWS BETWEEN 3 PRECEDING AND CURRENT ROW + ), + 0 + ) < 3 + THEN NULL + WHEN TRUE + THEN COALESCE( + SUM(`int64_col`) OVER ( + PARTITION BY `bool_col` + ORDER BY `bool_col` ASC NULLS LAST, `rowindex` ASC NULLS LAST + ROWS BETWEEN 3 PRECEDING AND CURRENT ROW + ), + 0 + ) + END AS `int64_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_range_rolling/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_range_rolling/out.sql index fe4cea08cb2..689aa4bb7d2 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 @@ -2,32 +2,26 @@ WITH `bfcte_0` AS ( SELECT * FROM UNNEST(ARRAY>[STRUCT(CAST('2025-01-01T00:00:00+00:00' AS TIMESTAMP), 0, 0), STRUCT(CAST('2025-01-01T00:00:01+00:00' AS TIMESTAMP), 1, 1), STRUCT(CAST('2025-01-01T00:00:02+00:00' AS TIMESTAMP), 2, 2), STRUCT(CAST('2025-01-01T00:00:03+00:00' AS TIMESTAMP), 3, 3), STRUCT(CAST('2025-01-01T00:00:04+00:00' AS TIMESTAMP), 0, 4), STRUCT(CAST('2025-01-01T00:00:05+00:00' AS TIMESTAMP), 1, 5), STRUCT(CAST('2025-01-01T00:00:06+00:00' AS TIMESTAMP), 2, 6), STRUCT(CAST('2025-01-01T00:00:07+00:00' AS TIMESTAMP), 3, 7), STRUCT(CAST('2025-01-01T00:00:08+00:00' AS TIMESTAMP), 0, 8), STRUCT(CAST('2025-01-01T00:00:09+00:00' AS TIMESTAMP), 1, 9), STRUCT(CAST('2025-01-01T00:00:10+00:00' AS TIMESTAMP), 2, 10), STRUCT(CAST('2025-01-01T00:00:11+00:00' AS TIMESTAMP), 3, 11), STRUCT(CAST('2025-01-01T00:00:12+00:00' AS TIMESTAMP), 0, 12), STRUCT(CAST('2025-01-01T00:00:13+00:00' AS TIMESTAMP), 1, 13), STRUCT(CAST('2025-01-01T00:00:14+00:00' AS TIMESTAMP), 2, 14), STRUCT(CAST('2025-01-01T00:00:15+00:00' AS TIMESTAMP), 3, 15), STRUCT(CAST('2025-01-01T00:00:16+00:00' AS TIMESTAMP), 0, 16), STRUCT(CAST('2025-01-01T00:00:17+00:00' AS TIMESTAMP), 1, 17), STRUCT(CAST('2025-01-01T00:00:18+00:00' AS TIMESTAMP), 2, 18), STRUCT(CAST('2025-01-01T00:00:19+00:00' AS TIMESTAMP), 3, 19)]) -), `bfcte_1` AS ( - SELECT - *, - CASE - WHEN COALESCE( - SUM(CAST(NOT `bfcol_1` IS NULL AS INT64)) OVER ( - ORDER BY UNIX_MICROS(`bfcol_0`) ASC - RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW - ), - 0 - ) < 1 - THEN NULL - ELSE COALESCE( - SUM(`bfcol_1`) OVER ( - ORDER BY UNIX_MICROS(`bfcol_0`) ASC - RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW - ), - 0 - ) - END AS `bfcol_6` - FROM `bfcte_0` ) SELECT + *, `bfcol_0` AS `ts_col`, - `bfcol_6` AS `int_col` -FROM `bfcte_1` -ORDER BY - `bfcol_0` ASC NULLS LAST, - `bfcol_2` ASC NULLS LAST \ No newline at end of file + CASE + WHEN COALESCE( + SUM(CAST(NOT `bfcol_1` IS NULL AS INT64)) OVER ( + ORDER BY UNIX_MICROS(`bfcol_0`) ASC + RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW + ), + 0 + ) < 1 + THEN NULL + WHEN TRUE + THEN COALESCE( + SUM(`bfcol_1`) OVER ( + ORDER BY UNIX_MICROS(`bfcol_0`) ASC + RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW + ), + 0 + ) + END AS `int_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_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 bf1e76c55c7..aa216a681d8 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 @@ -3,25 +3,20 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - WHEN COALESCE( - SUM(CAST(NOT `int64_col` IS NULL AS INT64)) OVER (ORDER BY `rowindex` ASC NULLS LAST ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), - 0 - ) < 3 - THEN NULL - ELSE COALESCE( - 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 - `rowindex`, - `bfcol_4` AS `int64_col` -FROM `bfcte_1` -ORDER BY - `rowindex` ASC NULLS LAST \ No newline at end of file + *, + `rowindex` AS `rowindex`, + CASE + WHEN COALESCE( + SUM(CAST(NOT `int64_col` IS NULL AS INT64)) OVER (ORDER BY `rowindex` ASC NULLS LAST ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + 0 + ) < 3 + THEN NULL + WHEN TRUE + THEN COALESCE( + SUM(`int64_col`) OVER (ORDER BY `rowindex` ASC NULLS LAST ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + 0 + ) + END AS `int64_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_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 5ad435ddbb7..09694d7d89d 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 @@ -3,19 +3,14 @@ WITH `bfcte_0` AS ( `int64_col`, `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - 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(`int64_col`) OVER (ORDER BY `rowindex` ASC NULLS LAST ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) - END AS `bfcol_4` - FROM `bfcte_0` ) SELECT - `rowindex`, - `bfcol_4` AS `int64_col` -FROM `bfcte_1` -ORDER BY - `rowindex` ASC NULLS LAST \ No newline at end of file + *, + `rowindex` AS `rowindex`, + CASE + WHEN COUNT(NOT `int64_col` IS NULL) OVER (ORDER BY `rowindex` ASC NULLS LAST ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) < 5 + THEN NULL + WHEN TRUE + THEN COUNT(`int64_col`) OVER (ORDER BY `rowindex` ASC NULLS LAST ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) + END AS `int64_col` +FROM `bfcte_0` \ No newline at end of file From d76ffb1d7cc768929e664b70f45afa07d2fed2a5 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Fri, 6 Feb 2026 00:02:12 +0000 Subject: [PATCH 2/6] properly drop old cols in sql node compile --- bigframes/core/compile/sqlglot/compiler.py | 2 +- .../test_binary_compiler/test_corr/out.sql | 1 - .../test_binary_compiler/test_cov/out.sql | 1 - .../test_row_number/out.sql | 1 - .../test_row_number_with_window/out.sql | 1 - .../test_nullary_compiler/test_size/out.sql | 1 - .../test_array_agg/out.sql | 1 - .../test_string_agg/out.sql | 1 - .../test_unary_compiler/test_all/out.sql | 1 - .../test_all_w_window/out.sql | 1 - .../test_unary_compiler/test_any/out.sql | 1 - .../test_any_value/out.sql | 1 - .../test_any_value/window_out.sql | 1 - .../test_any_value/window_partition_out.sql | 1 - .../test_any_w_window/out.sql | 1 - .../test_approx_quartiles/out.sql | 1 - .../test_approx_top_count/out.sql | 1 - .../test_unary_compiler/test_count/out.sql | 1 - .../test_count/window_out.sql | 1 - .../test_count/window_partition_out.sql | 1 - .../test_unary_compiler/test_cut/int_bins.sql | 1 - .../test_cut/int_bins_labels.sql | 1 - .../test_cut/interval_bins.sql | 1 - .../test_cut/interval_bins_labels.sql | 1 - .../test_dense_rank/out.sql | 1 - .../test_diff_w_bool/out.sql | 1 - .../test_diff_w_date/out.sql | 1 - .../test_diff_w_datetime/out.sql | 1 - .../test_diff_w_int/out.sql | 1 - .../test_diff_w_timestamp/out.sql | 1 - .../test_unary_compiler/test_first/out.sql | 1 - .../test_first_non_null/out.sql | 1 - .../test_unary_compiler/test_last/out.sql | 1 - .../test_last_non_null/out.sql | 1 - .../test_unary_compiler/test_max/out.sql | 1 - .../test_max/window_out.sql | 1 - .../test_max/window_partition_out.sql | 1 - .../test_unary_compiler/test_mean/out.sql | 8 ++--- .../test_mean/window_out.sql | 1 - .../test_mean/window_partition_out.sql | 1 - .../test_unary_compiler/test_median/out.sql | 1 - .../test_unary_compiler/test_min/out.sql | 1 - .../test_min/window_out.sql | 1 - .../test_min/window_partition_out.sql | 1 - .../test_unary_compiler/test_nunique/out.sql | 1 - .../test_unary_compiler/test_pop_var/out.sql | 1 - .../test_pop_var/window_out.sql | 1 - .../test_unary_compiler/test_product/out.sql | 1 - .../test_product/window_partition_out.sql | 1 - .../test_unary_compiler/test_quantile/out.sql | 1 - .../test_unary_compiler/test_rank/out.sql | 1 - .../test_unary_compiler/test_shift/lag.sql | 1 - .../test_unary_compiler/test_shift/lead.sql | 1 - .../test_unary_compiler/test_shift/noop.sql | 1 - .../test_unary_compiler/test_std/out.sql | 8 ++--- .../test_std/window_out.sql | 1 - .../test_unary_compiler/test_sum/out.sql | 1 - .../test_sum/window_out.sql | 1 - .../test_sum/window_partition_out.sql | 1 - .../test_unary_compiler/test_var/out.sql | 1 - .../test_var/window_out.sql | 1 - .../test_ai_ops/test_ai_classify/out.sql | 1 - .../test_ai_ops/test_ai_generate/out.sql | 1 - .../test_ai_ops/test_ai_generate_bool/out.sql | 1 - .../out.sql | 1 - .../out.sql | 1 - .../test_ai_generate_double/out.sql | 1 - .../out.sql | 1 - .../out.sql | 1 - .../test_ai_ops/test_ai_generate_int/out.sql | 1 - .../out.sql | 1 - .../out.sql | 1 - .../out.sql | 1 - .../test_ai_generate_with_model_param/out.sql | 1 - .../out.sql | 1 - .../snapshots/test_ai_ops/test_ai_if/out.sql | 1 - .../test_ai_ops/test_ai_score/out.sql | 1 - .../test_array_ops/test_array_index/out.sql | 1 - .../test_array_reduce_op/out.sql | 1 - .../test_array_slice_with_only_start/out.sql | 1 - .../out.sql | 1 - .../test_array_to_string/out.sql | 1 - .../test_array_ops/test_to_array_op/out.sql | 1 - .../test_obj_fetch_metadata/out.sql | 5 ++- .../test_obj_get_access_url/out.sql | 3 +- .../test_blob_ops/test_obj_make_ref/out.sql | 3 +- .../test_bool_ops/test_and_op/out.sql | 7 ++--- .../test_bool_ops/test_or_op/out.sql | 7 ++--- .../test_bool_ops/test_xor_op/out.sql | 7 ++--- .../test_eq_null_match/out.sql | 1 - .../test_eq_numeric/out.sql | 7 ++--- .../test_ge_numeric/out.sql | 7 ++--- .../test_gt_numeric/out.sql | 7 ++--- .../test_comparison_ops/test_is_in/out.sql | 1 - .../test_le_numeric/out.sql | 7 ++--- .../test_lt_numeric/out.sql | 7 ++--- .../test_maximum_op/out.sql | 1 - .../test_minimum_op/out.sql | 1 - .../test_ne_numeric/out.sql | 7 ++--- .../test_add_timedelta/out.sql | 7 ++--- .../test_datetime_ops/test_date/out.sql | 1 - .../test_datetime_to_integer_label/out.sql | 1 - .../test_datetime_ops/test_day/out.sql | 1 - .../test_datetime_ops/test_dayofweek/out.sql | 1 - .../test_datetime_ops/test_dayofyear/out.sql | 1 - .../test_datetime_ops/test_floor_dt/out.sql | 1 - .../test_datetime_ops/test_hour/out.sql | 1 - .../out.sql | 1 - .../out.sql | 1 - .../out.sql | 1 - .../out.sql | 1 - .../out.sql | 1 - .../test_datetime_ops/test_iso_day/out.sql | 1 - .../test_datetime_ops/test_iso_week/out.sql | 1 - .../test_datetime_ops/test_iso_year/out.sql | 1 - .../test_datetime_ops/test_minute/out.sql | 1 - .../test_datetime_ops/test_month/out.sql | 1 - .../test_datetime_ops/test_normalize/out.sql | 1 - .../test_datetime_ops/test_quarter/out.sql | 1 - .../test_datetime_ops/test_second/out.sql | 1 - .../test_datetime_ops/test_strftime/out.sql | 1 - .../test_sub_timedelta/out.sql | 9 +++--- .../test_datetime_ops/test_time/out.sql | 1 - .../test_to_datetime/out.sql | 3 +- .../test_to_timestamp/out.sql | 1 - .../test_unix_micros/out.sql | 1 - .../test_unix_millis/out.sql | 1 - .../test_unix_seconds/out.sql | 1 - .../test_datetime_ops/test_year/out.sql | 1 - .../test_generic_ops/test_astype_bool/out.sql | 3 +- .../test_astype_float/out.sql | 3 +- .../test_astype_from_json/out.sql | 1 - .../test_generic_ops/test_astype_int/out.sql | 1 - .../test_generic_ops/test_astype_json/out.sql | 1 - .../test_astype_string/out.sql | 3 +- .../test_astype_time_like/out.sql | 1 - .../test_binary_remote_function_op/out.sql | 1 - .../test_case_when_op/out.sql | 1 - .../test_generic_ops/test_clip/out.sql | 1 - .../test_generic_ops/test_coalesce/out.sql | 3 +- .../test_generic_ops/test_fillna/out.sql | 1 - .../test_generic_ops/test_hash/out.sql | 1 - .../test_generic_ops/test_invert/out.sql | 1 - .../test_generic_ops/test_isnull/out.sql | 1 - .../test_generic_ops/test_map/out.sql | 1 - .../test_nary_remote_function_op/out.sql | 1 - .../test_generic_ops/test_notnull/out.sql | 1 - .../test_remote_function_op/out.sql | 1 - .../test_generic_ops/test_row_key/out.sql | 1 - .../test_sql_scalar_op/out.sql | 1 - .../test_generic_ops/test_where/out.sql | 1 - .../test_geo_ops/test_geo_area/out.sql | 1 - .../test_geo_ops/test_geo_st_astext/out.sql | 1 - .../test_geo_ops/test_geo_st_boundary/out.sql | 1 - .../test_geo_ops/test_geo_st_buffer/out.sql | 1 - .../test_geo_ops/test_geo_st_centroid/out.sql | 1 - .../test_geo_st_convexhull/out.sql | 1 - .../test_geo_st_difference/out.sql | 1 - .../test_geo_ops/test_geo_st_distance/out.sql | 1 - .../test_geo_st_geogfromtext/out.sql | 1 - .../test_geo_st_geogpoint/out.sql | 1 - .../test_geo_st_intersection/out.sql | 1 - .../test_geo_ops/test_geo_st_isclosed/out.sql | 1 - .../test_geo_ops/test_geo_st_length/out.sql | 1 - .../snapshots/test_geo_ops/test_geo_x/out.sql | 1 - .../snapshots/test_geo_ops/test_geo_y/out.sql | 1 - .../test_json_ops/test_json_extract/out.sql | 1 - .../test_json_extract_array/out.sql | 1 - .../test_json_extract_string_array/out.sql | 1 - .../test_json_ops/test_json_keys/out.sql | 1 - .../test_json_ops/test_json_query/out.sql | 1 - .../test_json_query_array/out.sql | 1 - .../test_json_ops/test_json_set/out.sql | 1 - .../test_json_ops/test_json_value/out.sql | 1 - .../test_json_ops/test_parse_json/out.sql | 1 - .../test_json_ops/test_to_json/out.sql | 1 - .../test_json_ops/test_to_json_string/out.sql | 1 - .../test_numeric_ops/test_abs/out.sql | 1 - .../test_numeric_ops/test_add_numeric/out.sql | 7 ++--- .../test_numeric_ops/test_add_string/out.sql | 1 - .../test_add_timedelta/out.sql | 7 ++--- .../test_numeric_ops/test_arccos/out.sql | 1 - .../test_numeric_ops/test_arccosh/out.sql | 1 - .../test_numeric_ops/test_arcsin/out.sql | 1 - .../test_numeric_ops/test_arcsinh/out.sql | 1 - .../test_numeric_ops/test_arctan/out.sql | 1 - .../test_numeric_ops/test_arctan2/out.sql | 1 - .../test_numeric_ops/test_arctanh/out.sql | 1 - .../test_numeric_ops/test_ceil/out.sql | 1 - .../test_numeric_ops/test_cos/out.sql | 1 - .../test_numeric_ops/test_cosh/out.sql | 1 - .../test_cosine_distance/out.sql | 1 - .../test_numeric_ops/test_div_numeric/out.sql | 9 +++--- .../test_div_timedelta/out.sql | 7 ++--- .../test_euclidean_distance/out.sql | 1 - .../test_numeric_ops/test_exp/out.sql | 1 - .../test_numeric_ops/test_expm1/out.sql | 1 - .../test_numeric_ops/test_floor/out.sql | 1 - .../test_floordiv_timedelta/out.sql | 7 ++--- .../test_numeric_ops/test_ln/out.sql | 1 - .../test_numeric_ops/test_log10/out.sql | 1 - .../test_numeric_ops/test_log1p/out.sql | 1 - .../test_manhattan_distance/out.sql | 1 - .../test_numeric_ops/test_mod_numeric/out.sql | 7 ++--- .../test_numeric_ops/test_mul_numeric/out.sql | 7 ++--- .../test_mul_timedelta/out.sql | 9 +++--- .../test_numeric_ops/test_neg/out.sql | 1 - .../test_numeric_ops/test_pos/out.sql | 3 +- .../test_numeric_ops/test_pow/out.sql | 7 ++--- .../test_numeric_ops/test_round/out.sql | 7 ++--- .../test_numeric_ops/test_sin/out.sql | 1 - .../test_numeric_ops/test_sinh/out.sql | 1 - .../test_numeric_ops/test_sqrt/out.sql | 1 - .../test_numeric_ops/test_sub_numeric/out.sql | 7 ++--- .../test_sub_timedelta/out.sql | 9 +++--- .../test_numeric_ops/test_tan/out.sql | 1 - .../test_numeric_ops/test_tanh/out.sql | 1 - .../test_unsafe_pow_op/out.sql | 1 - .../test_string_ops/test_add_string/out.sql | 1 - .../test_string_ops/test_capitalize/out.sql | 1 - .../test_string_ops/test_endswith/out.sql | 1 - .../test_string_ops/test_isalnum/out.sql | 1 - .../test_string_ops/test_isalpha/out.sql | 1 - .../test_string_ops/test_isdecimal/out.sql | 1 - .../test_string_ops/test_isdigit/out.sql | 1 - .../test_string_ops/test_islower/out.sql | 1 - .../test_string_ops/test_isnumeric/out.sql | 1 - .../test_string_ops/test_isspace/out.sql | 1 - .../test_string_ops/test_isupper/out.sql | 1 - .../test_string_ops/test_len/out.sql | 1 - .../test_string_ops/test_len_w_array/out.sql | 1 - .../test_string_ops/test_lower/out.sql | 1 - .../test_string_ops/test_lstrip/out.sql | 1 - .../test_regex_replace_str/out.sql | 1 - .../test_string_ops/test_replace_str/out.sql | 1 - .../test_string_ops/test_reverse/out.sql | 1 - .../test_string_ops/test_rstrip/out.sql | 1 - .../test_string_ops/test_startswith/out.sql | 1 - .../test_string_ops/test_str_contains/out.sql | 1 - .../test_str_contains_regex/out.sql | 1 - .../test_string_ops/test_str_extract/out.sql | 1 - .../test_string_ops/test_str_find/out.sql | 1 - .../test_string_ops/test_str_get/out.sql | 1 - .../test_string_ops/test_str_pad/out.sql | 1 - .../test_string_ops/test_str_repeat/out.sql | 1 - .../test_string_ops/test_str_slice/out.sql | 1 - .../test_string_ops/test_strconcat/out.sql | 1 - .../test_string_ops/test_string_split/out.sql | 1 - .../test_string_ops/test_strip/out.sql | 1 - .../test_string_ops/test_upper/out.sql | 1 - .../test_string_ops/test_zfill/out.sql | 1 - .../test_struct_ops/test_struct_field/out.sql | 1 - .../test_struct_ops/test_struct_op/out.sql | 1 - .../test_timedelta_floor/out.sql | 1 - .../test_to_timedelta/out.sql | 7 ++--- .../test_compile_aggregate/out.sql | 6 ++-- .../test_compile_aggregate_wo_dropna/out.sql | 6 ++-- .../test_compile_concat/out.sql | 3 -- .../test_compile_concat_filter_sorted/out.sql | 5 --- .../test_compile_explode_dataframe/out.sql | 7 ++--- .../test_compile_explode_series/out.sql | 5 ++- .../test_compile_filter/out.sql | 5 ++- .../test_st_regionstats/out.sql | 13 ++++---- .../out.sql | 13 ++++---- .../test_compile_geo/test_st_simplify/out.sql | 1 - .../test_compile_isin/out.sql | 3 -- .../test_compile_isin_not_nullable/out.sql | 3 -- .../test_compile_join/out.sql | 3 -- .../test_compile_join_w_on/bool_col/out.sql | 3 -- .../float64_col/out.sql | 3 -- .../test_compile_join_w_on/int64_col/out.sql | 3 -- .../numeric_col/out.sql | 3 -- .../test_compile_join_w_on/string_col/out.sql | 3 -- .../test_compile_join_w_on/time_col/out.sql | 3 -- .../test_compile_random_sample/out.sql | 1 - .../test_compile_readlocal/out.sql | 1 - .../test_compile_readlocal_w_json_df/out.sql | 1 - .../test_compile_readlocal_w_lists_df/out.sql | 1 - .../out.sql | 1 - .../out.sql | 1 - .../test_compile_readtable/out.sql | 31 +++++++++---------- .../out.sql | 7 ++--- .../out.sql | 5 ++- .../test_compile_readtable_w_limit/out.sql | 5 ++- .../out.sql | 5 ++- .../test_compile_readtable_w_ordering/out.sql | 5 ++- .../out.sql | 17 +++++----- .../out.sql | 31 +++++++++---------- .../out.sql | 5 ++- .../out.sql | 1 - .../out.sql | 3 +- .../out.sql | 3 +- 292 files changed, 169 insertions(+), 488 deletions(-) diff --git a/bigframes/core/compile/sqlglot/compiler.py b/bigframes/core/compile/sqlglot/compiler.py index 2402bf0f64d..ae0b6075554 100644 --- a/bigframes/core/compile/sqlglot/compiler.py +++ b/bigframes/core/compile/sqlglot/compiler.py @@ -163,7 +163,7 @@ def compile_sql_select(node: sql_nodes.SelectNode, child: ir.SQLGlotIR): ) for cdef in node.selections ) - sqlglot_ir = sqlglot_ir.project(projected_cols) + sqlglot_ir = sqlglot_ir.select(projected_cols) if node.limit is not None: sqlglot_ir = sqlglot_ir.limit(node.limit) 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 714991256ef..5c838f48827 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 @@ -9,6 +9,5 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - *, `bfcol_2` AS `corr_col` FROM `bfcte_1` \ No newline at end of file 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 c25b460ac2f..eda082250a6 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 @@ -9,6 +9,5 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - *, `bfcol_2` AS `cov_col` FROM `bfcte_1` \ No newline at end of file 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 804c54d3cc2..2fdb2868888 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 @@ -18,6 +18,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ROW_NUMBER() OVER () - 1 AS `row_number` FROM `bfcte_0` \ No newline at end of file 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 c2de57a1162..fda72dbedbc 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ROW_NUMBER() OVER (ORDER BY `int64_col` ASC NULLS LAST) - 1 AS `row_number` FROM `bfcte_0` \ No newline at end of file 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 b61e19c6197..ed8e0c7619d 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 @@ -22,6 +22,5 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - *, `bfcol_32` AS `size` FROM `bfcte_1` \ No newline at end of file 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 a27e5feb871..eafbc39daf8 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 @@ -8,6 +8,5 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - *, `bfcol_1` AS `int64_col` FROM `bfcte_1` \ No newline at end of file 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 d1873661f97..321341d4a0a 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 @@ -14,6 +14,5 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - *, `bfcol_1` AS `string_col` FROM `bfcte_1` \ No newline at end of file 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 7d4b4ddbf8b..0be2fea80b2 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 @@ -10,7 +10,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - *, `bfcol_2` AS `bool_col`, `bfcol_3` AS `int64_col` FROM `bfcte_1` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all_w_window/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all_w_window/out.sql index 59b43e6f24d..7ca4225ee06 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all_w_window/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all_w_window/out.sql @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, COALESCE( LOGICAL_AND(`bool_col`) OVER ( ORDER BY `bool_col` ASC NULLS LAST diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any/out.sql index be0c8488dcc..ae62e22e36d 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any/out.sql @@ -10,7 +10,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - *, `bfcol_2` AS `bool_col`, `bfcol_3` AS `int64_col` FROM `bfcte_1` \ No newline at end of file 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 b0565c6cedd..4a13901f1c4 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 @@ -8,6 +8,5 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - *, `bfcol_1` AS `int64_col` FROM `bfcte_1` \ No newline at end of file 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 19da3291a98..f5282193024 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ANY_VALUE(`int64_col`) OVER ( ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING 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 d53a6eedb1d..dd08329421b 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 @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ANY_VALUE(`int64_col`) OVER ( PARTITION BY `string_col` ORDER BY `int64_col` ASC NULLS LAST diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_w_window/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_w_window/out.sql index df3d30e0376..b74555d3d5d 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_w_window/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_w_window/out.sql @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, COALESCE( LOGICAL_OR(`bool_col`) OVER ( ORDER BY `bool_col` ASC NULLS LAST 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 cba8708bec4..9eabb2d88a7 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 @@ -10,7 +10,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - *, `bfcol_1` AS `q1`, `bfcol_2` AS `q2`, `bfcol_3` AS `q3` 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 6d0ab7a0e57..b5e6275381b 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 @@ -8,6 +8,5 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - *, `bfcol_1` AS `int64_col` FROM `bfcte_1` \ No newline at end of file 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 6b7382fb56c..9d18367cf61 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 @@ -8,6 +8,5 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - *, `bfcol_1` AS `int64_col` FROM `bfcte_1` \ No newline at end of file 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 847070788dd..7789c3f8913 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, COUNT(`int64_col`) OVER ( ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING 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 d5aea84b045..44b7dcc89fd 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 @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, COUNT(`int64_col`) OVER ( PARTITION BY `string_col` ORDER BY `int64_col` DESC diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins.sql index 3baaaa352d4..14301f3c246 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins.sql @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CASE WHEN `int64_col` <= MIN(`int64_col`) OVER () + ( 1 * IEEE_DIVIDE(MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER (), 3) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins_labels.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins_labels.sql index b3e10428af6..e8cf4837817 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins_labels.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins_labels.sql @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CASE WHEN `int64_col` < MIN(`int64_col`) OVER () + ( 1 * IEEE_DIVIDE(MAX(`int64_col`) OVER () - MIN(`int64_col`) OVER (), 3) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins.sql index 418c34c5120..c5fb340057b 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins.sql @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CASE WHEN `int64_col` > 0 AND `int64_col` <= 1 THEN STRUCT(0 AS `left_exclusive`, 1 AS `right_inclusive`) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins_labels.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins_labels.sql index 3ea9dc1085c..e850c4410f3 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins_labels.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins_labels.sql @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CASE WHEN `int64_col` > 0 AND `int64_col` <= 1 THEN 0 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 3c29762ff4f..6bed4e72c5f 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, DENSE_RANK() OVER (ORDER BY `int64_col` DESC) AS `agg_int64` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_bool/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_bool/out.sql index e935a4e71a3..d888b3d29e7 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_bool/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_bool/out.sql @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, `bool_col` <> LAG(`bool_col`, 1) OVER (ORDER BY `bool_col` DESC) AS `diff_bool` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_date/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_date/out.sql index 56c37f4c467..1390b4d0f4a 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_date/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_date/out.sql @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CAST(FLOOR( DATE_DIFF(`date_col`, LAG(`date_col`, 1) OVER (ORDER BY `date_col` ASC NULLS LAST), DAY) * 86400000000 ) AS INT64) AS `diff_date` diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_datetime/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_datetime/out.sql index 10641ba496c..326047998d6 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_datetime/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_datetime/out.sql @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, DATETIME_DIFF( `datetime_col`, LAG(`datetime_col`, 1) OVER (ORDER BY `datetime_col` ASC NULLS LAST), diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_int/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_int/out.sql index b6cd3577796..148347b5672 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_int/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_int/out.sql @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, `int64_col` - LAG(`int64_col`, 1) OVER (ORDER BY `int64_col` ASC NULLS LAST) AS `diff_int` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_timestamp/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_timestamp/out.sql index 88a1f898370..5e00da4f4c1 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_timestamp/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_timestamp/out.sql @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, TIMESTAMP_DIFF( `timestamp_col`, LAG(`timestamp_col`, 1) OVER (ORDER BY `timestamp_col` DESC), 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 a6f3b20d2cb..e902b1cfe22 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, FIRST_VALUE(`int64_col`) OVER ( ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING 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 37d9b004949..1e16a4d3e1a 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, FIRST_VALUE(`int64_col` IGNORE NULLS) OVER ( ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING 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 0d962bdc50b..1d2595e356c 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, LAST_VALUE(`int64_col`) OVER ( ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING 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 403e07bd642..d70b9d3a9ce 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, LAST_VALUE(`int64_col` IGNORE NULLS) OVER ( ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING 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 ccbf88c6680..1537d735ead 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 @@ -8,6 +8,5 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - *, `bfcol_1` AS `int64_col` FROM `bfcte_1` \ No newline at end of file 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 32fdcb2626c..1023211a8e8 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, MAX(`int64_col`) OVER ( ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING 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 326b4e47b4e..d337e9dc330 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 @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, MAX(`int64_col`) OVER ( PARTITION BY `string_col` ORDER BY `int64_col` DESC 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 f8fbb107f33..b78190305ac 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 @@ -6,10 +6,9 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - *, - `bool_col` AS `bool_col`, - `duration_col` AS `duration_col`, - `int64_col` AS `int64_col`, + `bool_col`, + `duration_col`, + `int64_col`, `int64_col` AS `bfcol_6`, `bool_col` AS `bfcol_7`, `duration_col` AS `bfcol_8` @@ -23,7 +22,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_1` ) SELECT - *, `bfcol_12` AS `int64_col`, `bfcol_13` AS `bool_col`, `bfcol_14` AS `duration_col`, 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 5811a9e64d1..899310f1be7 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, AVG(`int64_col`) OVER ( ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING 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 e542dce51da..acb55c2688a 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 @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, AVG(`int64_col`) OVER ( PARTITION BY `string_col` ORDER BY `int64_col` ASC NULLS LAST 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 a1524278a31..bfe94622b31 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 @@ -12,7 +12,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - *, `bfcol_3` AS `int64_col`, `bfcol_4` AS `date_col`, `bfcol_5` AS `string_col` 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 b394ee75e15..0848313456e 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 @@ -8,6 +8,5 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - *, `bfcol_1` AS `int64_col` FROM `bfcte_1` \ No newline at end of file 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 b50c5623f9b..5eb763123fe 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, MIN(`int64_col`) OVER ( ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING 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 b26b67cbe9d..0724dfea48b 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 @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, MIN(`int64_col`) OVER ( PARTITION BY `string_col` ORDER BY `int64_col` DESC diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_nunique/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_nunique/out.sql index 9603f882fe7..f0b54934b45 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_nunique/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_nunique/out.sql @@ -8,6 +8,5 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - *, `bfcol_1` AS `int64_col` FROM `bfcte_1` \ No newline at end of file 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 226d722d23c..2d38311f45a 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 @@ -10,7 +10,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - *, `bfcol_4` AS `int64_col`, `bfcol_5` AS `bool_col` FROM `bfcte_1` \ No newline at end of file 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 411b48a0231..5df86fb3894 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, VAR_POP(`int64_col`) OVER ( ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_product/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_product/out.sql index 4dc6d683572..94ca21988e9 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_product/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_product/out.sql @@ -12,6 +12,5 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - *, `bfcol_1` AS `int64_col` FROM `bfcte_1` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_product/window_partition_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_product/window_partition_out.sql index bad5c02c1b4..65fc464b70d 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_product/window_partition_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_product/window_partition_out.sql @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CASE WHEN LOGICAL_OR(`int64_col` = 0) OVER (PARTITION BY `string_col`) THEN 0 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 cd08f0a46d9..e337356d965 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 @@ -11,7 +11,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - *, `bfcol_4` AS `int64`, `bfcol_5` AS `bool`, `bfcol_6` AS `int64_w_floor` 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 7f41d2892a9..58bd58e08a8 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, RANK() OVER (ORDER BY `int64_col` DESC NULLS FIRST) AS `agg_int64` FROM `bfcte_0` \ No newline at end of file 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 88933ef0c53..a30df4413cc 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, LAG(`int64_col`, 1) OVER (ORDER BY `int64_col` ASC) AS `lag` FROM `bfcte_0` \ No newline at end of file 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 eee93c1ca1c..94ed6e94b88 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, LEAD(`int64_col`, 1) OVER (ORDER BY `int64_col` ASC) AS `lead` FROM `bfcte_0` \ No newline at end of file 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 3b5658e4c1c..ea276a1a1c4 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, `int64_col` AS `noop` FROM `bfcte_0` \ No newline at end of file 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 cffd4b466f9..78af380428b 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 @@ -6,10 +6,9 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - *, - `bool_col` AS `bool_col`, - `duration_col` AS `duration_col`, - `int64_col` AS `int64_col`, + `bool_col`, + `duration_col`, + `int64_col`, `int64_col` AS `bfcol_6`, `bool_col` AS `bfcol_7`, `duration_col` AS `bfcol_8` @@ -23,7 +22,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_1` ) SELECT - *, `bfcol_12` AS `int64_col`, `bfcol_13` AS `bool_col`, `bfcol_14` AS `duration_col`, 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 489a54b3c65..f7a34c9f914 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, STDDEV(`int64_col`) OVER ( ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING 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 39778e7cf81..2bf6c26cd4b 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 @@ -10,7 +10,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - *, `bfcol_4` AS `int64_col`, `bfcol_5` AS `bool_col` FROM `bfcte_1` \ No newline at end of file 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 c63a6569f6c..f27bc2c0f7e 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, COALESCE( SUM(`int64_col`) OVER ( ORDER BY `int64_col` DESC 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 5a19d6fd590..2202976d49a 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 @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, COALESCE( SUM(`int64_col`) OVER ( PARTITION BY `string_col` 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 72f587f9c85..733a22438ce 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 @@ -10,7 +10,6 @@ WITH `bfcte_0` AS ( FROM `bfcte_0` ) SELECT - *, `bfcol_4` AS `int64_col`, `bfcol_5` AS `bool_col` FROM `bfcte_1` \ No newline at end of file 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 90845db543d..012298a68b0 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, VARIANCE(`int64_col`) OVER ( ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING 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 a3b41863a46..d8021a22ad3 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, AI.CLASSIFY( input => (`string_col`), categories => ['greeting', 'rejection'], 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 f44921f806a..a5751d168a2 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, AI.GENERATE( prompt => (`string_col`, ' is the same as ', `string_col`), endpoint => 'gemini-2.5-flash', 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 2d70bbc8149..96d8d53d8dc 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, AI.GENERATE_BOOL( prompt => (`string_col`, ' is the same as ', `string_col`), endpoint => 'gemini-2.5-flash', diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool_with_connection_id/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool_with_connection_id/out.sql index c2f433a2e36..66a55f690ec 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool_with_connection_id/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool_with_connection_id/out.sql @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, AI.GENERATE_BOOL( prompt => (`string_col`, ' is the same as ', `string_col`), connection_id => 'bigframes-dev.us.bigframes-default-connection', 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 4b8ae26fc37..08e05872827 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, AI.GENERATE_BOOL( prompt => (`string_col`, ' is the same as ', `string_col`), request_type => 'SHARED', 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 4be491cc23e..6ce5899c33e 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, AI.GENERATE_DOUBLE( prompt => (`string_col`, ' is the same as ', `string_col`), endpoint => 'gemini-2.5-flash', diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double_with_connection_id/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double_with_connection_id/out.sql index 5b17e4ca368..c38e6d74d6d 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double_with_connection_id/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double_with_connection_id/out.sql @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, AI.GENERATE_DOUBLE( prompt => (`string_col`, ' is the same as ', `string_col`), connection_id => 'bigframes-dev.us.bigframes-default-connection', 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 2d42852e7c3..5a38e31e94e 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, AI.GENERATE_DOUBLE( prompt => (`string_col`, ' is the same as ', `string_col`), request_type => 'SHARED', 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 c591d0489a1..c984c20b37f 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, AI.GENERATE_INT( prompt => (`string_col`, ' is the same as ', `string_col`), endpoint => 'gemini-2.5-flash', diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int_with_connection_id/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int_with_connection_id/out.sql index e2a882a267e..c56e8d29dab 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int_with_connection_id/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int_with_connection_id/out.sql @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, AI.GENERATE_INT( prompt => (`string_col`, ' is the same as ', `string_col`), connection_id => 'bigframes-dev.us.bigframes-default-connection', 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 a5e040ca481..21a408d4bd6 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, AI.GENERATE_INT( prompt => (`string_col`, ' is the same as ', `string_col`), request_type => 'SHARED', diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_connection_id/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_connection_id/out.sql index 1da9ee6fd54..349783fd240 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_connection_id/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_connection_id/out.sql @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, AI.GENERATE( prompt => (`string_col`, ' is the same as ', `string_col`), connection_id => 'bigframes-dev.us.bigframes-default-connection', 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 0d5b8f19708..53eef367285 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, AI.GENERATE( prompt => (`string_col`, ' is the same as ', `string_col`), request_type => 'SHARED', 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 c06c24514f5..3e0cb7fc442 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, AI.GENERATE( prompt => (`string_col`, ' is the same as ', `string_col`), endpoint => 'gemini-2.5-flash', 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 937069c2ff7..f74a5264dc6 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, AI.IF( prompt => (`string_col`, ' is the same as ', `string_col`), connection_id => 'bigframes-dev.us.bigframes-default-connection' 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 4afa9b285db..10177819d8a 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, AI.SCORE( prompt => (`string_col`, ' is the same as ', `string_col`), connection_id => 'bigframes-dev.us.bigframes-default-connection' 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 acdda931204..2f0a4c8862d 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ) SELECT - *, `string_list_col`[SAFE_OFFSET(1)] AS `string_list_col` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_reduce_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_reduce_op/out.sql index ce14c05924b..a3b739da5d3 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_reduce_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_reduce_op/out.sql @@ -6,7 +6,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ) SELECT - *, ( SELECT COALESCE(SUM(bf_arr_reduce_uid), 0) 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 4d4126c1b89..6968e7c1265 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ) SELECT - *, ARRAY( SELECT el 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 96366ff1870..fbf95635a18 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ) SELECT - *, ARRAY( SELECT el 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 48634627ec1..a8cb9e64e1d 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ) SELECT - *, ARRAY_TO_STRING(`string_list_col`, '.') AS `string_list_col` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_to_array_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_to_array_op/out.sql index c0f3eff3d05..3cfaef25348 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_to_array_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_to_array_op/out.sql @@ -7,7 +7,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, [COALESCE(`bool_col`, FALSE)] AS `bool_col`, [COALESCE(`int64_col`, 0)] AS `int64_col`, [COALESCE(`string_col`, ''), COALESCE(`string_col`, '')] AS `strs_col`, 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 4c66f5930a9..500ae267cbd 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 @@ -5,9 +5,8 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, + `rowindex`, OBJ.FETCH_METADATA( OBJ.MAKE_REF(`string_col`, 'bigframes-dev.test-region.bigframes-default-connection') - ).`version` AS `version` + ).`version` FROM `bfcte_0` \ 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 8266609362c..b168b787146 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 @@ -5,8 +5,7 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, + `rowindex`, JSON_VALUE( OBJ.GET_ACCESS_URL( OBJ.MAKE_REF(`string_col`, 'bigframes-dev.test-region.bigframes-default-connection'), 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 3c37aee576e..60a032f4c40 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 @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, + `rowindex`, OBJ.MAKE_REF(`string_col`, 'bigframes-dev.test-region.bigframes-default-connection') AS `string_col` FROM `bfcte_0` \ 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 90e227d464f..b49d709152d 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 @@ -6,10 +6,9 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `bool_col` AS `bool_col`, - `int64_col` AS `int64_col`, + `rowindex`, + `bool_col`, + `int64_col`, `int64_col` & `int64_col` AS `int_and_int`, `bool_col` AND `bool_col` AS `bool_and_bool`, IF(`bool_col` = FALSE, `bool_col`, NULL) AS `bool_and_null` 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 191534c76c0..c8b1d86953d 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 @@ -6,10 +6,9 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `bool_col` AS `bool_col`, - `int64_col` AS `int64_col`, + `rowindex`, + `bool_col`, + `int64_col`, `int64_col` | `int64_col` AS `int_and_int`, `bool_col` OR `bool_col` AS `bool_and_bool`, IF(`bool_col` = TRUE, `bool_col`, NULL) AS `bool_and_null` 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 0ae0e97fc20..51e969a6552 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 @@ -6,10 +6,9 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `bool_col` AS `bool_col`, - `int64_col` AS `int64_col`, + `rowindex`, + `bool_col`, + `int64_col`, `int64_col` ^ `int64_col` AS `int_and_int`, ( `bool_col` AND NOT `bool_col` 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 b8a259c51bf..24cc8dde78b 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 @@ -5,6 +5,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, COALESCE(CAST(`int64_col` AS STRING), '$NULL_SENTINEL$') = COALESCE(CAST(CAST(`bool_col` AS INT64) AS STRING), '$NULL_SENTINEL$') AS `int64_col` FROM `bfcte_0` \ No newline at end of file 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 775c765d114..1f0f2529dd1 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 @@ -6,10 +6,9 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `int64_col` AS `int64_col`, - `bool_col` AS `bool_col`, + `rowindex`, + `int64_col`, + `bool_col`, `int64_col` = `int64_col` AS `int_eq_int`, `int64_col` = 1 AS `int_eq_1`, `int64_col` IS NULL AS `int_eq_null`, 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 ecb863106d5..40b319c6250 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 @@ -6,10 +6,9 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `int64_col` AS `int64_col`, - `bool_col` AS `bool_col`, + `rowindex`, + `int64_col`, + `bool_col`, `int64_col` >= `int64_col` AS `int_ge_int`, `int64_col` >= 1 AS `int_ge_1`, `int64_col` >= CAST(`bool_col` AS INT64) AS `int_ge_bool`, 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 7a12fdb6374..0f9f412e482 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 @@ -6,10 +6,9 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `int64_col` AS `int64_col`, - `bool_col` AS `bool_col`, + `rowindex`, + `int64_col`, + `bool_col`, `int64_col` > `int64_col` AS `int_gt_int`, `int64_col` > 1 AS `int_gt_1`, `int64_col` > CAST(`bool_col` AS INT64) AS `int_gt_bool`, 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 97a82c431e6..cc15f4cccaf 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 @@ -6,7 +6,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, COALESCE(`bool_col` IN (TRUE, FALSE), FALSE) AS `bools`, COALESCE(`int64_col` IN (1, 2, 3), FALSE) AS `ints`, `int64_col` IS NULL AS `ints_w_null`, 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 406fd7f8826..a3fe2bc107a 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 @@ -6,10 +6,9 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `int64_col` AS `int64_col`, - `bool_col` AS `bool_col`, + `rowindex`, + `int64_col`, + `bool_col`, `int64_col` <= `int64_col` AS `int_le_int`, `int64_col` <= 1 AS `int_le_1`, `int64_col` <= CAST(`bool_col` AS INT64) AS `int_le_bool`, 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 dc6bbc8fcfa..a486b0b238d 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 @@ -6,10 +6,9 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `int64_col` AS `int64_col`, - `bool_col` AS `bool_col`, + `rowindex`, + `int64_col`, + `bool_col`, `int64_col` < `int64_col` AS `int_lt_int`, `int64_col` < 1 AS `int_lt_1`, `int64_col` < CAST(`bool_col` AS INT64) AS `int_lt_bool`, 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 4a1d4ddff7e..7a279b88560 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 @@ -5,6 +5,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, GREATEST(`int64_col`, `float64_col`) AS `int64_col` FROM `bfcte_0` \ No newline at end of file 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 75c7279dc0f..1e7e0a75ed9 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 @@ -5,6 +5,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, LEAST(`int64_col`, `float64_col`) AS `int64_col` FROM `bfcte_0` \ No newline at end of file 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 a591c05c093..8ec8433ec18 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 @@ -6,10 +6,9 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `int64_col` AS `int64_col`, - `bool_col` AS `bool_col`, + `rowindex`, + `int64_col`, + `bool_col`, `int64_col` <> `int64_col` AS `int_ne_int`, `int64_col` <> 1 AS `int_ne_1`, ( 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 8a37be4cbd7..5e82d20ae41 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 @@ -6,10 +6,9 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `timestamp_col` AS `timestamp_col`, - `date_col` AS `date_col`, + `rowindex`, + `timestamp_col`, + `date_col`, TIMESTAMP_ADD(CAST(`date_col` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `date_add_timedelta`, TIMESTAMP_ADD(`timestamp_col`, INTERVAL 86400000000 MICROSECOND) AS `timestamp_add_timedelta`, TIMESTAMP_ADD(CAST(`date_col` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `timedelta_add_date`, 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 259af74dad6..80d339a997f 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, DATE(`timestamp_col`) AS `timestamp_col` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_datetime_to_integer_label/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_datetime_to_integer_label/out.sql index 3f055c6aa5e..3ec8aa8162e 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_datetime_to_integer_label/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_datetime_to_integer_label/out.sql @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CAST(FLOOR( IEEE_DIVIDE( UNIX_MICROS(CAST(`datetime_col` AS TIMESTAMP)) - UNIX_MICROS(CAST(`timestamp_col` AS TIMESTAMP)), 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 0bdb1ba2a7a..cdbd26d2cf0 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, EXTRACT(DAY FROM `timestamp_col`) AS `timestamp_col` FROM `bfcte_0` \ No newline at end of file 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 f728f16a36b..5fa4f0f252e 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 @@ -6,7 +6,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CAST(MOD(EXTRACT(DAYOFWEEK FROM `datetime_col`) + 5, 7) AS INT64) AS `datetime_col`, CAST(MOD(EXTRACT(DAYOFWEEK FROM `timestamp_col`) + 5, 7) AS INT64) AS `timestamp_col`, CAST(MOD(EXTRACT(DAYOFWEEK FROM `date_col`) + 5, 7) AS INT64) AS `date_col` 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 2058f9994bf..bacc29fa9f2 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, EXTRACT(DAYOFYEAR FROM `timestamp_col`) AS `timestamp_col` FROM `bfcte_0` \ No newline at end of file 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 2c60b32582d..d35afbe26b7 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 @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, TIMESTAMP_TRUNC(`timestamp_col`, MICROSECOND) AS `timestamp_col_us`, TIMESTAMP_TRUNC(`timestamp_col`, MILLISECOND) AS `timestamp_col_ms`, TIMESTAMP_TRUNC(`timestamp_col`, SECOND) AS `timestamp_col_s`, 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 8e56bd0d705..cf91b6a2a5a 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, EXTRACT(HOUR FROM `timestamp_col`) AS `timestamp_col` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_fixed/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_fixed/out.sql index bd2087b4bb8..577cb6a78b8 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_fixed/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_fixed/out.sql @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CAST(TIMESTAMP_MICROS( CAST(CAST(`rowindex` AS BIGNUMERIC) * 86400000000 + CAST(UNIX_MICROS(CAST(`timestamp_col` AS TIMESTAMP)) AS BIGNUMERIC) AS INT64) ) AS TIMESTAMP) AS `fixed_freq` diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_month/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_month/out.sql index 96619f580b3..aa1b11d5750 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_month/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_month/out.sql @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CAST(TIMESTAMP( DATETIME( CASE diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_quarter/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_quarter/out.sql index b0fc8b145de..04e65af38ae 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_quarter/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_quarter/out.sql @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CAST(DATETIME( CASE WHEN ( diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_week/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_week/out.sql index f93473f636b..7e3c9c75320 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_week/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_week/out.sql @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CAST(TIMESTAMP_MICROS( CAST(CAST(`rowindex` AS BIGNUMERIC) * 604800000000 + CAST(UNIX_MICROS( TIMESTAMP_TRUNC(CAST(`timestamp_col` AS TIMESTAMP), WEEK(MONDAY)) + INTERVAL 6 DAY diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_year/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_year/out.sql index d199abc5ea6..4e6dd06bff3 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_year/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_year/out.sql @@ -5,6 +5,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CAST(TIMESTAMP(DATETIME(`rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) + 1, 1, 1, 0, 0, 0)) - INTERVAL 1 DAY AS TIMESTAMP) AS `non_fixed_freq_yearly` FROM `bfcte_0` \ No newline at end of file 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 3751efb2d3f..eb16d4f9c7d 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CAST(MOD(EXTRACT(DAYOFWEEK FROM `timestamp_col`) + 5, 7) AS INT64) + 1 AS `timestamp_col` FROM `bfcte_0` \ No newline at end of file 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 90651af773f..a6552f647c3 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, EXTRACT(ISOWEEK FROM `timestamp_col`) AS `timestamp_col` FROM `bfcte_0` \ No newline at end of file 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 c47404f235a..f316d25a0cd 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, EXTRACT(ISOYEAR FROM `timestamp_col`) AS `timestamp_col` FROM `bfcte_0` \ No newline at end of file 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 99b3197c6bb..4dc6bfdf4b5 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, EXTRACT(MINUTE FROM `timestamp_col`) AS `timestamp_col` FROM `bfcte_0` \ No newline at end of file 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 cdac5cf60d4..0574dc15648 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, EXTRACT(MONTH FROM `timestamp_col`) AS `timestamp_col` FROM `bfcte_0` \ No newline at end of file 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 7f1848a1251..28b6beb7c54 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, TIMESTAMP_TRUNC(`timestamp_col`, DAY) AS `timestamp_col` FROM `bfcte_0` \ No newline at end of file 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 a450792c1b1..86ebd60e57d 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, EXTRACT(QUARTER FROM `timestamp_col`) AS `timestamp_col` FROM `bfcte_0` \ No newline at end of file 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 29a1f2a6216..ccc97d9ea1a 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, EXTRACT(SECOND FROM `timestamp_col`) AS `timestamp_col` FROM `bfcte_0` \ No newline at end of file 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 36137772e49..2d250129cba 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 @@ -7,7 +7,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, FORMAT_DATE('%Y-%m-%d', `date_col`) AS `date_col`, FORMAT_DATETIME('%Y-%m-%d', `datetime_col`) AS `datetime_col`, FORMAT_TIME('%Y-%m-%d', `time_col`) AS `time_col`, 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 c5306a9d0b5..cc5dab6cf0c 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 @@ -7,11 +7,10 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `timestamp_col` AS `timestamp_col`, - `duration_col` AS `duration_col`, - `date_col` AS `date_col`, + `rowindex`, + `timestamp_col`, + `duration_col`, + `date_col`, TIMESTAMP_SUB(CAST(`date_col` AS DATETIME), INTERVAL `duration_col` MICROSECOND) AS `date_sub_timedelta`, TIMESTAMP_SUB(`timestamp_col`, INTERVAL `duration_col` MICROSECOND) AS `timestamp_sub_timedelta`, TIMESTAMP_DIFF(CAST(`date_col` AS DATETIME), CAST(`date_col` AS DATETIME), MICROSECOND) AS `timestamp_sub_date`, 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 b33b1c6a78b..0ffbd756537 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, TIME(`timestamp_col`) AS `timestamp_col` FROM `bfcte_0` \ No newline at end of file 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 c063a8a0ae3..f0b641795c6 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 @@ -6,8 +6,7 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CAST(TIMESTAMP_MICROS(CAST(TRUNC(`int64_col` * 0.001) AS INT64)) AS DATETIME) AS `int64_col`, - SAFE_CAST(`string_col` AS DATETIME) AS `string_col`, + SAFE_CAST(`string_col` AS DATETIME), CAST(TIMESTAMP_MICROS(CAST(TRUNC(`float64_col` * 0.001) AS INT64)) AS DATETIME) AS `float64_col` FROM `bfcte_0` \ No newline at end of file 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 9892c0d608d..9526dd301c1 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 @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CAST(TIMESTAMP_MICROS(CAST(TRUNC(`int64_col` * 0.001) AS INT64)) AS TIMESTAMP) AS `int64_col`, CAST(TIMESTAMP_MICROS(CAST(TRUNC(`float64_col` * 0.001) AS INT64)) AS TIMESTAMP) AS `float64_col`, CAST(TIMESTAMP_MICROS(CAST(TRUNC(`int64_col` * 1000000) AS INT64)) AS TIMESTAMP) AS `int64_col_s`, 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 2b09b23feb7..aceaa377f24 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, UNIX_MICROS(`timestamp_col`) AS `timestamp_col` FROM `bfcte_0` \ No newline at end of file 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 43996423bd0..5533c0e45ce 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, UNIX_MILLIS(`timestamp_col`) AS `timestamp_col` FROM `bfcte_0` \ No newline at end of file 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 c4155cac311..a457d55167f 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, UNIX_SECONDS(`timestamp_col`) AS `timestamp_col` FROM `bfcte_0` \ No newline at end of file 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 dfa150c2bca..9fae0b5fe70 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, EXTRACT(YEAR FROM `timestamp_col`) AS `timestamp_col` FROM `bfcte_0` \ No newline at end of file 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 f7868ed36dd..53353c6201a 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 @@ -5,8 +5,7 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `bool_col` AS `bool_col`, + `bool_col`, `float64_col` <> 0 AS `float64_col`, `float64_col` <> 0 AS `float64_w_safe` FROM `bfcte_0` \ No newline at end of file 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 7c8292a0ed5..c9b64a447d4 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 @@ -4,8 +4,7 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - CAST(CAST(`bool_col` AS INT64) AS FLOAT64) AS `bool_col`, + CAST(CAST(`bool_col` AS INT64) AS FLOAT64), CAST('1.34235e4' AS FLOAT64) AS `str_const`, SAFE_CAST(SAFE_CAST(`bool_col` AS INT64) AS FLOAT64) AS `bool_w_safe` FROM `bfcte_0` \ No newline at end of file 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 a3e6ebc35db..ae391c83e4a 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`json_types` ) SELECT - *, INT64(`json_col`) AS `int64_col`, FLOAT64(`json_col`) AS `float64_col`, BOOL(`json_col`) AS `bool_col`, 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 984ee9b2410..75602331b06 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 @@ -8,7 +8,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, UNIX_MICROS(CAST(`datetime_col` AS TIMESTAMP)) AS `datetime_col`, UNIX_MICROS(SAFE_CAST(`datetime_col` AS TIMESTAMP)) AS `datetime_w_safe`, TIME_DIFF(CAST(`time_col` AS TIME), '00:00:00', MICROSECOND) AS `time_col`, 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 e11f66b8125..362cc11336d 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 @@ -7,7 +7,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, PARSE_JSON(CAST(`int64_col` AS STRING)) AS `int64_col`, PARSE_JSON(CAST(`float64_col` AS STRING)) AS `float64_col`, PARSE_JSON(CAST(`bool_col` AS STRING)) AS `bool_col`, 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 433a2c6eae5..5eb4fa76f81 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 @@ -5,8 +5,7 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - CAST(`int64_col` AS STRING) AS `int64_col`, + CAST(`int64_col` AS STRING), INITCAP(CAST(`bool_col` AS STRING)) AS `bool_col`, INITCAP(SAFE_CAST(`bool_col` AS STRING)) AS `bool_w_safe` FROM `bfcte_0` \ No newline at end of file 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 4545b6458f6..75facae0072 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CAST(TIMESTAMP_MICROS(`int64_col`) AS DATETIME) AS `int64_to_datetime`, CAST(TIMESTAMP_MICROS(`int64_col`) AS TIME) AS `int64_to_time`, CAST(TIMESTAMP_MICROS(`int64_col`) AS TIMESTAMP) AS `int64_to_timestamp`, diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_binary_remote_function_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_binary_remote_function_op/out.sql index 1d0182b2803..e139122adf3 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_binary_remote_function_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_binary_remote_function_op/out.sql @@ -5,6 +5,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, `my_project`.`my_dataset`.`my_routine`(`int64_col`, `float64_col`) AS `int64_col` FROM `bfcte_0` \ No newline at end of file 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 25e1448b7af..e61dec3bc4c 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 @@ -7,7 +7,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CASE WHEN `bool_col` THEN `int64_col` END AS `single_case`, CASE WHEN `bool_col` THEN `int64_col` WHEN `bool_col` THEN `int64_too` END AS `double_case`, CASE WHEN `bool_col` THEN `bool_col` WHEN `bool_col` THEN `bool_col` END AS `bool_types_case`, 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 d413a5d2ba5..f0f0858d922 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 @@ -6,6 +6,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, GREATEST(LEAST(`rowindex`, `int64_too`), `int64_col`) AS `result_col` FROM `bfcte_0` \ No newline at end of file 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 9a5989bafec..5f05c6ae87e 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 @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `int64_col` AS `int64_col`, + `int64_col`, COALESCE(`int64_too`, `int64_col`) AS `int64_too` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_fillna/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_fillna/out.sql index 4b431f6806b..1152f4d9d3c 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_fillna/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_fillna/out.sql @@ -5,6 +5,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, COALESCE(`int64_col`, `float64_col`) AS `int64_col` FROM `bfcte_0` \ No newline at end of file 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 346fd6c9920..9e80a627358 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, FARM_FINGERPRINT(`string_col`) AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 e5be11cea29..3863e467dc8 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 @@ -6,7 +6,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ~( `int64_col` ) AS `int64_col`, 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 e1a1a8a3b49..a83c737663d 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, `float64_col` IS NULL AS `float64_col` FROM `bfcte_0` \ No newline at end of file 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 cbc026f65f8..7ce1a44a99f 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CASE WHEN `string_col` = 'value1' THEN 'mapped1' diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_nary_remote_function_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_nary_remote_function_op/out.sql index c031e2b8a13..3aa4a56c8f9 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_nary_remote_function_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_nary_remote_function_op/out.sql @@ -6,6 +6,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, `my_project`.`my_dataset`.`my_routine`(`int64_col`, `float64_col`, `string_col`) AS `int64_col` FROM `bfcte_0` \ No newline at end of file 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 a3ccc73b404..37b675fdff8 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, NOT `float64_col` IS NULL AS `float64_col` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_remote_function_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_remote_function_op/out.sql index 68062a3c0c5..75b73cac17f 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_remote_function_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_remote_function_op/out.sql @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, `my_project`.`my_dataset`.`my_routine`(`int64_col`) AS `apply_on_null_true`, IF( `int64_col` IS NULL, 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 eeecdf82ed3..4891744d16a 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 @@ -18,7 +18,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CONCAT( CAST(FARM_FINGERPRINT( CONCAT( 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 e916878df7f..14c3e8fa498 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 @@ -5,6 +5,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CAST(`bool_col` AS INT64) + BYTE_LENGTH(`bytes_col`) AS `bool_col` FROM `bfcte_0` \ No newline at end of file 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 ce0a355597e..e5f73b2db0f 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 @@ -6,6 +6,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, IF(`bool_col`, `int64_col`, `float64_col`) AS `result_col` FROM `bfcte_0` \ No newline at end of file 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 4f2a1e792a0..38a4ce9c1a3 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ST_AREA(`geography_col`) AS `geography_col` FROM `bfcte_0` \ No newline at end of file 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 ad73bba8aba..721157d6ff1 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ST_ASTEXT(`geography_col`) AS `geography_col` FROM `bfcte_0` \ No newline at end of file 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 a69af6cb96a..64b4fcf06e9 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ST_BOUNDARY(`geography_col`) AS `geography_col` FROM `bfcte_0` \ No newline at end of file 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 3574ce6c979..3a1c084fa06 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ST_BUFFER(`geography_col`, 1.0, 8.0, FALSE) AS `geography_col` FROM `bfcte_0` \ No newline at end of file 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 9c55b4e6c10..a7ed97d884a 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ST_CENTROID(`geography_col`) AS `geography_col` FROM `bfcte_0` \ No newline at end of file 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 c8c566380a0..8f074913b89 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ST_CONVEXHULL(`geography_col`) AS `geography_col` FROM `bfcte_0` \ No newline at end of file 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 c824268efb2..02ae95cdf9d 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ST_DIFFERENCE(`geography_col`, `geography_col`) AS `geography_col` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_distance/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_distance/out.sql index 9da34a13be8..502cca20f71 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_distance/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_distance/out.sql @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ST_DISTANCE(`geography_col`, `geography_col`, TRUE) AS `spheroid`, ST_DISTANCE(`geography_col`, `geography_col`, FALSE) AS `no_spheroid` FROM `bfcte_0` \ No newline at end of file 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 f35f314175a..2607f104964 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, SAFE.ST_GEOGFROMTEXT(`string_col`) AS `string_col` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_geogpoint/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_geogpoint/out.sql index f586873b75d..0da27247863 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_geogpoint/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_geogpoint/out.sql @@ -5,6 +5,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ST_GEOGPOINT(`rowindex`, `rowindex_2`) AS `rowindex` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_intersection/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_intersection/out.sql index 9a3a7336f02..807a2f47067 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_intersection/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_intersection/out.sql @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ST_INTERSECTION(`geography_col`, `geography_col`) AS `geography_col` FROM `bfcte_0` \ No newline at end of file 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 cd727577bda..b14f99d1192 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ST_ISCLOSED(`geography_col`) AS `geography_col` FROM `bfcte_0` \ No newline at end of file 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 9987345b3d1..26022a041b5 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ST_LENGTH(`geography_col`) AS `geography_col` FROM `bfcte_0` \ No newline at end of file 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 30e7bf75392..7114817312a 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ST_X(`geography_col`) AS `geography_col` FROM `bfcte_0` \ No newline at end of file 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 b4f2c48c21c..1b6742d62b0 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ST_Y(`geography_col`) AS `geography_col` FROM `bfcte_0` \ No newline at end of file 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 66665ca3d65..358ae3a12e1 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`json_types` ) SELECT - *, JSON_EXTRACT(`json_col`, '$') AS `json_col` FROM `bfcte_0` \ No newline at end of file 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 028571b9ca6..5a4bb1c4ed1 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`json_types` ) SELECT - *, JSON_EXTRACT_ARRAY(`json_col`, '$') AS `json_col` FROM `bfcte_0` \ No newline at end of file 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 23857e9cf4f..f13f2ea1ee2 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`json_types` ) SELECT - *, JSON_EXTRACT_STRING_ARRAY(`json_col`, '$') AS `json_col` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_keys/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_keys/out.sql index 7233fd81b47..ac629891e91 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_keys/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_keys/out.sql @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`json_types` ) SELECT - *, JSON_KEYS(`json_col`, NULL) AS `json_keys`, JSON_KEYS(`json_col`, 2) AS `json_keys_w_max_depth` FROM `bfcte_0` \ No newline at end of file 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 79c51616742..eb522f67d51 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`json_types` ) SELECT - *, JSON_QUERY(`json_col`, '$') AS `json_col` FROM `bfcte_0` \ No newline at end of file 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 e96554fac41..78a74bafcdd 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`json_types` ) SELECT - *, JSON_QUERY_ARRAY(`json_col`, '$') AS `json_col` FROM `bfcte_0` \ No newline at end of file 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 e48c213497d..7be34a92478 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`json_types` ) SELECT - *, JSON_SET(`json_col`, '$.a', 100) AS `json_col` FROM `bfcte_0` \ No newline at end of file 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 15ba80ad6e8..50fa90cada8 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`json_types` ) SELECT - *, JSON_VALUE(`json_col`, '$') AS `json_col` FROM `bfcte_0` \ No newline at end of file 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 f2dc0af00c5..0057b2ae541 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, PARSE_JSON(`string_col`) AS `string_col` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_to_json/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_to_json/out.sql index 8200825655f..6029a686e54 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_to_json/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_to_json/out.sql @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, TO_JSON(`string_col`) AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 9663e122f37..a9753a888e6 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`json_types` ) SELECT - *, TO_JSON_STRING(`json_col`) AS `json_col` FROM `bfcte_0` \ No newline at end of file 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 8b3c8fcc95a..6f9756496e5 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ABS(`float64_col`) AS `float64_col` FROM `bfcte_0` \ No newline at end of file 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 b5a6d824dc5..20dca75f58b 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 @@ -6,10 +6,9 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `int64_col` AS `int64_col`, - `bool_col` AS `bool_col`, + `rowindex`, + `int64_col`, + `bool_col`, `int64_col` + `int64_col` AS `int_add_int`, `int64_col` + 1 AS `int_add_1`, `int64_col` + CAST(`bool_col` AS INT64) AS `int_add_bool`, 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 2acc0a1057a..6585ce00f90 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CONCAT(`string_col`, 'a') AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 8a37be4cbd7..5e82d20ae41 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 @@ -6,10 +6,9 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `timestamp_col` AS `timestamp_col`, - `date_col` AS `date_col`, + `rowindex`, + `timestamp_col`, + `date_col`, TIMESTAMP_ADD(CAST(`date_col` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `date_add_timedelta`, TIMESTAMP_ADD(`timestamp_col`, INTERVAL 86400000000 MICROSECOND) AS `timestamp_add_timedelta`, TIMESTAMP_ADD(CAST(`date_col` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `timedelta_add_date`, 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 0bece99be32..7d53a7b39d0 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CASE WHEN ABS(`float64_col`) > 1 THEN CAST('NaN' AS FLOAT64) 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 ab10f757a5f..874d8dcc704 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CASE WHEN `float64_col` < 1 THEN CAST('NaN' AS FLOAT64) 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 af706cc476f..664211e6aa5 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CASE WHEN ABS(`float64_col`) > 1 THEN CAST('NaN' AS FLOAT64) 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 a6881bdb71a..ec827dd5c58 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ASINH(`float64_col`) AS `float64_col` FROM `bfcte_0` \ No newline at end of file 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 c2a8291fd32..2a0c66798f3 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ATAN(`float64_col`) AS `float64_col` FROM `bfcte_0` \ No newline at end of file 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 ba355d0c4bb..4fb0e010f2e 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 @@ -6,7 +6,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ATAN2(`int64_col`, `float64_col`) AS `int64_col`, ATAN2(CAST(`bool_col` AS INT64), `float64_col`) AS `bool_col` FROM `bfcte_0` \ No newline at end of file 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 70be6c5f4a5..47e1eae6722 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CASE WHEN ABS(`float64_col`) < 1 THEN ATANH(`float64_col`) 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 d94deca246f..00bf423ae11 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CEIL(`float64_col`) AS `float64_col` FROM `bfcte_0` \ No newline at end of file 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 6d7563340c9..0cee03c7f9a 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, COS(`float64_col`) AS `float64_col` FROM `bfcte_0` \ No newline at end of file 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 c5041210cce..249dd17bd07 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CASE WHEN ABS(`float64_col`) > 709.78 THEN CAST('Infinity' AS FLOAT64) 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 c75973082c5..f46281b4a41 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 @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ) SELECT - *, ML.DISTANCE(`int_list_col`, `int_list_col`, 'COSINE') AS `int_list_col`, ML.DISTANCE(`float_list_col`, `float_list_col`, 'COSINE') AS `float_list_col` FROM `bfcte_0` \ No newline at end of file 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 e52c24f895e..78d2a5f0631 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 @@ -7,11 +7,10 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `int64_col` AS `int64_col`, - `bool_col` AS `bool_col`, - `float64_col` AS `float64_col`, + `rowindex`, + `int64_col`, + `bool_col`, + `float64_col`, IEEE_DIVIDE(`int64_col`, `int64_col`) AS `int_div_int`, IEEE_DIVIDE(`int64_col`, 1) AS `int_div_1`, IEEE_DIVIDE(`int64_col`, 0.0) AS `int_div_0`, 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 ed56a4e36a0..010e17556a2 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 @@ -6,9 +6,8 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `timestamp_col` AS `timestamp_col`, - `int64_col` AS `int64_col`, + `rowindex`, + `timestamp_col`, + `int64_col`, CAST(FLOOR(IEEE_DIVIDE(86400000000, `int64_col`)) AS INT64) AS `timedelta_div_numeric` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_euclidean_distance/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_euclidean_distance/out.sql index 21d91bf3c24..46df8bee0ff 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_euclidean_distance/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_euclidean_distance/out.sql @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ) SELECT - *, ML.DISTANCE(`int_list_col`, `int_list_col`, 'EUCLIDEAN') AS `int_list_col`, ML.DISTANCE(`numeric_list_col`, `numeric_list_col`, 'EUCLIDEAN') AS `numeric_list_col` FROM `bfcte_0` \ No newline at end of file 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 fd48355dc99..4a0364a67f5 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CASE WHEN `float64_col` > 709.78 THEN CAST('Infinity' AS FLOAT64) 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 9a38580ee57..22f1a691f86 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, IF(`float64_col` > 709.78, CAST('Infinity' AS FLOAT64), EXP(`float64_col`) - 1) AS `float64_col` FROM `bfcte_0` \ No newline at end of file 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 edc4628ac0b..e77c10888ca 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, FLOOR(`float64_col`) AS `float64_col` FROM `bfcte_0` \ No newline at end of file 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 7e926366626..de65030d026 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 @@ -6,9 +6,8 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `timestamp_col` AS `timestamp_col`, - `date_col` AS `date_col`, + `rowindex`, + `timestamp_col`, + `date_col`, 43200000000 AS `timedelta_div_numeric` FROM `bfcte_0` \ 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 e569a004120..53cabeec347 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CASE WHEN `float64_col` IS NULL THEN NULL 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 a521506ce60..0c62c1cb42f 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CASE WHEN `float64_col` IS NULL THEN NULL 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 c7475f1aa4b..7db8d1ca38c 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CASE WHEN `float64_col` IS NULL THEN NULL diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_manhattan_distance/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_manhattan_distance/out.sql index 9f8a442d136..9e1e353bdf4 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_manhattan_distance/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_manhattan_distance/out.sql @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ) SELECT - *, ML.DISTANCE(`float_list_col`, `float_list_col`, 'MANHATTAN') AS `float_list_col`, ML.DISTANCE(`numeric_list_col`, `numeric_list_col`, 'MANHATTAN') AS `numeric_list_col` FROM `bfcte_0` \ No newline at end of file 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 d3f4c6132aa..4db0724e8cd 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 @@ -6,10 +6,9 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `int64_col` AS `int64_col`, - `float64_col` AS `float64_col`, + `rowindex`, + `int64_col`, + `float64_col`, CASE WHEN `int64_col` = CAST(0 AS INT64) THEN CAST(0 AS INT64) * `int64_col` 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 ecf03d0fa27..d6baa63040f 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 @@ -6,10 +6,9 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `int64_col` AS `int64_col`, - `bool_col` AS `bool_col`, + `rowindex`, + `int64_col`, + `bool_col`, `int64_col` * `int64_col` AS `int_mul_int`, `int64_col` * 1 AS `int_mul_1`, `int64_col` * CAST(`bool_col` AS INT64) AS `int_mul_bool`, 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 35d76d618f5..0f2a4f4f0e7 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 @@ -7,11 +7,10 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `timestamp_col` AS `timestamp_col`, - `int64_col` AS `int64_col`, - `duration_col` AS `duration_col`, + `rowindex`, + `timestamp_col`, + `int64_col`, + `duration_col`, CAST(FLOOR(`duration_col` * `int64_col`) AS INT64) AS `timedelta_mul_numeric`, CAST(FLOOR(`int64_col` * `duration_col`) AS INT64) AS `numeric_mul_timedelta` FROM `bfcte_0` \ No newline at end of file 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 f9e0d2f7d94..d421dabcd51 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, -( `float64_col` ) AS `float64_col` 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 0b09db469e9..07b691f4502 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `float64_col` AS `float64_col` + `float64_col` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pow/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pow/out.sql index 0bb9389bb19..425ad402ee7 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pow/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pow/out.sql @@ -6,10 +6,9 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `int64_col` AS `int64_col`, - `float64_col` AS `float64_col`, + `rowindex`, + `int64_col`, + `float64_col`, CASE WHEN `int64_col` <> 0 AND `int64_col` * LN(ABS(`int64_col`)) > 43.66827237527655 THEN NULL 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 e789156797b..c4d1056aa2b 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 @@ -6,10 +6,9 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `int64_col` AS `int64_col`, - `float64_col` AS `float64_col`, + `rowindex`, + `int64_col`, + `float64_col`, CAST(ROUND(`int64_col`, 0) AS INT64) AS `int_round_0`, CAST(ROUND(`int64_col`, 1) AS INT64) AS `int_round_1`, CAST(ROUND(`int64_col`, -1) AS INT64) AS `int_round_m1`, 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 544cf2dbff0..514dd02059c 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, SIN(`float64_col`) AS `float64_col` FROM `bfcte_0` \ No newline at end of file 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 1ac71692afb..679da4e84a2 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CASE WHEN ABS(`float64_col`) > 709.78 THEN SIGN(`float64_col`) * CAST('Infinity' AS FLOAT64) 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 6aad0dac445..ac7e7963653 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CASE WHEN `float64_col` < 0 THEN CAST('NaN' AS FLOAT64) ELSE SQRT(`float64_col`) END AS `float64_col` FROM `bfcte_0` \ No newline at end of file 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 dd6157b0025..8790698eccb 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 @@ -6,10 +6,9 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `int64_col` AS `int64_col`, - `bool_col` AS `bool_col`, + `rowindex`, + `int64_col`, + `bool_col`, `int64_col` - `int64_col` AS `int_add_int`, `int64_col` - 1 AS `int_add_1`, `int64_col` - CAST(`bool_col` AS INT64) AS `int_add_bool`, 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 c5306a9d0b5..cc5dab6cf0c 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 @@ -7,11 +7,10 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `timestamp_col` AS `timestamp_col`, - `duration_col` AS `duration_col`, - `date_col` AS `date_col`, + `rowindex`, + `timestamp_col`, + `duration_col`, + `date_col`, TIMESTAMP_SUB(CAST(`date_col` AS DATETIME), INTERVAL `duration_col` MICROSECOND) AS `date_sub_timedelta`, TIMESTAMP_SUB(`timestamp_col`, INTERVAL `duration_col` MICROSECOND) AS `timestamp_sub_timedelta`, TIMESTAMP_DIFF(CAST(`date_col` AS DATETIME), CAST(`date_col` AS DATETIME), MICROSECOND) AS `timestamp_sub_date`, 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 f63d14fc316..fa930bafc9b 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, TAN(`float64_col`) AS `float64_col` FROM `bfcte_0` \ No newline at end of file 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 bf397b55ecf..ea690759d4a 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, TANH(`float64_col`) AS `float64_col` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_unsafe_pow_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_unsafe_pow_op/out.sql index a21e05c708a..7914f508056 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_unsafe_pow_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_unsafe_pow_op/out.sql @@ -6,7 +6,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, POWER(`int64_col`, `int64_col`) AS `int_pow_int`, POWER(`int64_col`, `float64_col`) AS `int_pow_float`, POWER(`float64_col`, `int64_col`) AS `float_pow_int`, 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 2acc0a1057a..6585ce00f90 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CONCAT(`string_col`, 'a') AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 bdcc3f8a8a5..705decc1c08 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, INITCAP(`string_col`, '') AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 a1fc43ec710..f027bd6c5bb 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, ENDS_WITH(`string_col`, 'ab') AS `single`, ENDS_WITH(`string_col`, 'ab') OR ENDS_WITH(`string_col`, 'cd') AS `double`, FALSE AS `empty` 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 8a724f0884f..d242c762454 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, REGEXP_CONTAINS(`string_col`, '^(\\p{N}|\\p{L})+$') AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 ece586a2589..13a02a3b2ae 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, REGEXP_CONTAINS(`string_col`, '^\\p{L}+$') AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 4006a36d56a..94fe8ed39cd 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, REGEXP_CONTAINS(`string_col`, '^(\\p{Nd})+$') AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 c53446715f1..cf044280e39 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, REGEXP_CONTAINS( `string_col`, '^[\\p{Nd}\\x{00B9}\\x{00B2}\\x{00B3}\\x{2070}\\x{2074}-\\x{2079}\\x{2080}-\\x{2089}]+$' 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 aa08afb0c5e..35f9ac10880 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, LOWER(`string_col`) = `string_col` AND UPPER(`string_col`) <> `string_col` AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 f4b99d8ab94..8f8cad43885 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, REGEXP_CONTAINS(`string_col`, '^\\pN+$') AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 39e4571fbe7..62c9687bfd0 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, REGEXP_CONTAINS(`string_col`, '^\\s+$') AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 fb51a4a824e..637f39ee1a3 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, UPPER(`string_col`) = `string_col` AND LOWER(`string_col`) <> `string_col` AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 b939a50f4a6..0fda7c59506 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, LENGTH(`string_col`) AS `string_col` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_len_w_array/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_len_w_array/out.sql index bb4837484b2..3c8e4f4b62f 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_len_w_array/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_len_w_array/out.sql @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ) SELECT - *, ARRAY_LENGTH(`int_list_col`) AS `int_list_col` FROM `bfcte_0` \ No newline at end of file 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 7698dcb1b90..8dcca32bbea 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, LOWER(`string_col`) AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 659e7e471d8..595574b0ea3 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, LTRIM(`string_col`, ' ') AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 2ce5206cd2c..772b3b10bd7 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, REGEXP_REPLACE(`string_col`, 'e', 'a') AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 25254b42bef..be90d2252c1 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, REPLACE(`string_col`, 'e', 'a') AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 b3abbf00478..aafc9805d5c 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, REVERSE(`string_col`) AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 4cd3f1e5b5b..db0761a93cb 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, RTRIM(`string_col`, ' ') AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 fa7fafb8b70..90c794a69ea 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, STARTS_WITH(`string_col`, 'ab') AS `single`, STARTS_WITH(`string_col`, 'ab') OR STARTS_WITH(`string_col`, 'cd') AS `double`, FALSE AS `empty` 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 6dc99718f1e..48d0945cc90 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, `string_col` LIKE '%e%' AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 dde561a9ce0..1207261e441 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, REGEXP_CONTAINS(`string_col`, 'e') AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 7b6364dcccb..6d45e62cfd5 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, IF( REGEXP_CONTAINS(`string_col`, '([a-z]*)'), REGEXP_REPLACE(`string_col`, CONCAT('.*?(', '([a-z]*)', ').*'), '\\1'), 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 3143e763f77..e4e4fc77910 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, INSTR(`string_col`, 'e', 1) - 1 AS `none_none`, INSTR(`string_col`, 'e', 3) - 1 AS `start_none`, INSTR(SUBSTRING(`string_col`, 1, 5), 'e') - 1 AS `none_end`, 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 c18668b5ba3..b23b3424b78 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, IF(SUBSTRING(`string_col`, 2, 1) <> '', SUBSTRING(`string_col`, 2, 1), NULL) AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 7456982cc58..c256f4aa4dd 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, LPAD(`string_col`, GREATEST(LENGTH(`string_col`), 10), '-') AS `left`, RPAD(`string_col`, GREATEST(LENGTH(`string_col`), 10), '-') AS `right`, RPAD( 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 eea25de07d4..50e8e486b66 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, REPEAT(`string_col`, 2) AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 6ccaa676e08..bd63e9184f9 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, SUBSTRING(`string_col`, 2, 2) AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 2acc0a1057a..6585ce00f90 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CONCAT(`string_col`, 'a') AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 919b145949d..687af43d0bf 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, SPLIT(`string_col`, ',') AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 06a8f9c43e7..affa2f66e6b 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, TRIM(`string_col`, ' ') AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 77bc7a5db61..06f832ecae7 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, UPPER(`string_col`) AS `string_col` FROM `bfcte_0` \ No newline at end of file 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 4b8afb716cd..845eeb78678 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, CASE WHEN STARTS_WITH(`string_col`, '-') THEN CONCAT('-', LPAD(SUBSTRING(`string_col`, 2), GREATEST(LENGTH(`string_col`), 10) - 1, '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 1c84a4c7a45..f58553a188c 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`nested_structs_types` ) SELECT - *, `people`.`name` AS `string`, `people`.`name` AS `int` FROM `bfcte_0` \ No newline at end of file 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 0c51de1b191..e95e1c54a5d 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 @@ -7,7 +7,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, STRUCT( `bool_col` AS bool_col, `int64_col` AS int64_col, 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 dbd4ffddc20..187c2cd36bd 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 @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, FLOOR(`int64_col`) AS `int64_col` FROM `bfcte_0` \ No newline at end of file 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 ad377ef9d9e..9f0872c6f5b 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 @@ -6,10 +6,9 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `int64_col` AS `int64_col`, - `float64_col` AS `float64_col`, + `rowindex`, + `int64_col`, + `float64_col`, `int64_col` AS `duration_us`, CAST(FLOOR(`float64_col` * 1000000) AS INT64) AS `duration_s`, `int64_col` * 3600000000 AS `duration_w`, 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 ba19ac8be1e..b1523dd25e8 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 @@ -5,9 +5,8 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - *, - `bool_col` AS `bool_col`, - `int64_too` AS `int64_too`, + `bool_col`, + `int64_too`, `int64_too` AS `bfcol_2`, `bool_col` AS `bfcol_3` FROM `bfcte_0` @@ -22,7 +21,6 @@ WITH `bfcte_0` AS ( `bfcol_3` ) SELECT - *, `bfcol_3` AS `bool_col`, `bfcol_6` AS `int64_too` FROM `bfcte_2` \ No newline at end of file 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 c7df8d27127..02e2260ab84 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 @@ -5,9 +5,8 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - *, - `bool_col` AS `bool_col`, - `int64_too` AS `int64_too`, + `bool_col`, + `int64_too`, `int64_too` AS `bfcol_2`, `bool_col` AS `bfcol_3` FROM `bfcte_0` @@ -20,7 +19,6 @@ WITH `bfcte_0` AS ( `bfcol_3` ) SELECT - *, `bfcol_3` AS `bool_col`, `bfcol_6` AS `int64_too` FROM `bfcte_2` \ No newline at end of file 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 5285dd26842..10c62d49c01 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 @@ -21,7 +21,6 @@ WITH `bfcte_1` AS ( FROM ( ( SELECT - *, `rowindex` AS `bfcol_9`, `rowindex` AS `bfcol_10`, `int64_col` AS `bfcol_11`, @@ -33,7 +32,6 @@ WITH `bfcte_1` AS ( UNION ALL ( SELECT - *, `rowindex` AS `bfcol_24`, `rowindex` AS `bfcol_25`, `int64_col` AS `bfcol_26`, @@ -45,7 +43,6 @@ WITH `bfcte_1` AS ( ) ) SELECT - *, `bfcol_30` AS `rowindex`, `bfcol_31` AS `rowindex_1`, `bfcol_32` AS `int64_col`, 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 b54a7c5bd0e..238233fcdf4 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 @@ -29,7 +29,6 @@ WITH `bfcte_3` AS ( FROM ( ( SELECT - *, `float64_col` AS `bfcol_6`, `int64_col` AS `bfcol_7`, 0 AS `bfcol_8`, @@ -39,7 +38,6 @@ WITH `bfcte_3` AS ( UNION ALL ( SELECT - *, `float64_col` AS `bfcol_17`, `int64_too` AS `bfcol_18`, 1 AS `bfcol_19`, @@ -49,7 +47,6 @@ WITH `bfcte_3` AS ( UNION ALL ( SELECT - *, `float64_col` AS `bfcol_27`, `int64_col` AS `bfcol_28`, 2 AS `bfcol_29`, @@ -59,7 +56,6 @@ WITH `bfcte_3` AS ( UNION ALL ( SELECT - *, `float64_col` AS `bfcol_38`, `int64_too` AS `bfcol_39`, 3 AS `bfcol_40`, @@ -69,7 +65,6 @@ WITH `bfcte_3` AS ( ) ) SELECT - *, `bfcol_42` AS `float64_col`, `bfcol_43` AS `int64_col` FROM `bfcte_4` \ 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 8cb6a643e26..b83eaf65961 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 @@ -12,9 +12,8 @@ WITH `bfcte_0` AS ( LEFT 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 - *, - `rowindex` AS `rowindex`, + `rowindex`, `rowindex` AS `rowindex_1`, - `int_list_col` AS `int_list_col`, - `string_list_col` AS `string_list_col` + `int_list_col`, + `string_list_col` FROM `bfcte_1` \ 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 fc39add1e09..17511dbf646 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 @@ -11,7 +11,6 @@ WITH `bfcte_0` AS ( LEFT JOIN UNNEST(`int_list_col`) AS `bfcol_8` WITH OFFSET AS `bfcol_4` ) SELECT - *, - `rowindex` AS `rowindex`, - `int_list_col` AS `int_list_col` + `rowindex`, + `int_list_col` FROM `bfcte_1` \ 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 f69b4b9de1f..295a6ad2563 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 @@ -5,8 +5,7 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, + `rowindex`, `rowindex` AS `rowindex_1`, - `int64_col` AS `int64_col` + `int64_col` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats/out.sql index 728f773bf59..289aae03977 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats/out.sql @@ -4,47 +4,46 @@ WITH `bfcte_0` AS ( FROM UNNEST(ARRAY>[STRUCT('POINT(1 1)', 0)]) ) SELECT - *, ST_REGIONSTATS( `bfcol_0`, 'ee://some/raster/uri', band => 'band1', include => 'some equation', options => JSON '{"scale": 100}' - ).`min` AS `min`, + ).`min`, ST_REGIONSTATS( `bfcol_0`, 'ee://some/raster/uri', band => 'band1', include => 'some equation', options => JSON '{"scale": 100}' - ).`max` AS `max`, + ).`max`, ST_REGIONSTATS( `bfcol_0`, 'ee://some/raster/uri', band => 'band1', include => 'some equation', options => JSON '{"scale": 100}' - ).`sum` AS `sum`, + ).`sum`, ST_REGIONSTATS( `bfcol_0`, 'ee://some/raster/uri', band => 'band1', include => 'some equation', options => JSON '{"scale": 100}' - ).`count` AS `count`, + ).`count`, ST_REGIONSTATS( `bfcol_0`, 'ee://some/raster/uri', band => 'band1', include => 'some equation', options => JSON '{"scale": 100}' - ).`mean` AS `mean`, + ).`mean`, ST_REGIONSTATS( `bfcol_0`, 'ee://some/raster/uri', band => 'band1', include => 'some equation', options => JSON '{"scale": 100}' - ).`area` AS `area` + ).`area` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats_without_optional_args/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats_without_optional_args/out.sql index cbeaf97f0b3..cfef8cc5350 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats_without_optional_args/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats_without_optional_args/out.sql @@ -4,11 +4,10 @@ WITH `bfcte_0` AS ( FROM UNNEST(ARRAY>[STRUCT('POINT(1 1)', 0)]) ) SELECT - *, - ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`min` AS `min`, - ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`max` AS `max`, - ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`sum` AS `sum`, - ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`count` AS `count`, - ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`mean` AS `mean`, - ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`area` AS `area` + ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`min`, + ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`max`, + ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`sum`, + ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`count`, + ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`mean`, + ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`area` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_simplify/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_simplify/out.sql index a1b8ffaf782..aacaa7ed759 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_simplify/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_simplify/out.sql @@ -4,6 +4,5 @@ WITH `bfcte_0` AS ( FROM UNNEST(ARRAY>[STRUCT('POINT(1 1)', 0)]) ) SELECT - *, ST_SIMPLIFY(`bfcol_0`, 123.125) AS `0` FROM `bfcte_0` \ No newline at end of file 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 eb03d1ffc77..77aef6ad8bb 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 @@ -5,7 +5,6 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT - *, `rowindex` AS `bfcol_2`, `int64_col` AS `bfcol_3` FROM `bfcte_1` @@ -27,7 +26,6 @@ WITH `bfcte_1` AS ( 1 FROM ( SELECT - *, `int64_too` AS `bfcol_4` FROM `bfcte_2` ) AS `bft_0` @@ -38,7 +36,6 @@ WITH `bfcte_1` AS ( FROM `bfcte_3` ) SELECT - *, `bfcol_2` AS `rowindex`, `bfcol_5` AS `int64_col` 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 0d59abe7da9..8089c5b462b 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 @@ -5,7 +5,6 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT - *, `rowindex` AS `bfcol_2`, `rowindex_2` AS `bfcol_3` FROM `bfcte_1` @@ -24,14 +23,12 @@ WITH `bfcte_1` AS ( `bfcte_3`.*, `bfcte_3`.`bfcol_3` IN (( SELECT - *, `rowindex_2` AS `bfcol_4` FROM `bfcte_2` )) AS `bfcol_5` FROM `bfcte_3` ) SELECT - *, `bfcol_2` AS `rowindex`, `bfcol_5` AS `rowindex_2` 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 3494677c81c..3a7ff60d3ee 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 @@ -5,7 +5,6 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT - *, `rowindex` AS `bfcol_2`, `int64_col` AS `bfcol_3` FROM `bfcte_1` @@ -16,7 +15,6 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT - *, `int64_col` AS `bfcol_6`, `int64_too` AS `bfcol_7` FROM `bfcte_0` @@ -29,7 +27,6 @@ WITH `bfcte_1` AS ( AND COALESCE(`bfcol_2`, 1) = COALESCE(`bfcol_6`, 1) ) SELECT - *, `bfcol_3` AS `int64_col`, `bfcol_7` AS `int64_too` 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/bool_col/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/bool_col/out.sql index 79d447cac87..30f363e900e 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 @@ -5,7 +5,6 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT - *, `rowindex` AS `bfcol_2`, `bool_col` AS `bfcol_3` FROM `bfcte_1` @@ -16,7 +15,6 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT - *, `rowindex` AS `bfcol_6`, `bool_col` AS `bfcol_7` FROM `bfcte_0` @@ -29,7 +27,6 @@ WITH `bfcte_1` AS ( AND COALESCE(CAST(`bfcol_3` AS STRING), '1') = COALESCE(CAST(`bfcol_7` AS STRING), '1') ) SELECT - *, `bfcol_2` AS `rowindex_x`, `bfcol_3` AS `bool_col`, `bfcol_6` AS `rowindex_y` 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 2bec1fddc69..9fa7673fb31 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 @@ -5,7 +5,6 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT - *, `rowindex` AS `bfcol_2`, `float64_col` AS `bfcol_3` FROM `bfcte_1` @@ -16,7 +15,6 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT - *, `rowindex` AS `bfcol_6`, `float64_col` AS `bfcol_7` FROM `bfcte_0` @@ -29,7 +27,6 @@ WITH `bfcte_1` AS ( AND IF(IS_NAN(`bfcol_3`), 3, COALESCE(`bfcol_3`, 1)) = IF(IS_NAN(`bfcol_7`), 3, COALESCE(`bfcol_7`, 1)) ) SELECT - *, `bfcol_2` AS `rowindex_x`, `bfcol_3` AS `float64_col`, `bfcol_6` AS `rowindex_y` 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 1063b09d344..c9fca069d6a 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 @@ -5,7 +5,6 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT - *, `rowindex` AS `bfcol_2`, `int64_col` AS `bfcol_3` FROM `bfcte_1` @@ -16,7 +15,6 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT - *, `rowindex` AS `bfcol_6`, `int64_col` AS `bfcol_7` FROM `bfcte_0` @@ -29,7 +27,6 @@ WITH `bfcte_1` AS ( AND COALESCE(`bfcol_3`, 1) = COALESCE(`bfcol_7`, 1) ) SELECT - *, `bfcol_2` AS `rowindex_x`, `bfcol_3` AS `int64_col`, `bfcol_6` AS `rowindex_y` 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 191a785f452..88649c65188 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 @@ -5,7 +5,6 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT - *, `rowindex` AS `bfcol_2`, `numeric_col` AS `bfcol_3` FROM `bfcte_1` @@ -16,7 +15,6 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT - *, `rowindex` AS `bfcol_6`, `numeric_col` AS `bfcol_7` FROM `bfcte_0` @@ -29,7 +27,6 @@ WITH `bfcte_1` AS ( AND COALESCE(`bfcol_3`, CAST(1 AS NUMERIC)) = COALESCE(`bfcol_7`, CAST(1 AS NUMERIC)) ) SELECT - *, `bfcol_2` AS `rowindex_x`, `bfcol_3` AS `numeric_col`, `bfcol_6` AS `rowindex_y` 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 4bbcd729b1c..8758ec8340e 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 @@ -5,7 +5,6 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT - *, `rowindex` AS `bfcol_0`, `string_col` AS `bfcol_1` FROM `bfcte_1` @@ -16,7 +15,6 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT - *, `rowindex` AS `bfcol_4`, `string_col` AS `bfcol_5` FROM `bfcte_0` @@ -29,7 +27,6 @@ WITH `bfcte_1` AS ( AND COALESCE(CAST(`bfcol_1` AS STRING), '1') = COALESCE(CAST(`bfcol_5` AS STRING), '1') ) SELECT - *, `bfcol_0` AS `rowindex_x`, `bfcol_1` AS `string_col`, `bfcol_4` AS `rowindex_y` 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 17ccff058cf..42fc15cd1d4 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 @@ -5,7 +5,6 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT - *, `rowindex` AS `bfcol_0`, `time_col` AS `bfcol_1` FROM `bfcte_1` @@ -16,7 +15,6 @@ WITH `bfcte_1` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT - *, `rowindex` AS `bfcol_4`, `time_col` AS `bfcol_5` FROM `bfcte_0` @@ -29,7 +27,6 @@ WITH `bfcte_1` AS ( AND COALESCE(CAST(`bfcol_1` AS STRING), '1') = COALESCE(CAST(`bfcol_5` AS STRING), '1') ) SELECT - *, `bfcol_0` AS `rowindex_x`, `bfcol_1` AS `time_col`, `bfcol_4` AS `rowindex_y` diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_random_sample/test_compile_random_sample/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_random_sample/test_compile_random_sample/out.sql index 02dbd3adc5c..aaaddc49fee 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_random_sample/test_compile_random_sample/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_random_sample/test_compile_random_sample/out.sql @@ -164,7 +164,6 @@ WITH `bfcte_0` AS ( `bfcol_16` < 0.1 ) SELECT - *, `bfcol_0` AS `bool_col`, `bfcol_1` AS `bytes_col`, `bfcol_2` AS `date_col`, diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal/out.sql index 2663f8f6c26..7de2ca06322 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal/out.sql @@ -166,7 +166,6 @@ WITH `bfcte_0` AS ( )]) ) SELECT - *, `bfcol_0` AS `rowindex`, `bfcol_1` AS `bool_col`, `bfcol_2` AS `bytes_col`, diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_json_df/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_json_df/out.sql index b201b79b770..34fc576d408 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_json_df/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_json_df/out.sql @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM UNNEST(ARRAY>[STRUCT(0, PARSE_JSON('null'), 0), STRUCT(1, PARSE_JSON('true'), 1), STRUCT(2, PARSE_JSON('100'), 2), STRUCT(3, PARSE_JSON('0.98'), 3), STRUCT(4, PARSE_JSON('"a string"'), 4), STRUCT(5, PARSE_JSON('[]'), 5), STRUCT(6, PARSE_JSON('[1,2,3]'), 6), STRUCT(7, PARSE_JSON('[{"a":1},{"a":2},{"a":null},{}]'), 7), STRUCT(8, PARSE_JSON('"100"'), 8), STRUCT(9, PARSE_JSON('{"date":"2024-07-16"}'), 9), STRUCT(10, PARSE_JSON('{"int_value":2,"null_filed":null}'), 10), STRUCT(11, PARSE_JSON('{"list_data":[10,20,30]}'), 11)]) ) SELECT - *, `bfcol_0` AS `rowindex`, `bfcol_1` AS `json_col` FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_lists_df/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_lists_df/out.sql index 5a9df6bea46..1ba602f2056 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_lists_df/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_lists_df/out.sql @@ -34,7 +34,6 @@ WITH `bfcte_0` AS ( )]) ) SELECT - *, `bfcol_0` AS `rowindex`, `bfcol_1` AS `int_list_col`, `bfcol_2` AS `bool_list_col`, diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_special_values/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_special_values/out.sql index 2ddf958efca..02ea0785fb6 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_special_values/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_special_values/out.sql @@ -13,7 +13,6 @@ WITH `bfcte_0` AS ( ), STRUCT(1.0, 1.0, 1.0, 1.0, STRUCT(1 AS `foo`), STRUCT(1 AS `foo`), [1, 2], 1), STRUCT(2.0, 2.0, 2.0, 2.0, STRUCT(2 AS `foo`), STRUCT(2 AS `foo`), [3, 4], 2)]) ) SELECT - *, `bfcol_0` AS `col_none`, `bfcol_1` AS `col_inf`, `bfcol_2` AS `col_neginf`, diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_structs_df/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_structs_df/out.sql index 6b360de47c3..54d1a1bb2b3 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_structs_df/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_structs_df/out.sql @@ -20,7 +20,6 @@ WITH `bfcte_0` AS ( )]) ) SELECT - *, `bfcol_0` AS `id`, `bfcol_1` AS `person` FROM `bfcte_0` \ 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 778c752668f..959a31a2a35 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 @@ -18,21 +18,20 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `bool_col` AS `bool_col`, - `bytes_col` AS `bytes_col`, - `date_col` AS `date_col`, - `datetime_col` AS `datetime_col`, - `geography_col` AS `geography_col`, - `int64_col` AS `int64_col`, - `int64_too` AS `int64_too`, - `numeric_col` AS `numeric_col`, - `float64_col` AS `float64_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` AS `rowindex_2`, - `string_col` AS `string_col`, - `time_col` AS `time_col`, - `timestamp_col` AS `timestamp_col`, - `duration_col` AS `duration_col` + `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_columns_filters/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_columns_filters/out.sql index 74a8473d3b0..0d8a10c9566 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_columns_filters/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_columns_filters/out.sql @@ -8,8 +8,7 @@ WITH `bfcte_0` AS ( `rowindex` > 0 AND `string_col` IN ('Hello, World!') ) SELECT - *, - `rowindex` AS `rowindex`, - `int64_col` AS `int64_col`, - `string_col` AS `string_col` + `rowindex`, + `int64_col`, + `string_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 d1d9425e976..4b5750d7aaf 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 @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`json_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `json_col` 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 4d2aa555be9..6e19ae67883 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 @@ -5,8 +5,7 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `int64_col` AS `int64_col` + `rowindex`, + `int64_col` FROM `bfcte_0` 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 5684d7ae13f..79ae1ac9072 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 @@ -5,8 +5,7 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`nested_structs_types` ) SELECT - *, - `id` AS `id`, + `id`, `id` AS `id_1`, - `people` AS `people` + `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 0cdb7136456..4cef7fe289a 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 @@ -5,7 +5,6 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, - `int64_col` AS `int64_col` + `rowindex`, + `int64_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_repeated_types/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_repeated_types/out.sql index 5f1e6d50bf8..a22c845ef1c 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 @@ -11,14 +11,13 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ) SELECT - *, - `rowindex` AS `rowindex`, + `rowindex`, `rowindex` AS `rowindex_1`, - `int_list_col` AS `int_list_col`, - `bool_list_col` AS `bool_list_col`, - `float_list_col` AS `float_list_col`, - `date_list_col` AS `date_list_col`, - `date_time_list_col` AS `date_time_list_col`, - `numeric_list_col` AS `numeric_list_col`, - `string_list_col` AS `string_list_col` + `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_readtable/test_compile_readtable_w_system_time/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_system_time/out.sql index 77408078bda..59c36870803 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_system_time/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_system_time/out.sql @@ -18,20 +18,19 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` FOR SYSTEM_TIME AS OF '2025-11-09T03:04:05.678901+00:00' ) SELECT - *, - `bool_col` AS `bool_col`, - `bytes_col` AS `bytes_col`, - `date_col` AS `date_col`, - `datetime_col` AS `datetime_col`, - `geography_col` AS `geography_col`, - `int64_col` AS `int64_col`, - `int64_too` AS `int64_too`, - `numeric_col` AS `numeric_col`, - `float64_col` AS `float64_col`, - `rowindex` AS `rowindex`, - `rowindex_2` AS `rowindex_2`, - `string_col` AS `string_col`, - `time_col` AS `time_col`, - `timestamp_col` AS `timestamp_col`, - `duration_col` AS `duration_col` + `bool_col`, + `bytes_col`, + `date_col`, + `datetime_col`, + `geography_col`, + `int64_col`, + `int64_too`, + `numeric_col`, + `float64_col`, + `rowindex`, + `rowindex_2`, + `string_col`, + `time_col`, + `timestamp_col`, + `duration_col` FROM `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 464eecdb159..a0a50c79e2a 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 @@ -6,9 +6,8 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `bool_col` AS `bool_col`, - `rowindex` AS `rowindex`, + `bool_col`, + `rowindex`, CASE WHEN COALESCE( SUM(CAST(NOT `bool_col` IS NULL AS INT64)) OVER ( 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 689aa4bb7d2..ef3c244749d 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 @@ -4,7 +4,6 @@ WITH `bfcte_0` AS ( FROM UNNEST(ARRAY>[STRUCT(CAST('2025-01-01T00:00:00+00:00' AS TIMESTAMP), 0, 0), STRUCT(CAST('2025-01-01T00:00:01+00:00' AS TIMESTAMP), 1, 1), STRUCT(CAST('2025-01-01T00:00:02+00:00' AS TIMESTAMP), 2, 2), STRUCT(CAST('2025-01-01T00:00:03+00:00' AS TIMESTAMP), 3, 3), STRUCT(CAST('2025-01-01T00:00:04+00:00' AS TIMESTAMP), 0, 4), STRUCT(CAST('2025-01-01T00:00:05+00:00' AS TIMESTAMP), 1, 5), STRUCT(CAST('2025-01-01T00:00:06+00:00' AS TIMESTAMP), 2, 6), STRUCT(CAST('2025-01-01T00:00:07+00:00' AS TIMESTAMP), 3, 7), STRUCT(CAST('2025-01-01T00:00:08+00:00' AS TIMESTAMP), 0, 8), STRUCT(CAST('2025-01-01T00:00:09+00:00' AS TIMESTAMP), 1, 9), STRUCT(CAST('2025-01-01T00:00:10+00:00' AS TIMESTAMP), 2, 10), STRUCT(CAST('2025-01-01T00:00:11+00:00' AS TIMESTAMP), 3, 11), STRUCT(CAST('2025-01-01T00:00:12+00:00' AS TIMESTAMP), 0, 12), STRUCT(CAST('2025-01-01T00:00:13+00:00' AS TIMESTAMP), 1, 13), STRUCT(CAST('2025-01-01T00:00:14+00:00' AS TIMESTAMP), 2, 14), STRUCT(CAST('2025-01-01T00:00:15+00:00' AS TIMESTAMP), 3, 15), STRUCT(CAST('2025-01-01T00:00:16+00:00' AS TIMESTAMP), 0, 16), STRUCT(CAST('2025-01-01T00:00:17+00:00' AS TIMESTAMP), 1, 17), STRUCT(CAST('2025-01-01T00:00:18+00:00' AS TIMESTAMP), 2, 18), STRUCT(CAST('2025-01-01T00:00:19+00:00' AS TIMESTAMP), 3, 19)]) ) SELECT - *, `bfcol_0` AS `ts_col`, CASE WHEN COALESCE( 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 aa216a681d8..b10c822f5c2 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 @@ -5,8 +5,7 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, + `rowindex`, CASE WHEN COALESCE( SUM(CAST(NOT `int64_col` IS NULL AS INT64)) OVER (ORDER BY `rowindex` ASC NULLS LAST ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), 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 09694d7d89d..f83e368d713 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 @@ -5,8 +5,7 @@ WITH `bfcte_0` AS ( FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT - *, - `rowindex` AS `rowindex`, + `rowindex`, CASE WHEN COUNT(NOT `int64_col` IS NULL) OVER (ORDER BY `rowindex` ASC NULLS LAST ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) < 5 THEN NULL From a005129569d44f614b2539413e86e65b55b48c17 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Fri, 6 Feb 2026 01:15:23 +0000 Subject: [PATCH 3/6] improve data source handling, compile predicates again --- bigframes/core/compile/sqlglot/compiler.py | 12 ++-- bigframes/core/compile/sqlglot/sqlglot_ir.py | 17 ++--- bigframes/core/rewrite/as_sql.py | 45 ++++++------ bigframes/core/sql_nodes.py | 72 ++++++++++++++++---- 4 files changed, 98 insertions(+), 48 deletions(-) diff --git a/bigframes/core/compile/sqlglot/compiler.py b/bigframes/core/compile/sqlglot/compiler.py index ae0b6075554..d4a202d4ba3 100644 --- a/bigframes/core/compile/sqlglot/compiler.py +++ b/bigframes/core/compile/sqlglot/compiler.py @@ -141,7 +141,7 @@ def _compile_node( @_compile_node.register -def compile_sql_select(node: sql_nodes.SelectNode, child: ir.SQLGlotIR): +def compile_sql_select(node: sql_nodes.SqlSelectNode, child: ir.SQLGlotIR): sqlglot_ir = child if node.sorting is not None: ordering_cols = tuple( @@ -165,6 +165,12 @@ def compile_sql_select(node: sql_nodes.SelectNode, child: ir.SQLGlotIR): ) sqlglot_ir = sqlglot_ir.select(projected_cols) + if len(node.predicates) > 0: + sge_predicates = tuple( + scalar_compiler.scalar_op_compiler.compile_expression(expression) + for expression in node.predicates + ) + sqlglot_ir = sqlglot_ir.filter(sge_predicates) if node.limit is not None: sqlglot_ir = sqlglot_ir.limit(node.limit) @@ -185,14 +191,12 @@ def compile_readlocal(node: nodes.ReadLocalNode, child: ir.SQLGlotIR) -> ir.SQLG @_compile_node.register -def compile_readtable(node: nodes.ReadTableNode, child: ir.SQLGlotIR): +def compile_readtable(node: sql_nodes.SqlDataSource, child: ir.SQLGlotIR): table = node.source.table return ir.SQLGlotIR.from_table( table.project_id, table.dataset_id, table.table_id, - col_names=[col.source_id for col in node.scan_list.items], - alias_names=[col.id.sql for col in node.scan_list.items], uid_gen=child.uid_gen, sql_predicate=node.source.sql_predicate, system_time=node.source.at_time, diff --git a/bigframes/core/compile/sqlglot/sqlglot_ir.py b/bigframes/core/compile/sqlglot/sqlglot_ir.py index ad5da31206a..be4056f53cd 100644 --- a/bigframes/core/compile/sqlglot/sqlglot_ir.py +++ b/bigframes/core/compile/sqlglot/sqlglot_ir.py @@ -116,8 +116,6 @@ def from_table( project_id: str, dataset_id: str, table_id: str, - col_names: typing.Sequence[str], - alias_names: typing.Sequence[str], uid_gen: guid.SequentialUIDGenerator, sql_predicate: typing.Optional[str] = None, system_time: typing.Optional[datetime.datetime] = None, @@ -134,15 +132,6 @@ def from_table( sql_predicate (typing.Optional[str]): An optional SQL predicate for filtering. system_time (typing.Optional[str]): An optional system time for time-travel queries. """ - selections = [ - sge.Alias( - this=sge.to_identifier(col_name, quoted=cls.quoted), - alias=sge.to_identifier(alias_name, quoted=cls.quoted), - ) - if col_name != alias_name - else sge.to_identifier(col_name, quoted=cls.quoted) - for col_name, alias_name in zip(col_names, alias_names) - ] version = ( sge.Version( this="TIMESTAMP", @@ -158,12 +147,14 @@ def from_table( catalog=sg.to_identifier(project_id, quoted=cls.quoted), version=version, ) - select_expr = sge.Select().select(*selections).from_(table_expr) if sql_predicate: + select_expr = sge.Select().select(sge.Star()).from_(table_expr) select_expr = select_expr.where( sg.parse_one(sql_predicate, dialect="bigquery"), append=False ) - return cls(expr=select_expr, uid_gen=uid_gen) + return cls(expr=select_expr, uid_gen=uid_gen) + + return cls(expr=table_expr, uid_gen=uid_gen) @classmethod def from_query_string( diff --git a/bigframes/core/rewrite/as_sql.py b/bigframes/core/rewrite/as_sql.py index 307fffa691e..3fd7c48aead 100644 --- a/bigframes/core/rewrite/as_sql.py +++ b/bigframes/core/rewrite/as_sql.py @@ -1,4 +1,4 @@ -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -27,14 +27,14 @@ import bigframes.core.rewrite -def _limit(select: sql_nodes.SelectNode, limit: int) -> sql_nodes.SelectNode: +def _limit(select: sql_nodes.SqlSelectNode, limit: int) -> sql_nodes.SqlSelectNode: new_limit = limit if select.limit is None else min([select.limit, limit]) return dataclasses.replace(select, limit=new_limit) def _try_sort( - select: sql_nodes.SelectNode, sort_by: Sequence[ordering.OrderingExpression] -) -> Optional[sql_nodes.SelectNode]: + select: sql_nodes.SqlSelectNode, sort_by: Sequence[ordering.OrderingExpression] +) -> Optional[sql_nodes.SqlSelectNode]: new_order_exprs = [] for sort_expr in sort_by: new_expr = _try_bind( @@ -50,8 +50,8 @@ def _try_sort( def _sort( node: nodes.BigFrameNode, sort_by: Sequence[ordering.OrderingExpression] -) -> sql_nodes.SelectNode: - if isinstance(node, sql_nodes.SelectNode): +) -> sql_nodes.SqlSelectNode: + if isinstance(node, sql_nodes.SqlSelectNode): merged = _try_sort(node, sort_by) if merged: return merged @@ -73,8 +73,8 @@ def _try_bind( def _try_add_cdefs( - select: sql_nodes.SelectNode, cdefs: Sequence[nodes.ColumnDef] -) -> Optional[sql_nodes.SelectNode]: + select: sql_nodes.SqlSelectNode, cdefs: Sequence[nodes.ColumnDef] +) -> Optional[sql_nodes.SqlSelectNode]: # TODO: add up complexity measure while inlining refs new_defs = [] for cdef in cdefs: @@ -91,8 +91,8 @@ def _try_add_cdefs( def _add_cdefs( node: nodes.BigFrameNode, cdefs: Sequence[nodes.ColumnDef] -) -> sql_nodes.SelectNode: - if isinstance(node, sql_nodes.SelectNode): +) -> sql_nodes.SqlSelectNode: + if isinstance(node, sql_nodes.SqlSelectNode): merged = _try_add_cdefs(node, cdefs) if merged: return merged @@ -103,8 +103,8 @@ def _add_cdefs( def _try_add_filter( - select: sql_nodes.SelectNode, predicates: Sequence[expression.Expression] -) -> Optional[sql_nodes.SelectNode]: + select: sql_nodes.SqlSelectNode, predicates: Sequence[expression.Expression] +) -> Optional[sql_nodes.SqlSelectNode]: # Constraint: filters can only be merged if they are scalar expression after binding new_predicates = [] # bind variables, merge predicates @@ -118,8 +118,8 @@ def _try_add_filter( def _add_filter( node: nodes.BigFrameNode, predicates: Sequence[expression.Expression] -) -> sql_nodes.SelectNode: - if isinstance(node, sql_nodes.SelectNode): +) -> sql_nodes.SqlSelectNode: + if isinstance(node, sql_nodes.SqlSelectNode): result = _try_add_filter(node, predicates) if result: return result @@ -128,8 +128,8 @@ def _add_filter( return new_node -def _create_noop_select(node: nodes.BigFrameNode) -> sql_nodes.SelectNode: - return sql_nodes.SelectNode( +def _create_noop_select(node: nodes.BigFrameNode) -> sql_nodes.SqlSelectNode: + return sql_nodes.SqlSelectNode( node, selections=tuple( nodes.ColumnDef(expression.ResolvedDerefOp.from_field(field), field.id) @@ -139,7 +139,7 @@ def _create_noop_select(node: nodes.BigFrameNode) -> sql_nodes.SelectNode: def _try_remap_select_cols( - select: sql_nodes.SelectNode, cols: Sequence[nodes.AliasedRef] + select: sql_nodes.SqlSelectNode, cols: Sequence[nodes.AliasedRef] ): new_defs = [] for aliased_ref in cols: @@ -151,7 +151,7 @@ def _try_remap_select_cols( def _remap_select_cols(node: nodes.BigFrameNode, cols: Sequence[nodes.AliasedRef]): - if isinstance(node, sql_nodes.SelectNode): + if isinstance(node, sql_nodes.SqlSelectNode): result = _try_remap_select_cols(node, cols) if result: return result @@ -183,7 +183,14 @@ def _get_added_cdefs(node: Union[nodes.ProjectionNode, nodes.WindowOpNode]): def _as_sql_node(node: nodes.BigFrameNode) -> nodes.BigFrameNode: # case one, can be converted to select - if isinstance(node, (nodes.ProjectionNode, nodes.WindowOpNode)): + if isinstance(node, nodes.ReadTableNode): + leaf = sql_nodes.SqlDataSource(source=node.source) + mappings = [ + nodes.AliasedRef(expression.deref(scan_item.source_id), scan_item.id) + for scan_item in node.scan_list.items + ] + return _remap_select_cols(leaf, mappings) + elif isinstance(node, (nodes.ProjectionNode, nodes.WindowOpNode)): cdefs = _get_added_cdefs(node) return _add_cdefs(node.child, cdefs) elif isinstance(node, (nodes.SelectionNode)): diff --git a/bigframes/core/sql_nodes.py b/bigframes/core/sql_nodes.py index d58add355da..afa7f8b369e 100644 --- a/bigframes/core/sql_nodes.py +++ b/bigframes/core/sql_nodes.py @@ -1,4 +1,4 @@ -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,26 +18,74 @@ import functools from typing import Mapping, Optional, Sequence, Tuple -from bigframes.core import identifiers, nodes +from bigframes.core import bq_data, identifiers, nodes import bigframes.core.expression as ex from bigframes.core.ordering import OrderingExpression import bigframes.dtypes -# A fixed number of variable to assume for overhead on some operations -OVERHEAD_VARIABLES = 5 +# TODO: Join node, union node +@dataclasses.dataclass(frozen=True) +class SqlDataSource(nodes.LeafNode): + source: bq_data.BigqueryDataSource + + @functools.cached_property + def fields(self) -> Sequence[nodes.Field]: + return tuple( + nodes.Field( + identifiers.ColumnId(source_id), + self.source.schema.get_type(source_id), + self.source.table.schema_by_id[source_id].is_nullable, + ) + for source_id in self.source.schema.names + ) + + @property + def variables_introduced(self) -> int: + # This operation only renames variables, doesn't actually create new ones + return 0 + + @property + def defines_namespace(self) -> bool: + return True + + @property + def explicitly_ordered(self) -> bool: + return False + + @property + def order_ambiguous(self) -> bool: + return True + + @property + def row_count(self) -> Optional[int]: + return self.source.n_rows + + @property + def node_defined_ids(self) -> Tuple[identifiers.ColumnId, ...]: + return tuple(self.ids) + + @property + def consumed_ids(self): + return () -@dataclasses.dataclass(frozen=True, eq=True) -class ColumnDef: - expression: ex.Expression - id: identifiers.ColumnId + @property + def _node_expressions(self): + return () + def remap_vars( + self, mappings: Mapping[identifiers.ColumnId, identifiers.ColumnId] + ) -> SqlSelectNode: + raise NotImplementedError() -# TODO: Raw data source node, join node, union node + def remap_refs( + self, mappings: Mapping[identifiers.ColumnId, identifiers.ColumnId] + ) -> SqlSelectNode: + raise NotImplementedError() # type: ignore @dataclasses.dataclass(frozen=True) -class SelectNode(nodes.UnaryNode): +class SqlSelectNode(nodes.UnaryNode): selections: tuple[nodes.ColumnDef, ...] = () predicates: tuple[ex.Expression, ...] = () sorting: tuple[OrderingExpression, ...] = () @@ -106,10 +154,10 @@ def get_id_mapping(self) -> dict[identifiers.ColumnId, ex.Expression]: def remap_vars( self, mappings: Mapping[identifiers.ColumnId, identifiers.ColumnId] - ) -> SelectNode: + ) -> SqlSelectNode: raise NotImplementedError() def remap_refs( self, mappings: Mapping[identifiers.ColumnId, identifiers.ColumnId] - ) -> SelectNode: + ) -> SqlSelectNode: raise NotImplementedError() # type: ignore From 27180daf517008244acb6d4e735352ff33fd6257 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Fri, 6 Feb 2026 01:43:27 +0000 Subject: [PATCH 4/6] cte logic, cleanup --- .../compile/sqlglot/aggregate_compiler.py | 10 +- .../compile/sqlglot/aggregations/windows.py | 6 +- bigframes/core/compile/sqlglot/compiler.py | 48 ++-- .../compile/sqlglot/expression_compiler.py | 16 +- .../compile/sqlglot/expressions/ai_ops.py | 4 +- .../compile/sqlglot/expressions/array_ops.py | 6 +- .../compile/sqlglot/expressions/blob_ops.py | 6 +- .../compile/sqlglot/expressions/bool_ops.py | 4 +- .../sqlglot/expressions/comparison_ops.py | 6 +- .../compile/sqlglot/expressions/date_ops.py | 4 +- .../sqlglot/expressions/datetime_ops.py | 6 +- .../sqlglot/expressions/generic_ops.py | 10 +- .../compile/sqlglot/expressions/geo_ops.py | 6 +- .../compile/sqlglot/expressions/json_ops.py | 6 +- .../sqlglot/expressions/numeric_ops.py | 6 +- .../compile/sqlglot/expressions/string_ops.py | 6 +- .../compile/sqlglot/expressions/struct_ops.py | 6 +- .../sqlglot/expressions/timedelta_ops.py | 4 +- .../core/compile/sqlglot/scalar_compiler.py | 231 ------------------ bigframes/core/compile/sqlglot/sqlglot_ir.py | 133 ++++------ .../compile/sqlglot/test_scalar_compiler.py | 20 +- 21 files changed, 133 insertions(+), 411 deletions(-) delete mode 100644 bigframes/core/compile/sqlglot/scalar_compiler.py diff --git a/bigframes/core/compile/sqlglot/aggregate_compiler.py b/bigframes/core/compile/sqlglot/aggregate_compiler.py index d2ecfaade01..f86e2af0dee 100644 --- a/bigframes/core/compile/sqlglot/aggregate_compiler.py +++ b/bigframes/core/compile/sqlglot/aggregate_compiler.py @@ -22,8 +22,8 @@ ordered_unary_compiler, unary_compiler, ) +import bigframes.core.compile.sqlglot.expression_compiler as expression_compiler from bigframes.core.compile.sqlglot.expressions import typed_expr -import bigframes.core.compile.sqlglot.scalar_compiler as scalar_compiler def compile_aggregate( @@ -35,7 +35,7 @@ def compile_aggregate( return nullary_compiler.compile(aggregate.op) if isinstance(aggregate, agg_expressions.UnaryAggregation): column = typed_expr.TypedExpr( - scalar_compiler.scalar_op_compiler.compile_expression(aggregate.arg), + expression_compiler.expression_compiler.compile_expression(aggregate.arg), aggregate.arg.output_type, ) if not aggregate.op.order_independent: @@ -46,11 +46,11 @@ def compile_aggregate( return unary_compiler.compile(aggregate.op, column) elif isinstance(aggregate, agg_expressions.BinaryAggregation): left = typed_expr.TypedExpr( - scalar_compiler.scalar_op_compiler.compile_expression(aggregate.left), + expression_compiler.expression_compiler.compile_expression(aggregate.left), aggregate.left.output_type, ) right = typed_expr.TypedExpr( - scalar_compiler.scalar_op_compiler.compile_expression(aggregate.right), + expression_compiler.expression_compiler.compile_expression(aggregate.right), aggregate.right.output_type, ) return binary_compiler.compile(aggregate.op, left, right) @@ -66,7 +66,7 @@ def compile_analytic( return nullary_compiler.compile(aggregate.op, window) if isinstance(aggregate, agg_expressions.UnaryAggregation): column = typed_expr.TypedExpr( - scalar_compiler.scalar_op_compiler.compile_expression(aggregate.arg), + expression_compiler.expression_compiler.compile_expression(aggregate.arg), aggregate.arg.output_type, ) return unary_compiler.compile(aggregate.op, column, window) diff --git a/bigframes/core/compile/sqlglot/aggregations/windows.py b/bigframes/core/compile/sqlglot/aggregations/windows.py index 9c327885850..0fad50046bc 100644 --- a/bigframes/core/compile/sqlglot/aggregations/windows.py +++ b/bigframes/core/compile/sqlglot/aggregations/windows.py @@ -18,7 +18,7 @@ import bigframes_vendored.sqlglot.expressions as sge from bigframes.core import utils, window_spec -import bigframes.core.compile.sqlglot.scalar_compiler as scalar_compiler +import bigframes.core.compile.sqlglot.expression_compiler as expression_compiler import bigframes.core.expression as ex import bigframes.core.ordering as ordering_spec import bigframes.dtypes as dtypes @@ -116,7 +116,7 @@ def get_window_order_by( order_by = [] for ordering_spec_item in ordering: - expr = scalar_compiler.scalar_op_compiler.compile_expression( + expr = expression_compiler.expression_compiler.compile_expression( ordering_spec_item.scalar_expression ) desc = not ordering_spec_item.direction.is_ascending @@ -191,7 +191,7 @@ def _get_window_bounds( def _compile_group_by_key(key: ex.Expression) -> sge.Expression: - expr = scalar_compiler.scalar_op_compiler.compile_expression(key) + expr = expression_compiler.expression_compiler.compile_expression(key) # The group_by keys has been rewritten by bind_schema_to_node assert isinstance(key, ex.ResolvedDerefOp) diff --git a/bigframes/core/compile/sqlglot/compiler.py b/bigframes/core/compile/sqlglot/compiler.py index d4a202d4ba3..ba4390916c8 100644 --- a/bigframes/core/compile/sqlglot/compiler.py +++ b/bigframes/core/compile/sqlglot/compiler.py @@ -31,8 +31,8 @@ from bigframes.core.compile import configs import bigframes.core.compile.sqlglot.aggregate_compiler as aggregate_compiler from bigframes.core.compile.sqlglot.aggregations import windows +import bigframes.core.compile.sqlglot.expression_compiler as expression_compiler from bigframes.core.compile.sqlglot.expressions import typed_expr -import bigframes.core.compile.sqlglot.scalar_compiler as scalar_compiler import bigframes.core.compile.sqlglot.sqlglot_ir as ir from bigframes.core.logging import data_types as data_type_logger import bigframes.core.ordering as bf_ordering @@ -143,38 +143,32 @@ def _compile_node( @_compile_node.register def compile_sql_select(node: sql_nodes.SqlSelectNode, child: ir.SQLGlotIR): sqlglot_ir = child - if node.sorting is not None: - ordering_cols = tuple( - sge.Ordered( - this=scalar_compiler.scalar_op_compiler.compile_expression( - ordering.scalar_expression - ), - desc=ordering.direction.is_ascending is False, - nulls_first=ordering.na_last is False, - ) - for ordering in node.sorting + ordering_cols = tuple( + sge.Ordered( + this=expression_compiler.expression_compiler.compile_expression( + ordering.scalar_expression + ), + desc=ordering.direction.is_ascending is False, + nulls_first=ordering.na_last is False, ) - sqlglot_ir = sqlglot_ir.order_by(ordering_cols) + for ordering in node.sorting + ) projected_cols: tuple[tuple[str, sge.Expression], ...] = tuple( ( cdef.id.sql, - scalar_compiler.scalar_op_compiler.compile_expression(cdef.expression), + expression_compiler.expression_compiler.compile_expression(cdef.expression), ) for cdef in node.selections ) sqlglot_ir = sqlglot_ir.select(projected_cols) - if len(node.predicates) > 0: - sge_predicates = tuple( - scalar_compiler.scalar_op_compiler.compile_expression(expression) - for expression in node.predicates - ) - sqlglot_ir = sqlglot_ir.filter(sge_predicates) - if node.limit is not None: - sqlglot_ir = sqlglot_ir.limit(node.limit) + sge_predicates = tuple( + expression_compiler.expression_compiler.compile_expression(expression) + for expression in node.predicates + ) - return sqlglot_ir + return child.select(projected_cols, sge_predicates, ordering_cols, node.limit) @_compile_node.register @@ -210,11 +204,11 @@ def compile_join( conditions = tuple( ( typed_expr.TypedExpr( - scalar_compiler.scalar_op_compiler.compile_expression(left), + expression_compiler.expression_compiler.compile_expression(left), left.output_type, ), typed_expr.TypedExpr( - scalar_compiler.scalar_op_compiler.compile_expression(right), + expression_compiler.expression_compiler.compile_expression(right), right.output_type, ), ) @@ -236,11 +230,11 @@ def compile_isin_join( right_field = node.right_child.fields[0] conditions = ( typed_expr.TypedExpr( - scalar_compiler.scalar_op_compiler.compile_expression(node.left_col), + expression_compiler.expression_compiler.compile_expression(node.left_col), node.left_col.output_type, ), typed_expr.TypedExpr( - scalar_compiler.scalar_op_compiler.compile_expression( + expression_compiler.expression_compiler.compile_expression( expression.DerefOp(right_field.id) ), right_field.dtype, @@ -303,7 +297,7 @@ def compile_aggregate(node: nodes.AggregateNode, child: ir.SQLGlotIR) -> ir.SQLG for agg, id in node.aggregations ) by_cols: tuple[sge.Expression, ...] = tuple( - scalar_compiler.scalar_op_compiler.compile_expression(by_col) + expression_compiler.expression_compiler.compile_expression(by_col) for by_col in node.by_column_ids ) diff --git a/bigframes/core/compile/sqlglot/expression_compiler.py b/bigframes/core/compile/sqlglot/expression_compiler.py index 4254bd7afe0..b2ff34bf747 100644 --- a/bigframes/core/compile/sqlglot/expression_compiler.py +++ b/bigframes/core/compile/sqlglot/expression_compiler.py @@ -1,4 +1,4 @@ -# Copyright 2026 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,13 +18,14 @@ import bigframes_vendored.sqlglot.expressions as sge +import bigframes.core.agg_expressions as agg_exprs from bigframes.core.compile.sqlglot.expressions.typed_expr import TypedExpr import bigframes.core.compile.sqlglot.sqlglot_ir as ir import bigframes.core.expression as ex import bigframes.operations as ops -class ScalarOpCompiler: +class ExpressionCompiler: # Mapping of operation name to implemenations _registry: dict[ str, @@ -78,6 +79,15 @@ def _(self, expr: ex.DerefOp) -> sge.Expression: def _(self, expr: ex.ScalarConstantExpression) -> sge.Expression: return ir._literal(expr.value, expr.dtype) + @compile_expression.register + def _(self, expr: agg_exprs.WindowExpression) -> sge.Expression: + import bigframes.core.compile.sqlglot.aggregate_compiler as agg_compile + + return agg_compile.compile_analytic( + expr.analytic_expr, + expr.window, + ) + @compile_expression.register def _(self, expr: ex.OpExpression) -> sge.Expression: # Non-recursively compiles the children scalar expressions. @@ -218,4 +228,4 @@ def _add_parentheses(cls, expr: TypedExpr) -> TypedExpr: # Singleton compiler -scalar_op_compiler = ScalarOpCompiler() +expression_compiler = ExpressionCompiler() diff --git a/bigframes/core/compile/sqlglot/expressions/ai_ops.py b/bigframes/core/compile/sqlglot/expressions/ai_ops.py index 748f15b8677..cc0cbaad8fe 100644 --- a/bigframes/core/compile/sqlglot/expressions/ai_ops.py +++ b/bigframes/core/compile/sqlglot/expressions/ai_ops.py @@ -19,10 +19,10 @@ import bigframes_vendored.sqlglot.expressions as sge from bigframes import operations as ops -from bigframes.core.compile.sqlglot import scalar_compiler +from bigframes.core.compile.sqlglot import expression_compiler from bigframes.core.compile.sqlglot.expressions.typed_expr import TypedExpr -register_nary_op = scalar_compiler.scalar_op_compiler.register_nary_op +register_nary_op = expression_compiler.expression_compiler.register_nary_op @register_nary_op(ops.AIGenerate, pass_op=True) diff --git a/bigframes/core/compile/sqlglot/expressions/array_ops.py b/bigframes/core/compile/sqlglot/expressions/array_ops.py index e83a6ea99a9..eb7582cb168 100644 --- a/bigframes/core/compile/sqlglot/expressions/array_ops.py +++ b/bigframes/core/compile/sqlglot/expressions/array_ops.py @@ -20,16 +20,16 @@ import bigframes_vendored.sqlglot.expressions as sge from bigframes import operations as ops +import bigframes.core.compile.sqlglot.expression_compiler as expression_compiler from bigframes.core.compile.sqlglot.expressions.string_ops import ( string_index, string_slice, ) from bigframes.core.compile.sqlglot.expressions.typed_expr import TypedExpr -import bigframes.core.compile.sqlglot.scalar_compiler as scalar_compiler import bigframes.dtypes as dtypes -register_unary_op = scalar_compiler.scalar_op_compiler.register_unary_op -register_nary_op = scalar_compiler.scalar_op_compiler.register_nary_op +register_unary_op = expression_compiler.expression_compiler.register_unary_op +register_nary_op = expression_compiler.expression_compiler.register_nary_op @register_unary_op(ops.ArrayIndexOp, pass_op=True) diff --git a/bigframes/core/compile/sqlglot/expressions/blob_ops.py b/bigframes/core/compile/sqlglot/expressions/blob_ops.py index 3105cd8e303..cf939c68cef 100644 --- a/bigframes/core/compile/sqlglot/expressions/blob_ops.py +++ b/bigframes/core/compile/sqlglot/expressions/blob_ops.py @@ -17,11 +17,11 @@ import bigframes_vendored.sqlglot.expressions as sge from bigframes import operations as ops +import bigframes.core.compile.sqlglot.expression_compiler as expression_compiler from bigframes.core.compile.sqlglot.expressions.typed_expr import TypedExpr -import bigframes.core.compile.sqlglot.scalar_compiler as scalar_compiler -register_unary_op = scalar_compiler.scalar_op_compiler.register_unary_op -register_binary_op = scalar_compiler.scalar_op_compiler.register_binary_op +register_unary_op = expression_compiler.expression_compiler.register_unary_op +register_binary_op = expression_compiler.expression_compiler.register_binary_op @register_unary_op(ops.obj_fetch_metadata_op) diff --git a/bigframes/core/compile/sqlglot/expressions/bool_ops.py b/bigframes/core/compile/sqlglot/expressions/bool_ops.py index 6fee3f4278e..cd7f9da4084 100644 --- a/bigframes/core/compile/sqlglot/expressions/bool_ops.py +++ b/bigframes/core/compile/sqlglot/expressions/bool_ops.py @@ -18,10 +18,10 @@ from bigframes import dtypes from bigframes import operations as ops +import bigframes.core.compile.sqlglot.expression_compiler as expression_compiler from bigframes.core.compile.sqlglot.expressions.typed_expr import TypedExpr -import bigframes.core.compile.sqlglot.scalar_compiler as scalar_compiler -register_binary_op = scalar_compiler.scalar_op_compiler.register_binary_op +register_binary_op = expression_compiler.expression_compiler.register_binary_op @register_binary_op(ops.and_op) diff --git a/bigframes/core/compile/sqlglot/expressions/comparison_ops.py b/bigframes/core/compile/sqlglot/expressions/comparison_ops.py index 8c201f6a068..550a6c25be2 100644 --- a/bigframes/core/compile/sqlglot/expressions/comparison_ops.py +++ b/bigframes/core/compile/sqlglot/expressions/comparison_ops.py @@ -23,11 +23,11 @@ from bigframes import dtypes from bigframes import operations as ops from bigframes.core.compile.sqlglot import sqlglot_ir +import bigframes.core.compile.sqlglot.expression_compiler as expression_compiler from bigframes.core.compile.sqlglot.expressions.typed_expr import TypedExpr -import bigframes.core.compile.sqlglot.scalar_compiler as scalar_compiler -register_unary_op = scalar_compiler.scalar_op_compiler.register_unary_op -register_binary_op = scalar_compiler.scalar_op_compiler.register_binary_op +register_unary_op = expression_compiler.expression_compiler.register_unary_op +register_binary_op = expression_compiler.expression_compiler.register_binary_op @register_unary_op(ops.IsInOp, pass_op=True) diff --git a/bigframes/core/compile/sqlglot/expressions/date_ops.py b/bigframes/core/compile/sqlglot/expressions/date_ops.py index 3de7c4b23b1..e9b43febaed 100644 --- a/bigframes/core/compile/sqlglot/expressions/date_ops.py +++ b/bigframes/core/compile/sqlglot/expressions/date_ops.py @@ -17,10 +17,10 @@ import bigframes_vendored.sqlglot.expressions as sge from bigframes import operations as ops +import bigframes.core.compile.sqlglot.expression_compiler as expression_compiler from bigframes.core.compile.sqlglot.expressions.typed_expr import TypedExpr -import bigframes.core.compile.sqlglot.scalar_compiler as scalar_compiler -register_unary_op = scalar_compiler.scalar_op_compiler.register_unary_op +register_unary_op = expression_compiler.expression_compiler.register_unary_op @register_unary_op(ops.date_op) diff --git a/bigframes/core/compile/sqlglot/expressions/datetime_ops.py b/bigframes/core/compile/sqlglot/expressions/datetime_ops.py index 7f3e8135af1..82f2f34edf3 100644 --- a/bigframes/core/compile/sqlglot/expressions/datetime_ops.py +++ b/bigframes/core/compile/sqlglot/expressions/datetime_ops.py @@ -20,11 +20,11 @@ from bigframes import operations as ops from bigframes.core.compile.constants import UNIT_TO_US_CONVERSION_FACTORS from bigframes.core.compile.sqlglot import sqlglot_types +import bigframes.core.compile.sqlglot.expression_compiler as expression_compiler from bigframes.core.compile.sqlglot.expressions.typed_expr import TypedExpr -import bigframes.core.compile.sqlglot.scalar_compiler as scalar_compiler -register_unary_op = scalar_compiler.scalar_op_compiler.register_unary_op -register_binary_op = scalar_compiler.scalar_op_compiler.register_binary_op +register_unary_op = expression_compiler.expression_compiler.register_unary_op +register_binary_op = expression_compiler.expression_compiler.register_binary_op @register_binary_op(ops.DatetimeToIntegerLabelOp, pass_op=True) diff --git a/bigframes/core/compile/sqlglot/expressions/generic_ops.py b/bigframes/core/compile/sqlglot/expressions/generic_ops.py index 003a7296fcb..9fc09915c74 100644 --- a/bigframes/core/compile/sqlglot/expressions/generic_ops.py +++ b/bigframes/core/compile/sqlglot/expressions/generic_ops.py @@ -20,13 +20,13 @@ from bigframes import dtypes from bigframes import operations as ops from bigframes.core.compile.sqlglot import sqlglot_ir, sqlglot_types +import bigframes.core.compile.sqlglot.expression_compiler as expression_compiler from bigframes.core.compile.sqlglot.expressions.typed_expr import TypedExpr -import bigframes.core.compile.sqlglot.scalar_compiler as scalar_compiler -register_unary_op = scalar_compiler.scalar_op_compiler.register_unary_op -register_binary_op = scalar_compiler.scalar_op_compiler.register_binary_op -register_nary_op = scalar_compiler.scalar_op_compiler.register_nary_op -register_ternary_op = scalar_compiler.scalar_op_compiler.register_ternary_op +register_unary_op = expression_compiler.expression_compiler.register_unary_op +register_binary_op = expression_compiler.expression_compiler.register_binary_op +register_nary_op = expression_compiler.expression_compiler.register_nary_op +register_ternary_op = expression_compiler.expression_compiler.register_ternary_op @register_unary_op(ops.AsTypeOp, pass_op=True) diff --git a/bigframes/core/compile/sqlglot/expressions/geo_ops.py b/bigframes/core/compile/sqlglot/expressions/geo_ops.py index 9c6ba33ea54..ea7f09b41a8 100644 --- a/bigframes/core/compile/sqlglot/expressions/geo_ops.py +++ b/bigframes/core/compile/sqlglot/expressions/geo_ops.py @@ -17,11 +17,11 @@ import bigframes_vendored.sqlglot.expressions as sge from bigframes import operations as ops +import bigframes.core.compile.sqlglot.expression_compiler as expression_compiler from bigframes.core.compile.sqlglot.expressions.typed_expr import TypedExpr -import bigframes.core.compile.sqlglot.scalar_compiler as scalar_compiler -register_unary_op = scalar_compiler.scalar_op_compiler.register_unary_op -register_binary_op = scalar_compiler.scalar_op_compiler.register_binary_op +register_unary_op = expression_compiler.expression_compiler.register_unary_op +register_binary_op = expression_compiler.expression_compiler.register_binary_op @register_unary_op(ops.geo_area_op) diff --git a/bigframes/core/compile/sqlglot/expressions/json_ops.py b/bigframes/core/compile/sqlglot/expressions/json_ops.py index d2008b45bf9..d7ecf49fc6c 100644 --- a/bigframes/core/compile/sqlglot/expressions/json_ops.py +++ b/bigframes/core/compile/sqlglot/expressions/json_ops.py @@ -17,11 +17,11 @@ import bigframes_vendored.sqlglot.expressions as sge from bigframes import operations as ops +import bigframes.core.compile.sqlglot.expression_compiler as expression_compiler from bigframes.core.compile.sqlglot.expressions.typed_expr import TypedExpr -import bigframes.core.compile.sqlglot.scalar_compiler as scalar_compiler -register_unary_op = scalar_compiler.scalar_op_compiler.register_unary_op -register_binary_op = scalar_compiler.scalar_op_compiler.register_binary_op +register_unary_op = expression_compiler.expression_compiler.register_unary_op +register_binary_op = expression_compiler.expression_compiler.register_binary_op @register_unary_op(ops.JSONExtract, pass_op=True) diff --git a/bigframes/core/compile/sqlglot/expressions/numeric_ops.py b/bigframes/core/compile/sqlglot/expressions/numeric_ops.py index 28d3532b8b8..f2ae6cd82eb 100644 --- a/bigframes/core/compile/sqlglot/expressions/numeric_ops.py +++ b/bigframes/core/compile/sqlglot/expressions/numeric_ops.py @@ -19,13 +19,13 @@ from bigframes import dtypes from bigframes import operations as ops +import bigframes.core.compile.sqlglot.expression_compiler as expression_compiler import bigframes.core.compile.sqlglot.expressions.constants as constants from bigframes.core.compile.sqlglot.expressions.typed_expr import TypedExpr -import bigframes.core.compile.sqlglot.scalar_compiler as scalar_compiler from bigframes.operations import numeric_ops -register_unary_op = scalar_compiler.scalar_op_compiler.register_unary_op -register_binary_op = scalar_compiler.scalar_op_compiler.register_binary_op +register_unary_op = expression_compiler.expression_compiler.register_unary_op +register_binary_op = expression_compiler.expression_compiler.register_binary_op @register_unary_op(ops.abs_op) diff --git a/bigframes/core/compile/sqlglot/expressions/string_ops.py b/bigframes/core/compile/sqlglot/expressions/string_ops.py index 242dd7ae20d..3bfec04b3e0 100644 --- a/bigframes/core/compile/sqlglot/expressions/string_ops.py +++ b/bigframes/core/compile/sqlglot/expressions/string_ops.py @@ -21,11 +21,11 @@ from bigframes import dtypes from bigframes import operations as ops +import bigframes.core.compile.sqlglot.expression_compiler as expression_compiler from bigframes.core.compile.sqlglot.expressions.typed_expr import TypedExpr -import bigframes.core.compile.sqlglot.scalar_compiler as scalar_compiler -register_unary_op = scalar_compiler.scalar_op_compiler.register_unary_op -register_binary_op = scalar_compiler.scalar_op_compiler.register_binary_op +register_unary_op = expression_compiler.expression_compiler.register_unary_op +register_binary_op = expression_compiler.expression_compiler.register_binary_op @register_unary_op(ops.capitalize_op) diff --git a/bigframes/core/compile/sqlglot/expressions/struct_ops.py b/bigframes/core/compile/sqlglot/expressions/struct_ops.py index 5048941f149..0fe09cb294e 100644 --- a/bigframes/core/compile/sqlglot/expressions/struct_ops.py +++ b/bigframes/core/compile/sqlglot/expressions/struct_ops.py @@ -21,11 +21,11 @@ import pyarrow as pa from bigframes import operations as ops +import bigframes.core.compile.sqlglot.expression_compiler as expression_compiler from bigframes.core.compile.sqlglot.expressions.typed_expr import TypedExpr -import bigframes.core.compile.sqlglot.scalar_compiler as scalar_compiler -register_nary_op = scalar_compiler.scalar_op_compiler.register_nary_op -register_unary_op = scalar_compiler.scalar_op_compiler.register_unary_op +register_nary_op = expression_compiler.expression_compiler.register_nary_op +register_unary_op = expression_compiler.expression_compiler.register_unary_op @register_unary_op(ops.StructFieldOp, pass_op=True) diff --git a/bigframes/core/compile/sqlglot/expressions/timedelta_ops.py b/bigframes/core/compile/sqlglot/expressions/timedelta_ops.py index b442fa8175d..ab75669a3dc 100644 --- a/bigframes/core/compile/sqlglot/expressions/timedelta_ops.py +++ b/bigframes/core/compile/sqlglot/expressions/timedelta_ops.py @@ -19,10 +19,10 @@ from bigframes import dtypes from bigframes import operations as ops from bigframes.core.compile.constants import UNIT_TO_US_CONVERSION_FACTORS +import bigframes.core.compile.sqlglot.expression_compiler as expression_compiler from bigframes.core.compile.sqlglot.expressions.typed_expr import TypedExpr -import bigframes.core.compile.sqlglot.scalar_compiler as scalar_compiler -register_unary_op = scalar_compiler.scalar_op_compiler.register_unary_op +register_unary_op = expression_compiler.expression_compiler.register_unary_op @register_unary_op(ops.timedelta_floor_op) diff --git a/bigframes/core/compile/sqlglot/scalar_compiler.py b/bigframes/core/compile/sqlglot/scalar_compiler.py deleted file mode 100644 index 78eb5b59b25..00000000000 --- a/bigframes/core/compile/sqlglot/scalar_compiler.py +++ /dev/null @@ -1,231 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -from __future__ import annotations - -import functools -import typing - -import bigframes_vendored.sqlglot.expressions as sge - -import bigframes.core.agg_expressions as agg_exprs -from bigframes.core.compile.sqlglot.expressions.typed_expr import TypedExpr -import bigframes.core.compile.sqlglot.sqlglot_ir as ir -import bigframes.core.expression as ex -import bigframes.operations as ops - - -class ScalarOpCompiler: - # Mapping of operation name to implemenations - _registry: dict[ - str, - typing.Callable[[typing.Sequence[TypedExpr], ops.RowOp], sge.Expression], - ] = {} - - # A set of SQLGlot classes that may need to be parenthesized - SQLGLOT_NEEDS_PARENS = { - # Numeric operations - sge.Add, - sge.Sub, - sge.Mul, - sge.Div, - sge.Mod, - sge.Pow, - # Comparison operations - sge.GTE, - sge.GT, - sge.LTE, - sge.LT, - sge.EQ, - sge.NEQ, - # Logical operations - sge.And, - sge.Or, - sge.Xor, - # Bitwise operations - sge.BitwiseAnd, - sge.BitwiseOr, - sge.BitwiseXor, - sge.BitwiseLeftShift, - sge.BitwiseRightShift, - sge.BitwiseNot, - # Other operations - sge.Is, - } - - @functools.singledispatchmethod - def compile_expression( - self, - expression: ex.Expression, - ) -> sge.Expression: - """Compiles BigFrames scalar expression into SQLGlot expression.""" - raise NotImplementedError(f"Unrecognized expression: {expression}") - - @compile_expression.register - def _(self, expr: ex.DerefOp) -> sge.Expression: - return sge.Column(this=sge.to_identifier(expr.id.sql, quoted=True)) - - @compile_expression.register - def _(self, expr: ex.ScalarConstantExpression) -> sge.Expression: - return ir._literal(expr.value, expr.dtype) - - @compile_expression.register - def _(self, expr: agg_exprs.WindowExpression) -> sge.Expression: - import bigframes.core.compile.sqlglot.aggregate_compiler as agg_compile - - return agg_compile.compile_analytic( - expr.analytic_expr, - expr.window, - ) - - @compile_expression.register - def _(self, expr: ex.OpExpression) -> sge.Expression: - # Non-recursively compiles the children scalar expressions. - inputs = tuple( - TypedExpr(self.compile_expression(sub_expr), sub_expr.output_type) - for sub_expr in expr.inputs - ) - return self.compile_row_op(expr.op, inputs) - - def compile_row_op( - self, op: ops.RowOp, inputs: typing.Sequence[TypedExpr] - ) -> sge.Expression: - impl = self._registry[op.name] - return impl(inputs, op) - - def register_unary_op( - self, - op_ref: typing.Union[ops.UnaryOp, type[ops.UnaryOp]], - pass_op: bool = False, - ): - """ - Decorator to register a unary op implementation. - - Args: - op_ref (UnaryOp or UnaryOp type): - Class or instance of operator that is implemented by the decorated function. - pass_op (bool): - Set to true if implementation takes the operator object as the last argument. - This is needed for parameterized ops where parameters are part of op object. - """ - key = typing.cast(str, op_ref.name) - - def decorator(impl: typing.Callable[..., sge.Expression]): - def normalized_impl(args: typing.Sequence[TypedExpr], op: ops.RowOp): - if pass_op: - return impl(args[0], op) - else: - return impl(args[0]) - - self._register(key, normalized_impl) - return impl - - return decorator - - def register_binary_op( - self, - op_ref: typing.Union[ops.BinaryOp, type[ops.BinaryOp]], - pass_op: bool = False, - ): - """ - Decorator to register a binary op implementation. - - Args: - op_ref (BinaryOp or BinaryOp type): - Class or instance of operator that is implemented by the decorated function. - pass_op (bool): - Set to true if implementation takes the operator object as the last argument. - This is needed for parameterized ops where parameters are part of op object. - """ - key = typing.cast(str, op_ref.name) - - def decorator(impl: typing.Callable[..., sge.Expression]): - def normalized_impl(args: typing.Sequence[TypedExpr], op: ops.RowOp): - left = self._add_parentheses(args[0]) - right = self._add_parentheses(args[1]) - if pass_op: - return impl(left, right, op) - else: - return impl(left, right) - - self._register(key, normalized_impl) - return impl - - return decorator - - def register_ternary_op( - self, op_ref: typing.Union[ops.TernaryOp, type[ops.TernaryOp]] - ): - """ - Decorator to register a ternary op implementation. - - Args: - op_ref (TernaryOp or TernaryOp type): - Class or instance of operator that is implemented by the decorated function. - """ - key = typing.cast(str, op_ref.name) - - def decorator(impl: typing.Callable[..., sge.Expression]): - def normalized_impl(args: typing.Sequence[TypedExpr], op: ops.RowOp): - return impl(args[0], args[1], args[2]) - - self._register(key, normalized_impl) - return impl - - return decorator - - def register_nary_op( - self, op_ref: typing.Union[ops.NaryOp, type[ops.NaryOp]], pass_op: bool = False - ): - """ - Decorator to register a nary op implementation. - - Args: - op_ref (NaryOp or NaryOp type): - Class or instance of operator that is implemented by the decorated function. - pass_op (bool): - Set to true if implementation takes the operator object as the last argument. - This is needed for parameterized ops where parameters are part of op object. - """ - key = typing.cast(str, op_ref.name) - - def decorator(impl: typing.Callable[..., sge.Expression]): - def normalized_impl(args: typing.Sequence[TypedExpr], op: ops.RowOp): - if pass_op: - return impl(*args, op=op) - else: - return impl(*args) - - self._register(key, normalized_impl) - return impl - - return decorator - - def _register( - self, - op_name: str, - impl: typing.Callable[[typing.Sequence[TypedExpr], ops.RowOp], sge.Expression], - ): - if op_name in self._registry: - raise ValueError(f"Operation name {op_name} already registered") - self._registry[op_name] = impl - - @classmethod - def _add_parentheses(cls, expr: TypedExpr) -> TypedExpr: - if type(expr.expr) in cls.SQLGLOT_NEEDS_PARENS: - return TypedExpr(sge.paren(expr.expr, copy=False), expr.dtype) - return expr - - -# Singleton compiler -scalar_op_compiler = ScalarOpCompiler() diff --git a/bigframes/core/compile/sqlglot/sqlglot_ir.py b/bigframes/core/compile/sqlglot/sqlglot_ir.py index be4056f53cd..92031cbc2ca 100644 --- a/bigframes/core/compile/sqlglot/sqlglot_ir.py +++ b/bigframes/core/compile/sqlglot/sqlglot_ir.py @@ -156,6 +156,47 @@ def from_table( return cls(expr=table_expr, uid_gen=uid_gen) + def select( + self, + selections: tuple[tuple[str, sge.Expression], ...] = (), + predicates: tuple[sge.Expression, ...] = (), + sorting: tuple[sge.Ordered, ...] = (), + limit: typing.Optional[int] = None, + ) -> SQLGlotIR: + + # TODO: Explicitly insert CTEs into plan + if isinstance(self.expr, sge.Select): + new_expr = _select_to_cte( + self.expr, + sge.to_identifier( + next(self.uid_gen.get_uid_stream("bfcte_")), quoted=self.quoted + ), + ) + else: + new_expr = self.expr + + if len(sorting) > 0: + new_expr = new_expr.order_by(*sorting) + + to_select = [ + sge.Alias( + this=expr, + alias=sge.to_identifier(id, quoted=self.quoted), + ) + if expr.alias_or_name != id + else expr + for id, expr in selections + ] + new_expr = new_expr.select(*to_select, append=False) + + if len(predicates) > 0: + condition = _and(predicates) + new_expr = new_expr.where(condition, append=False) + if limit is not None: + new_expr = new_expr.limit(limit) + + return SQLGlotIR(expr=new_expr, uid_gen=self.uid_gen) + @classmethod def from_query_string( cls, @@ -222,91 +263,6 @@ def from_union( final_select_expr = _set_query_ctes(final_select_expr, existing_ctes) return cls(expr=final_select_expr, uid_gen=uid_gen) - def select( - self, - selected_cols: tuple[tuple[str, sge.Expression], ...], - ) -> SQLGlotIR: - """Replaces new selected columns of the current SELECT clause.""" - selections = [ - sge.Alias( - this=expr, - alias=sge.to_identifier(id, quoted=self.quoted), - ) - if expr.alias_or_name != id - else expr - for id, expr in selected_cols - ] - - new_expr = _select_to_cte( - self.expr, - sge.to_identifier( - next(self.uid_gen.get_uid_stream("bfcte_")), quoted=self.quoted - ), - ) - new_expr = new_expr.select(*selections, append=False) - return SQLGlotIR(expr=new_expr, uid_gen=self.uid_gen) - - def project( - self, - projected_cols: tuple[tuple[str, sge.Expression], ...], - ) -> SQLGlotIR: - """Adds new columns to the SELECT clause.""" - projected_cols_expr = [ - sge.Alias( - this=expr, - alias=sge.to_identifier(id, quoted=self.quoted), - ) - for id, expr in projected_cols - ] - new_expr = _select_to_cte( - self.expr, - sge.to_identifier( - next(self.uid_gen.get_uid_stream("bfcte_")), quoted=self.quoted - ), - ) - new_expr = new_expr.select(*projected_cols_expr, append=True) - return SQLGlotIR(expr=new_expr, uid_gen=self.uid_gen) - - def order_by( - self, - ordering: tuple[sge.Ordered, ...], - ) -> SQLGlotIR: - """Adds an ORDER BY clause to the query.""" - if len(ordering) == 0: - return SQLGlotIR(expr=self.expr.copy(), uid_gen=self.uid_gen) - new_expr = self.expr.order_by(*ordering) - return SQLGlotIR(expr=new_expr, uid_gen=self.uid_gen) - - def limit( - self, - limit: int | None, - ) -> SQLGlotIR: - """Adds a LIMIT clause to the query.""" - if limit is not None: - new_expr = self.expr.limit(limit) - else: - new_expr = self.expr.copy() - return SQLGlotIR(expr=new_expr, uid_gen=self.uid_gen) - - def filter( - self, - conditions: tuple[sge.Expression, ...], - ) -> SQLGlotIR: - """Filters the query by adding a WHERE clause.""" - condition = _and(conditions) - if condition is None: - return SQLGlotIR(expr=self.expr.copy(), uid_gen=self.uid_gen) - - new_expr = _select_to_cte( - self.expr, - sge.to_identifier( - next(self.uid_gen.get_uid_stream("bfcte_")), quoted=self.quoted - ), - ) - return SQLGlotIR( - expr=new_expr.where(condition, append=False), uid_gen=self.uid_gen - ) - def join( self, right: SQLGlotIR, @@ -482,13 +438,6 @@ def aggregate( new_expr = new_expr.where(condition, append=False) return SQLGlotIR(expr=new_expr, uid_gen=self.uid_gen) - def window( - self, - window_op: sge.Expression, - output_column_id: str, - ) -> SQLGlotIR: - return self.project(((output_column_id, window_op),)) - def insert( self, destination: bigquery.TableReference, diff --git a/tests/unit/core/compile/sqlglot/test_scalar_compiler.py b/tests/unit/core/compile/sqlglot/test_scalar_compiler.py index 3469d15d74b..07ae59e881e 100644 --- a/tests/unit/core/compile/sqlglot/test_scalar_compiler.py +++ b/tests/unit/core/compile/sqlglot/test_scalar_compiler.py @@ -17,13 +17,13 @@ import bigframes_vendored.sqlglot.expressions as sge import pytest +import bigframes.core.compile.sqlglot.expression_compiler as expression_compiler from bigframes.core.compile.sqlglot.expressions.typed_expr import TypedExpr -import bigframes.core.compile.sqlglot.scalar_compiler as scalar_compiler import bigframes.operations as ops def test_register_unary_op(): - compiler = scalar_compiler.ScalarOpCompiler() + compiler = expression_compiler.ExpressionCompiler() class MockUnaryOp(ops.UnaryOp): name = "mock_unary_op" @@ -43,7 +43,7 @@ def _(expr: TypedExpr) -> sge.Expression: def test_register_unary_op_pass_op(): - compiler = scalar_compiler.ScalarOpCompiler() + compiler = expression_compiler.ExpressionCompiler() class MockUnaryOp(ops.UnaryOp): name = "mock_unary_op_pass_op" @@ -63,7 +63,7 @@ def _(expr: TypedExpr, op: ops.UnaryOp) -> sge.Expression: def test_register_binary_op(): - compiler = scalar_compiler.ScalarOpCompiler() + compiler = expression_compiler.ExpressionCompiler() class MockBinaryOp(ops.BinaryOp): name = "mock_binary_op" @@ -84,7 +84,7 @@ def _(left: TypedExpr, right: TypedExpr) -> sge.Expression: def test_register_binary_op_pass_on(): - compiler = scalar_compiler.ScalarOpCompiler() + compiler = expression_compiler.ExpressionCompiler() class MockBinaryOp(ops.BinaryOp): name = "mock_binary_op_pass_op" @@ -105,7 +105,7 @@ def _(left: TypedExpr, right: TypedExpr, op: ops.BinaryOp) -> sge.Expression: def test_register_ternary_op(): - compiler = scalar_compiler.ScalarOpCompiler() + compiler = expression_compiler.ExpressionCompiler() class MockTernaryOp(ops.TernaryOp): name = "mock_ternary_op" @@ -127,7 +127,7 @@ def _(arg1: TypedExpr, arg2: TypedExpr, arg3: TypedExpr) -> sge.Expression: def test_register_nary_op(): - compiler = scalar_compiler.ScalarOpCompiler() + compiler = expression_compiler.ExpressionCompiler() class MockNaryOp(ops.NaryOp): name = "mock_nary_op" @@ -148,7 +148,7 @@ def _(*args: TypedExpr) -> sge.Expression: def test_register_nary_op_pass_on(): - compiler = scalar_compiler.ScalarOpCompiler() + compiler = expression_compiler.ExpressionCompiler() class MockNaryOp(ops.NaryOp): name = "mock_nary_op_pass_op" @@ -171,7 +171,7 @@ def _(*args: TypedExpr, op: ops.NaryOp) -> sge.Expression: def test_binary_op_parentheses(): - compiler = scalar_compiler.ScalarOpCompiler() + compiler = expression_compiler.ExpressionCompiler() class MockAddOp(ops.BinaryOp): name = "mock_add_op" @@ -208,7 +208,7 @@ def _(left: TypedExpr, right: TypedExpr) -> sge.Expression: def test_register_duplicate_op_raises(): - compiler = scalar_compiler.ScalarOpCompiler() + compiler = expression_compiler.ExpressionCompiler() class MockUnaryOp(ops.UnaryOp): name = "mock_unary_op_duplicate" From 920ff4aea2c4a9c6df581e47fa0ffab9a0ab6416 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Fri, 6 Feb 2026 01:51:32 +0000 Subject: [PATCH 5/6] fix table select, update snapshots --- bigframes/core/compile/sqlglot/compiler.py | 2 - bigframes/core/compile/sqlglot/sqlglot_ir.py | 2 +- .../test_row_number/out.sql | 21 +--------- .../test_row_number_with_window/out.sql | 7 +--- .../test_all_w_window/out.sql | 7 +--- .../test_any_value/window_out.sql | 7 +--- .../test_any_value/window_partition_out.sql | 8 +--- .../test_any_w_window/out.sql | 7 +--- .../test_count/window_out.sql | 7 +--- .../test_count/window_partition_out.sql | 8 +--- .../test_unary_compiler/test_cut/int_bins.sql | 7 +--- .../test_cut/int_bins_labels.sql | 7 +--- .../test_cut/interval_bins.sql | 7 +--- .../test_cut/interval_bins_labels.sql | 7 +--- .../test_dense_rank/out.sql | 7 +--- .../test_diff_w_bool/out.sql | 7 +--- .../test_diff_w_date/out.sql | 7 +--- .../test_diff_w_datetime/out.sql | 7 +--- .../test_diff_w_int/out.sql | 7 +--- .../test_diff_w_timestamp/out.sql | 7 +--- .../test_unary_compiler/test_first/out.sql | 7 +--- .../test_first_non_null/out.sql | 7 +--- .../test_unary_compiler/test_last/out.sql | 7 +--- .../test_last_non_null/out.sql | 7 +--- .../test_max/window_out.sql | 7 +--- .../test_max/window_partition_out.sql | 8 +--- .../test_unary_compiler/test_mean/out.sql | 14 ++----- .../test_mean/window_out.sql | 7 +--- .../test_mean/window_partition_out.sql | 8 +--- .../test_min/window_out.sql | 7 +--- .../test_min/window_partition_out.sql | 8 +--- .../test_pop_var/window_out.sql | 7 +--- .../test_product/window_partition_out.sql | 8 +--- .../test_unary_compiler/test_rank/out.sql | 7 +--- .../test_unary_compiler/test_shift/lag.sql | 7 +--- .../test_unary_compiler/test_shift/lead.sql | 7 +--- .../test_unary_compiler/test_shift/noop.sql | 7 +--- .../test_unary_compiler/test_std/out.sql | 14 ++----- .../test_std/window_out.sql | 7 +--- .../test_sum/window_out.sql | 7 +--- .../test_sum/window_partition_out.sql | 8 +--- .../test_var/window_out.sql | 7 +--- .../test_ai_ops/test_ai_classify/out.sql | 7 +--- .../test_ai_ops/test_ai_generate/out.sql | 7 +--- .../test_ai_ops/test_ai_generate_bool/out.sql | 7 +--- .../out.sql | 7 +--- .../out.sql | 7 +--- .../test_ai_generate_double/out.sql | 7 +--- .../out.sql | 7 +--- .../out.sql | 7 +--- .../test_ai_ops/test_ai_generate_int/out.sql | 7 +--- .../out.sql | 7 +--- .../out.sql | 7 +--- .../out.sql | 7 +--- .../test_ai_generate_with_model_param/out.sql | 7 +--- .../out.sql | 7 +--- .../snapshots/test_ai_ops/test_ai_if/out.sql | 7 +--- .../test_ai_ops/test_ai_score/out.sql | 7 +--- .../test_array_ops/test_array_index/out.sql | 7 +--- .../test_array_reduce_op/out.sql | 9 +---- .../test_array_slice_with_only_start/out.sql | 7 +--- .../out.sql | 7 +--- .../test_array_to_string/out.sql | 7 +--- .../test_array_ops/test_to_array_op/out.sql | 10 +---- .../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 | 9 +---- .../test_bool_ops/test_or_op/out.sql | 9 +---- .../test_bool_ops/test_xor_op/out.sql | 9 +---- .../test_eq_null_match/out.sql | 8 +--- .../test_eq_numeric/out.sql | 9 +---- .../test_ge_numeric/out.sql | 9 +---- .../test_gt_numeric/out.sql | 9 +---- .../test_comparison_ops/test_is_in/out.sql | 9 +---- .../test_le_numeric/out.sql | 9 +---- .../test_lt_numeric/out.sql | 9 +---- .../test_maximum_op/out.sql | 8 +--- .../test_minimum_op/out.sql | 8 +--- .../test_ne_numeric/out.sql | 9 +---- .../test_add_timedelta/out.sql | 9 +---- .../test_datetime_ops/test_date/out.sql | 7 +--- .../test_datetime_to_integer_label/out.sql | 8 +--- .../test_datetime_ops/test_day/out.sql | 7 +--- .../test_datetime_ops/test_dayofweek/out.sql | 9 +---- .../test_datetime_ops/test_dayofyear/out.sql | 7 +--- .../test_datetime_ops/test_floor_dt/out.sql | 8 +--- .../test_datetime_ops/test_hour/out.sql | 7 +--- .../out.sql | 8 +--- .../out.sql | 8 +--- .../out.sql | 8 +--- .../out.sql | 8 +--- .../out.sql | 8 +--- .../test_datetime_ops/test_iso_day/out.sql | 7 +--- .../test_datetime_ops/test_iso_week/out.sql | 7 +--- .../test_datetime_ops/test_iso_year/out.sql | 7 +--- .../test_datetime_ops/test_minute/out.sql | 7 +--- .../test_datetime_ops/test_month/out.sql | 7 +--- .../test_datetime_ops/test_normalize/out.sql | 7 +--- .../test_datetime_ops/test_quarter/out.sql | 7 +--- .../test_datetime_ops/test_second/out.sql | 7 +--- .../test_datetime_ops/test_strftime/out.sql | 10 +---- .../test_sub_timedelta/out.sql | 10 +---- .../test_datetime_ops/test_time/out.sql | 7 +--- .../test_to_datetime/out.sql | 9 +---- .../test_to_timestamp/out.sql | 8 +--- .../test_unix_micros/out.sql | 7 +--- .../test_unix_millis/out.sql | 7 +--- .../test_unix_seconds/out.sql | 7 +--- .../test_datetime_ops/test_year/out.sql | 7 +--- .../test_generic_ops/test_astype_bool/out.sql | 8 +--- .../test_astype_float/out.sql | 7 +--- .../test_astype_from_json/out.sql | 7 +--- .../test_generic_ops/test_astype_int/out.sql | 11 +----- .../test_generic_ops/test_astype_json/out.sql | 10 +---- .../test_astype_string/out.sql | 8 +--- .../test_astype_time_like/out.sql | 7 +--- .../test_binary_remote_function_op/out.sql | 8 +--- .../test_case_when_op/out.sql | 10 +---- .../test_generic_ops/test_clip/out.sql | 9 +---- .../test_generic_ops/test_coalesce/out.sql | 8 +--- .../test_generic_ops/test_fillna/out.sql | 8 +--- .../test_generic_ops/test_hash/out.sql | 7 +--- .../test_generic_ops/test_invert/out.sql | 9 +---- .../test_generic_ops/test_isnull/out.sql | 7 +--- .../test_generic_ops/test_map/out.sql | 7 +--- .../test_nary_remote_function_op/out.sql | 9 +---- .../test_generic_ops/test_notnull/out.sql | 7 +--- .../test_remote_function_op/out.sql | 7 +--- .../test_generic_ops/test_row_key/out.sql | 21 +--------- .../test_sql_scalar_op/out.sql | 8 +--- .../test_generic_ops/test_where/out.sql | 9 +---- .../test_geo_ops/test_geo_area/out.sql | 7 +--- .../test_geo_ops/test_geo_st_astext/out.sql | 7 +--- .../test_geo_ops/test_geo_st_boundary/out.sql | 7 +--- .../test_geo_ops/test_geo_st_buffer/out.sql | 7 +--- .../test_geo_ops/test_geo_st_centroid/out.sql | 7 +--- .../test_geo_st_convexhull/out.sql | 7 +--- .../test_geo_st_difference/out.sql | 7 +--- .../test_geo_ops/test_geo_st_distance/out.sql | 7 +--- .../test_geo_st_geogfromtext/out.sql | 7 +--- .../test_geo_st_geogpoint/out.sql | 8 +--- .../test_geo_st_intersection/out.sql | 7 +--- .../test_geo_ops/test_geo_st_isclosed/out.sql | 7 +--- .../test_geo_ops/test_geo_st_length/out.sql | 7 +--- .../snapshots/test_geo_ops/test_geo_x/out.sql | 7 +--- .../snapshots/test_geo_ops/test_geo_y/out.sql | 7 +--- .../test_json_ops/test_json_extract/out.sql | 7 +--- .../test_json_extract_array/out.sql | 7 +--- .../test_json_extract_string_array/out.sql | 7 +--- .../test_json_ops/test_json_keys/out.sql | 7 +--- .../test_json_ops/test_json_query/out.sql | 7 +--- .../test_json_query_array/out.sql | 7 +--- .../test_json_ops/test_json_set/out.sql | 7 +--- .../test_json_ops/test_json_value/out.sql | 7 +--- .../test_json_ops/test_parse_json/out.sql | 7 +--- .../test_json_ops/test_to_json/out.sql | 7 +--- .../test_json_ops/test_to_json_string/out.sql | 7 +--- .../test_numeric_ops/test_abs/out.sql | 7 +--- .../test_numeric_ops/test_add_numeric/out.sql | 9 +---- .../test_numeric_ops/test_add_string/out.sql | 7 +--- .../test_add_timedelta/out.sql | 9 +---- .../test_numeric_ops/test_arccos/out.sql | 7 +--- .../test_numeric_ops/test_arccosh/out.sql | 7 +--- .../test_numeric_ops/test_arcsin/out.sql | 7 +--- .../test_numeric_ops/test_arcsinh/out.sql | 7 +--- .../test_numeric_ops/test_arctan/out.sql | 7 +--- .../test_numeric_ops/test_arctan2/out.sql | 9 +---- .../test_numeric_ops/test_arctanh/out.sql | 7 +--- .../test_numeric_ops/test_ceil/out.sql | 7 +--- .../test_numeric_ops/test_cos/out.sql | 7 +--- .../test_numeric_ops/test_cosh/out.sql | 7 +--- .../test_cosine_distance/out.sql | 8 +--- .../test_numeric_ops/test_div_numeric/out.sql | 10 +---- .../test_div_timedelta/out.sql | 9 +---- .../test_euclidean_distance/out.sql | 8 +--- .../test_numeric_ops/test_exp/out.sql | 7 +--- .../test_numeric_ops/test_expm1/out.sql | 7 +--- .../test_numeric_ops/test_floor/out.sql | 7 +--- .../test_floordiv_timedelta/out.sql | 9 +---- .../test_numeric_ops/test_ln/out.sql | 7 +--- .../test_numeric_ops/test_log10/out.sql | 7 +--- .../test_numeric_ops/test_log1p/out.sql | 7 +--- .../test_manhattan_distance/out.sql | 8 +--- .../test_numeric_ops/test_mod_numeric/out.sql | 9 +---- .../test_numeric_ops/test_mul_numeric/out.sql | 9 +---- .../test_mul_timedelta/out.sql | 10 +---- .../test_numeric_ops/test_neg/out.sql | 7 +--- .../test_numeric_ops/test_pos/out.sql | 7 +--- .../test_numeric_ops/test_pow/out.sql | 9 +---- .../test_numeric_ops/test_round/out.sql | 9 +---- .../test_numeric_ops/test_sin/out.sql | 7 +--- .../test_numeric_ops/test_sinh/out.sql | 7 +--- .../test_numeric_ops/test_sqrt/out.sql | 7 +--- .../test_numeric_ops/test_sub_numeric/out.sql | 9 +---- .../test_sub_timedelta/out.sql | 10 +---- .../test_numeric_ops/test_tan/out.sql | 7 +--- .../test_numeric_ops/test_tanh/out.sql | 7 +--- .../test_unsafe_pow_op/out.sql | 15 ++++---- .../test_string_ops/test_add_string/out.sql | 7 +--- .../test_string_ops/test_capitalize/out.sql | 7 +--- .../test_string_ops/test_endswith/out.sql | 7 +--- .../test_string_ops/test_isalnum/out.sql | 7 +--- .../test_string_ops/test_isalpha/out.sql | 7 +--- .../test_string_ops/test_isdecimal/out.sql | 7 +--- .../test_string_ops/test_isdigit/out.sql | 7 +--- .../test_string_ops/test_islower/out.sql | 7 +--- .../test_string_ops/test_isnumeric/out.sql | 7 +--- .../test_string_ops/test_isspace/out.sql | 7 +--- .../test_string_ops/test_isupper/out.sql | 7 +--- .../test_string_ops/test_len/out.sql | 7 +--- .../test_string_ops/test_len_w_array/out.sql | 7 +--- .../test_string_ops/test_lower/out.sql | 7 +--- .../test_string_ops/test_lstrip/out.sql | 7 +--- .../test_regex_replace_str/out.sql | 7 +--- .../test_string_ops/test_replace_str/out.sql | 7 +--- .../test_string_ops/test_reverse/out.sql | 7 +--- .../test_string_ops/test_rstrip/out.sql | 7 +--- .../test_string_ops/test_startswith/out.sql | 7 +--- .../test_string_ops/test_str_contains/out.sql | 7 +--- .../test_str_contains_regex/out.sql | 7 +--- .../test_string_ops/test_str_extract/out.sql | 7 +--- .../test_string_ops/test_str_find/out.sql | 7 +--- .../test_string_ops/test_str_get/out.sql | 7 +--- .../test_string_ops/test_str_pad/out.sql | 7 +--- .../test_string_ops/test_str_repeat/out.sql | 7 +--- .../test_string_ops/test_str_slice/out.sql | 7 +--- .../test_string_ops/test_strconcat/out.sql | 7 +--- .../test_string_ops/test_string_split/out.sql | 7 +--- .../test_string_ops/test_strip/out.sql | 7 +--- .../test_string_ops/test_upper/out.sql | 7 +--- .../test_string_ops/test_zfill/out.sql | 7 +--- .../test_struct_ops/test_struct_field/out.sql | 7 +--- .../test_struct_ops/test_struct_op/out.sql | 10 +---- .../test_timedelta_floor/out.sql | 7 +--- .../test_to_timedelta/out.sql | 9 +---- .../test_compile_aggregate/out.sql | 13 ++----- .../test_compile_aggregate_wo_dropna/out.sql | 13 ++----- .../test_compile_concat/out.sql | 20 ++-------- .../test_compile_concat_filter_sorted/out.sql | 38 +++++-------------- .../test_compile_filter/out.sql | 10 ++--- .../test_compile_isin/out.sql | 25 +++++------- .../test_compile_isin_not_nullable/out.sql | 23 +++++------ .../test_compile_join/out.sql | 24 ++++-------- .../test_compile_join_w_on/bool_col/out.sql | 24 ++++-------- .../float64_col/out.sql | 24 ++++-------- .../test_compile_join_w_on/int64_col/out.sql | 24 ++++-------- .../numeric_col/out.sql | 24 ++++-------- .../test_compile_join_w_on/string_col/out.sql | 24 ++++-------- .../test_compile_join_w_on/time_col/out.sql | 24 ++++-------- .../test_compile_readtable/out.sql | 21 +--------- .../out.sql | 4 +- .../out.sql | 8 +--- .../test_compile_readtable_w_limit/out.sql | 8 +--- .../out.sql | 8 +--- .../test_compile_readtable_w_ordering/out.sql | 8 +--- .../out.sql | 14 +------ .../out.sql | 21 +--------- .../out.sql | 11 ++---- .../out.sql | 8 +--- .../out.sql | 8 +--- 261 files changed, 353 insertions(+), 1888 deletions(-) diff --git a/bigframes/core/compile/sqlglot/compiler.py b/bigframes/core/compile/sqlglot/compiler.py index ba4390916c8..87078ed6787 100644 --- a/bigframes/core/compile/sqlglot/compiler.py +++ b/bigframes/core/compile/sqlglot/compiler.py @@ -142,7 +142,6 @@ def _compile_node( @_compile_node.register def compile_sql_select(node: sql_nodes.SqlSelectNode, child: ir.SQLGlotIR): - sqlglot_ir = child ordering_cols = tuple( sge.Ordered( this=expression_compiler.expression_compiler.compile_expression( @@ -161,7 +160,6 @@ def compile_sql_select(node: sql_nodes.SqlSelectNode, child: ir.SQLGlotIR): ) for cdef in node.selections ) - sqlglot_ir = sqlglot_ir.select(projected_cols) sge_predicates = tuple( expression_compiler.expression_compiler.compile_expression(expression) diff --git a/bigframes/core/compile/sqlglot/sqlglot_ir.py b/bigframes/core/compile/sqlglot/sqlglot_ir.py index 92031cbc2ca..fed42493ff5 100644 --- a/bigframes/core/compile/sqlglot/sqlglot_ir.py +++ b/bigframes/core/compile/sqlglot/sqlglot_ir.py @@ -173,7 +173,7 @@ def select( ), ) else: - new_expr = self.expr + new_expr = sge.Select().from_(self.expr) if len(sorting) > 0: new_expr = new_expr.order_by(*sorting) 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 2fdb2868888..e2b5c841046 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,22 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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 ROW_NUMBER() OVER () - 1 AS `row_number` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 fda72dbedbc..5301ba76fd3 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ROW_NUMBER() OVER (ORDER BY `int64_col` ASC NULLS LAST) - 1 AS `row_number` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all_w_window/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all_w_window/out.sql index 7ca4225ee06..945c1282d51 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all_w_window/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all_w_window/out.sql @@ -1,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT COALESCE( LOGICAL_AND(`bool_col`) OVER ( @@ -11,4 +6,4 @@ SELECT ), TRUE ) AS `agg_bool` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 f5282193024..e43ba6ed248 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,6 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ANY_VALUE(`int64_col`) OVER ( ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 dd08329421b..bdb9eb87684 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,13 +1,7 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ANY_VALUE(`int64_col`) OVER ( PARTITION BY `string_col` ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_w_window/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_w_window/out.sql index b74555d3d5d..14b11cfd37b 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_w_window/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_w_window/out.sql @@ -1,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT COALESCE( LOGICAL_OR(`bool_col`) OVER ( @@ -11,4 +6,4 @@ SELECT ), FALSE ) AS `agg_bool` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 7789c3f8913..d87e9ab2dbf 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,6 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT COUNT(`int64_col`) OVER ( ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 44b7dcc89fd..dde22ff818c 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,13 +1,7 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT COUNT(`int64_col`) OVER ( PARTITION BY `string_col` ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins.sql index 14301f3c246..d7b0fde7103 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins.sql @@ -1,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CASE WHEN `int64_col` <= MIN(`int64_col`) OVER () + ( @@ -47,4 +42,4 @@ SELECT ) + 0 AS `right_inclusive` ) END AS `int_bins` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins_labels.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins_labels.sql index e8cf4837817..1a3aede0502 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins_labels.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/int_bins_labels.sql @@ -1,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CASE WHEN `int64_col` < MIN(`int64_col`) OVER () + ( @@ -16,4 +11,4 @@ SELECT WHEN `int64_col` IS NOT NULL THEN 'c' END AS `int_bins_labels` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins.sql index c5fb340057b..3365500e0bd 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins.sql @@ -1,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CASE WHEN `int64_col` > 0 AND `int64_col` <= 1 @@ -10,4 +5,4 @@ SELECT WHEN `int64_col` > 1 AND `int64_col` <= 2 THEN STRUCT(1 AS `left_exclusive`, 2 AS `right_inclusive`) END AS `interval_bins` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins_labels.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins_labels.sql index e850c4410f3..2cc91765c84 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins_labels.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_cut/interval_bins_labels.sql @@ -1,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CASE WHEN `int64_col` > 0 AND `int64_col` <= 1 @@ -10,4 +5,4 @@ SELECT WHEN `int64_col` > 1 AND `int64_col` <= 2 THEN 1 END AS `interval_bins_labels` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 6bed4e72c5f..d8f8e26ddcb 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT DENSE_RANK() OVER (ORDER BY `int64_col` DESC) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_bool/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_bool/out.sql index d888b3d29e7..18da6d95fbf 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_bool/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_bool/out.sql @@ -1,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `bool_col` <> LAG(`bool_col`, 1) OVER (ORDER BY `bool_col` DESC) AS `diff_bool` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_date/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_date/out.sql index 1390b4d0f4a..d5a548f9207 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_date/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_date/out.sql @@ -1,10 +1,5 @@ -WITH `bfcte_0` AS ( - SELECT - `date_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CAST(FLOOR( DATE_DIFF(`date_col`, LAG(`date_col`, 1) OVER (ORDER BY `date_col` ASC NULLS LAST), DAY) * 86400000000 ) AS INT64) AS `diff_date` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_datetime/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_datetime/out.sql index 326047998d6..c997025ad2a 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_datetime/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_datetime/out.sql @@ -1,12 +1,7 @@ -WITH `bfcte_0` AS ( - SELECT - `datetime_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT DATETIME_DIFF( `datetime_col`, LAG(`datetime_col`, 1) OVER (ORDER BY `datetime_col` ASC NULLS LAST), MICROSECOND ) AS `diff_datetime` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_int/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_int/out.sql index 148347b5672..37acf8896ef 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_int/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_int/out.sql @@ -1,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `int64_col` - LAG(`int64_col`, 1) OVER (ORDER BY `int64_col` ASC NULLS LAST) AS `diff_int` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_timestamp/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_timestamp/out.sql index 5e00da4f4c1..5ed7e83ae5c 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_timestamp/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff_w_timestamp/out.sql @@ -1,12 +1,7 @@ -WITH `bfcte_0` AS ( - SELECT - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT TIMESTAMP_DIFF( `timestamp_col`, LAG(`timestamp_col`, 1) OVER (ORDER BY `timestamp_col` DESC), MICROSECOND ) AS `diff_timestamp` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 e902b1cfe22..29de93c80c9 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,11 +1,6 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT FIRST_VALUE(`int64_col`) OVER ( ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 1e16a4d3e1a..4d53d126104 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,11 +1,6 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT FIRST_VALUE(`int64_col` IGNORE NULLS) OVER ( ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 1d2595e356c..8e41cbd8b69 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,11 +1,6 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT LAST_VALUE(`int64_col`) OVER ( ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 d70b9d3a9ce..a563eeb52ad 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,11 +1,6 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT LAST_VALUE(`int64_col` IGNORE NULLS) OVER ( ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 1023211a8e8..bf351115535 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,6 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT MAX(`int64_col`) OVER ( ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 d337e9dc330..c375a10baf1 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,13 +1,7 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT MAX(`int64_col`) OVER ( PARTITION BY `string_col` ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 b78190305ac..2f9d540776f 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,10 +1,4 @@ WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `duration_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( SELECT `bool_col`, `duration_col`, @@ -12,18 +6,18 @@ WITH `bfcte_0` AS ( `int64_col` AS `bfcol_6`, `bool_col` AS `bfcol_7`, `duration_col` AS `bfcol_8` - FROM `bfcte_0` -), `bfcte_2` AS ( + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( SELECT AVG(`bfcol_6`) AS `bfcol_12`, AVG(CAST(`bfcol_7` AS INT64)) AS `bfcol_13`, CAST(FLOOR(AVG(`bfcol_8`)) AS INT64) AS `bfcol_14`, CAST(FLOOR(AVG(`bfcol_6`)) AS INT64) AS `bfcol_15` - FROM `bfcte_1` + FROM `bfcte_0` ) SELECT `bfcol_12` AS `int64_col`, `bfcol_13` AS `bool_col`, `bfcol_14` AS `duration_col`, `bfcol_15` AS `int64_col_w_floor` -FROM `bfcte_2` \ No newline at end of file +FROM `bfcte_1` \ No newline at end of file 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 899310f1be7..ff337a90fbb 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,6 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT AVG(`int64_col`) OVER ( ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 acb55c2688a..d3ab4944d85 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,13 +1,7 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT AVG(`int64_col`) OVER ( PARTITION BY `string_col` ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 5eb763123fe..cb8fc8649a1 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,6 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT MIN(`int64_col`) OVER ( ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 0724dfea48b..cfcbb07a493 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,13 +1,7 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT MIN(`int64_col`) OVER ( PARTITION BY `string_col` ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 5df86fb3894..e32dfd6b6e0 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,6 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT VAR_POP(`int64_col`) OVER ( ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_product/window_partition_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_product/window_partition_out.sql index 65fc464b70d..335bfcd17c2 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_product/window_partition_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_product/window_partition_out.sql @@ -1,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CASE WHEN LOGICAL_OR(`int64_col` = 0) OVER (PARTITION BY `string_col`) @@ -19,4 +13,4 @@ SELECT ) ) END AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 58bd58e08a8..cdba69fe68d 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT RANK() OVER (ORDER BY `int64_col` DESC NULLS FIRST) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 a30df4413cc..674c59fb1e2 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT LAG(`int64_col`, 1) OVER (ORDER BY `int64_col` ASC) AS `lag` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 94ed6e94b88..eff56dd81d8 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT LEAD(`int64_col`, 1) OVER (ORDER BY `int64_col` ASC) AS `lead` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 ea276a1a1c4..ec2e9d11a06 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `int64_col` AS `noop` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 78af380428b..bc744258913 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,10 +1,4 @@ WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `duration_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( SELECT `bool_col`, `duration_col`, @@ -12,18 +6,18 @@ WITH `bfcte_0` AS ( `int64_col` AS `bfcol_6`, `bool_col` AS `bfcol_7`, `duration_col` AS `bfcol_8` - FROM `bfcte_0` -), `bfcte_2` AS ( + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( SELECT STDDEV(`bfcol_6`) AS `bfcol_12`, STDDEV(CAST(`bfcol_7` AS INT64)) AS `bfcol_13`, CAST(FLOOR(STDDEV(`bfcol_8`)) AS INT64) AS `bfcol_14`, CAST(FLOOR(STDDEV(`bfcol_6`)) AS INT64) AS `bfcol_15` - FROM `bfcte_1` + FROM `bfcte_0` ) SELECT `bfcol_12` AS `int64_col`, `bfcol_13` AS `bool_col`, `bfcol_14` AS `duration_col`, `bfcol_15` AS `int64_col_w_floor` -FROM `bfcte_2` \ No newline at end of file +FROM `bfcte_1` \ No newline at end of file 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 f7a34c9f914..b80c462982f 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,6 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT STDDEV(`int64_col`) OVER ( ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 f27bc2c0f7e..8f1d8f4d695 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT COALESCE( SUM(`int64_col`) OVER ( @@ -11,4 +6,4 @@ SELECT ), 0 ) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 2202976d49a..55a961fded8 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,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT COALESCE( SUM(`int64_col`) OVER ( @@ -13,4 +7,4 @@ SELECT ), 0 ) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 012298a68b0..4ded15ee3e4 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,6 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT VARIANCE(`int64_col`) OVER ( ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS `agg_int64` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 d8021a22ad3..65098ca9e2a 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,7 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT AI.CLASSIFY( input => (`string_col`), categories => ['greeting', 'rejection'], connection_id => 'bigframes-dev.us.bigframes-default-connection' ) AS `result` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 a5751d168a2..0d79dfd0f0f 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,7 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT AI.GENERATE( prompt => (`string_col`, ' is the same as ', `string_col`), endpoint => 'gemini-2.5-flash', request_type => 'SHARED' ) AS `result` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 96d8d53d8dc..7a4260ed8d5 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,7 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT AI.GENERATE_BOOL( prompt => (`string_col`, ' is the same as ', `string_col`), endpoint => 'gemini-2.5-flash', request_type => 'SHARED' ) AS `result` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool_with_connection_id/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool_with_connection_id/out.sql index 66a55f690ec..ebbe4c0847d 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool_with_connection_id/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool_with_connection_id/out.sql @@ -1,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT AI.GENERATE_BOOL( prompt => (`string_col`, ' is the same as ', `string_col`), @@ -10,4 +5,4 @@ SELECT endpoint => 'gemini-2.5-flash', request_type => 'SHARED' ) AS `result` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 08e05872827..2556208610c 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,7 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT AI.GENERATE_BOOL( prompt => (`string_col`, ' is the same as ', `string_col`), request_type => 'SHARED', model_params => JSON '{}' ) AS `result` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 6ce5899c33e..2712af87752 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,7 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT AI.GENERATE_DOUBLE( prompt => (`string_col`, ' is the same as ', `string_col`), endpoint => 'gemini-2.5-flash', request_type => 'SHARED' ) AS `result` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double_with_connection_id/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double_with_connection_id/out.sql index c38e6d74d6d..a1671c300df 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double_with_connection_id/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double_with_connection_id/out.sql @@ -1,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT AI.GENERATE_DOUBLE( prompt => (`string_col`, ' is the same as ', `string_col`), @@ -10,4 +5,4 @@ SELECT endpoint => 'gemini-2.5-flash', request_type => 'SHARED' ) AS `result` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 5a38e31e94e..4f6ada7eee3 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,7 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT AI.GENERATE_DOUBLE( prompt => (`string_col`, ' is the same as ', `string_col`), request_type => 'SHARED', model_params => JSON '{}' ) AS `result` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 c984c20b37f..42fad82bcf5 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,7 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT AI.GENERATE_INT( prompt => (`string_col`, ' is the same as ', `string_col`), endpoint => 'gemini-2.5-flash', request_type => 'SHARED' ) AS `result` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int_with_connection_id/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int_with_connection_id/out.sql index c56e8d29dab..0c565df519f 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int_with_connection_id/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int_with_connection_id/out.sql @@ -1,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT AI.GENERATE_INT( prompt => (`string_col`, ' is the same as ', `string_col`), @@ -10,4 +5,4 @@ SELECT endpoint => 'gemini-2.5-flash', request_type => 'SHARED' ) AS `result` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 21a408d4bd6..360ca346987 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,7 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT AI.GENERATE_INT( prompt => (`string_col`, ' is the same as ', `string_col`), request_type => 'SHARED', model_params => JSON '{}' ) AS `result` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_connection_id/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_connection_id/out.sql index 349783fd240..5e289430d98 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_connection_id/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_connection_id/out.sql @@ -1,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT AI.GENERATE( prompt => (`string_col`, ' is the same as ', `string_col`), @@ -10,4 +5,4 @@ SELECT endpoint => 'gemini-2.5-flash', request_type => 'SHARED' ) AS `result` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 53eef367285..1706cf8f308 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,7 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT AI.GENERATE( prompt => (`string_col`, ' is the same as ', `string_col`), request_type => 'SHARED', model_params => JSON '{}' ) AS `result` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 3e0cb7fc442..c94637dc707 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT AI.GENERATE( prompt => (`string_col`, ' is the same as ', `string_col`), @@ -10,4 +5,4 @@ SELECT request_type => 'SHARED', output_schema => 'x INT64, y FLOAT64' ) AS `result` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 f74a5264dc6..8ad4457475d 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,11 +1,6 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT AI.IF( prompt => (`string_col`, ' is the same as ', `string_col`), connection_id => 'bigframes-dev.us.bigframes-default-connection' ) AS `result` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 10177819d8a..709dfd11c09 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,11 +1,6 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT AI.SCORE( prompt => (`string_col`, ' is the same as ', `string_col`), connection_id => 'bigframes-dev.us.bigframes-default-connection' ) AS `result` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 2f0a4c8862d..0198d92697e 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_list_col` - FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` -) SELECT `string_list_col`[SAFE_OFFSET(1)] AS `string_list_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_reduce_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_reduce_op/out.sql index a3b739da5d3..7c955a273aa 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_reduce_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_reduce_op/out.sql @@ -1,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_list_col`, - `float_list_col`, - `string_list_col` - FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` -) SELECT ( SELECT @@ -26,4 +19,4 @@ SELECT COALESCE(LOGICAL_OR(bf_arr_reduce_uid), FALSE) FROM UNNEST(`bool_list_col`) AS bf_arr_reduce_uid ) AS `any_bool` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` \ No newline at end of file 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 6968e7c1265..2fb104cdf40 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_list_col` - FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` -) SELECT ARRAY( SELECT @@ -11,4 +6,4 @@ SELECT WHERE slice_idx >= 1 ) AS `string_list_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` \ No newline at end of file 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 fbf95635a18..e6bcf4f1e27 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_list_col` - FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` -) SELECT ARRAY( SELECT @@ -11,4 +6,4 @@ SELECT WHERE slice_idx >= 1 AND slice_idx < 5 ) AS `string_list_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` \ No newline at end of file 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 a8cb9e64e1d..435249cbe9c 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_list_col` - FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` -) SELECT ARRAY_TO_STRING(`string_list_col`, '.') AS `string_list_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_to_array_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_to_array_op/out.sql index 3cfaef25348..a243c37d4fe 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_to_array_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_to_array_op/out.sql @@ -1,11 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `float64_col`, - `int64_col`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT [COALESCE(`bool_col`, FALSE)] AS `bool_col`, [COALESCE(`int64_col`, 0)] AS `int64_col`, @@ -15,4 +7,4 @@ SELECT CAST(COALESCE(`bool_col`, FALSE) AS INT64), COALESCE(`float64_col`, 0.0) ] AS `numeric_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 500ae267cbd..5efae7637a0 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,6 @@ -WITH `bfcte_0` AS ( - SELECT - `rowindex`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, OBJ.FETCH_METADATA( OBJ.MAKE_REF(`string_col`, 'bigframes-dev.test-region.bigframes-default-connection') ).`version` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ 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 b168b787146..675f19af69b 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,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `rowindex`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, JSON_VALUE( @@ -13,4 +7,4 @@ SELECT ), '$.access_urls.read_url' ) AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ 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 60a032f4c40..89e891c0825 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,10 +1,4 @@ -WITH `bfcte_0` AS ( - SELECT - `rowindex`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, OBJ.MAKE_REF(`string_col`, 'bigframes-dev.test-region.bigframes-default-connection') AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ 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 b49d709152d..074a291883a 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `bool_col`, @@ -12,4 +5,4 @@ SELECT `int64_col` & `int64_col` AS `int_and_int`, `bool_col` AND `bool_col` AS `bool_and_bool`, IF(`bool_col` = FALSE, `bool_col`, NULL) AS `bool_and_null` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 c8b1d86953d..7ebb3f77fe4 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `bool_col`, @@ -12,4 +5,4 @@ SELECT `int64_col` | `int64_col` AS `int_and_int`, `bool_col` OR `bool_col` AS `bool_and_bool`, IF(`bool_col` = TRUE, `bool_col`, NULL) AS `bool_and_null` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 51e969a6552..5f90436ead7 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `bool_col`, @@ -21,4 +14,4 @@ SELECT OR ( NOT `bool_col` AND CAST(NULL AS BOOLEAN) ) AS `bool_and_null` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 24cc8dde78b..17ac7379815 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,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT COALESCE(CAST(`int64_col` AS STRING), '$NULL_SENTINEL$') = COALESCE(CAST(CAST(`bool_col` AS INT64) AS STRING), '$NULL_SENTINEL$') AS `int64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 1f0f2529dd1..391311df073 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `int64_col`, @@ -14,4 +7,4 @@ SELECT `int64_col` IS NULL AS `int_eq_null`, `int64_col` = CAST(`bool_col` AS INT64) AS `int_eq_bool`, CAST(`bool_col` AS INT64) = `int64_col` AS `bool_eq_int` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 40b319c6250..aaab4f4e391 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `int64_col`, @@ -13,4 +6,4 @@ SELECT `int64_col` >= 1 AS `int_ge_1`, `int64_col` >= CAST(`bool_col` AS INT64) AS `int_ge_bool`, CAST(`bool_col` AS INT64) >= `int64_col` AS `bool_ge_int` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 0f9f412e482..f83c4e87e00 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `int64_col`, @@ -13,4 +6,4 @@ SELECT `int64_col` > 1 AS `int_gt_1`, `int64_col` > CAST(`bool_col` AS INT64) AS `int_gt_bool`, CAST(`bool_col` AS INT64) > `int64_col` AS `bool_gt_int` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 cc15f4cccaf..f5b60baee32 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `float64_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT COALESCE(`bool_col` IN (TRUE, FALSE), FALSE) AS `bools`, COALESCE(`int64_col` IN (1, 2, 3), FALSE) AS `ints`, @@ -18,4 +11,4 @@ SELECT ( `float64_col` IS NULL ) OR `float64_col` IN (1, 2, 3) AS `float_in_ints` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 a3fe2bc107a..09ce08d2f0b 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `int64_col`, @@ -13,4 +6,4 @@ SELECT `int64_col` <= 1 AS `int_le_1`, `int64_col` <= CAST(`bool_col` AS INT64) AS `int_le_bool`, CAST(`bool_col` AS INT64) <= `int64_col` AS `bool_le_int` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 a486b0b238d..bdeb6aee7e7 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `int64_col`, @@ -13,4 +6,4 @@ SELECT `int64_col` < 1 AS `int_lt_1`, `int64_col` < CAST(`bool_col` AS INT64) AS `int_lt_bool`, CAST(`bool_col` AS INT64) < `int64_col` AS `bool_lt_int` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 7a279b88560..1d710112c02 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,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT GREATEST(`int64_col`, `float64_col`) AS `int64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 1e7e0a75ed9..9372f1b5200 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,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT LEAST(`int64_col`, `float64_col`) AS `int64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 8ec8433ec18..d362f9820c7 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `int64_col`, @@ -16,4 +9,4 @@ SELECT ) IS NOT NULL AS `int_ne_null`, `int64_col` <> CAST(`bool_col` AS INT64) AS `int_ne_bool`, CAST(`bool_col` AS INT64) <> `int64_col` AS `bool_ne_int` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 5e82d20ae41..f5a3b94c0bb 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `date_col`, - `rowindex`, - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `timestamp_col`, @@ -14,4 +7,4 @@ SELECT TIMESTAMP_ADD(CAST(`date_col` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `timedelta_add_date`, TIMESTAMP_ADD(`timestamp_col`, INTERVAL 86400000000 MICROSECOND) AS `timedelta_add_timestamp`, 172800000000 AS `timedelta_add_timedelta` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 80d339a997f..90c29c6c7df 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT DATE(`timestamp_col`) AS `timestamp_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_datetime_to_integer_label/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_datetime_to_integer_label/out.sql index 3ec8aa8162e..e29494a33df 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_datetime_to_integer_label/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_datetime_to_integer_label/out.sql @@ -1,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `datetime_col`, - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CAST(FLOOR( IEEE_DIVIDE( @@ -29,4 +23,4 @@ SELECT ) ) AS INT64) + 1 END AS `non_fixed_freq_weekly` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 cdbd26d2cf0..4f8f3637d57 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT EXTRACT(DAY FROM `timestamp_col`) AS `timestamp_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 5fa4f0f252e..4bd0cd4fd67 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,12 +1,5 @@ -WITH `bfcte_0` AS ( - SELECT - `date_col`, - `datetime_col`, - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CAST(MOD(EXTRACT(DAYOFWEEK FROM `datetime_col`) + 5, 7) AS INT64) AS `datetime_col`, CAST(MOD(EXTRACT(DAYOFWEEK FROM `timestamp_col`) + 5, 7) AS INT64) AS `timestamp_col`, CAST(MOD(EXTRACT(DAYOFWEEK FROM `date_col`) + 5, 7) AS INT64) AS `date_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 bacc29fa9f2..d8b919586ed 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT EXTRACT(DAYOFYEAR FROM `timestamp_col`) AS `timestamp_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 d35afbe26b7..a40a726b4ed 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,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `datetime_col`, - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT TIMESTAMP_TRUNC(`timestamp_col`, MICROSECOND) AS `timestamp_col_us`, TIMESTAMP_TRUNC(`timestamp_col`, MILLISECOND) AS `timestamp_col_ms`, @@ -17,4 +11,4 @@ SELECT TIMESTAMP_TRUNC(`timestamp_col`, YEAR) AS `timestamp_col_Y`, TIMESTAMP_TRUNC(`datetime_col`, MICROSECOND) AS `datetime_col_q`, TIMESTAMP_TRUNC(`datetime_col`, MICROSECOND) AS `datetime_col_us` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 cf91b6a2a5a..7b3189f3a67 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT EXTRACT(HOUR FROM `timestamp_col`) AS `timestamp_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_fixed/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_fixed/out.sql index 577cb6a78b8..b4e23ed8772 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_fixed/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_fixed/out.sql @@ -1,11 +1,5 @@ -WITH `bfcte_0` AS ( - SELECT - `rowindex`, - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CAST(TIMESTAMP_MICROS( CAST(CAST(`rowindex` AS BIGNUMERIC) * 86400000000 + CAST(UNIX_MICROS(CAST(`timestamp_col` AS TIMESTAMP)) AS BIGNUMERIC) AS INT64) ) AS TIMESTAMP) AS `fixed_freq` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_month/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_month/out.sql index aa1b11d5750..5d20e2c1d16 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_month/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_month/out.sql @@ -1,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `rowindex`, - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CAST(TIMESTAMP( DATETIME( @@ -42,4 +36,4 @@ SELECT 0 ) ) - INTERVAL 1 DAY AS TIMESTAMP) AS `non_fixed_freq_monthly` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_quarter/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_quarter/out.sql index 04e65af38ae..ba2311dee6f 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_quarter/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_quarter/out.sql @@ -1,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `rowindex`, - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CAST(DATETIME( CASE @@ -46,4 +40,4 @@ SELECT 0, 0 ) - INTERVAL 1 DAY AS TIMESTAMP) AS `non_fixed_freq` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_week/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_week/out.sql index 7e3c9c75320..26960cbc290 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_week/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_week/out.sql @@ -1,13 +1,7 @@ -WITH `bfcte_0` AS ( - SELECT - `rowindex`, - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CAST(TIMESTAMP_MICROS( CAST(CAST(`rowindex` AS BIGNUMERIC) * 604800000000 + CAST(UNIX_MICROS( TIMESTAMP_TRUNC(CAST(`timestamp_col` AS TIMESTAMP), WEEK(MONDAY)) + INTERVAL 6 DAY ) AS BIGNUMERIC) AS INT64) ) AS TIMESTAMP) AS `non_fixed_freq_weekly` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_year/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_year/out.sql index 4e6dd06bff3..e4bed8e69fc 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_year/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_integer_label_to_datetime_year/out.sql @@ -1,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `rowindex`, - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CAST(TIMESTAMP(DATETIME(`rowindex` * 1 + EXTRACT(YEAR FROM `timestamp_col`) + 1, 1, 1, 0, 0, 0)) - INTERVAL 1 DAY AS TIMESTAMP) AS `non_fixed_freq_yearly` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 eb16d4f9c7d..2277875a21c 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CAST(MOD(EXTRACT(DAYOFWEEK FROM `timestamp_col`) + 5, 7) AS INT64) + 1 AS `timestamp_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 a6552f647c3..0c7ec5a8717 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT EXTRACT(ISOWEEK FROM `timestamp_col`) AS `timestamp_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 f316d25a0cd..6e0b7f264a2 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT EXTRACT(ISOYEAR FROM `timestamp_col`) AS `timestamp_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 4dc6bfdf4b5..ed1842262cb 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT EXTRACT(MINUTE FROM `timestamp_col`) AS `timestamp_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 0574dc15648..1f122f03929 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT EXTRACT(MONTH FROM `timestamp_col`) AS `timestamp_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 28b6beb7c54..0fc59582f78 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT TIMESTAMP_TRUNC(`timestamp_col`, DAY) AS `timestamp_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 86ebd60e57d..6738427f768 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT EXTRACT(QUARTER FROM `timestamp_col`) AS `timestamp_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 ccc97d9ea1a..740eb3234b3 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT EXTRACT(SECOND FROM `timestamp_col`) AS `timestamp_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 2d250129cba..ac523e0da5a 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,14 +1,6 @@ -WITH `bfcte_0` AS ( - SELECT - `date_col`, - `datetime_col`, - `time_col`, - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT FORMAT_DATE('%Y-%m-%d', `date_col`) AS `date_col`, FORMAT_DATETIME('%Y-%m-%d', `datetime_col`) AS `datetime_col`, FORMAT_TIME('%Y-%m-%d', `time_col`) AS `time_col`, FORMAT_TIMESTAMP('%Y-%m-%d', `timestamp_col`) AS `timestamp_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 cc5dab6cf0c..8c53679af1d 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,11 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `date_col`, - `duration_col`, - `rowindex`, - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `timestamp_col`, @@ -16,4 +8,4 @@ SELECT TIMESTAMP_DIFF(CAST(`date_col` AS DATETIME), CAST(`date_col` AS DATETIME), MICROSECOND) AS `timestamp_sub_date`, TIMESTAMP_DIFF(`timestamp_col`, `timestamp_col`, MICROSECOND) AS `date_sub_timestamp`, `duration_col` - `duration_col` AS `timedelta_sub_timedelta` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 0ffbd756537..52125d4b831 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT TIME(`timestamp_col`) AS `timestamp_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 f0b641795c6..430ee6ef8be 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,12 +1,5 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col`, - `int64_col`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CAST(TIMESTAMP_MICROS(CAST(TRUNC(`int64_col` * 0.001) AS INT64)) AS DATETIME) AS `int64_col`, SAFE_CAST(`string_col` AS DATETIME), CAST(TIMESTAMP_MICROS(CAST(TRUNC(`float64_col` * 0.001) AS INT64)) AS DATETIME) AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 9526dd301c1..84c8660c885 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,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CAST(TIMESTAMP_MICROS(CAST(TRUNC(`int64_col` * 0.001) AS INT64)) AS TIMESTAMP) AS `int64_col`, CAST(TIMESTAMP_MICROS(CAST(TRUNC(`float64_col` * 0.001) AS INT64)) AS TIMESTAMP) AS `float64_col`, @@ -11,4 +5,4 @@ SELECT CAST(TIMESTAMP_MICROS(CAST(TRUNC(`int64_col` * 1000) AS INT64)) AS TIMESTAMP) AS `int64_col_ms`, CAST(TIMESTAMP_MICROS(CAST(TRUNC(`int64_col`) AS INT64)) AS TIMESTAMP) AS `int64_col_us`, CAST(TIMESTAMP_MICROS(CAST(TRUNC(`int64_col` * 0.001) AS INT64)) AS TIMESTAMP) AS `int64_col_ns` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 aceaa377f24..55d199f02d4 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT UNIX_MICROS(`timestamp_col`) AS `timestamp_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 5533c0e45ce..39c4bf42154 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT UNIX_MILLIS(`timestamp_col`) AS `timestamp_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 a457d55167f..a4da6182c13 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT UNIX_SECONDS(`timestamp_col`) AS `timestamp_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 9fae0b5fe70..8e60460ce69 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT EXTRACT(YEAR FROM `timestamp_col`) AS `timestamp_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 53353c6201a..1a347f5a9af 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,11 +1,5 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `bool_col`, `float64_col` <> 0 AS `float64_col`, `float64_col` <> 0 AS `float64_w_safe` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 c9b64a447d4..840436d1515 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,10 +1,5 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CAST(CAST(`bool_col` AS INT64) AS FLOAT64), CAST('1.34235e4' AS FLOAT64) AS `str_const`, SAFE_CAST(SAFE_CAST(`bool_col` AS INT64) AS FLOAT64) AS `bool_w_safe` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 ae391c83e4a..882c7bc6f02 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,12 +1,7 @@ -WITH `bfcte_0` AS ( - SELECT - `json_col` - FROM `bigframes-dev`.`sqlglot_test`.`json_types` -) SELECT INT64(`json_col`) AS `int64_col`, FLOAT64(`json_col`) AS `float64_col`, BOOL(`json_col`) AS `bool_col`, STRING(`json_col`) AS `string_col`, SAFE.INT64(`json_col`) AS `int64_w_safe` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`json_types` \ No newline at end of file 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 75602331b06..37e544db6b5 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,12 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `datetime_col`, - `float64_col`, - `numeric_col`, - `time_col`, - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT UNIX_MICROS(CAST(`datetime_col` AS TIMESTAMP)) AS `datetime_col`, UNIX_MICROS(SAFE_CAST(`datetime_col` AS TIMESTAMP)) AS `datetime_w_safe`, @@ -17,4 +8,4 @@ SELECT CAST(TRUNC(`float64_col`) AS INT64) AS `float64_col`, SAFE_CAST(TRUNC(`float64_col`) AS INT64) AS `float64_w_safe`, CAST('100' AS INT64) AS `str_const` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 362cc11336d..f3293d2f87f 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,11 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `float64_col`, - `int64_col`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT PARSE_JSON(CAST(`int64_col` AS STRING)) AS `int64_col`, PARSE_JSON(CAST(`float64_col` AS STRING)) AS `float64_col`, @@ -13,4 +5,4 @@ SELECT PARSE_JSON(`string_col`) AS `string_col`, PARSE_JSON(CAST(`bool_col` AS STRING)) AS `bool_w_safe`, SAFE.PARSE_JSON(`string_col`) AS `string_w_safe` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 5eb4fa76f81..aabdb6a40d1 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,11 +1,5 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CAST(`int64_col` AS STRING), INITCAP(CAST(`bool_col` AS STRING)) AS `bool_col`, INITCAP(SAFE_CAST(`bool_col` AS STRING)) AS `bool_w_safe` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 75facae0072..36d8ec09630 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,11 +1,6 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CAST(TIMESTAMP_MICROS(`int64_col`) AS DATETIME) AS `int64_to_datetime`, CAST(TIMESTAMP_MICROS(`int64_col`) AS TIME) AS `int64_to_time`, CAST(TIMESTAMP_MICROS(`int64_col`) AS TIMESTAMP) AS `int64_to_timestamp`, SAFE_CAST(TIMESTAMP_MICROS(`int64_col`) AS TIME) AS `int64_to_time_safe` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_binary_remote_function_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_binary_remote_function_op/out.sql index e139122adf3..93dc413d80c 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_binary_remote_function_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_binary_remote_function_op/out.sql @@ -1,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `my_project`.`my_dataset`.`my_routine`(`int64_col`, `float64_col`) AS `int64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 e61dec3bc4c..9bd61690932 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,11 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `float64_col`, - `int64_col`, - `int64_too` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CASE WHEN `bool_col` THEN `int64_col` END AS `single_case`, CASE WHEN `bool_col` THEN `int64_col` WHEN `bool_col` THEN `int64_too` END AS `double_case`, @@ -18,4 +10,4 @@ SELECT WHEN `bool_col` THEN `float64_col` END AS `mixed_types_cast` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 f0f0858d922..9106faf6c8b 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `int64_too`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT GREATEST(LEAST(`rowindex`, `int64_too`), `int64_col`) AS `result_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 5f05c6ae87e..96fa1244029 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,10 +1,4 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `int64_too` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `int64_col`, COALESCE(`int64_too`, `int64_col`) AS `int64_too` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_fillna/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_fillna/out.sql index 1152f4d9d3c..52594023e9d 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_fillna/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_fillna/out.sql @@ -1,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT COALESCE(`int64_col`, `float64_col`) AS `int64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 9e80a627358..52d0758ae4f 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT FARM_FINGERPRINT(`string_col`) AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 3863e467dc8..f16f4232de3 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `bytes_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ~( `int64_col` @@ -15,4 +8,4 @@ SELECT NOT ( `bool_col` ) AS `bool_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 a83c737663d..2994208b465 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `float64_col` IS NULL AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 7ce1a44a99f..c217a632f38 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CASE WHEN `string_col` = 'value1' @@ -11,4 +6,4 @@ SELECT THEN 'UNKNOWN' ELSE `string_col` END AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_nary_remote_function_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_nary_remote_function_op/out.sql index 3aa4a56c8f9..c330d2b0e68 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_nary_remote_function_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_nary_remote_function_op/out.sql @@ -1,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col`, - `int64_col`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `my_project`.`my_dataset`.`my_routine`(`int64_col`, `float64_col`, `string_col`) AS `int64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 37b675fdff8..30140baa460 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT NOT `float64_col` IS NULL AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_remote_function_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_remote_function_op/out.sql index 75b73cac17f..4f83586edf1 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_remote_function_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_remote_function_op/out.sql @@ -1,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `my_project`.`my_dataset`.`my_routine`(`int64_col`) AS `apply_on_null_true`, IF( @@ -10,4 +5,4 @@ SELECT `int64_col`, `my_project`.`my_dataset`.`my_routine`(`int64_col`) ) AS `apply_on_null_false` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 4891744d16a..d0646c18c18 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,22 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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 CONCAT( CAST(FARM_FINGERPRINT( @@ -62,4 +43,4 @@ SELECT ) AS STRING), CAST(RAND() AS STRING) ) AS `row_key` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 14c3e8fa498..64a6e907028 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,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `bytes_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CAST(`bool_col` AS INT64) + BYTE_LENGTH(`bytes_col`) AS `bool_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 e5f73b2db0f..651f24ffc7f 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `float64_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT IF(`bool_col`, `int64_col`, `float64_col`) AS `result_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 38a4ce9c1a3..d6de4f45769 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `geography_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ST_AREA(`geography_col`) AS `geography_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 721157d6ff1..39eccc28459 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `geography_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ST_ASTEXT(`geography_col`) AS `geography_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 64b4fcf06e9..4ae9288c59f 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `geography_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ST_BOUNDARY(`geography_col`) AS `geography_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 3a1c084fa06..d9273e11e89 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `geography_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ST_BUFFER(`geography_col`, 1.0, 8.0, FALSE) AS `geography_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 a7ed97d884a..375caae748f 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `geography_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ST_CENTROID(`geography_col`) AS `geography_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 8f074913b89..36e4daa6879 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `geography_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ST_CONVEXHULL(`geography_col`) AS `geography_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 02ae95cdf9d..81e1cd09953 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `geography_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ST_DIFFERENCE(`geography_col`, `geography_col`) AS `geography_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_distance/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_distance/out.sql index 502cca20f71..24eab471096 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_distance/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_distance/out.sql @@ -1,9 +1,4 @@ -WITH `bfcte_0` AS ( - SELECT - `geography_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ST_DISTANCE(`geography_col`, `geography_col`, TRUE) AS `spheroid`, ST_DISTANCE(`geography_col`, `geography_col`, FALSE) AS `no_spheroid` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 2607f104964..2554b1a017e 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT SAFE.ST_GEOGFROMTEXT(`string_col`) AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_geogpoint/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_geogpoint/out.sql index 0da27247863..eddd11cc3d0 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_geogpoint/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_geogpoint/out.sql @@ -1,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `rowindex`, - `rowindex_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ST_GEOGPOINT(`rowindex`, `rowindex_2`) AS `rowindex` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_intersection/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_intersection/out.sql index 807a2f47067..b60b7248d93 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_intersection/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_intersection/out.sql @@ -1,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `geography_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ST_INTERSECTION(`geography_col`, `geography_col`) AS `geography_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 b14f99d1192..32189c1bb90 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `geography_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ST_ISCLOSED(`geography_col`) AS `geography_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 26022a041b5..18701e4d990 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `geography_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ST_LENGTH(`geography_col`) AS `geography_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 7114817312a..bb44db105f2 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `geography_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ST_X(`geography_col`) AS `geography_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 1b6742d62b0..e41be63567e 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `geography_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ST_Y(`geography_col`) AS `geography_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 358ae3a12e1..95930efe79c 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `json_col` - FROM `bigframes-dev`.`sqlglot_test`.`json_types` -) SELECT JSON_EXTRACT(`json_col`, '$') AS `json_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`json_types` \ No newline at end of file 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 5a4bb1c4ed1..013bb32fef0 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `json_col` - FROM `bigframes-dev`.`sqlglot_test`.`json_types` -) SELECT JSON_EXTRACT_ARRAY(`json_col`, '$') AS `json_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`json_types` \ No newline at end of file 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 f13f2ea1ee2..3a0a623659e 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `json_col` - FROM `bigframes-dev`.`sqlglot_test`.`json_types` -) SELECT JSON_EXTRACT_STRING_ARRAY(`json_col`, '$') AS `json_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`json_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_keys/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_keys/out.sql index ac629891e91..4ae4786c190 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_keys/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_keys/out.sql @@ -1,9 +1,4 @@ -WITH `bfcte_0` AS ( - SELECT - `json_col` - FROM `bigframes-dev`.`sqlglot_test`.`json_types` -) SELECT JSON_KEYS(`json_col`, NULL) AS `json_keys`, JSON_KEYS(`json_col`, 2) AS `json_keys_w_max_depth` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`json_types` \ No newline at end of file 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 eb522f67d51..d37a9db1bf8 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `json_col` - FROM `bigframes-dev`.`sqlglot_test`.`json_types` -) SELECT JSON_QUERY(`json_col`, '$') AS `json_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`json_types` \ No newline at end of file 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 78a74bafcdd..26e40b21d93 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `json_col` - FROM `bigframes-dev`.`sqlglot_test`.`json_types` -) SELECT JSON_QUERY_ARRAY(`json_col`, '$') AS `json_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`json_types` \ No newline at end of file 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 7be34a92478..8e9de92fa52 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `json_col` - FROM `bigframes-dev`.`sqlglot_test`.`json_types` -) SELECT JSON_SET(`json_col`, '$.a', 100) AS `json_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`json_types` \ No newline at end of file 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 50fa90cada8..0bb8d89c33e 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `json_col` - FROM `bigframes-dev`.`sqlglot_test`.`json_types` -) SELECT JSON_VALUE(`json_col`, '$') AS `json_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`json_types` \ No newline at end of file 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 0057b2ae541..e8be6759627 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT PARSE_JSON(`string_col`) AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_to_json/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_to_json/out.sql index 6029a686e54..2f7c6cbe086 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_to_json/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_to_json/out.sql @@ -1,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT TO_JSON(`string_col`) AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 a9753a888e6..fd4d74162af 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `json_col` - FROM `bigframes-dev`.`sqlglot_test`.`json_types` -) SELECT TO_JSON_STRING(`json_col`) AS `json_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`json_types` \ No newline at end of file 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 6f9756496e5..971a1492530 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ABS(`float64_col`) AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 20dca75f58b..5243fcbd2d0 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `int64_col`, @@ -13,4 +6,4 @@ SELECT `int64_col` + 1 AS `int_add_1`, `int64_col` + CAST(`bool_col` AS INT64) AS `int_add_bool`, CAST(`bool_col` AS INT64) + `int64_col` AS `bool_add_int` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 6585ce00f90..0031882bc70 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CONCAT(`string_col`, 'a') AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 5e82d20ae41..f5a3b94c0bb 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `date_col`, - `rowindex`, - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `timestamp_col`, @@ -14,4 +7,4 @@ SELECT TIMESTAMP_ADD(CAST(`date_col` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `timedelta_add_date`, TIMESTAMP_ADD(`timestamp_col`, INTERVAL 86400000000 MICROSECOND) AS `timedelta_add_timestamp`, 172800000000 AS `timedelta_add_timedelta` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 7d53a7b39d0..6469c88421c 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,12 +1,7 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CASE WHEN ABS(`float64_col`) > 1 THEN CAST('NaN' AS FLOAT64) ELSE ACOS(`float64_col`) END AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 874d8dcc704..13fd28298db 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,12 +1,7 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CASE WHEN `float64_col` < 1 THEN CAST('NaN' AS FLOAT64) ELSE ACOSH(`float64_col`) END AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 664211e6aa5..48ba4a9fdbd 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,12 +1,7 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CASE WHEN ABS(`float64_col`) > 1 THEN CAST('NaN' AS FLOAT64) ELSE ASIN(`float64_col`) END AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 ec827dd5c58..c6409c13734 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ASINH(`float64_col`) AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 2a0c66798f3..70025441dba 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ATAN(`float64_col`) AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 4fb0e010f2e..044c0a01511 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,11 +1,4 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `float64_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ATAN2(`int64_col`, `float64_col`) AS `int64_col`, ATAN2(CAST(`bool_col` AS INT64), `float64_col`) AS `bool_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 47e1eae6722..218cd7f4908 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CASE WHEN ABS(`float64_col`) < 1 @@ -11,4 +6,4 @@ SELECT THEN CAST('NaN' AS FLOAT64) ELSE CAST('Infinity' AS FLOAT64) * `float64_col` END AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 00bf423ae11..b202cc874d3 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CEIL(`float64_col`) AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 0cee03c7f9a..bd57e61deab 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT COS(`float64_col`) AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 249dd17bd07..4666fc9443c 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,12 +1,7 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CASE WHEN ABS(`float64_col`) > 709.78 THEN CAST('Infinity' AS FLOAT64) ELSE COSH(`float64_col`) END AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 f46281b4a41..e80dd7d91b6 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,10 +1,4 @@ -WITH `bfcte_0` AS ( - SELECT - `float_list_col`, - `int_list_col` - FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` -) SELECT ML.DISTANCE(`int_list_col`, `int_list_col`, 'COSINE') AS `int_list_col`, ML.DISTANCE(`float_list_col`, `float_list_col`, 'COSINE') AS `float_list_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` \ No newline at end of file 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 78d2a5f0631..42928d83a45 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,11 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `float64_col`, - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `int64_col`, @@ -19,4 +11,4 @@ SELECT IEEE_DIVIDE(`float64_col`, 0.0) AS `float_div_0`, IEEE_DIVIDE(`int64_col`, CAST(`bool_col` AS INT64)) AS `int_div_bool`, IEEE_DIVIDE(CAST(`bool_col` AS INT64), `int64_col`) AS `bool_div_int` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 010e17556a2..f8eaf06e5f2 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,13 +1,6 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `rowindex`, - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `timestamp_col`, `int64_col`, CAST(FLOOR(IEEE_DIVIDE(86400000000, `int64_col`)) AS INT64) AS `timedelta_div_numeric` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_euclidean_distance/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_euclidean_distance/out.sql index 46df8bee0ff..18bbd3d412d 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_euclidean_distance/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_euclidean_distance/out.sql @@ -1,10 +1,4 @@ -WITH `bfcte_0` AS ( - SELECT - `int_list_col`, - `numeric_list_col` - FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` -) SELECT ML.DISTANCE(`int_list_col`, `int_list_col`, 'EUCLIDEAN') AS `int_list_col`, ML.DISTANCE(`numeric_list_col`, `numeric_list_col`, 'EUCLIDEAN') AS `numeric_list_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` \ No newline at end of file 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 4a0364a67f5..b854008e1ee 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,12 +1,7 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CASE WHEN `float64_col` > 709.78 THEN CAST('Infinity' AS FLOAT64) ELSE EXP(`float64_col`) END AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 22f1a691f86..86ab545c1da 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT IF(`float64_col` > 709.78, CAST('Infinity' AS FLOAT64), EXP(`float64_col`) - 1) AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 e77c10888ca..c53e2143138 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT FLOOR(`float64_col`) AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 de65030d026..bbcc43d1fc3 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,13 +1,6 @@ -WITH `bfcte_0` AS ( - SELECT - `date_col`, - `rowindex`, - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `timestamp_col`, `date_col`, 43200000000 AS `timedelta_div_numeric` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ 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 53cabeec347..4d28ba6c771 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CASE WHEN `float64_col` IS NULL @@ -13,4 +8,4 @@ SELECT THEN CAST('NaN' AS FLOAT64) ELSE CAST('-Infinity' AS FLOAT64) END AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 0c62c1cb42f..509ca0a2f33 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CASE WHEN `float64_col` IS NULL @@ -13,4 +8,4 @@ SELECT THEN CAST('NaN' AS FLOAT64) ELSE CAST('-Infinity' AS FLOAT64) END AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 7db8d1ca38c..4e63205a287 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CASE WHEN `float64_col` IS NULL @@ -13,4 +8,4 @@ SELECT THEN CAST('NaN' AS FLOAT64) ELSE CAST('-Infinity' AS FLOAT64) END AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_manhattan_distance/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_manhattan_distance/out.sql index 9e1e353bdf4..35e53e1ee29 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_manhattan_distance/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_manhattan_distance/out.sql @@ -1,10 +1,4 @@ -WITH `bfcte_0` AS ( - SELECT - `float_list_col`, - `numeric_list_col` - FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` -) SELECT ML.DISTANCE(`float_list_col`, `float_list_col`, 'MANHATTAN') AS `float_list_col`, ML.DISTANCE(`numeric_list_col`, `numeric_list_col`, 'MANHATTAN') AS `numeric_list_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` \ No newline at end of file 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 4db0724e8cd..fdd6f3f305a 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col`, - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `int64_col`, @@ -197,4 +190,4 @@ SELECT ) ELSE MOD(CAST(`float64_col` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) END AS `float_mod_0` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 d6baa63040f..00c4d64fb4d 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `int64_col`, @@ -13,4 +6,4 @@ SELECT `int64_col` * 1 AS `int_mul_1`, `int64_col` * CAST(`bool_col` AS INT64) AS `int_mul_bool`, CAST(`bool_col` AS INT64) * `int64_col` AS `bool_mul_int` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 0f2a4f4f0e7..30ca104e614 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,11 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `duration_col`, - `int64_col`, - `rowindex`, - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `timestamp_col`, @@ -13,4 +5,4 @@ SELECT `duration_col`, CAST(FLOOR(`duration_col` * `int64_col`) AS INT64) AS `timedelta_mul_numeric`, CAST(FLOOR(`int64_col` * `duration_col`) AS INT64) AS `numeric_mul_timedelta` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 d421dabcd51..a2141579ca2 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,10 +1,5 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT -( `float64_col` ) AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 07b691f4502..9174e063743 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pow/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pow/out.sql index 425ad402ee7..213d8a011b0 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pow/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pow/out.sql @@ -1,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col`, - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `int64_col`, @@ -238,4 +231,4 @@ SELECT END ) END AS `float_pow_1` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 c4d1056aa2b..2301645eb72 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col`, - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `int64_col`, @@ -15,4 +8,4 @@ SELECT ROUND(`float64_col`, 0) AS `float_round_0`, ROUND(`float64_col`, 1) AS `float_round_1`, ROUND(`float64_col`, -1) AS `float_round_m1` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 514dd02059c..04489505d1b 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT SIN(`float64_col`) AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 679da4e84a2..add574e772d 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,12 +1,7 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CASE WHEN ABS(`float64_col`) > 709.78 THEN SIGN(`float64_col`) * CAST('Infinity' AS FLOAT64) ELSE SINH(`float64_col`) END AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 ac7e7963653..e6d18871f92 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CASE WHEN `float64_col` < 0 THEN CAST('NaN' AS FLOAT64) ELSE SQRT(`float64_col`) END AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 8790698eccb..dc95e3a28b1 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `int64_col`, @@ -13,4 +6,4 @@ SELECT `int64_col` - 1 AS `int_add_1`, `int64_col` - CAST(`bool_col` AS INT64) AS `int_add_bool`, CAST(`bool_col` AS INT64) - `int64_col` AS `bool_add_int` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 cc5dab6cf0c..8c53679af1d 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,11 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `date_col`, - `duration_col`, - `rowindex`, - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `timestamp_col`, @@ -16,4 +8,4 @@ SELECT TIMESTAMP_DIFF(CAST(`date_col` AS DATETIME), CAST(`date_col` AS DATETIME), MICROSECOND) AS `timestamp_sub_date`, TIMESTAMP_DIFF(`timestamp_col`, `timestamp_col`, MICROSECOND) AS `date_sub_timestamp`, `duration_col` - `duration_col` AS `timedelta_sub_timedelta` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 fa930bafc9b..d00c5cb791f 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT TAN(`float64_col`) AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 ea690759d4a..5d25fc32589 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT TANH(`float64_col`) AS `float64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_unsafe_pow_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_unsafe_pow_op/out.sql index 7914f508056..ab1e9663ced 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_unsafe_pow_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_unsafe_pow_op/out.sql @@ -1,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `float64_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT POWER(`int64_col`, `int64_col`) AS `int_pow_int`, POWER(`int64_col`, `float64_col`) AS `int_pow_float`, @@ -12,4 +5,10 @@ SELECT POWER(`float64_col`, `float64_col`) AS `float_pow_float`, POWER(`int64_col`, CAST(`bool_col` AS INT64)) AS `int_pow_bool`, POWER(CAST(`bool_col` AS INT64), `int64_col`) AS `bool_pow_int` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +WHERE + ( + `int64_col` >= 0 + ) AND ( + `int64_col` <= 10 + ) \ No newline at end of file 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 6585ce00f90..0031882bc70 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CONCAT(`string_col`, 'a') AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 705decc1c08..97c694aaa25 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT INITCAP(`string_col`, '') AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 f027bd6c5bb..0653a3fdc48 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,10 +1,5 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT ENDS_WITH(`string_col`, 'ab') AS `single`, ENDS_WITH(`string_col`, 'ab') OR ENDS_WITH(`string_col`, 'cd') AS `double`, FALSE AS `empty` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 d242c762454..530888a7e00 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT REGEXP_CONTAINS(`string_col`, '^(\\p{N}|\\p{L})+$') AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 13a02a3b2ae..0e48876157c 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT REGEXP_CONTAINS(`string_col`, '^\\p{L}+$') AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 94fe8ed39cd..fa47e342bb1 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT REGEXP_CONTAINS(`string_col`, '^(\\p{Nd})+$') AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 cf044280e39..66a2f8175a7 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,6 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT REGEXP_CONTAINS( `string_col`, '^[\\p{Nd}\\x{00B9}\\x{00B2}\\x{00B3}\\x{2070}\\x{2074}-\\x{2079}\\x{2080}-\\x{2089}]+$' ) AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 35f9ac10880..861687a301b 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT LOWER(`string_col`) = `string_col` AND UPPER(`string_col`) <> `string_col` AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 8f8cad43885..c23fb577bac 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT REGEXP_CONTAINS(`string_col`, '^\\pN+$') AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 62c9687bfd0..f38be0bfbc4 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT REGEXP_CONTAINS(`string_col`, '^\\s+$') AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 637f39ee1a3..d08f2550529 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT UPPER(`string_col`) = `string_col` AND LOWER(`string_col`) <> `string_col` AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 0fda7c59506..0f5bb072d77 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT LENGTH(`string_col`) AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_len_w_array/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_len_w_array/out.sql index 3c8e4f4b62f..bbef05c6737 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_len_w_array/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_len_w_array/out.sql @@ -1,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int_list_col` - FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` -) SELECT ARRAY_LENGTH(`int_list_col`) AS `int_list_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` \ No newline at end of file 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 8dcca32bbea..80b7fd8a589 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT LOWER(`string_col`) AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 595574b0ea3..d76f4dee73d 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT LTRIM(`string_col`, ' ') AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 772b3b10bd7..0146ddf4c4a 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT REGEXP_REPLACE(`string_col`, 'e', 'a') AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 be90d2252c1..c3851a294fd 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT REPLACE(`string_col`, 'e', 'a') AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 aafc9805d5c..6c919b52e07 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT REVERSE(`string_col`) AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 db0761a93cb..67c6030b416 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT RTRIM(`string_col`, ' ') AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 90c794a69ea..b0e1f77ad00 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,10 +1,5 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT STARTS_WITH(`string_col`, 'ab') AS `single`, STARTS_WITH(`string_col`, 'ab') OR STARTS_WITH(`string_col`, 'cd') AS `double`, FALSE AS `empty` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 48d0945cc90..c8a5d766ef6 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `string_col` LIKE '%e%' AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 1207261e441..e32010f9e4b 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT REGEXP_CONTAINS(`string_col`, 'e') AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 6d45e62cfd5..96552cc7326 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT IF( REGEXP_CONTAINS(`string_col`, '([a-z]*)'), @@ -14,4 +9,4 @@ SELECT REGEXP_REPLACE(`string_col`, CONCAT('.*?', '([a-z]*)', '.*'), '\\1'), NULL ) AS `one` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 e4e4fc77910..79a5f7c6388 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,11 +1,6 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT INSTR(`string_col`, 'e', 1) - 1 AS `none_none`, INSTR(`string_col`, 'e', 3) - 1 AS `start_none`, INSTR(SUBSTRING(`string_col`, 1, 5), 'e') - 1 AS `none_end`, INSTR(SUBSTRING(`string_col`, 3, 3), 'e') - 1 AS `start_end` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 b23b3424b78..f2717ede36b 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT IF(SUBSTRING(`string_col`, 2, 1) <> '', SUBSTRING(`string_col`, 2, 1), NULL) AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 c256f4aa4dd..12ea103743a 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT LPAD(`string_col`, GREATEST(LENGTH(`string_col`), 10), '-') AS `left`, RPAD(`string_col`, GREATEST(LENGTH(`string_col`), 10), '-') AS `right`, @@ -15,4 +10,4 @@ SELECT GREATEST(LENGTH(`string_col`), 10), '-' ) AS `both` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 50e8e486b66..9ad03238efa 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT REPEAT(`string_col`, 2) AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 bd63e9184f9..c0d5886a940 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT SUBSTRING(`string_col`, 2, 2) AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 6585ce00f90..0031882bc70 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CONCAT(`string_col`, 'a') AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 687af43d0bf..ca8c4f1d61b 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT SPLIT(`string_col`, ',') AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 affa2f66e6b..5bf171c0ba0 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT TRIM(`string_col`, ' ') AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 06f832ecae7..8e6b2ba657a 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT UPPER(`string_col`) AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 845eeb78678..0cfd70950e4 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,12 +1,7 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT CASE WHEN STARTS_WITH(`string_col`, '-') THEN CONCAT('-', LPAD(SUBSTRING(`string_col`, 2), GREATEST(LENGTH(`string_col`), 10) - 1, '0')) ELSE LPAD(`string_col`, GREATEST(LENGTH(`string_col`), 10), '0') END AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 f58553a188c..de60033454b 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,9 +1,4 @@ -WITH `bfcte_0` AS ( - SELECT - `people` - FROM `bigframes-dev`.`sqlglot_test`.`nested_structs_types` -) SELECT `people`.`name` AS `string`, `people`.`name` AS `int` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`nested_structs_types` \ No newline at end of file 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 e95e1c54a5d..56024b50fc9 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,11 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `float64_col`, - `int64_col`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT STRUCT( `bool_col` AS bool_col, @@ -13,4 +5,4 @@ SELECT `float64_col` AS float64_col, `string_col` AS string_col ) AS `result_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 187c2cd36bd..362a958b62e 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,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT FLOOR(`int64_col`) AS `int64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 9f0872c6f5b..109f72f0dc1 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col`, - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `int64_col`, @@ -13,4 +6,4 @@ SELECT CAST(FLOOR(`float64_col` * 1000000) AS INT64) AS `duration_s`, `int64_col` * 3600000000 AS `duration_w`, `int64_col` AS `duration_on_duration` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 b1523dd25e8..8f3008db771 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,20 +1,15 @@ WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_too` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( SELECT `bool_col`, `int64_too`, `int64_too` AS `bfcol_2`, `bool_col` AS `bfcol_3` - FROM `bfcte_0` -), `bfcte_2` AS ( + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( SELECT `bfcol_3`, COALESCE(SUM(`bfcol_2`), 0) AS `bfcol_6` - FROM `bfcte_1` + FROM `bfcte_0` WHERE NOT `bfcol_3` IS NULL GROUP BY @@ -23,4 +18,4 @@ WITH `bfcte_0` AS ( SELECT `bfcol_3` AS `bool_col`, `bfcol_6` AS `int64_too` -FROM `bfcte_2` \ No newline at end of file +FROM `bfcte_1` \ No newline at end of file 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 02e2260ab84..b4b71b7ebf5 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,24 +1,19 @@ WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_too` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( SELECT `bool_col`, `int64_too`, `int64_too` AS `bfcol_2`, `bool_col` AS `bfcol_3` - FROM `bfcte_0` -), `bfcte_2` AS ( + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( SELECT `bfcol_3`, COALESCE(SUM(`bfcol_2`), 0) AS `bfcol_6` - FROM `bfcte_1` + FROM `bfcte_0` GROUP BY `bfcol_3` ) SELECT `bfcol_3` AS `bool_col`, `bfcol_6` AS `int64_too` -FROM `bfcte_2` \ No newline at end of file +FROM `bfcte_1` \ No newline at end of file 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 10c62d49c01..0a6741669a9 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,16 +1,4 @@ -WITH `bfcte_1` AS ( - SELECT - `int64_col`, - `rowindex`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_0` AS ( - SELECT - `int64_col`, - `rowindex`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` AS ( +WITH `bfcte_0` AS ( SELECT `bfcol_9` AS `bfcol_30`, `bfcol_10` AS `bfcol_31`, @@ -27,7 +15,7 @@ WITH `bfcte_1` AS ( `string_col` AS `bfcol_12`, 0 AS `bfcol_13`, ROW_NUMBER() OVER () - 1 AS `bfcol_14` - FROM `bfcte_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) UNION ALL ( @@ -38,7 +26,7 @@ WITH `bfcte_1` AS ( `string_col` AS `bfcol_27`, 1 AS `bfcol_28`, ROW_NUMBER() OVER () - 1 AS `bfcol_29` - FROM `bfcte_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) ) ) @@ -47,4 +35,4 @@ SELECT `bfcol_31` AS `rowindex_1`, `bfcol_32` AS `int64_col`, `bfcol_33` AS `string_col` -FROM `bfcte_2` \ No newline at end of file +FROM `bfcte_0` \ No newline at end of file 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 238233fcdf4..cfbdbe00b96 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,26 +1,4 @@ -WITH `bfcte_3` AS ( - SELECT - `float64_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - `bool_col`, - `float64_col`, - `int64_too` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` AS ( - SELECT - `float64_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_0` AS ( - SELECT - `bool_col`, - `float64_col`, - `int64_too` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_4` AS ( +WITH `bfcte_0` AS ( SELECT `bfcol_6` AS `bfcol_42`, `bfcol_7` AS `bfcol_43`, @@ -33,7 +11,7 @@ WITH `bfcte_3` AS ( `int64_col` AS `bfcol_7`, 0 AS `bfcol_8`, ROW_NUMBER() OVER (ORDER BY `int64_col` ASC NULLS LAST) - 1 AS `bfcol_9` - FROM `bfcte_3` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) UNION ALL ( @@ -42,7 +20,9 @@ WITH `bfcte_3` AS ( `int64_too` AS `bfcol_18`, 1 AS `bfcol_19`, ROW_NUMBER() OVER () - 1 AS `bfcol_20` - FROM `bfcte_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + WHERE + `bool_col` ) UNION ALL ( @@ -51,7 +31,7 @@ WITH `bfcte_3` AS ( `int64_col` AS `bfcol_28`, 2 AS `bfcol_29`, ROW_NUMBER() OVER (ORDER BY `int64_col` ASC NULLS LAST) - 1 AS `bfcol_30` - FROM `bfcte_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) UNION ALL ( @@ -60,11 +40,13 @@ WITH `bfcte_3` AS ( `int64_too` AS `bfcol_39`, 3 AS `bfcol_40`, ROW_NUMBER() OVER () - 1 AS `bfcol_41` - FROM `bfcte_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + WHERE + `bool_col` ) ) ) SELECT `bfcol_42` AS `float64_col`, `bfcol_43` AS `int64_col` -FROM `bfcte_4` \ No newline at end of file +FROM `bfcte_0` \ 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 295a6ad2563..062e02c24c5 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,11 +1,7 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `rowindex` AS `rowindex_1`, `int64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +WHERE + `rowindex` >= 1 \ No newline at end of file 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 77aef6ad8bb..410b400f920 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,41 +1,36 @@ -WITH `bfcte_1` AS ( - SELECT - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_3` AS ( +WITH `bfcte_2` AS ( SELECT `rowindex` AS `bfcol_2`, `int64_col` AS `bfcol_3` - FROM `bfcte_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_0` AS ( SELECT `int64_too` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` AS ( +), `bfcte_1` AS ( SELECT `int64_too` FROM `bfcte_0` GROUP BY `int64_too` -), `bfcte_4` AS ( +), `bfcte_3` AS ( SELECT - `bfcte_3`.*, + `bfcte_2`.*, EXISTS( SELECT 1 FROM ( SELECT `int64_too` AS `bfcol_4` - FROM `bfcte_2` + FROM `bfcte_1` ) AS `bft_0` WHERE - 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) + 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) ) AS `bfcol_5` - FROM `bfcte_3` + FROM `bfcte_2` ) SELECT `bfcol_2` AS `rowindex`, `bfcol_5` AS `int64_col` -FROM `bfcte_4` \ No newline at end of file +FROM `bfcte_3` \ 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 8089c5b462b..61d4185a0d1 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,34 +1,29 @@ -WITH `bfcte_1` AS ( - SELECT - `rowindex`, - `rowindex_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_3` AS ( +WITH `bfcte_2` AS ( SELECT `rowindex` AS `bfcol_2`, `rowindex_2` AS `bfcol_3` - FROM `bfcte_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_0` AS ( SELECT `rowindex_2` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` AS ( +), `bfcte_1` AS ( SELECT `rowindex_2` FROM `bfcte_0` GROUP BY `rowindex_2` -), `bfcte_4` AS ( +), `bfcte_3` AS ( SELECT - `bfcte_3`.*, - `bfcte_3`.`bfcol_3` IN (( + `bfcte_2`.*, + `bfcte_2`.`bfcol_3` IN (( SELECT `rowindex_2` AS `bfcol_4` - FROM `bfcte_2` + FROM `bfcte_1` )) AS `bfcol_5` - FROM `bfcte_3` + FROM `bfcte_2` ) SELECT `bfcol_2` AS `rowindex`, `bfcol_5` AS `rowindex_2` -FROM `bfcte_4` \ No newline at end of file +FROM `bfcte_3` \ 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 3a7ff60d3ee..baddb66b09d 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,32 +1,22 @@ -WITH `bfcte_1` AS ( - SELECT - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` AS ( +WITH `bfcte_0` AS ( SELECT `rowindex` AS `bfcol_2`, `int64_col` AS `bfcol_3` - FROM `bfcte_1` -), `bfcte_0` AS ( - SELECT - `int64_col`, - `int64_too` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_3` AS ( +), `bfcte_1` AS ( SELECT `int64_col` AS `bfcol_6`, `int64_too` AS `bfcol_7` - FROM `bfcte_0` -), `bfcte_4` AS ( + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_2` AS ( SELECT * - FROM `bfcte_2` - LEFT JOIN `bfcte_3` + FROM `bfcte_0` + LEFT JOIN `bfcte_1` ON COALESCE(`bfcol_2`, 0) = COALESCE(`bfcol_6`, 0) AND COALESCE(`bfcol_2`, 1) = COALESCE(`bfcol_6`, 1) ) SELECT `bfcol_3` AS `int64_col`, `bfcol_7` AS `int64_too` -FROM `bfcte_4` \ No newline at end of file +FROM `bfcte_2` \ No newline at end of file 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 30f363e900e..8f55e7a6ef8 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,28 +1,18 @@ -WITH `bfcte_1` AS ( - SELECT - `bool_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` AS ( +WITH `bfcte_0` AS ( SELECT `rowindex` AS `bfcol_2`, `bool_col` AS `bfcol_3` - FROM `bfcte_1` -), `bfcte_0` AS ( - SELECT - `bool_col`, - `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_3` AS ( +), `bfcte_1` AS ( SELECT `rowindex` AS `bfcol_6`, `bool_col` AS `bfcol_7` - FROM `bfcte_0` -), `bfcte_4` AS ( + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_2` AS ( SELECT * - FROM `bfcte_2` - INNER JOIN `bfcte_3` + FROM `bfcte_0` + INNER JOIN `bfcte_1` ON COALESCE(CAST(`bfcol_3` AS STRING), '0') = COALESCE(CAST(`bfcol_7` AS STRING), '0') AND COALESCE(CAST(`bfcol_3` AS STRING), '1') = COALESCE(CAST(`bfcol_7` AS STRING), '1') ) @@ -30,4 +20,4 @@ SELECT `bfcol_2` AS `rowindex_x`, `bfcol_3` AS `bool_col`, `bfcol_6` AS `rowindex_y` -FROM `bfcte_4` \ No newline at end of file +FROM `bfcte_2` \ No newline at end of file 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 9fa7673fb31..1bf5912bce6 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,28 +1,18 @@ -WITH `bfcte_1` AS ( - SELECT - `float64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` AS ( +WITH `bfcte_0` AS ( SELECT `rowindex` AS `bfcol_2`, `float64_col` AS `bfcol_3` - FROM `bfcte_1` -), `bfcte_0` AS ( - SELECT - `float64_col`, - `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_3` AS ( +), `bfcte_1` AS ( SELECT `rowindex` AS `bfcol_6`, `float64_col` AS `bfcol_7` - FROM `bfcte_0` -), `bfcte_4` AS ( + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_2` AS ( SELECT * - FROM `bfcte_2` - INNER JOIN `bfcte_3` + FROM `bfcte_0` + INNER JOIN `bfcte_1` ON IF(IS_NAN(`bfcol_3`), 2, COALESCE(`bfcol_3`, 0)) = IF(IS_NAN(`bfcol_7`), 2, COALESCE(`bfcol_7`, 0)) AND IF(IS_NAN(`bfcol_3`), 3, COALESCE(`bfcol_3`, 1)) = IF(IS_NAN(`bfcol_7`), 3, COALESCE(`bfcol_7`, 1)) ) @@ -30,4 +20,4 @@ SELECT `bfcol_2` AS `rowindex_x`, `bfcol_3` AS `float64_col`, `bfcol_6` AS `rowindex_y` -FROM `bfcte_4` \ No newline at end of file +FROM `bfcte_2` \ No newline at end of file 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 c9fca069d6a..3e0f105a7be 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,28 +1,18 @@ -WITH `bfcte_1` AS ( - SELECT - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` AS ( +WITH `bfcte_0` AS ( SELECT `rowindex` AS `bfcol_2`, `int64_col` AS `bfcol_3` - FROM `bfcte_1` -), `bfcte_0` AS ( - SELECT - `int64_col`, - `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_3` AS ( +), `bfcte_1` AS ( SELECT `rowindex` AS `bfcol_6`, `int64_col` AS `bfcol_7` - FROM `bfcte_0` -), `bfcte_4` AS ( + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_2` AS ( SELECT * - FROM `bfcte_2` - INNER JOIN `bfcte_3` + FROM `bfcte_0` + INNER JOIN `bfcte_1` ON COALESCE(`bfcol_3`, 0) = COALESCE(`bfcol_7`, 0) AND COALESCE(`bfcol_3`, 1) = COALESCE(`bfcol_7`, 1) ) @@ -30,4 +20,4 @@ SELECT `bfcol_2` AS `rowindex_x`, `bfcol_3` AS `int64_col`, `bfcol_6` AS `rowindex_y` -FROM `bfcte_4` \ No newline at end of file +FROM `bfcte_2` \ No newline at end of file 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 88649c65188..b2481e07ace 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,28 +1,18 @@ -WITH `bfcte_1` AS ( - SELECT - `numeric_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` AS ( +WITH `bfcte_0` AS ( SELECT `rowindex` AS `bfcol_2`, `numeric_col` AS `bfcol_3` - FROM `bfcte_1` -), `bfcte_0` AS ( - SELECT - `numeric_col`, - `rowindex` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_3` AS ( +), `bfcte_1` AS ( SELECT `rowindex` AS `bfcol_6`, `numeric_col` AS `bfcol_7` - FROM `bfcte_0` -), `bfcte_4` AS ( + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_2` AS ( SELECT * - FROM `bfcte_2` - INNER JOIN `bfcte_3` + FROM `bfcte_0` + INNER JOIN `bfcte_1` ON COALESCE(`bfcol_3`, CAST(0 AS NUMERIC)) = COALESCE(`bfcol_7`, CAST(0 AS NUMERIC)) AND COALESCE(`bfcol_3`, CAST(1 AS NUMERIC)) = COALESCE(`bfcol_7`, CAST(1 AS NUMERIC)) ) @@ -30,4 +20,4 @@ SELECT `bfcol_2` AS `rowindex_x`, `bfcol_3` AS `numeric_col`, `bfcol_6` AS `rowindex_y` -FROM `bfcte_4` \ No newline at end of file +FROM `bfcte_2` \ No newline at end of file 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 8758ec8340e..f804b0d1f87 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,28 +1,18 @@ -WITH `bfcte_1` AS ( - SELECT - `rowindex`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` AS ( +WITH `bfcte_0` AS ( SELECT `rowindex` AS `bfcol_0`, `string_col` AS `bfcol_1` - FROM `bfcte_1` -), `bfcte_0` AS ( - SELECT - `rowindex`, - `string_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_3` AS ( +), `bfcte_1` AS ( SELECT `rowindex` AS `bfcol_4`, `string_col` AS `bfcol_5` - FROM `bfcte_0` -), `bfcte_4` AS ( + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_2` AS ( SELECT * - FROM `bfcte_2` - INNER JOIN `bfcte_3` + FROM `bfcte_0` + INNER JOIN `bfcte_1` 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') ) @@ -30,4 +20,4 @@ SELECT `bfcol_0` AS `rowindex_x`, `bfcol_1` AS `string_col`, `bfcol_4` AS `rowindex_y` -FROM `bfcte_4` \ No newline at end of file +FROM `bfcte_2` \ 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 42fc15cd1d4..8fc9e135eee 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,28 +1,18 @@ -WITH `bfcte_1` AS ( - SELECT - `rowindex`, - `time_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` AS ( +WITH `bfcte_0` AS ( SELECT `rowindex` AS `bfcol_0`, `time_col` AS `bfcol_1` - FROM `bfcte_1` -), `bfcte_0` AS ( - SELECT - `rowindex`, - `time_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_3` AS ( +), `bfcte_1` AS ( SELECT `rowindex` AS `bfcol_4`, `time_col` AS `bfcol_5` - FROM `bfcte_0` -), `bfcte_4` AS ( + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_2` AS ( SELECT * - FROM `bfcte_2` - INNER JOIN `bfcte_3` + FROM `bfcte_0` + INNER JOIN `bfcte_1` 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') ) @@ -30,4 +20,4 @@ SELECT `bfcol_0` AS `rowindex_x`, `bfcol_1` AS `time_col`, `bfcol_4` AS `rowindex_y` -FROM `bfcte_4` \ No newline at end of file +FROM `bfcte_2` \ 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 959a31a2a35..e0f6e7f3d2e 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,22 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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 `rowindex`, `bool_col`, @@ -34,4 +15,4 @@ SELECT `time_col`, `timestamp_col`, `duration_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_columns_filters/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_columns_filters/out.sql index 0d8a10c9566..c9a42b73f1a 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_columns_filters/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_columns_filters/out.sql @@ -1,8 +1,6 @@ WITH `bfcte_0` AS ( SELECT - `int64_col`, - `rowindex`, - `string_col` + * FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` WHERE `rowindex` > 0 AND `string_col` IN ('Hello, World!') diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_json_types/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_json_types/out.sql index 4b5750d7aaf..f65f3a10f0f 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,4 @@ -WITH `bfcte_0` AS ( - SELECT - `json_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`json_types` -) SELECT `rowindex`, `json_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`json_types` \ 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 6e19ae67883..1a2bd071dd0 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,11 +1,5 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `int64_col` -FROM `bfcte_0` +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` 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 79ae1ac9072..678b3b694f0 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,5 @@ -WITH `bfcte_0` AS ( - SELECT - `id`, - `people` - FROM `bigframes-dev`.`sqlglot_test`.`nested_structs_types` -) SELECT `id`, `id` AS `id_1`, `people` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`nested_structs_types` \ 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 4cef7fe289a..fc581f87fb2 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,10 +1,4 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `int64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ 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 a22c845ef1c..41f0d13d4fd 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,15 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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 `rowindex`, `rowindex` AS `rowindex_1`, @@ -20,4 +8,4 @@ SELECT `date_time_list_col`, `numeric_list_col`, `string_list_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_system_time/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_system_time/out.sql index 59c36870803..d188899e7c2 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_system_time/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_system_time/out.sql @@ -1,22 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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` FOR SYSTEM_TIME AS OF '2025-11-09T03:04:05.678901+00:00' -) SELECT `bool_col`, `bytes_col`, @@ -33,4 +14,4 @@ SELECT `time_col`, `timestamp_col`, `duration_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` FOR SYSTEM_TIME AS OF '2025-11-09T03:04:05.678901+00:00' \ 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 a0a50c79e2a..f1b7b27375b 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,10 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `bool_col`, `rowindex`, @@ -48,4 +41,6 @@ SELECT 0 ) END AS `int64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +WHERE + NOT `bool_col` IS NULL \ 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 b10c822f5c2..41b3d4b1931 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,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, CASE @@ -18,4 +12,4 @@ SELECT 0 ) END AS `int64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ 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 f83e368d713..5531779f6aa 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,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, CASE @@ -12,4 +6,4 @@ SELECT WHEN TRUE THEN COUNT(`int64_col`) OVER (ORDER BY `rowindex` ASC NULLS LAST ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) END AS `int64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file From 46dcf2960be0efa3c557b8b485317c059518d580 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Fri, 6 Feb 2026 05:39:48 +0000 Subject: [PATCH 6/6] fix order by, window key issues --- .../compile/sqlglot/aggregations/windows.py | 8 +-- bigframes/core/compile/sqlglot/compiler.py | 1 + bigframes/core/rewrite/as_sql.py | 2 +- .../test_unary_compiler/test_qcut/out.sql | 70 ++++++------------- .../test_compile_aggregate/out.sql | 4 +- .../test_compile_aggregate_wo_dropna/out.sql | 4 +- .../test_compile_concat/out.sql | 5 +- .../test_compile_concat_filter_sorted/out.sql | 5 +- .../test_compile_explode_dataframe/out.sql | 4 +- .../test_compile_explode_series/out.sql | 4 +- .../test_st_regionstats/out.sql | 4 +- .../out.sql | 4 +- .../test_compile_geo/test_st_simplify/out.sql | 4 +- .../test_compile_random_sample/out.sql | 4 +- .../test_compile_readlocal/out.sql | 4 +- .../test_compile_readlocal_w_json_df/out.sql | 4 +- .../test_compile_readlocal_w_lists_df/out.sql | 4 +- .../out.sql | 4 +- .../out.sql | 4 +- .../test_compile_readtable_w_limit/out.sql | 2 + .../test_compile_readtable_w_ordering/out.sql | 4 +- .../out.sql | 5 +- .../out.sql | 5 +- .../out.sql | 4 +- .../out.sql | 4 +- 25 files changed, 94 insertions(+), 73 deletions(-) diff --git a/bigframes/core/compile/sqlglot/aggregations/windows.py b/bigframes/core/compile/sqlglot/aggregations/windows.py index 0fad50046bc..d10da8f1c05 100644 --- a/bigframes/core/compile/sqlglot/aggregations/windows.py +++ b/bigframes/core/compile/sqlglot/aggregations/windows.py @@ -193,13 +193,13 @@ def _get_window_bounds( def _compile_group_by_key(key: ex.Expression) -> sge.Expression: expr = expression_compiler.expression_compiler.compile_expression(key) # The group_by keys has been rewritten by bind_schema_to_node - assert isinstance(key, ex.ResolvedDerefOp) + assert key.is_scalar_expr and key.is_resolved # Some types need to be converted to another type to enable groupby - if key.dtype == dtypes.FLOAT_DTYPE: + if key.output_type == dtypes.FLOAT_DTYPE: expr = sge.Cast(this=expr, to="STRING") - elif key.dtype == dtypes.GEO_DTYPE: + elif key.output_type == dtypes.GEO_DTYPE: expr = sge.func("ST_ASBINARY", expr) - elif key.dtype == dtypes.JSON_DTYPE: + elif key.output_type == dtypes.JSON_DTYPE: expr = sge.func("TO_JSON_STRING", expr) return expr diff --git a/bigframes/core/compile/sqlglot/compiler.py b/bigframes/core/compile/sqlglot/compiler.py index 87078ed6787..2745fe0bd8f 100644 --- a/bigframes/core/compile/sqlglot/compiler.py +++ b/bigframes/core/compile/sqlglot/compiler.py @@ -108,6 +108,7 @@ def _compile_result_node(root: nodes.ResultNode) -> str: root = typing.cast(nodes.ResultNode, schema_binding.bind_schema_to_tree(root)) sqlglot_ir = compile_node(rewrite.as_sql_nodes(root), uid_gen) + print(sqlglot_ir.sql) return sqlglot_ir.sql diff --git a/bigframes/core/rewrite/as_sql.py b/bigframes/core/rewrite/as_sql.py index 3fd7c48aead..efe7dcc49ca 100644 --- a/bigframes/core/rewrite/as_sql.py +++ b/bigframes/core/rewrite/as_sql.py @@ -202,7 +202,7 @@ def _as_sql_node(node: nodes.BigFrameNode) -> nodes.BigFrameNode: if node.order_by is not None: result = _sort(result, node.order_by.all_ordering_columns) result = _remap_select_cols( - node.child, + result, [ nodes.AliasedRef(ref, identifiers.ColumnId(name)) for ref, name in node.output_cols diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_qcut/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_qcut/out.sql index 1aa2e436caa..3f0a9d0a963 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_qcut/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_qcut/out.sql @@ -1,61 +1,35 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - NOT `int64_col` IS NULL AS `bfcol_4` - FROM `bfcte_0` -), `bfcte_2` AS ( - SELECT - *, +SELECT + `rowindex`, + `int64_col`, + IF( + NOT `int64_col` IS NULL, IF( `int64_col` IS NULL, NULL, CAST(GREATEST( - CEIL(PERCENT_RANK() OVER (PARTITION BY `bfcol_4` ORDER BY `int64_col` ASC) * 4) - 1, + CEIL( + PERCENT_RANK() OVER (PARTITION BY NOT `int64_col` IS NULL ORDER BY `int64_col` ASC) * 4 + ) - 1, 0 ) AS INT64) - ) AS `bfcol_5` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - IF(`bfcol_4`, `bfcol_5`, NULL) AS `bfcol_6` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - *, - NOT `int64_col` IS NULL AS `bfcol_10` - FROM `bfcte_3` -), `bfcte_5` AS ( - SELECT - *, + ), + NULL + ) AS `qcut_w_int`, + IF( + NOT `int64_col` IS NULL, CASE - WHEN PERCENT_RANK() OVER (PARTITION BY `bfcol_10` ORDER BY `int64_col` ASC) < 0 + WHEN PERCENT_RANK() OVER (PARTITION BY NOT `int64_col` IS NULL ORDER BY `int64_col` ASC) < 0 THEN NULL - WHEN PERCENT_RANK() OVER (PARTITION BY `bfcol_10` ORDER BY `int64_col` ASC) <= 0.25 + WHEN PERCENT_RANK() OVER (PARTITION BY NOT `int64_col` IS NULL ORDER BY `int64_col` ASC) <= 0.25 THEN 0 - WHEN PERCENT_RANK() OVER (PARTITION BY `bfcol_10` ORDER BY `int64_col` ASC) <= 0.5 + WHEN PERCENT_RANK() OVER (PARTITION BY NOT `int64_col` IS NULL ORDER BY `int64_col` ASC) <= 0.5 THEN 1 - WHEN PERCENT_RANK() OVER (PARTITION BY `bfcol_10` ORDER BY `int64_col` ASC) <= 0.75 + WHEN PERCENT_RANK() OVER (PARTITION BY NOT `int64_col` IS NULL ORDER BY `int64_col` ASC) <= 0.75 THEN 2 - WHEN PERCENT_RANK() OVER (PARTITION BY `bfcol_10` ORDER BY `int64_col` ASC) <= 1 + WHEN PERCENT_RANK() OVER (PARTITION BY NOT `int64_col` IS NULL ORDER BY `int64_col` ASC) <= 1 THEN 3 ELSE NULL - END AS `bfcol_11` - FROM `bfcte_4` -), `bfcte_6` AS ( - SELECT - *, - IF(`bfcol_10`, `bfcol_11`, NULL) AS `bfcol_12` - FROM `bfcte_5` -) -SELECT - `rowindex`, - `int64_col`, - `bfcol_6` AS `qcut_w_int`, - `bfcol_12` AS `qcut_w_list` -FROM `bfcte_6` \ No newline at end of file + END, + NULL + ) AS `qcut_w_list` +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file 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 8f3008db771..153ff1e03a4 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 @@ -18,4 +18,6 @@ WITH `bfcte_0` AS ( SELECT `bfcol_3` AS `bool_col`, `bfcol_6` AS `int64_too` -FROM `bfcte_1` \ No newline at end of file +FROM `bfcte_1` +ORDER BY + `bfcol_3` ASC NULLS LAST \ No newline at end of file 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 b4b71b7ebf5..4a9fd5374d3 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 @@ -16,4 +16,6 @@ WITH `bfcte_0` AS ( SELECT `bfcol_3` AS `bool_col`, `bfcol_6` AS `int64_too` -FROM `bfcte_1` \ No newline at end of file +FROM `bfcte_1` +ORDER BY + `bfcol_3` ASC NULLS LAST \ No newline at end of file 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 0a6741669a9..efa7c6cbe95 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 @@ -35,4 +35,7 @@ SELECT `bfcol_31` AS `rowindex_1`, `bfcol_32` AS `int64_col`, `bfcol_33` AS `string_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bfcte_0` +ORDER BY + `bfcol_34` ASC NULLS LAST, + `bfcol_35` ASC NULLS LAST \ No newline at end of file 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 cfbdbe00b96..82534292032 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 @@ -49,4 +49,7 @@ WITH `bfcte_0` AS ( SELECT `bfcol_42` AS `float64_col`, `bfcol_43` AS `int64_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bfcte_0` +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 b83eaf65961..5d9019439f2 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 @@ -16,4 +16,6 @@ SELECT `rowindex` AS `rowindex_1`, `int_list_col`, `string_list_col` -FROM `bfcte_1` \ No newline at end of file +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 17511dbf646..8ba4559da83 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 @@ -13,4 +13,6 @@ WITH `bfcte_0` AS ( SELECT `rowindex`, `int_list_col` -FROM `bfcte_1` \ No newline at end of file +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_geo/test_st_regionstats/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats/out.sql index 289aae03977..457436e98c4 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats/out.sql @@ -46,4 +46,6 @@ SELECT include => 'some equation', options => JSON '{"scale": 100}' ).`area` -FROM `bfcte_0` \ No newline at end of file +FROM `bfcte_0` +ORDER BY + `bfcol_1` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats_without_optional_args/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats_without_optional_args/out.sql index cfef8cc5350..410909d80c5 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats_without_optional_args/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_regionstats_without_optional_args/out.sql @@ -10,4 +10,6 @@ SELECT ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`count`, ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`mean`, ST_REGIONSTATS(`bfcol_0`, 'ee://some/raster/uri').`area` -FROM `bfcte_0` \ No newline at end of file +FROM `bfcte_0` +ORDER BY + `bfcol_1` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_simplify/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_simplify/out.sql index aacaa7ed759..1c146e1e1be 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_simplify/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_geo/test_st_simplify/out.sql @@ -5,4 +5,6 @@ WITH `bfcte_0` AS ( ) SELECT ST_SIMPLIFY(`bfcol_0`, 123.125) AS `0` -FROM `bfcte_0` \ No newline at end of file +FROM `bfcte_0` +ORDER BY + `bfcol_1` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_random_sample/test_compile_random_sample/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_random_sample/test_compile_random_sample/out.sql index aaaddc49fee..aae34716d86 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_random_sample/test_compile_random_sample/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_random_sample/test_compile_random_sample/out.sql @@ -179,4 +179,6 @@ SELECT `bfcol_12` AS `time_col`, `bfcol_13` AS `timestamp_col`, `bfcol_14` AS `duration_col` -FROM `bfcte_1` \ No newline at end of file +FROM `bfcte_1` +ORDER BY + `bfcol_15` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal/out.sql index 7de2ca06322..2b080b0b7ce 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal/out.sql @@ -182,4 +182,6 @@ SELECT `bfcol_13` AS `time_col`, `bfcol_14` AS `timestamp_col`, `bfcol_15` AS `duration_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bfcte_0` +ORDER BY + `bfcol_16` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_json_df/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_json_df/out.sql index 34fc576d408..4e21266b87b 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_json_df/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_json_df/out.sql @@ -6,4 +6,6 @@ WITH `bfcte_0` AS ( SELECT `bfcol_0` AS `rowindex`, `bfcol_1` AS `json_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bfcte_0` +ORDER BY + `bfcol_2` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_lists_df/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_lists_df/out.sql index 1ba602f2056..923476aafd4 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_lists_df/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_lists_df/out.sql @@ -42,4 +42,6 @@ SELECT `bfcol_5` AS `date_time_list_col`, `bfcol_6` AS `numeric_list_col`, `bfcol_7` AS `string_list_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bfcte_0` +ORDER BY + `bfcol_8` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_special_values/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_special_values/out.sql index 02ea0785fb6..ba5e0c8f1cf 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_special_values/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_special_values/out.sql @@ -20,4 +20,6 @@ SELECT `bfcol_4` AS `col_struct_none`, `bfcol_5` AS `col_struct_w_none`, `bfcol_6` AS `col_list_none` -FROM `bfcte_0` \ No newline at end of file +FROM `bfcte_0` +ORDER BY + `bfcol_7` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_structs_df/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_structs_df/out.sql index 54d1a1bb2b3..7ded9cf5fff 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_structs_df/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readlocal/test_compile_readlocal_w_structs_df/out.sql @@ -22,4 +22,6 @@ WITH `bfcte_0` AS ( SELECT `bfcol_0` AS `id`, `bfcol_1` AS `person` -FROM `bfcte_0` \ No newline at end of file +FROM `bfcte_0` +ORDER BY + `bfcol_2` 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_limit/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_limit/out.sql index 1a2bd071dd0..90ad5b0186f 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 @@ -2,4 +2,6 @@ SELECT `rowindex`, `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +ORDER BY + `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_ordering/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_ordering/out.sql index fc581f87fb2..fb114c50e81 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,4 +1,6 @@ SELECT `rowindex`, `int64_col` -FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +ORDER BY + `int64_col` 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_groupby_rolling/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_groupby_rolling/out.sql index f1b7b27375b..3c48aa1b24f 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 @@ -43,4 +43,7 @@ SELECT END AS `int64_col` FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` WHERE - NOT `bool_col` IS NULL \ No newline at end of file + NOT `bool_col` IS NULL +ORDER BY + `bool_col` ASC NULLS LAST, + `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_range_rolling/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_range_rolling/out.sql index ef3c244749d..e9ab1a08629 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 @@ -23,4 +23,7 @@ SELECT 0 ) END AS `int_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bfcte_0` +ORDER BY + `bfcol_0` ASC NULLS LAST, + `bfcol_2` 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 41b3d4b1931..248916c4f3c 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 @@ -12,4 +12,6 @@ SELECT 0 ) END AS `int64_col` -FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +ORDER BY + `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 5531779f6aa..92864e3f862 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 @@ -6,4 +6,6 @@ SELECT WHEN TRUE THEN COUNT(`int64_col`) OVER (ORDER BY `rowindex` ASC NULLS LAST ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) END AS `int64_col` -FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` \ No newline at end of file +FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +ORDER BY + `rowindex` ASC NULLS LAST \ No newline at end of file