From 60c0ba97a6a1c8a44f9e9e085e6ef4659f075fa1 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Sat, 15 Nov 2025 00:04:46 +0000 Subject: [PATCH 01/10] refactor: Remove never_skip_nulls param from window node def --- bigframes/core/array_value.py | 28 ------------------- bigframes/core/blocks.py | 6 ---- bigframes/core/compile/compiled.py | 7 ----- .../compile/ibis_compiler/ibis_compiler.py | 1 - bigframes/core/compile/polars/compiler.py | 21 -------------- bigframes/core/compile/sqlglot/compiler.py | 6 +--- bigframes/core/groupby/dataframe_group_by.py | 17 +++++++++-- bigframes/core/groupby/series_group_by.py | 14 ++++++++-- bigframes/core/nodes.py | 1 - bigframes/core/rewrite/timedeltas.py | 1 - bigframes/core/window/rolling.py | 1 - bigframes/dataframe.py | 17 ++++++++++- bigframes/operations/aggregations.py | 4 +++ bigframes/series.py | 6 +++- tests/system/small/engines/test_windowing.py | 3 -- 15 files changed, 52 insertions(+), 81 deletions(-) diff --git a/bigframes/core/array_value.py b/bigframes/core/array_value.py index 35d0c5d4d4..5af6fbd56e 100644 --- a/bigframes/core/array_value.py +++ b/bigframes/core/array_value.py @@ -401,37 +401,10 @@ def aggregate( ) ) - def project_window_op( - self, - column_name: str, - op: agg_ops.UnaryWindowOp, - window_spec: WindowSpec, - *, - never_skip_nulls=False, - skip_reproject_unsafe: bool = False, - ) -> Tuple[ArrayValue, str]: - """ - Creates a new expression based on this expression with unary operation applied to one column. - column_name: the id of the input column present in the expression - op: the windowable operator to apply to the input column - window_spec: a specification of the window over which to apply the operator - output_name: the id to assign to the output of the operator, by default will replace input col if distinct output id not provided - never_skip_nulls: will disable null skipping for operators that would otherwise do so - skip_reproject_unsafe: skips the reprojection step, can be used when performing many non-dependent window operations, user responsible for not nesting window expressions, or using outputs as join, filter or aggregation keys before a reprojection - """ - - return self.project_window_expr( - agg_expressions.UnaryAggregation(op, ex.deref(column_name)), - window_spec, - never_skip_nulls, - skip_reproject_unsafe, - ) - def project_window_expr( self, expression: agg_expressions.Aggregation, window: WindowSpec, - never_skip_nulls=False, skip_reproject_unsafe: bool = False, ): output_name = self._gen_namespaced_uid() @@ -442,7 +415,6 @@ def project_window_expr( expression=expression, window_spec=window, output_name=ids.ColumnId(output_name), - never_skip_nulls=never_skip_nulls, skip_reproject_unsafe=skip_reproject_unsafe, ) ), diff --git a/bigframes/core/blocks.py b/bigframes/core/blocks.py index bd478800eb..466dbfce72 100644 --- a/bigframes/core/blocks.py +++ b/bigframes/core/blocks.py @@ -1090,7 +1090,6 @@ def multi_apply_window_op( window_spec: windows.WindowSpec, *, skip_null_groups: bool = False, - never_skip_nulls: bool = False, ) -> typing.Tuple[Block, typing.Sequence[str]]: block = self result_ids = [] @@ -1103,7 +1102,6 @@ def multi_apply_window_op( skip_reproject_unsafe=(i + 1) < len(columns), result_label=label, skip_null_groups=skip_null_groups, - never_skip_nulls=never_skip_nulls, ) result_ids.append(result_id) return block, result_ids @@ -1184,7 +1182,6 @@ def apply_window_op( result_label: Label = None, skip_null_groups: bool = False, skip_reproject_unsafe: bool = False, - never_skip_nulls: bool = False, ) -> typing.Tuple[Block, str]: agg_expr = agg_expressions.UnaryAggregation(op, ex.deref(column)) return self.apply_analytic( @@ -1192,7 +1189,6 @@ def apply_window_op( window_spec, result_label, skip_reproject_unsafe=skip_reproject_unsafe, - never_skip_nulls=never_skip_nulls, skip_null_groups=skip_null_groups, ) @@ -1203,7 +1199,6 @@ def apply_analytic( result_label: Label, *, skip_reproject_unsafe: bool = False, - never_skip_nulls: bool = False, skip_null_groups: bool = False, ) -> typing.Tuple[Block, str]: block = self @@ -1214,7 +1209,6 @@ def apply_analytic( agg_expr, window, skip_reproject_unsafe=skip_reproject_unsafe, - never_skip_nulls=never_skip_nulls, ) block = Block( expr, diff --git a/bigframes/core/compile/compiled.py b/bigframes/core/compile/compiled.py index 91d72d96b2..f8be331d59 100644 --- a/bigframes/core/compile/compiled.py +++ b/bigframes/core/compile/compiled.py @@ -394,8 +394,6 @@ def project_window_op( expression: ex_types.Aggregation, window_spec: WindowSpec, output_name: str, - *, - never_skip_nulls=False, ) -> UnorderedIR: """ Creates a new expression based on this expression with unary operation applied to one column. @@ -403,7 +401,6 @@ def project_window_op( op: the windowable operator to apply to the input column window_spec: a specification of the window over which to apply the operator output_name: the id to assign to the output of the operator - never_skip_nulls: will disable null skipping for operators that would otherwise do so """ # Cannot nest analytic expressions, so reproject to cte first if needed. # Also ibis cannot window literals, so need to reproject those (even though this is legal in googlesql) @@ -425,7 +422,6 @@ def project_window_op( expression, window_spec, output_name, - never_skip_nulls=never_skip_nulls, ) if expression.op.order_independent and window_spec.is_unbounded: @@ -437,9 +433,6 @@ def project_window_op( expression, window_spec ) clauses: list[tuple[ex.Expression, ex.Expression]] = [] - if expression.op.skips_nulls and not never_skip_nulls: - for input in expression.inputs: - clauses.append((ops.isnull_op.as_expr(input), ex.const(None))) 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() diff --git a/bigframes/core/compile/ibis_compiler/ibis_compiler.py b/bigframes/core/compile/ibis_compiler/ibis_compiler.py index 17bfc6ef55..b46c66f879 100644 --- a/bigframes/core/compile/ibis_compiler/ibis_compiler.py +++ b/bigframes/core/compile/ibis_compiler/ibis_compiler.py @@ -269,7 +269,6 @@ def compile_window(node: nodes.WindowOpNode, child: compiled.UnorderedIR): node.expression, node.window_spec, node.output_name.sql, - never_skip_nulls=node.never_skip_nulls, ) return result diff --git a/bigframes/core/compile/polars/compiler.py b/bigframes/core/compile/polars/compiler.py index f822a6a83f..1c9b0d802d 100644 --- a/bigframes/core/compile/polars/compiler.py +++ b/bigframes/core/compile/polars/compiler.py @@ -16,7 +16,6 @@ import dataclasses import functools import itertools -import operator from typing import cast, Literal, Optional, Sequence, Tuple, Type, TYPE_CHECKING import pandas as pd @@ -868,26 +867,6 @@ def compile_window(self, node: nodes.WindowOpNode): df, node.expression, node.window_spec, node.output_name.sql ) result = pl.concat([df, window_result], how="horizontal") - - # Probably easier just to pull this out as a rewriter - if ( - node.expression.op.skips_nulls - and not node.never_skip_nulls - and node.expression.column_references - ): - nullity_expr = functools.reduce( - operator.or_, - ( - pl.col(column.sql).is_null() - for column in node.expression.column_references - ), - ) - result = result.with_columns( - pl.when(nullity_expr) - .then(None) - .otherwise(pl.col(node.output_name.sql)) - .alias(node.output_name.sql) - ) return result def _calc_row_analytic_func( diff --git a/bigframes/core/compile/sqlglot/compiler.py b/bigframes/core/compile/sqlglot/compiler.py index 2f99b74176..276751d6e3 100644 --- a/bigframes/core/compile/sqlglot/compiler.py +++ b/bigframes/core/compile/sqlglot/compiler.py @@ -324,12 +324,8 @@ def compile_window(node: nodes.WindowOpNode, child: ir.SQLGlotIR) -> ir.SQLGlotI ) clauses: list[tuple[sge.Expression, sge.Expression]] = [] - if node.expression.op.skips_nulls and not node.never_skip_nulls: - for column in inputs: - clauses.append((sge.Is(this=column, expression=sge.Null()), sge.Null())) - if window_spec.min_periods and len(inputs) > 0: - if node.expression.op.skips_nulls: + if not node.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())) diff --git a/bigframes/core/groupby/dataframe_group_by.py b/bigframes/core/groupby/dataframe_group_by.py index 149971249f..89da73c95d 100644 --- a/bigframes/core/groupby/dataframe_group_by.py +++ b/bigframes/core/groupby/dataframe_group_by.py @@ -38,6 +38,7 @@ import bigframes.core.window_spec as window_specs import bigframes.dataframe as df import bigframes.dtypes as dtypes +import bigframes.operations import bigframes.operations.aggregations as agg_ops import bigframes.series as series @@ -753,8 +754,20 @@ def _apply_window_op( op, window_spec=window_spec, ) - result = df.DataFrame(block.select_columns(result_ids)) - return result + block = self._block.project_exprs( + tuple( + bigframes.operations.where_op.as_expr( + bigframes.operations.notnull_op.as_expr(og_col), + r_col, + ex.const(None), + ) + for og_col, r_col in zip(columns, result_ids) + ), + labels=block.column_labels, + drop=True, + ) + + return df.DataFrame(block) def _resolve_label(self, label: blocks.Label) -> str: """Resolve label to column id.""" diff --git a/bigframes/core/groupby/series_group_by.py b/bigframes/core/groupby/series_group_by.py index b09b63dcfe..fa1131d7b4 100644 --- a/bigframes/core/groupby/series_group_by.py +++ b/bigframes/core/groupby/series_group_by.py @@ -37,6 +37,7 @@ import bigframes.core.window_spec as window_specs import bigframes.dataframe as df import bigframes.dtypes +import bigframes.operations import bigframes.operations.aggregations as agg_ops import bigframes.series as series @@ -339,7 +340,6 @@ def cumcount(self, *args, **kwargs) -> series.Series: self._apply_window_op( agg_ops.SizeUnaryOp(), discard_name=True, - never_skip_nulls=True, ) - 1 ) @@ -426,7 +426,6 @@ def _apply_window_op( op: agg_ops.UnaryWindowOp, discard_name=False, window: typing.Optional[window_specs.WindowSpec] = None, - never_skip_nulls: bool = False, ) -> series.Series: """Apply window op to groupby. Defaults to grouped cumulative window.""" window_spec = window or window_specs.cumulative_rows( @@ -439,6 +438,15 @@ def _apply_window_op( op, result_label=label, window_spec=window_spec, - never_skip_nulls=never_skip_nulls, ) + if op.skips_nulls: + block, result_id = self._block.project_expr( + bigframes.operations.where_op.as_expr( + bigframes.operations.notnull_op.as_expr(self._value_column), + result_id, + ex.const(None), + ), + label, + ) + return series.Series(block.select_column(result_id)) diff --git a/bigframes/core/nodes.py b/bigframes/core/nodes.py index 8d1759afd7..e1631c435d 100644 --- a/bigframes/core/nodes.py +++ b/bigframes/core/nodes.py @@ -1394,7 +1394,6 @@ class WindowOpNode(UnaryNode, AdditiveNode): expression: agg_expressions.Aggregation window_spec: window.WindowSpec output_name: identifiers.ColumnId - never_skip_nulls: bool = False skip_reproject_unsafe: bool = False def _validate(self): diff --git a/bigframes/core/rewrite/timedeltas.py b/bigframes/core/rewrite/timedeltas.py index 91c6ab83c6..01401a7b90 100644 --- a/bigframes/core/rewrite/timedeltas.py +++ b/bigframes/core/rewrite/timedeltas.py @@ -67,7 +67,6 @@ def rewrite_timedelta_expressions(root: nodes.BigFrameNode) -> nodes.BigFrameNod _rewrite_aggregation(root.expression, root.schema), root.window_spec, root.output_name, - root.never_skip_nulls, root.skip_reproject_unsafe, ) diff --git a/bigframes/core/window/rolling.py b/bigframes/core/window/rolling.py index 1f3466874f..8b21f4166c 100644 --- a/bigframes/core/window/rolling.py +++ b/bigframes/core/window/rolling.py @@ -102,7 +102,6 @@ def _aggregate_block(self, op: agg_ops.UnaryAggregateOp) -> blocks.Block: op, self._window_spec, skip_null_groups=self._drop_null_groups, - never_skip_nulls=True, ) if self._window_spec.grouping_keys: diff --git a/bigframes/dataframe.py b/bigframes/dataframe.py index 4b41006547..f5b5336599 100644 --- a/bigframes/dataframe.py +++ b/bigframes/dataframe.py @@ -4159,7 +4159,22 @@ def _apply_window_op( op, window_spec=window_spec, ) - return DataFrame(block.select_columns(result_ids)) + if op.skips_nulls: + block = self._block.project_exprs( + tuple( + bigframes.operations.where_op.as_expr( + bigframes.operations.notnull_op.as_expr(og_col), + r_col, + ex.const(None), + ) + for og_col, r_col in zip(self._block.value_columns, result_ids) + ), + labels=block.column_labels, + drop=True, + ) + else: + block = block.select_columns(result_ids) + return DataFrame(block) @validations.requires_ordering() def sample( diff --git a/bigframes/operations/aggregations.py b/bigframes/operations/aggregations.py index 1160ab2c8e..289d3bf00a 100644 --- a/bigframes/operations/aggregations.py +++ b/bigframes/operations/aggregations.py @@ -183,6 +183,10 @@ def output_type(self, *input_types: dtypes.ExpressionType): class SizeUnaryOp(UnaryAggregateOp): name: ClassVar[str] = "size" + @property + def skips_nulls(self): + return False + def output_type(self, *input_types: dtypes.ExpressionType): return dtypes.INT_DTYPE diff --git a/bigframes/series.py b/bigframes/series.py index c11cc48394..f2d4d98c14 100644 --- a/bigframes/series.py +++ b/bigframes/series.py @@ -1780,7 +1780,11 @@ def _apply_window_op( block, result_id = block.apply_window_op( self._value_column, op, window_spec=window_spec, result_label=self.name ) - return Series(block.select_column(result_id)) + result = Series(block.select_column(result_id)) + if op.skips_nulls: + return result.where(self.notna(), None) + else: + return result def value_counts( self, diff --git a/tests/system/small/engines/test_windowing.py b/tests/system/small/engines/test_windowing.py index a34d7b8f38..510a2de3ba 100644 --- a/tests/system/small/engines/test_windowing.py +++ b/tests/system/small/engines/test_windowing.py @@ -43,12 +43,10 @@ def test_engines_with_offsets( assert_equivalence_execution(result.node, REFERENCE_ENGINE, engine) -@pytest.mark.parametrize("never_skip_nulls", [True, False]) @pytest.mark.parametrize("agg_op", [agg_ops.sum_op, agg_ops.count_op]) def test_engines_with_rows_window( scalars_array_value: array_value.ArrayValue, bigquery_client: bigquery.Client, - never_skip_nulls, agg_op, ): window = window_spec.WindowSpec( @@ -61,7 +59,6 @@ def test_engines_with_rows_window( ), window_spec=window, output_name=identifiers.ColumnId("agg_int64"), - never_skip_nulls=never_skip_nulls, skip_reproject_unsafe=False, ) From 1eb20bb3329260a97e6024ea8169349b4991ed7c Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Sat, 15 Nov 2025 00:32:56 +0000 Subject: [PATCH 02/10] update snapshot tests --- .../test_unary_compiler/test_all/window_out.sql | 6 +----- .../test_all/window_partition_out.sql | 6 +----- .../test_any_value/window_out.sql | 2 +- .../test_any_value/window_partition_out.sql | 6 +----- .../snapshots/test_unary_compiler/test_first/out.sql | 12 ++++-------- .../snapshots/test_unary_compiler/test_last/out.sql | 12 ++++-------- .../test_unary_compiler/test_max/window_out.sql | 2 +- .../test_max/window_partition_out.sql | 6 +----- .../test_unary_compiler/test_mean/window_out.sql | 2 +- .../test_mean/window_partition_out.sql | 6 +----- .../test_unary_compiler/test_min/window_out.sql | 2 +- .../test_min/window_partition_out.sql | 6 +----- .../test_unary_compiler/test_pop_var/window_out.sql | 2 +- .../test_unary_compiler/test_std/window_out.sql | 2 +- .../test_unary_compiler/test_sum/window_out.sql | 6 +----- .../test_sum/window_partition_out.sql | 6 +----- .../test_unary_compiler/test_var/window_out.sql | 2 +- 17 files changed, 23 insertions(+), 63 deletions(-) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_out.sql index 83bd288e73..829e5a8836 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_out.sql @@ -5,11 +5,7 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - CASE - WHEN `bool_col` IS NULL - THEN NULL - ELSE COALESCE(LOGICAL_AND(`bool_col`) OVER (), TRUE) - END AS `bfcol_1` + COALESCE(LOGICAL_AND(`bool_col`) OVER (), TRUE) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_partition_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_partition_out.sql index dc2471148b..23357817c1 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_partition_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_partition_out.sql @@ -6,11 +6,7 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - CASE - WHEN `bool_col` IS NULL - THEN NULL - ELSE COALESCE(LOGICAL_AND(`bool_col`) OVER (PARTITION BY `string_col`), TRUE) - END AS `bfcol_2` + COALESCE(LOGICAL_AND(`bool_col`) OVER (PARTITION BY `string_col`), TRUE) AS `bfcol_2` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/window_out.sql index f179808b57..ea15243d90 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 @@ -5,7 +5,7 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - CASE WHEN `int64_col` IS NULL THEN NULL ELSE ANY_VALUE(`int64_col`) OVER () END AS `bfcol_1` + ANY_VALUE(`int64_col`) OVER () AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/window_partition_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/window_partition_out.sql index e1b3da8a9a..e722318fbc 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 @@ -6,11 +6,7 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - CASE - WHEN `int64_col` IS NULL - THEN NULL - ELSE ANY_VALUE(`int64_col`) OVER (PARTITION BY `string_col`) - END AS `bfcol_2` + ANY_VALUE(`int64_col`) OVER (PARTITION BY `string_col`) AS `bfcol_2` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first/out.sql index 40c9e6ddd8..b053178f58 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 @@ -5,14 +5,10 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - CASE - WHEN `int64_col` IS NULL - THEN NULL - ELSE FIRST_VALUE(`int64_col`) OVER ( - ORDER BY `int64_col` DESC - ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING - ) - END AS `bfcol_1` + FIRST_VALUE(`int64_col`) OVER ( + ORDER BY `int64_col` DESC + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last/out.sql index ebeaa0e338..61e90ee612 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 @@ -5,14 +5,10 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - CASE - WHEN `int64_col` IS NULL - THEN NULL - ELSE LAST_VALUE(`int64_col`) OVER ( - ORDER BY `int64_col` DESC - ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING - ) - END AS `bfcol_1` + LAST_VALUE(`int64_col`) OVER ( + ORDER BY `int64_col` DESC + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/window_out.sql index a234601b6a..f55201418a 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 @@ -5,7 +5,7 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - CASE WHEN `int64_col` IS NULL THEN NULL ELSE MAX(`int64_col`) OVER () END AS `bfcol_1` + MAX(`int64_col`) OVER () AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/window_partition_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/window_partition_out.sql index f918500788..ac9b2df84e 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 @@ -6,11 +6,7 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - CASE - WHEN `int64_col` IS NULL - THEN NULL - ELSE MAX(`int64_col`) OVER (PARTITION BY `string_col`) - END AS `bfcol_2` + MAX(`int64_col`) OVER (PARTITION BY `string_col`) AS `bfcol_2` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/window_out.sql index 73bec9ccce..fdb59809c3 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 @@ -5,7 +5,7 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - CASE WHEN `int64_col` IS NULL THEN NULL ELSE AVG(`int64_col`) OVER () END AS `bfcol_1` + AVG(`int64_col`) OVER () AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/window_partition_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/window_partition_out.sql index d0a8345e12..d96121e54d 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 @@ -6,11 +6,7 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - CASE - WHEN `int64_col` IS NULL - THEN NULL - ELSE AVG(`int64_col`) OVER (PARTITION BY `string_col`) - END AS `bfcol_2` + AVG(`int64_col`) OVER (PARTITION BY `string_col`) AS `bfcol_2` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/window_out.sql index 1d9db63491..cbda2b7d58 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 @@ -5,7 +5,7 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - CASE WHEN `int64_col` IS NULL THEN NULL ELSE MIN(`int64_col`) OVER () END AS `bfcol_1` + MIN(`int64_col`) OVER () AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/window_partition_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/window_partition_out.sql index 8040f43ca5..d601832950 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 @@ -6,11 +6,7 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - CASE - WHEN `int64_col` IS NULL - THEN NULL - ELSE MIN(`int64_col`) OVER (PARTITION BY `string_col`) - END AS `bfcol_2` + MIN(`int64_col`) OVER (PARTITION BY `string_col`) AS `bfcol_2` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_pop_var/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_pop_var/window_out.sql index eae3db0048..430da33e3c 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 @@ -5,7 +5,7 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - CASE WHEN `int64_col` IS NULL THEN NULL ELSE VAR_POP(`int64_col`) OVER () END AS `bfcol_1` + VAR_POP(`int64_col`) OVER () AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_std/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_std/window_out.sql index cb39f6dbc8..80e0cf5bc6 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 @@ -5,7 +5,7 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - CASE WHEN `int64_col` IS NULL THEN NULL ELSE STDDEV(`int64_col`) OVER () END AS `bfcol_1` + STDDEV(`int64_col`) OVER () AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/window_out.sql index 401436019e..47426abcbd 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 @@ -5,11 +5,7 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - CASE - WHEN `int64_col` IS NULL - THEN NULL - ELSE COALESCE(SUM(`int64_col`) OVER (), 0) - END AS `bfcol_1` + COALESCE(SUM(`int64_col`) OVER (), 0) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/window_partition_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/window_partition_out.sql index f8ada8a5d4..fd1bd4f630 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 @@ -6,11 +6,7 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - CASE - WHEN `int64_col` IS NULL - THEN NULL - ELSE COALESCE(SUM(`int64_col`) OVER (PARTITION BY `string_col`), 0) - END AS `bfcol_2` + COALESCE(SUM(`int64_col`) OVER (PARTITION BY `string_col`), 0) AS `bfcol_2` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_var/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_var/window_out.sql index d300251447..e9d6c1cb93 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 @@ -5,7 +5,7 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - CASE WHEN `int64_col` IS NULL THEN NULL ELSE VARIANCE(`int64_col`) OVER () END AS `bfcol_1` + VARIANCE(`int64_col`) OVER () AS `bfcol_1` FROM `bfcte_0` ) SELECT From 0fdd566f7e0a64612f2e2d928a234dfa944bbb7d Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Sat, 15 Nov 2025 00:47:53 +0000 Subject: [PATCH 03/10] fixup impl errors --- bigframes/core/groupby/dataframe_group_by.py | 8 ++++---- bigframes/core/groupby/series_group_by.py | 4 ++-- bigframes/dataframe.py | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bigframes/core/groupby/dataframe_group_by.py b/bigframes/core/groupby/dataframe_group_by.py index 89da73c95d..21f0d7f426 100644 --- a/bigframes/core/groupby/dataframe_group_by.py +++ b/bigframes/core/groupby/dataframe_group_by.py @@ -748,22 +748,22 @@ def _apply_window_op( window_spec = window or window_specs.cumulative_rows( grouping_keys=tuple(self._by_col_ids) ) - columns, _ = self._aggregated_columns(numeric_only=numeric_only) + columns, labels = self._aggregated_columns(numeric_only=numeric_only) block, result_ids = self._block.multi_apply_window_op( columns, op, window_spec=window_spec, ) - block = self._block.project_exprs( + block = block.project_exprs( tuple( bigframes.operations.where_op.as_expr( - bigframes.operations.notnull_op.as_expr(og_col), r_col, + bigframes.operations.notnull_op.as_expr(og_col), ex.const(None), ) for og_col, r_col in zip(columns, result_ids) ), - labels=block.column_labels, + labels=labels, drop=True, ) diff --git a/bigframes/core/groupby/series_group_by.py b/bigframes/core/groupby/series_group_by.py index fa1131d7b4..27c55f7a6a 100644 --- a/bigframes/core/groupby/series_group_by.py +++ b/bigframes/core/groupby/series_group_by.py @@ -440,10 +440,10 @@ def _apply_window_op( window_spec=window_spec, ) if op.skips_nulls: - block, result_id = self._block.project_expr( + block, result_id = block.project_expr( bigframes.operations.where_op.as_expr( - bigframes.operations.notnull_op.as_expr(self._value_column), result_id, + bigframes.operations.notnull_op.as_expr(self._value_column), ex.const(None), ), label, diff --git a/bigframes/dataframe.py b/bigframes/dataframe.py index f5b5336599..173aa48db8 100644 --- a/bigframes/dataframe.py +++ b/bigframes/dataframe.py @@ -4160,16 +4160,16 @@ def _apply_window_op( window_spec=window_spec, ) if op.skips_nulls: - block = self._block.project_exprs( + block = block.project_exprs( tuple( bigframes.operations.where_op.as_expr( - bigframes.operations.notnull_op.as_expr(og_col), r_col, + bigframes.operations.notnull_op.as_expr(og_col), ex.const(None), ) for og_col, r_col in zip(self._block.value_columns, result_ids) ), - labels=block.column_labels, + labels=self._block.column_labels, drop=True, ) else: From 8077734aa37c85ce6dd4e1fac5797334b9839f1d Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Sat, 15 Nov 2025 00:56:23 +0000 Subject: [PATCH 04/10] fix shapshot from merge --- .../snapshots/test_unary_compiler/test_any/window_out.sql | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any/window_out.sql index 970349a4f5..337f0ff963 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any/window_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any/window_out.sql @@ -5,11 +5,7 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - CASE - WHEN `bool_col` IS NULL - THEN NULL - ELSE COALESCE(LOGICAL_OR(`bool_col`) OVER (), FALSE) - END AS `bfcol_1` + COALESCE(LOGICAL_OR(`bool_col`) OVER (), FALSE) AS `bfcol_1` FROM `bfcte_0` ) SELECT From efd041cf9e0b3fe30c3fb42935aedcd9c612d165 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Sat, 15 Nov 2025 01:22:59 +0000 Subject: [PATCH 05/10] fix test_timedelta_cumsum --- bigframes/core/rewrite/timedeltas.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bigframes/core/rewrite/timedeltas.py b/bigframes/core/rewrite/timedeltas.py index 01401a7b90..5c7a85ee1b 100644 --- a/bigframes/core/rewrite/timedeltas.py +++ b/bigframes/core/rewrite/timedeltas.py @@ -111,6 +111,8 @@ def _rewrite_expressions(expr: ex.Expression, schema: schema.ArraySchema) -> _Ty def _rewrite_scalar_constant_expr(expr: ex.ScalarConstantExpression) -> _TypedExpr: + if expr.value is None: + return _TypedExpr(ex.const(None, expr.dtype), expr.dtype) if expr.dtype == dtypes.TIMEDELTA_DTYPE: int_repr = utils.timedelta_to_micros(expr.value) # type: ignore return _TypedExpr(ex.const(int_repr, expr.dtype), expr.dtype) From 9c8e3be200e54608f85f7a9d25d76e9f0e20ef45 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Mon, 17 Nov 2025 20:55:32 +0000 Subject: [PATCH 06/10] loosen test --- tests/system/small/session/test_read_gbq_query.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/system/small/session/test_read_gbq_query.py b/tests/system/small/session/test_read_gbq_query.py index c1408febca..bb9026dc70 100644 --- a/tests/system/small/session/test_read_gbq_query.py +++ b/tests/system/small/session/test_read_gbq_query.py @@ -36,9 +36,9 @@ def test_read_gbq_query_w_allow_large_results(session: bigframes.Session): allow_large_results=False, ) assert df_false.shape == (1, 1) - roots_false = df_false._get_block().expr.node.roots - assert any(isinstance(node, nodes.ReadLocalNode) for node in roots_false) - assert not any(isinstance(node, nodes.ReadTableNode) for node in roots_false) + nodes_false = df_false._get_block().expr.node.unique_nodes() + assert any(isinstance(node, nodes.ReadLocalNode) for node in nodes_false) + assert not any(isinstance(node, nodes.ReadTableNode) for node in nodes_false) # Large results allowed should wrap a table. df_true = session.read_gbq( @@ -47,8 +47,8 @@ def test_read_gbq_query_w_allow_large_results(session: bigframes.Session): allow_large_results=True, ) assert df_true.shape == (1, 1) - roots_true = df_true._get_block().expr.node.roots - assert any(isinstance(node, nodes.ReadTableNode) for node in roots_true) + nodes_true = df_true._get_block().expr.node.unique_nodes() + assert any(isinstance(node, nodes.ReadTableNode) for node in nodes_true) def test_read_gbq_query_w_columns(session: bigframes.Session): From 17e490fc621f09d481a05b78b07ce01cdaaf513c Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Mon, 17 Nov 2025 22:03:11 +0000 Subject: [PATCH 07/10] use latest sqlglot --- .../test_binary_compiler/test_corr/out.sql | 10 - .../test_binary_compiler/test_cov/out.sql | 10 - .../test_row_number/out.sql | 24 -- .../test_row_number_with_window/out.sql | 10 - .../test_nullary_compiler/test_size/out.sql | 23 -- .../test_array_agg/out.sql | 9 - .../test_string_agg/out.sql | 15 - .../test_unary_compiler/test_all/out.sql | 9 - .../test_all/window_out.sql | 10 - .../test_all/window_partition_out.sql | 11 - .../test_unary_compiler/test_any/out.sql | 9 - .../test_any/window_out.sql | 10 - .../test_any_value/out.sql | 9 - .../test_any_value/window_out.sql | 10 - .../test_any_value/window_partition_out.sql | 11 - .../test_approx_quartiles/out.sql | 11 - .../test_approx_top_count/out.sql | 9 - .../test_unary_compiler/test_count/out.sql | 9 - .../test_count/window_out.sql | 10 - .../test_count/window_partition_out.sql | 11 - .../test_date_series_diff/out.sql | 10 - .../test_dense_rank/out.sql | 10 - .../test_diff/diff_bool.sql | 10 - .../test_diff/diff_int.sql | 10 - .../test_unary_compiler/test_first/out.sql | 13 - .../test_first_non_null/out.sql | 13 - .../test_unary_compiler/test_last/out.sql | 13 - .../test_last_non_null/out.sql | 13 - .../test_unary_compiler/test_max/out.sql | 9 - .../test_max/window_out.sql | 10 - .../test_max/window_partition_out.sql | 11 - .../test_unary_compiler/test_mean/out.sql | 21 -- .../test_mean/window_out.sql | 10 - .../test_mean/window_partition_out.sql | 11 - .../test_unary_compiler/test_median/out.sql | 13 - .../test_unary_compiler/test_min/out.sql | 9 - .../test_min/window_out.sql | 10 - .../test_min/window_partition_out.sql | 11 - .../test_unary_compiler/test_pop_var/out.sql | 11 - .../test_pop_var/window_out.sql | 10 - .../test_unary_compiler/test_quantile/out.sql | 10 - .../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 | 21 -- .../test_std/window_out.sql | 10 - .../test_unary_compiler/test_sum/out.sql | 11 - .../test_sum/window_out.sql | 10 - .../test_sum/window_partition_out.sql | 11 - .../test_time_series_diff/out.sql | 14 - .../test_unary_compiler/test_var/out.sql | 11 - .../test_var/window_out.sql | 10 - .../test_ai_ops/test_ai_classify/out.sql | 14 - .../test_ai_ops/test_ai_generate/out.sql | 15 - .../test_ai_ops/test_ai_generate_bool/out.sql | 15 - .../out.sql | 15 - .../test_ai_generate_double/out.sql | 15 - .../out.sql | 15 - .../test_ai_ops/test_ai_generate_int/out.sql | 15 - .../out.sql | 15 - .../test_ai_generate_with_model_param/out.sql | 15 - .../out.sql | 16 - .../snapshots/test_ai_ops/test_ai_if/out.sql | 13 - .../test_ai_ops/test_ai_score/out.sql | 13 - .../test_array_ops/test_array_index/out.sql | 10 - .../test_array_reduce_op/out.sql | 31 -- .../test_array_slice_with_only_start/out.sql | 16 - .../out.sql | 16 - .../test_array_to_string/out.sql | 10 - .../test_array_ops/test_to_array_op/out.sql | 20 -- .../test_obj_fetch_metadata/out.sql | 21 -- .../test_obj_get_access_url/out.sql | 21 -- .../test_blob_ops/test_obj_make_ref/out.sql | 11 - .../test_bool_ops/test_and_op/out.sql | 24 -- .../test_bool_ops/test_or_op/out.sql | 24 -- .../test_bool_ops/test_xor_op/out.sql | 24 -- .../test_eq_null_match/out.sql | 11 - .../test_eq_numeric/out.sql | 45 --- .../test_ge_numeric/out.sql | 45 --- .../test_gt_numeric/out.sql | 45 --- .../test_comparison_ops/test_is_in/out.sql | 22 -- .../test_le_numeric/out.sql | 45 --- .../test_lt_numeric/out.sql | 45 --- .../test_maximum_op/out.sql | 11 - .../test_minimum_op/out.sql | 11 - .../test_ne_numeric/out.sql | 45 --- .../test_add_timedelta/out.sql | 50 ---- .../test_datetime_ops/test_date/out.sql | 10 - .../test_datetime_ops/test_day/out.sql | 10 - .../test_datetime_ops/test_dayofweek/out.sql | 14 - .../test_datetime_ops/test_dayofyear/out.sql | 10 - .../test_datetime_ops/test_floor_dt/out.sql | 22 -- .../test_datetime_ops/test_hour/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 | 10 - .../test_sub_timedelta/out.sql | 71 ----- .../test_datetime_ops/test_time/out.sql | 10 - .../test_to_datetime/out.sql | 10 - .../test_to_timestamp/out.sql | 10 - .../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 | 13 - .../test_astype_float/out.sql | 12 - .../test_astype_from_json/out.sql | 14 - .../test_generic_ops/test_astype_int/out.sql | 22 -- .../test_generic_ops/test_astype_json/out.sql | 18 -- .../test_astype_string/out.sql | 13 - .../test_astype_time_like/out.sql | 13 - .../test_case_when_op/out.sql | 23 -- .../test_generic_ops/test_clip/out.sql | 12 - .../test_generic_ops/test_coalesce/out.sql | 12 - .../test_generic_ops/test_fillna/out.sql | 11 - .../test_generic_ops/test_hash/out.sql | 10 - .../test_generic_ops/test_invert/out.sql | 20 -- .../test_generic_ops/test_isnull/out.sql | 10 - .../test_generic_ops/test_map/out.sql | 10 - .../test_generic_ops/test_notnull/out.sql | 10 - .../test_generic_ops/test_row_key/out.sql | 67 ----- .../test_sql_scalar_op/out.sql | 11 - .../test_generic_ops/test_where/out.sql | 12 - .../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_st_geogfromtext/out.sql | 10 - .../test_geo_st_geogpoint/out.sql | 11 - .../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_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_string/out.sql | 10 - .../test_numeric_ops/test_abs/out.sql | 10 - .../test_numeric_ops/test_add_numeric/out.sql | 45 --- .../test_numeric_ops/test_add_string/out.sql | 10 - .../test_add_timedelta/out.sql | 50 ---- .../test_numeric_ops/test_arccos/out.sql | 14 - .../test_numeric_ops/test_arccosh/out.sql | 14 - .../test_numeric_ops/test_arcsin/out.sql | 14 - .../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 | 14 - .../test_numeric_ops/test_ceil/out.sql | 10 - .../test_numeric_ops/test_cos/out.sql | 10 - .../test_numeric_ops/test_cosh/out.sql | 14 - .../test_cosine_distance/out.sql | 12 - .../test_numeric_ops/test_div_numeric/out.sql | 108 ------- .../test_div_timedelta/out.sql | 15 - .../test_euclidean_distance/out.sql | 12 - .../test_numeric_ops/test_exp/out.sql | 14 - .../test_numeric_ops/test_expm1/out.sql | 14 - .../test_numeric_ops/test_floor/out.sql | 10 - .../test_floordiv_timedelta/out.sql | 12 - .../test_numeric_ops/test_ln/out.sql | 10 - .../test_numeric_ops/test_log10/out.sql | 14 - .../test_numeric_ops/test_log1p/out.sql | 14 - .../test_manhattan_distance/out.sql | 12 - .../test_numeric_ops/test_mod_numeric/out.sql | 279 ------------------ .../test_numeric_ops/test_mul_numeric/out.sql | 45 --- .../test_mul_timedelta/out.sql | 35 --- .../test_numeric_ops/test_neg/out.sql | 12 - .../test_numeric_ops/test_pos/out.sql | 10 - .../test_numeric_ops/test_round/out.sql | 70 ----- .../test_numeric_ops/test_sin/out.sql | 10 - .../test_numeric_ops/test_sinh/out.sql | 14 - .../test_numeric_ops/test_sqrt/out.sql | 10 - .../test_numeric_ops/test_sub_numeric/out.sql | 45 --- .../test_sub_timedelta/out.sql | 71 ----- .../test_numeric_ops/test_tan/out.sql | 10 - .../test_numeric_ops/test_tanh/out.sql | 10 - .../test_string_ops/test_add_string/out.sql | 10 - .../test_string_ops/test_capitalize/out.sql | 10 - .../test_string_ops/test_endswith/out.sql | 12 - .../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 | 10 - .../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_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 | 12 - .../test_string_ops/test_str_contains/out.sql | 10 - .../test_str_contains_regex/out.sql | 10 - .../test_string_ops/test_str_extract/out.sql | 10 - .../test_string_ops/test_str_find/out.sql | 13 - .../test_string_ops/test_str_get/out.sql | 10 - .../test_string_ops/test_str_pad/out.sql | 20 -- .../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 | 14 - .../test_struct_ops/test_struct_field/out.sql | 11 - .../test_struct_ops/test_struct_op/out.sql | 18 -- .../test_timedelta_floor/out.sql | 10 - .../test_to_timedelta/out.sql | 30 -- .../test_compile_aggregate/out.sql | 21 -- .../test_compile_aggregate_wo_dropna/out.sql | 19 -- .../test_compile_concat/out.sql | 73 ----- .../test_compile_concat_filter_sorted/out.sql | 135 --------- .../test_compile_explode_dataframe/out.sql | 13 - .../test_compile_explode_series/out.sql | 12 - .../test_compile_filter/out.sql | 20 -- .../test_st_regionstats/out.sql | 26 -- .../out.sql | 20 -- .../test_compile_geo/test_st_simplify/out.sql | 10 - .../test_compile_isin/out.sql | 37 --- .../test_compile_isin_not_nullable/out.sql | 30 -- .../test_compile_join/out.sql | 28 -- .../test_compile_join_w_on/bool_col/out.sql | 28 -- .../float64_col/out.sql | 28 -- .../test_compile_join_w_on/int64_col/out.sql | 28 -- .../numeric_col/out.sql | 28 -- .../test_compile_join_w_on/string_col/out.sql | 28 -- .../test_compile_join_w_on/time_col/out.sql | 28 -- .../test_compile_random_sample/out.sql | 165 ----------- .../test_compile_readlocal/out.sql | 167 ----------- .../test_compile_readlocal_w_json_df/out.sql | 5 - .../test_compile_readlocal_w_lists_df/out.sql | 35 --- .../out.sql | 21 -- .../test_compile_readtable/out.sql | 19 -- .../out.sql | 6 - .../test_compile_readtable_w_limit/out.sql | 6 - .../out.sql | 6 - .../test_compile_readtable_w_ordering/out.sql | 6 - .../out.sql | 12 - .../out.sql | 19 -- .../out.sql | 67 ----- .../out.sql | 23 -- .../out.sql | 18 -- .../out.sql | 15 - 263 files changed, 4954 deletions(-) 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 5c838f4882..656304ab25 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_corr/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_corr/out.sql @@ -1,13 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - CORR(`int64_col`, `float64_col`) AS `bfcol_2` - 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 eda082250a..58e85af16c 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_cov/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_cov/out.sql @@ -1,13 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - COVAR_SAMP(`int64_col`, `float64_col`) AS `bfcol_2` - 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 78cc44fa54..e259198f92 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,27 +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` -), `bfcte_1` AS ( - SELECT - *, - ROW_NUMBER() OVER () AS `bfcol_32` - FROM `bfcte_0` -) SELECT `bfcol_32` AS `row_number` 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_with_window/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number_with_window/out.sql index b63cb1ff61..23e9dd0bc2 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,13 +1,3 @@ -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) AS `bfcol_1` - FROM `bfcte_0` -) SELECT `bfcol_1` AS `row_number` FROM `bfcte_1` \ 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 ed8e0c7619..150235a08e 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_size/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_size/out.sql @@ -1,26 +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` -), `bfcte_1` AS ( - SELECT - COUNT(1) AS `bfcol_32` - 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 eafbc39daf..0f2667b00e 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_array_agg/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_array_agg/out.sql @@ -1,12 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - ARRAY_AGG(`int64_col` IGNORE NULLS ORDER BY `int64_col` IS NULL ASC, `int64_col` ASC) AS `bfcol_1` - 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 321341d4a0..dc2aa6a3e2 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_string_agg/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_string_agg/out.sql @@ -1,18 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - COALESCE( - STRING_AGG(`string_col`, ',' - ORDER BY - `string_col` IS NULL ASC, - `string_col` ASC), - '' - ) AS `bfcol_1` - 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 d31b21f56b..eab455d84a 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/out.sql @@ -1,12 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - COALESCE(LOGICAL_AND(`bool_col`), TRUE) AS `bfcol_1` - FROM `bfcte_0` -) SELECT `bfcol_1` 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_all/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_out.sql index 829e5a8836..5a51967aee 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_out.sql @@ -1,13 +1,3 @@ -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 diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_partition_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_partition_out.sql index 23357817c1..bdb5694fe0 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_partition_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_partition_out.sql @@ -1,14 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - COALESCE(LOGICAL_AND(`bool_col`) OVER (PARTITION BY `string_col`), TRUE) AS `bfcol_2` - FROM `bfcte_0` -) SELECT `bfcol_2` AS `agg_bool` FROM `bfcte_1` \ 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 03b0d5c151..eab455d84a 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 @@ -1,12 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - COALESCE(LOGICAL_OR(`bool_col`), FALSE) AS `bfcol_1` - FROM `bfcte_0` -) SELECT `bfcol_1` 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_any/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any/window_out.sql index 337f0ff963..5a51967aee 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any/window_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any/window_out.sql @@ -1,13 +1,3 @@ -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 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 4a13901f1c..0f2667b00e 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/out.sql @@ -1,12 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - ANY_VALUE(`int64_col`) AS `bfcol_1` - 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 ea15243d90..09a787ae98 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,13 +1,3 @@ -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 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 e722318fbc..0f86562a25 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,14 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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 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 9eabb2d88a..8a8cc9b587 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_approx_quartiles/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_approx_quartiles/out.sql @@ -1,14 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - APPROX_QUANTILES(`int64_col`, 4)[OFFSET(1)] AS `bfcol_1`, - APPROX_QUANTILES(`int64_col`, 4)[OFFSET(2)] AS `bfcol_2`, - APPROX_QUANTILES(`int64_col`, 4)[OFFSET(3)] AS `bfcol_3` - FROM `bfcte_0` -) SELECT `bfcol_1` AS `q1`, `bfcol_2` AS `q2`, 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 b5e6275381..0f2667b00e 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_approx_top_count/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_approx_top_count/out.sql @@ -1,12 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - APPROX_TOP_COUNT(`int64_col`, 10) AS `bfcol_1` - 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 9d18367cf6..0f2667b00e 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/out.sql @@ -1,12 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - COUNT(`int64_col`) AS `bfcol_1` - 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 0baac95311..09a787ae98 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,13 +1,3 @@ -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 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 6d3f856459..0f86562a25 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,14 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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 diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_date_series_diff/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_date_series_diff/out.sql index 84c95fd010..f96d8d87f5 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_date_series_diff/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_date_series_diff/out.sql @@ -1,13 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `date_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CAST(DATE_DIFF(`date_col`, LAG(`date_col`, 1) OVER (ORDER BY `date_col` ASC NULLS LAST), DAY) * 86400000000 AS INT64) AS `bfcol_1` - FROM `bfcte_0` -) SELECT `bfcol_1` AS `diff_date` FROM `bfcte_1` \ 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 76b455a65c..09a787ae98 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,13 +1,3 @@ -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 diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_bool.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_bool.sql index 96d23c4747..d39b4f0cd3 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_bool.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_bool.sql @@ -1,13 +1,3 @@ -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 diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_int.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_int.sql index 95d786b951..4ed75bf95e 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_int.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_int.sql @@ -1,13 +1,3 @@ -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 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 b053178f58..09a787ae98 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,16 +1,3 @@ -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 diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first_non_null/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first_non_null/out.sql index 2ef7b7151e..09a787ae98 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,16 +1,3 @@ -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 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 61e90ee612..09a787ae98 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,16 +1,3 @@ -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 diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last_non_null/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last_non_null/out.sql index c626c263ac..09a787ae98 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,16 +1,3 @@ -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 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 1537d735ea..0f2667b00e 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/out.sql @@ -1,12 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - MAX(`int64_col`) AS `bfcol_1` - 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 f55201418a..09a787ae98 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,13 +1,3 @@ -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 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 ac9b2df84e..0f86562a25 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,14 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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 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 0b33d0b1d0..ad92b1854b 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,24 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `duration_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `int64_col` AS `bfcol_6`, - `bool_col` AS `bfcol_7`, - `duration_col` AS `bfcol_8` - FROM `bfcte_0` -), `bfcte_2` 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` -) SELECT `bfcol_12` AS `int64_col`, `bfcol_13` AS `bool_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 fdb59809c3..09a787ae98 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,13 +1,3 @@ -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 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 d96121e54d..0f86562a25 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,14 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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 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 bfe94622b3..2faf8b433e 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_median/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_median/out.sql @@ -1,16 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `date_col`, - `int64_col`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - APPROX_QUANTILES(`int64_col`, 2)[OFFSET(1)] AS `bfcol_3`, - APPROX_QUANTILES(`date_col`, 2)[OFFSET(1)] AS `bfcol_4`, - APPROX_QUANTILES(`string_col`, 2)[OFFSET(1)] AS `bfcol_5` - FROM `bfcte_0` -) SELECT `bfcol_3` AS `int64_col`, `bfcol_4` AS `date_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 0848313456..0f2667b00e 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/out.sql @@ -1,12 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - MIN(`int64_col`) AS `bfcol_1` - 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 cbda2b7d58..09a787ae98 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,13 +1,3 @@ -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 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 d601832950..0f86562a25 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,14 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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 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 2d38311f45..f4b139576c 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_pop_var/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_pop_var/out.sql @@ -1,14 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - VAR_POP(`int64_col`) AS `bfcol_4`, - VAR_POP(CAST(`bool_col` AS INT64)) AS `bfcol_5` - FROM `bfcte_0` -) SELECT `bfcol_4` AS `int64_col`, `bfcol_5` AS `bool_col` 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 430da33e3c..09a787ae98 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,13 +1,3 @@ -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 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 b79d8d381f..3fad56c87a 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_quantile/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_quantile/out.sql @@ -1,13 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - PERCENTILE_CONT(`int64_col`, 0.5) OVER () AS `bfcol_1`, - CAST(FLOOR(PERCENTILE_CONT(`int64_col`, 0.5) OVER ()) AS INT64) AS `bfcol_2` - FROM `bfcte_0` -) SELECT `bfcol_1` AS `quantile`, `bfcol_2` AS `quantile_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 96b121bde4..09a787ae98 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,13 +1,3 @@ -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 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 7d1d62f1ae..2563b3182d 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,13 +1,3 @@ -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 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 67b40c99db..437e6f22a2 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,13 +1,3 @@ -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 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 0202cf5c21..7b00b5269b 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,13 +1,3 @@ -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 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 36a50302a6..ad92b1854b 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,24 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `duration_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `int64_col` AS `bfcol_6`, - `bool_col` AS `bfcol_7`, - `duration_col` AS `bfcol_8` - FROM `bfcte_0` -), `bfcte_2` 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` -) SELECT `bfcol_12` AS `int64_col`, `bfcol_13` AS `bool_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 80e0cf5bc6..09a787ae98 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,13 +1,3 @@ -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 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 2bf6c26cd4..f4b139576c 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/out.sql @@ -1,14 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - COALESCE(SUM(`int64_col`), 0) AS `bfcol_4`, - COALESCE(SUM(CAST(`bool_col` AS INT64)), 0) AS `bfcol_5` - FROM `bfcte_0` -) SELECT `bfcol_4` AS `int64_col`, `bfcol_5` AS `bool_col` 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 47426abcbd..09a787ae98 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,13 +1,3 @@ -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 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 fd1bd4f630..0f86562a25 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,14 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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 diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_time_series_diff/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_time_series_diff/out.sql index 645f583dc1..3449f376a4 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_time_series_diff/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_time_series_diff/out.sql @@ -1,17 +1,3 @@ -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` ASC NULLS LAST), - MICROSECOND - ) AS `bfcol_1` - FROM `bfcte_0` -) SELECT `bfcol_1` AS `diff_time` FROM `bfcte_1` \ 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 733a22438c..f4b139576c 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_var/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_var/out.sql @@ -1,14 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - VARIANCE(`int64_col`) AS `bfcol_4`, - VARIANCE(CAST(`bool_col` AS INT64)) AS `bfcol_5` - FROM `bfcte_0` -) SELECT `bfcol_4` AS `int64_col`, `bfcol_5` AS `bool_col` 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 e9d6c1cb93..09a787ae98 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,13 +1,3 @@ -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 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 a40784a3ca..5f0b7fdca7 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,17 +1,3 @@ -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 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 19f85b181b..5f0b7fdca7 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,18 +1,3 @@ -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 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 f844ed1691..5f0b7fdca7 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,18 +1,3 @@ -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 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 35538c2ec2..5f0b7fdca7 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,18 +1,3 @@ -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', - 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 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 fae92515cb..5f0b7fdca7 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,18 +1,3 @@ -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 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 f3ddf71014..5f0b7fdca7 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,18 +1,3 @@ -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', - 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 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 a0c92c959c..5f0b7fdca7 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,18 +1,3 @@ -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 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 1951e13325..5f0b7fdca7 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,18 +1,3 @@ -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', - 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 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 3419a77c61..5f0b7fdca7 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,18 +1,3 @@ -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', - 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 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 e1e1670f12..5f0b7fdca7 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,19 +1,3 @@ -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', - 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 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 275ba8d423..5f0b7fdca7 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,16 +1,3 @@ -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 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 01c71065b9..5f0b7fdca7 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,16 +1,3 @@ -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 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 d8e223d5f8..5abdaa8f21 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,13 +1,3 @@ -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 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 b9f87bfd1e..b342c67533 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,34 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_list_col`, - `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`, 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 0034ffd69c..5abdaa8f21 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,19 +1,3 @@ -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 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 f0638fa3af..5abdaa8f21 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,19 +1,3 @@ -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 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 09446bb8f5..5abdaa8f21 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,13 +1,3 @@ -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 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 3e29701658..c85acd114d 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,23 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `float64_col`, - `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`, 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 bd99b86064..e3169ef0ac 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,24 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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` 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 c65436e530..6e45764d75 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,24 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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`) 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` 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 d74449c986..04ab050788 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,14 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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` 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 634a936a0e..02212b4b49 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,27 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `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` -) SELECT `bfcol_14` AS `rowindex`, `bfcol_15` AS `bool_col`, 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 0069b07d8f..02212b4b49 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,27 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `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` -) SELECT `bfcol_14` AS `rowindex`, `bfcol_15` AS `bool_col`, 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 e4c87ed720..02212b4b49 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,27 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `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` -) SELECT `bfcol_14` AS `rowindex`, `bfcol_15` AS `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 57af99a52b..591d6c7d1d 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,14 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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 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 9c7c19e61c..cf9b22f563 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,48 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `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`, 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 e99fe49c8e..1ad2a52a16 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,48 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `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`, 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 4e5aba3d31..914e091787 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,48 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `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`, 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 197ed279fa..1030794065 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,25 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col`, - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - COALESCE(`int64_col` IN (1, 2, 3), FALSE) AS `bfcol_2`, - ( - `int64_col` IS NULL - ) OR `int64_col` IN (123456) AS `bfcol_3`, - COALESCE(`int64_col` IN (1.0, 2.0, 3.0), FALSE) AS `bfcol_4`, - FALSE AS `bfcol_5`, - COALESCE(`int64_col` IN (2.5, 3), FALSE) AS `bfcol_6`, - FALSE AS `bfcol_7`, - COALESCE(`int64_col` IN (123456), FALSE) AS `bfcol_8`, - ( - `float64_col` IS NULL - ) OR `float64_col` IN (1, 2, 3) AS `bfcol_9` - FROM `bfcte_0` -) SELECT `bfcol_2` AS `ints`, `bfcol_3` 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 97a00d1c88..9289fae574 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,48 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `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`, 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 addebd3187..fa1ce080c4 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,48 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `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`, 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 bbef212707..90fd50517b 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,14 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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 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 1f00f5892e..90fd50517b 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,14 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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 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 417d24aa72..cf9b22f563 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,48 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `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`, 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 2fef18eeb8..385618475a 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,53 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `date_col`, - `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`, 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 b8f46ceafe..f6e171e2a6 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,13 +1,3 @@ -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 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 52d80fd2a6..f6e171e2a6 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,13 +1,3 @@ -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 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 0119bbb4e9..6d00877a3d 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,17 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `date_col`, - `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`, 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 521419757a..f6e171e2a6 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,13 +1,3 @@ -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 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 fe76efb609..ac2d64656e 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,25 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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`, 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 5fc6621a7c..f6e171e2a6 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,13 +1,3 @@ -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 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 9422844b34..f6e171e2a6 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,13 +1,3 @@ -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 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 4db49fb10f..f6e171e2a6 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,13 +1,3 @@ -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 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 8d49933202..f6e171e2a6 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,13 +1,3 @@ -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 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 e089a77af5..f6e171e2a6 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,13 +1,3 @@ -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 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 53d135903b..f6e171e2a6 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,13 +1,3 @@ -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 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 b542dfea72..f6e171e2a6 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,13 +1,3 @@ -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 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 4a232cb5a3..f6e171e2a6 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,13 +1,3 @@ -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 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 e86d830b73..f6e171e2a6 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,13 +1,3 @@ -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 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 190cd7895b..f6e171e2a6 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,13 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `timestamp_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - FORMAT_TIMESTAMP('%Y-%m-%d', `timestamp_col`) AS `bfcol_1` - FROM `bfcte_0` -) SELECT `bfcol_1` AS `timestamp_col` FROM `bfcte_1` \ 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 ebcffd67f6..bc0cc58449 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,74 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `date_col`, - `duration_col`, - `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`, 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 5a8ab600ba..f6e171e2a6 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,13 +1,3 @@ -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 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 bbba3b1533..0f2667b00e 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,13 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CAST(TIMESTAMP_SECONDS(`int64_col`) AS DATETIME) AS `bfcol_1` - 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/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 df01fb3269..0f2667b00e 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,13 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - TIMESTAMP_SECONDS(`int64_col`) AS `bfcol_1` - 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/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 e6515017f2..f6e171e2a6 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,13 +1,3 @@ -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 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 caec5effe0..f6e171e2a6 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,13 +1,3 @@ -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 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 6dc0ea2a02..f6e171e2a6 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,13 +1,3 @@ -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 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 1ceb674137..f6e171e2a6 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,13 +1,3 @@ -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 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 1f90accd0b..fcaba91497 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,16 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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`, 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 32c8da56fa..0fd94588e7 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,15 +1,3 @@ -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`, 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 d1577c0664..c5ccce7446 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,17 +1,3 @@ -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`, 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 e0fe2af9a9..c5ae06696b 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,25 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `datetime_col`, - `float64_col`, - `numeric_col`, - `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`, 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 2defc2e72b..e3f8a87b74 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,21 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `float64_col`, - `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`, - PARSE_JSON_IN_SAFE(`string_col`) AS `bfcol_9` - FROM `bfcte_0` -) SELECT `bfcol_4` AS `int64_col`, `bfcol_5` AS `float64_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 da6eb6ce18..6eaaf99cb6 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,16 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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`, 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 6523d8376c..e11068501a 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,16 +1,3 @@ -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`, 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 08a489e240..5c1ca69329 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,26 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `float64_col`, - `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`, 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 b162593147..52268f97e4 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,15 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `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 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 451de48b64..5857aa58d9 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,15 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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` 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 07f2877e74..90fd50517b 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,14 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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 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 19fce60091..dc2aa6a3e2 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,13 +1,3 @@ -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 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 1bd2eb7426..2e882be382 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,23 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `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`, 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 0a549bdd44..e3b44a06ef 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,13 +1,3 @@ -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 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 52a3174cf9..dc2aa6a3e2 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,13 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE `string_col` WHEN 'value1' THEN 'mapped1' END AS `bfcol_1` - 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/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 bf3425fe6d..e3b44a06ef 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,13 +1,3 @@ -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 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 13b27c2e14..b807db1d3e 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,70 +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` -), `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 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 611cbf4e7e..483abf98a3 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,14 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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 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 872c794333..52268f97e4 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,15 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `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 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 105b5f1665..c6d3fc16e3 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,13 +1,3 @@ -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 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 c338baeb5f..c6d3fc16e3 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,13 +1,3 @@ -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 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 2d4ac2e960..c6d3fc16e3 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,13 +1,3 @@ -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 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 84b3ab1600..c6d3fc16e3 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,13 +1,3 @@ -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 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 733f1e9495..c6d3fc16e3 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,13 +1,3 @@ -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 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 11b3b7f691..c6d3fc16e3 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,13 +1,3 @@ -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 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 4e18216dda..c6d3fc16e3 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,13 +1,3 @@ -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 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 1bbb114349..dc2aa6a3e2 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,13 +1,3 @@ -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 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 f6c953d161..7595df6290 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,14 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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 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 f9290fe01a..c6d3fc16e3 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,13 +1,3 @@ -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 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 516f175c13..c6d3fc16e3 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,13 +1,3 @@ -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 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 80eef1c906..c6d3fc16e3 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,13 +1,3 @@ -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 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 09211270d1..c6d3fc16e3 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,13 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `geography_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - SAFE.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 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 625613ae2a..c6d3fc16e3 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,13 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `geography_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - SAFE.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 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 435ee96df1..cebf4c7688 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,13 +1,3 @@ -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 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 6c9c02594d..cebf4c7688 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,13 +1,3 @@ -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 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 a3a51be378..cebf4c7688 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,13 +1,3 @@ -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 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 164fe2e426..cebf4c7688 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,13 +1,3 @@ -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 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 4c3fa8e7e9..cebf4c7688 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,13 +1,3 @@ -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 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 f41979ea2e..cebf4c7688 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,13 +1,3 @@ -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 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 72f7237240..cebf4c7688 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,13 +1,3 @@ -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 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 5f80187ba0..dc2aa6a3e2 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,13 +1,3 @@ -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 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 e282c89c80..cebf4c7688 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,13 +1,3 @@ -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 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 0fb9589387..e3b44a06ef 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,13 +1,3 @@ -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 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 1707aad8c1..8515214c24 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,48 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `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`, 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 cb674787ff..dc2aa6a3e2 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,13 +1,3 @@ -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 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 2fef18eeb8..385618475a 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,53 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `date_col`, - `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`, 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 bb1766adf3..e3b44a06ef 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,17 +1,3 @@ -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 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 af556b9c3a..e3b44a06ef 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,17 +1,3 @@ -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 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 8243232e0b..e3b44a06ef 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,17 +1,3 @@ -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 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 e6bf3b339c..e3b44a06ef 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,13 +1,3 @@ -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 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 a85ff6403c..e3b44a06ef 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,13 +1,3 @@ -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 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 28fc8c869d..6024692972 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,16 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `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` 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 197bf59306..e3b44a06ef 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,17 +1,3 @@ -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 ATANH(`float64_col`) - END AS `bfcol_1` - FROM `bfcte_0` -) SELECT `bfcol_1` AS `float64_col` FROM `bfcte_1` \ 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 922fe5c550..e3b44a06ef 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,13 +1,3 @@ -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 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 0acb2bfa94..e3b44a06ef 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,13 +1,3 @@ -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 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 8c84a25047..e3b44a06ef 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,17 +1,3 @@ -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 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 ba6b6bfa9f..7da78a0329 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,15 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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` 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 db11f1529f..65157dc880 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,111 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `float64_col`, - `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`, 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 1a82a67368..5f490022f7 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,18 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `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`, 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 3327a99f4b..2130c978d5 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,15 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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` 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 610b96cda7..e3b44a06ef 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,17 +1,3 @@ -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 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 076ad584c2..e3b44a06ef 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,17 +1,3 @@ -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 - 1 AS `bfcol_1` - FROM `bfcte_0` -) SELECT `bfcol_1` AS `float64_col` FROM `bfcte_1` \ 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 e0c2e1072e..e3b44a06ef 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,13 +1,3 @@ -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 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 2fe20fb618..16230f0d51 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,15 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `date_col`, - `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`, 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 776cc33e0f..e3b44a06ef 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,13 +1,3 @@ -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 LN(`float64_col`) END AS `bfcol_1` - FROM `bfcte_0` -) SELECT `bfcol_1` AS `float64_col` FROM `bfcte_1` \ 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 11a318c22d..e3b44a06ef 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,17 +1,3 @@ -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 LOG(10, `float64_col`) - END AS `bfcol_1` - FROM `bfcte_0` -) SELECT `bfcol_1` AS `float64_col` FROM `bfcte_1` \ 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 4297fff227..e3b44a06ef 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,17 +1,3 @@ -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 LN(1 + `float64_col`) - END AS `bfcol_1` - FROM `bfcte_0` -) SELECT `bfcol_1` AS `float64_col` FROM `bfcte_1` \ 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 185bb7b277..b3093687c1 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,15 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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` 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 241ffa0b5e..ef38bc9d4d 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,282 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col`, - `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`, 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 d0c537e482..806619f1ab 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,48 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `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`, 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 ebdf296b2b..ffdb393e45 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,38 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `duration_col`, - `int64_col`, - `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`, 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 4374af349b..e3b44a06ef 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,15 +1,3 @@ -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 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 1ed016029a..e3b44a06ef 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,13 +1,3 @@ -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 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 9ce76f7c63..e75c893014 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,73 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `float64_col`, - `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`, 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 1699b6d8df..e3b44a06ef 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,13 +1,3 @@ -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 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 c1ea003e2d..e3b44a06ef 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,17 +1,3 @@ -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 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 152545d550..e3b44a06ef 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,13 +1,3 @@ -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 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 7e0f07af7b..8515214c24 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,48 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `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`, 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 ebcffd67f6..bc0cc58449 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,74 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `date_col`, - `duration_col`, - `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`, 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 f09d26a188..e3b44a06ef 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,13 +1,3 @@ -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 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 a5e5a87fbc..e3b44a06ef 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,13 +1,3 @@ -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 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 cb674787ff..dc2aa6a3e2 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,13 +1,3 @@ -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 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 b429007ffc..dc2aa6a3e2 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,13 +1,3 @@ -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 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 eeb2574094..96bccbc5b5 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,15 +1,3 @@ -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`, 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 61c2643f16..dc2aa6a3e2 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,13 +1,3 @@ -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 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 2b086f3e3d..dc2aa6a3e2 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,13 +1,3 @@ -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 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 7355ab7aa7..dc2aa6a3e2 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,13 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - REGEXP_CONTAINS(`string_col`, '^\\d+$') AS `bfcol_1` - 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/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 d7dd8c0729..dc2aa6a3e2 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,13 +1,3 @@ -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 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 b6ff57797c..dc2aa6a3e2 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,13 +1,3 @@ -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 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 6143b3685a..dc2aa6a3e2 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,13 +1,3 @@ -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 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 47ccd642d4..dc2aa6a3e2 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,13 +1,3 @@ -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 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 54f7b55ce3..dc2aa6a3e2 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,13 +1,3 @@ -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 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 63e8e160bf..dc2aa6a3e2 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,13 +1,3 @@ -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 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 0a9623162a..dc2aa6a3e2 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,13 +1,3 @@ -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 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 ebe4c39bbf..dc2aa6a3e2 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,13 +1,3 @@ -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 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 2fd3365a80..dc2aa6a3e2 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,13 +1,3 @@ -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 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 61b2e2f432..dc2aa6a3e2 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,13 +1,3 @@ -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 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 f9d287a591..dc2aa6a3e2 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,13 +1,3 @@ -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 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 ebe4c39bbf..dc2aa6a3e2 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,13 +1,3 @@ -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 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 54c8adb7b8..96bccbc5b5 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,15 +1,3 @@ -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`, 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 e973a97136..dc2aa6a3e2 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,13 +1,3 @@ -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 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 510e52e254..dc2aa6a3e2 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,13 +1,3 @@ -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 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 3e59f617ac..dc2aa6a3e2 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,13 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - REGEXP_EXTRACT(`string_col`, '([a-z]*)') AS `bfcol_1` - 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/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 82847d5e22..4b9130d13b 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,16 +1,3 @@ -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`, 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 b2a08e0e9d..dc2aa6a3e2 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,13 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - SUBSTRING(`string_col`, 2, 1) AS `bfcol_1` - 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/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 5f157bc5cb..8bd8692e2b 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,23 +1,3 @@ -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(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`, 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 90a52a40b1..dc2aa6a3e2 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,13 +1,3 @@ -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 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 8bd2a5f7fe..dc2aa6a3e2 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,13 +1,3 @@ -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 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 cb674787ff..dc2aa6a3e2 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,13 +1,3 @@ -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 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 37b15a0cf9..dc2aa6a3e2 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,13 +1,3 @@ -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 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 771bb9c49f..dc2aa6a3e2 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,13 +1,3 @@ -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 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 aa14c5f05d..dc2aa6a3e2 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,13 +1,3 @@ -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 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 97651ece49..dc2aa6a3e2 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,17 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - WHEN SUBSTRING(`string_col`, 1, 1) = '-' - THEN CONCAT('-', LPAD(SUBSTRING(`string_col`, 1), 9, '0')) - ELSE LPAD(`string_col`, 10, '0') - END AS `bfcol_1` - FROM `bfcte_0` -) SELECT `bfcol_1` AS `string_col` FROM `bfcte_1` \ 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 b85e88a90a..f733e5dd3f 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,14 +1,3 @@ -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` 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 575a162080..073287839c 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,21 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `float64_col`, - `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 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 432aefd7f6..0f2667b00e 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,13 +1,3 @@ -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 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 3c75cc3e89..53b88a9dc7 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,33 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `rowindex` AS `bfcol_4`, - `int64_col` AS `bfcol_5`, - `int64_col` AS `bfcol_6` - FROM `bfcte_0` -), `bfcte_2` AS ( - SELECT - *, - `bfcol_4` AS `bfcol_10`, - `bfcol_5` AS `bfcol_11`, - `bfcol_6` AS `bfcol_12`, - `bfcol_5` * 1000000 AS `bfcol_13` - FROM `bfcte_1` -), `bfcte_3` AS ( - SELECT - *, - `bfcol_10` AS `bfcol_18`, - `bfcol_11` AS `bfcol_19`, - `bfcol_12` AS `bfcol_20`, - `bfcol_13` AS `bfcol_21`, - `bfcol_11` * 604800000000 AS `bfcol_22` - FROM `bfcte_2` -) SELECT `bfcol_18` AS `rowindex`, `bfcol_19` AS `int64_col`, 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 949ed82574..cc6a5fe899 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,24 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_too` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `int64_too` AS `bfcol_2`, - `bool_col` AS `bfcol_3` - FROM `bfcte_0` -), `bfcte_2` AS ( - SELECT - `bfcol_3`, - COALESCE(SUM(`bfcol_2`), 0) AS `bfcol_6` - FROM `bfcte_1` - WHERE - NOT `bfcol_3` IS NULL - GROUP BY - `bfcol_3` -) SELECT `bfcol_3` AS `bool_col`, `bfcol_6` AS `int64_too` 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 3c09250858..cc6a5fe899 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,22 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `int64_too` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - `int64_too` AS `bfcol_2`, - `bool_col` AS `bfcol_3` - FROM `bfcte_0` -), `bfcte_2` AS ( - SELECT - `bfcol_3`, - COALESCE(SUM(`bfcol_2`), 0) AS `bfcol_6` - FROM `bfcte_1` - GROUP BY - `bfcol_3` -) SELECT `bfcol_3` AS `bool_col`, `bfcol_6` AS `int64_too` 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 f606de4ed3..8a412c22ab 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,76 +1,3 @@ -WITH `bfcte_1` AS ( - SELECT - `int64_col`, - `rowindex`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_3` AS ( - SELECT - *, - ROW_NUMBER() OVER () AS `bfcol_7` - FROM `bfcte_1` -), `bfcte_5` AS ( - SELECT - *, - 0 AS `bfcol_8` - FROM `bfcte_3` -), `bfcte_6` AS ( - 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` -), `bfcte_0` AS ( - SELECT - `int64_col`, - `rowindex`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` AS ( - SELECT - *, - ROW_NUMBER() OVER () AS `bfcol_22` - FROM `bfcte_0` -), `bfcte_4` AS ( - SELECT - *, - 1 AS `bfcol_23` - FROM `bfcte_2` -), `bfcte_7` AS ( - 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` -), `bfcte_8` AS ( - SELECT - * - FROM ( - SELECT - `bfcol_9` AS `bfcol_30`, - `bfcol_10` AS `bfcol_31`, - `bfcol_11` AS `bfcol_32`, - `bfcol_12` AS `bfcol_33`, - `bfcol_13` AS `bfcol_34`, - `bfcol_14` AS `bfcol_35` - FROM `bfcte_6` - UNION ALL - SELECT - `bfcol_24` AS `bfcol_30`, - `bfcol_25` AS `bfcol_31`, - `bfcol_26` AS `bfcol_32`, - `bfcol_27` AS `bfcol_33`, - `bfcol_28` AS `bfcol_34`, - `bfcol_29` AS `bfcol_35` - FROM `bfcte_7` - ) -) SELECT `bfcol_30` AS `rowindex`, `bfcol_31` AS `rowindex_1`, 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 a67d1943a2..b35b73d4dc 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,138 +1,3 @@ -WITH `bfcte_2` 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) AS `bfcol_4` - FROM `bfcte_2` -), `bfcte_10` AS ( - SELECT - *, - 0 AS `bfcol_5` - FROM `bfcte_6` -), `bfcte_13` AS ( - SELECT - `float64_col` AS `bfcol_6`, - `int64_col` AS `bfcol_7`, - `bfcol_5` AS `bfcol_8`, - `bfcol_4` AS `bfcol_9` - FROM `bfcte_10` -), `bfcte_0` 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 () AS `bfcol_15` - FROM `bfcte_4` -), `bfcte_12` AS ( - SELECT - *, - 1 AS `bfcol_16` - FROM `bfcte_8` -), `bfcte_14` AS ( - SELECT - `float64_col` AS `bfcol_17`, - `int64_too` AS `bfcol_18`, - `bfcol_16` AS `bfcol_19`, - `bfcol_15` AS `bfcol_20` - FROM `bfcte_12` -), `bfcte_1` 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) AS `bfcol_25` - FROM `bfcte_1` -), `bfcte_9` AS ( - SELECT - *, - 2 AS `bfcol_26` - FROM `bfcte_5` -), `bfcte_15` AS ( - SELECT - `float64_col` AS `bfcol_27`, - `int64_col` AS `bfcol_28`, - `bfcol_26` AS `bfcol_29`, - `bfcol_25` AS `bfcol_30` - FROM `bfcte_9` -), `bfcte_0` AS ( - SELECT - `bool_col`, - `float64_col`, - `int64_too` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_3` AS ( - SELECT - * - FROM `bfcte_0` - WHERE - `bool_col` -), `bfcte_7` AS ( - SELECT - *, - ROW_NUMBER() OVER () AS `bfcol_36` - FROM `bfcte_3` -), `bfcte_11` AS ( - SELECT - *, - 3 AS `bfcol_37` - FROM `bfcte_7` -), `bfcte_16` AS ( - SELECT - `float64_col` AS `bfcol_38`, - `int64_too` AS `bfcol_39`, - `bfcol_37` AS `bfcol_40`, - `bfcol_36` AS `bfcol_41` - FROM `bfcte_11` -), `bfcte_17` AS ( - SELECT - * - FROM ( - SELECT - `bfcol_6` AS `bfcol_42`, - `bfcol_7` AS `bfcol_43`, - `bfcol_8` AS `bfcol_44`, - `bfcol_9` AS `bfcol_45` - FROM `bfcte_13` - UNION ALL - SELECT - `bfcol_17` AS `bfcol_42`, - `bfcol_18` AS `bfcol_43`, - `bfcol_19` AS `bfcol_44`, - `bfcol_20` AS `bfcol_45` - FROM `bfcte_14` - UNION ALL - SELECT - `bfcol_27` AS `bfcol_42`, - `bfcol_28` AS `bfcol_43`, - `bfcol_29` AS `bfcol_44`, - `bfcol_30` AS `bfcol_45` - FROM `bfcte_15` - UNION ALL - SELECT - `bfcol_38` AS `bfcol_42`, - `bfcol_39` AS `bfcol_43`, - `bfcol_40` AS `bfcol_44`, - `bfcol_41` AS `bfcol_45` - FROM `bfcte_16` - ) -) SELECT `bfcol_42` AS `float64_col`, `bfcol_43` AS `int64_col` 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 e594b67669..6f9b5dcb10 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_dataframe/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_dataframe/out.sql @@ -1,16 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int_list_col`, - `rowindex`, - `string_list_col` - FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` -), `bfcte_1` AS ( - SELECT - * - REPLACE (`int_list_col`[SAFE_OFFSET(`bfcol_13`)] AS `int_list_col`, `string_list_col`[SAFE_OFFSET(`bfcol_13`)] AS `string_list_col`) - FROM `bfcte_0` - CROSS JOIN UNNEST(GENERATE_ARRAY(0, LEAST(ARRAY_LENGTH(`int_list_col`) - 1, ARRAY_LENGTH(`string_list_col`) - 1))) AS `bfcol_13` WITH OFFSET AS `bfcol_7` -) SELECT `rowindex`, `rowindex` AS `rowindex_1`, 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 5af0aa0092..e44937d560 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_series/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_series/out.sql @@ -1,15 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int_list_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` -), `bfcte_1` AS ( - SELECT - * - REPLACE (`bfcol_8` AS `int_list_col`) - FROM `bfcte_0` - CROSS JOIN UNNEST(`int_list_col`) AS `bfcol_8` WITH OFFSET AS `bfcol_4` -) SELECT `rowindex`, `int_list_col` 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 f5fff16f60..5f66d25df4 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,23 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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`, 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 63076077cf..6240763cb0 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 @@ -1,29 +1,3 @@ -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`, 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 f794711961..6240763cb0 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 @@ -1,23 +1,3 @@ -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`, 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 b8dd1587a8..2c3f5cfa4a 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 @@ -1,13 +1,3 @@ -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` 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 77aef6ad8b..cd7ea2f150 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,40 +1,3 @@ -WITH `bfcte_1` AS ( - SELECT - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_3` AS ( - SELECT - `rowindex` AS `bfcol_2`, - `int64_col` AS `bfcol_3` - FROM `bfcte_1` -), `bfcte_0` AS ( - SELECT - `int64_too` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` AS ( - SELECT - `int64_too` - FROM `bfcte_0` - GROUP BY - `int64_too` -), `bfcte_4` AS ( - SELECT - `bfcte_3`.*, - EXISTS( - SELECT - 1 - FROM ( - SELECT - `int64_too` AS `bfcol_4` - FROM `bfcte_2` - ) 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) - ) AS `bfcol_5` - FROM `bfcte_3` -) SELECT `bfcol_2` AS `rowindex`, `bfcol_5` AS `int64_col` diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql index 8089c5b462..998cc9656a 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,33 +1,3 @@ -WITH `bfcte_1` AS ( - SELECT - `rowindex`, - `rowindex_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_3` AS ( - SELECT - `rowindex` AS `bfcol_2`, - `rowindex_2` AS `bfcol_3` - FROM `bfcte_1` -), `bfcte_0` AS ( - SELECT - `rowindex_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` AS ( - SELECT - `rowindex_2` - FROM `bfcte_0` - GROUP BY - `rowindex_2` -), `bfcte_4` AS ( - SELECT - `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` 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 3a7ff60d3e..1ad571e572 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,31 +1,3 @@ -WITH `bfcte_1` AS ( - SELECT - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` 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 ( - SELECT - `int64_col` AS `bfcol_6`, - `int64_too` AS `bfcol_7` - FROM `bfcte_0` -), `bfcte_4` AS ( - SELECT - * - FROM `bfcte_2` - LEFT JOIN `bfcte_3` - 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` 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 30f363e900..7ed7c73d03 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,31 +1,3 @@ -WITH `bfcte_1` AS ( - SELECT - `bool_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` 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 ( - SELECT - `rowindex` AS `bfcol_6`, - `bool_col` AS `bfcol_7` - FROM `bfcte_0` -), `bfcte_4` AS ( - SELECT - * - FROM `bfcte_2` - INNER JOIN `bfcte_3` - 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') -) SELECT `bfcol_2` AS `rowindex_x`, `bfcol_3` AS `bool_col`, 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 9fa7673fb3..1c4d42bdd3 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,31 +1,3 @@ -WITH `bfcte_1` AS ( - SELECT - `float64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` 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 ( - SELECT - `rowindex` AS `bfcol_6`, - `float64_col` AS `bfcol_7` - FROM `bfcte_0` -), `bfcte_4` AS ( - SELECT - * - FROM `bfcte_2` - INNER JOIN `bfcte_3` - 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)) -) SELECT `bfcol_2` AS `rowindex_x`, `bfcol_3` AS `float64_col`, 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 c9fca069d6..1d48d684ee 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,31 +1,3 @@ -WITH `bfcte_1` AS ( - SELECT - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` 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 ( - SELECT - `rowindex` AS `bfcol_6`, - `int64_col` AS `bfcol_7` - FROM `bfcte_0` -), `bfcte_4` AS ( - SELECT - * - FROM `bfcte_2` - INNER JOIN `bfcte_3` - ON COALESCE(`bfcol_3`, 0) = COALESCE(`bfcol_7`, 0) - AND COALESCE(`bfcol_3`, 1) = COALESCE(`bfcol_7`, 1) -) SELECT `bfcol_2` AS `rowindex_x`, `bfcol_3` AS `int64_col`, 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 88649c6518..497136e79a 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,31 +1,3 @@ -WITH `bfcte_1` AS ( - SELECT - `numeric_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` 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 ( - SELECT - `rowindex` AS `bfcol_6`, - `numeric_col` AS `bfcol_7` - FROM `bfcte_0` -), `bfcte_4` AS ( - SELECT - * - FROM `bfcte_2` - INNER JOIN `bfcte_3` - 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)) -) SELECT `bfcol_2` AS `rowindex_x`, `bfcol_3` AS `numeric_col`, 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 8758ec8340..63297e6f3a 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,31 +1,3 @@ -WITH `bfcte_1` AS ( - SELECT - `rowindex`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` AS ( - SELECT - `rowindex` AS `bfcol_0`, - `string_col` AS `bfcol_1` - FROM `bfcte_1` -), `bfcte_0` AS ( - SELECT - `rowindex`, - `string_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_3` AS ( - SELECT - `rowindex` AS `bfcol_4`, - `string_col` AS `bfcol_5` - FROM `bfcte_0` -), `bfcte_4` AS ( - SELECT - * - FROM `bfcte_2` - INNER JOIN `bfcte_3` - ON COALESCE(CAST(`bfcol_1` AS STRING), '0') = COALESCE(CAST(`bfcol_5` AS STRING), '0') - AND COALESCE(CAST(`bfcol_1` AS STRING), '1') = COALESCE(CAST(`bfcol_5` AS STRING), '1') -) SELECT `bfcol_0` AS `rowindex_x`, `bfcol_1` AS `string_col`, 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 42fc15cd1d..1c1b70821e 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,31 +1,3 @@ -WITH `bfcte_1` AS ( - SELECT - `rowindex`, - `time_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_2` AS ( - SELECT - `rowindex` AS `bfcol_0`, - `time_col` AS `bfcol_1` - FROM `bfcte_1` -), `bfcte_0` AS ( - SELECT - `rowindex`, - `time_col` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_3` AS ( - SELECT - `rowindex` AS `bfcol_4`, - `time_col` AS `bfcol_5` - FROM `bfcte_0` -), `bfcte_4` AS ( - SELECT - * - FROM `bfcte_2` - INNER JOIN `bfcte_3` - ON COALESCE(CAST(`bfcol_1` AS STRING), '0') = COALESCE(CAST(`bfcol_5` AS STRING), '0') - AND COALESCE(CAST(`bfcol_1` AS STRING), '1') = COALESCE(CAST(`bfcol_5` AS STRING), '1') -) SELECT `bfcol_0` AS `rowindex_x`, `bfcol_1` AS `time_col`, 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 aae34716d8..287ebb19d0 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 @@ -1,168 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - *, - RAND() AS `bfcol_16` - FROM UNNEST(ARRAY>[STRUCT( - TRUE, - CAST(b'Hello, World!' AS BYTES), - CAST('2021-07-21' AS DATE), - CAST('2021-07-21T11:39:45' AS DATETIME), - ST_GEOGFROMTEXT('POINT(-122.0838511 37.3860517)'), - 123456789, - 0, - CAST(1.234567890 AS NUMERIC), - 1.25, - 0, - 0, - 'Hello, World!', - CAST('11:41:43.076160' AS TIME), - CAST('2021-07-21T17:43:43.945289+00:00' AS TIMESTAMP), - 4, - 0 - ), STRUCT( - FALSE, - CAST(b'\xe3\x81\x93\xe3\x82\x93\xe3\x81\xab\xe3\x81\xa1\xe3\x81\xaf' AS BYTES), - CAST('1991-02-03' AS DATE), - CAST('1991-01-02T03:45:06' AS DATETIME), - ST_GEOGFROMTEXT('POINT(-71.104 42.315)'), - -987654321, - 1, - CAST(1.234567890 AS NUMERIC), - 2.51, - 1, - 1, - 'こんにちは', - CAST('11:14:34.701606' AS TIME), - CAST('2021-07-21T17:43:43.945289+00:00' AS TIMESTAMP), - -1000000, - 1 - ), STRUCT( - TRUE, - CAST(b'\xc2\xa1Hola Mundo!' AS BYTES), - CAST('2023-03-01' AS DATE), - CAST('2023-03-01T10:55:13' AS DATETIME), - ST_GEOGFROMTEXT('POINT(-0.124474760143016 51.5007826749545)'), - 314159, - 0, - CAST(101.101010100 AS NUMERIC), - 25000000000.0, - 2, - 2, - ' ¡Hola Mundo! ', - CAST('23:59:59.999999' AS TIME), - CAST('2023-03-01T10:55:13.250125+00:00' AS TIMESTAMP), - 0, - 2 - ), STRUCT( - CAST(NULL AS BOOLEAN), - CAST(NULL AS BYTES), - CAST(NULL AS DATE), - CAST(NULL AS DATETIME), - CAST(NULL AS GEOGRAPHY), - CAST(NULL AS INT64), - 1, - CAST(NULL AS NUMERIC), - CAST(NULL AS FLOAT64), - 3, - 3, - CAST(NULL AS STRING), - CAST(NULL AS TIME), - CAST(NULL AS TIMESTAMP), - CAST(NULL AS INT64), - 3 - ), STRUCT( - FALSE, - CAST(b'\xe3\x81\x93\xe3\x82\x93\xe3\x81\xab\xe3\x81\xa1\xe3\x81\xaf' AS BYTES), - CAST('2021-07-21' AS DATE), - CAST(NULL AS DATETIME), - CAST(NULL AS GEOGRAPHY), - -234892, - -2345, - CAST(NULL AS NUMERIC), - CAST(NULL AS FLOAT64), - 4, - 4, - 'Hello, World!', - CAST(NULL AS TIME), - CAST(NULL AS TIMESTAMP), - 31540000000000, - 4 - ), STRUCT( - FALSE, - CAST(b'G\xc3\xbcten Tag' AS BYTES), - CAST('1980-03-14' AS DATE), - CAST('1980-03-14T15:16:17' AS DATETIME), - CAST(NULL AS GEOGRAPHY), - 55555, - 0, - CAST(5.555555000 AS NUMERIC), - 555.555, - 5, - 5, - 'Güten Tag!', - CAST('15:16:17.181921' AS TIME), - CAST('1980-03-14T15:16:17.181921+00:00' AS TIMESTAMP), - 4, - 5 - ), STRUCT( - TRUE, - CAST(b'Hello\tBigFrames!\x07' AS BYTES), - CAST('2023-05-23' AS DATE), - CAST('2023-05-23T11:37:01' AS DATETIME), - ST_GEOGFROMTEXT('LINESTRING(-0.127959 51.507728, -0.127026 51.507473)'), - 101202303, - 2, - CAST(-10.090807000 AS NUMERIC), - -123.456, - 6, - 6, - 'capitalize, This ', - CAST('01:02:03.456789' AS TIME), - CAST('2023-05-23T11:42:55.000001+00:00' AS TIMESTAMP), - CAST(NULL AS INT64), - 6 - ), STRUCT( - TRUE, - CAST(NULL AS BYTES), - CAST('2038-01-20' AS DATE), - CAST('2038-01-19T03:14:08' AS DATETIME), - CAST(NULL AS GEOGRAPHY), - -214748367, - 2, - CAST(11111111.100000000 AS NUMERIC), - 42.42, - 7, - 7, - ' سلام', - CAST('12:00:00.000001' AS TIME), - CAST('2038-01-19T03:14:17.999999+00:00' AS TIMESTAMP), - 4, - 7 - ), STRUCT( - FALSE, - CAST(NULL AS BYTES), - CAST(NULL AS DATE), - CAST(NULL AS DATETIME), - CAST(NULL AS GEOGRAPHY), - 2, - 1, - CAST(NULL AS NUMERIC), - 6.87, - 8, - 8, - 'T', - CAST(NULL AS TIME), - CAST(NULL AS TIMESTAMP), - 432000000000, - 8 - )]) -), `bfcte_1` AS ( - SELECT - * - FROM `bfcte_0` - WHERE - `bfcol_16` < 0.1 -) SELECT `bfcol_0` AS `bool_col`, `bfcol_1` AS `bytes_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 2b080b0b7c..671943cdd9 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 @@ -1,170 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - * - FROM UNNEST(ARRAY>[STRUCT( - 0, - TRUE, - CAST(b'Hello, World!' AS BYTES), - CAST('2021-07-21' AS DATE), - CAST('2021-07-21T11:39:45' AS DATETIME), - ST_GEOGFROMTEXT('POINT(-122.0838511 37.3860517)'), - 123456789, - 0, - CAST(1.234567890 AS NUMERIC), - 1.25, - 0, - 0, - 'Hello, World!', - CAST('11:41:43.076160' AS TIME), - CAST('2021-07-21T17:43:43.945289+00:00' AS TIMESTAMP), - 4, - 0 - ), STRUCT( - 1, - FALSE, - CAST(b'\xe3\x81\x93\xe3\x82\x93\xe3\x81\xab\xe3\x81\xa1\xe3\x81\xaf' AS BYTES), - CAST('1991-02-03' AS DATE), - CAST('1991-01-02T03:45:06' AS DATETIME), - ST_GEOGFROMTEXT('POINT(-71.104 42.315)'), - -987654321, - 1, - CAST(1.234567890 AS NUMERIC), - 2.51, - 1, - 1, - 'こんにちは', - CAST('11:14:34.701606' AS TIME), - CAST('2021-07-21T17:43:43.945289+00:00' AS TIMESTAMP), - -1000000, - 1 - ), STRUCT( - 2, - TRUE, - CAST(b'\xc2\xa1Hola Mundo!' AS BYTES), - CAST('2023-03-01' AS DATE), - CAST('2023-03-01T10:55:13' AS DATETIME), - ST_GEOGFROMTEXT('POINT(-0.124474760143016 51.5007826749545)'), - 314159, - 0, - CAST(101.101010100 AS NUMERIC), - 25000000000.0, - 2, - 2, - ' ¡Hola Mundo! ', - CAST('23:59:59.999999' AS TIME), - CAST('2023-03-01T10:55:13.250125+00:00' AS TIMESTAMP), - 0, - 2 - ), STRUCT( - 3, - CAST(NULL AS BOOLEAN), - CAST(NULL AS BYTES), - CAST(NULL AS DATE), - CAST(NULL AS DATETIME), - CAST(NULL AS GEOGRAPHY), - CAST(NULL AS INT64), - 1, - CAST(NULL AS NUMERIC), - CAST(NULL AS FLOAT64), - 3, - 3, - CAST(NULL AS STRING), - CAST(NULL AS TIME), - CAST(NULL AS TIMESTAMP), - CAST(NULL AS INT64), - 3 - ), STRUCT( - 4, - FALSE, - CAST(b'\xe3\x81\x93\xe3\x82\x93\xe3\x81\xab\xe3\x81\xa1\xe3\x81\xaf' AS BYTES), - CAST('2021-07-21' AS DATE), - CAST(NULL AS DATETIME), - CAST(NULL AS GEOGRAPHY), - -234892, - -2345, - CAST(NULL AS NUMERIC), - CAST(NULL AS FLOAT64), - 4, - 4, - 'Hello, World!', - CAST(NULL AS TIME), - CAST(NULL AS TIMESTAMP), - 31540000000000, - 4 - ), STRUCT( - 5, - FALSE, - CAST(b'G\xc3\xbcten Tag' AS BYTES), - CAST('1980-03-14' AS DATE), - CAST('1980-03-14T15:16:17' AS DATETIME), - CAST(NULL AS GEOGRAPHY), - 55555, - 0, - CAST(5.555555000 AS NUMERIC), - 555.555, - 5, - 5, - 'Güten Tag!', - CAST('15:16:17.181921' AS TIME), - CAST('1980-03-14T15:16:17.181921+00:00' AS TIMESTAMP), - 4, - 5 - ), STRUCT( - 6, - TRUE, - CAST(b'Hello\tBigFrames!\x07' AS BYTES), - CAST('2023-05-23' AS DATE), - CAST('2023-05-23T11:37:01' AS DATETIME), - ST_GEOGFROMTEXT('LINESTRING(-0.127959 51.507728, -0.127026 51.507473)'), - 101202303, - 2, - CAST(-10.090807000 AS NUMERIC), - -123.456, - 6, - 6, - 'capitalize, This ', - CAST('01:02:03.456789' AS TIME), - CAST('2023-05-23T11:42:55.000001+00:00' AS TIMESTAMP), - CAST(NULL AS INT64), - 6 - ), STRUCT( - 7, - TRUE, - CAST(NULL AS BYTES), - CAST('2038-01-20' AS DATE), - CAST('2038-01-19T03:14:08' AS DATETIME), - CAST(NULL AS GEOGRAPHY), - -214748367, - 2, - CAST(11111111.100000000 AS NUMERIC), - 42.42, - 7, - 7, - ' سلام', - CAST('12:00:00.000001' AS TIME), - CAST('2038-01-19T03:14:17.999999+00:00' AS TIMESTAMP), - 4, - 7 - ), STRUCT( - 8, - FALSE, - CAST(NULL AS BYTES), - CAST(NULL AS DATE), - CAST(NULL AS DATETIME), - CAST(NULL AS GEOGRAPHY), - 2, - 1, - CAST(NULL AS NUMERIC), - 6.87, - 8, - 8, - 'T', - CAST(NULL AS TIME), - CAST(NULL AS TIMESTAMP), - 432000000000, - 8 - )]) -) SELECT `bfcol_0` AS `rowindex`, `bfcol_1` AS `bool_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 4e21266b87..48ce1a825b 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 @@ -1,8 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - * - 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` 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 923476aafd..17cb21c14c 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 @@ -1,38 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - * - FROM UNNEST(ARRAY, `bfcol_2` ARRAY, `bfcol_3` ARRAY, `bfcol_4` ARRAY, `bfcol_5` ARRAY, `bfcol_6` ARRAY, `bfcol_7` ARRAY, `bfcol_8` INT64>>[STRUCT( - 0, - [1], - [TRUE], - [1.2, 2.3], - ['2021-07-21'], - ['2021-07-21 11:39:45'], - [1.2, 2.3, 3.4], - ['abc', 'de', 'f'], - 0 - ), STRUCT( - 1, - [1, 2], - [TRUE, FALSE], - [1.1], - ['2021-07-21', '1987-03-28'], - ['1999-03-14 17:22:00'], - [5.5, 2.3], - ['a', 'bc', 'de'], - 1 - ), STRUCT( - 2, - [1, 2, 3], - [TRUE], - [0.5, -1.9, 2.3], - ['2017-08-01', '2004-11-22'], - ['1979-06-03 03:20:45'], - [1.7000000000000002], - ['', 'a'], - 2 - )]) -) SELECT `bfcol_0` AS `rowindex`, `bfcol_1` AS `int_list_col`, 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 7ded9cf5ff..fcada5055b 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 @@ -1,24 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - * - FROM UNNEST(ARRAY>, `bfcol_2` INT64>>[STRUCT( - 1, - STRUCT( - 'Alice' AS `name`, - 30 AS `age`, - STRUCT('New York' AS `city`, 'USA' AS `country`) AS `address` - ), - 0 - ), STRUCT( - 2, - STRUCT( - 'Bob' AS `name`, - 25 AS `age`, - STRUCT('London' AS `city`, 'UK' AS `country`) AS `address` - ), - 1 - )]) -) SELECT `bfcol_0` AS `id`, `bfcol_1` AS `person` 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 959a31a2a3..e657b5ece1 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`, 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 4b5750d7aa..ad0e61b0ce 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,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `json_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`json_types` -) SELECT `rowindex`, `json_col` 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 856c7061da..c60fec7b1b 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,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `int64_col` 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 79ae1ac907..b19839d864 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,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `id`, - `people` - FROM `bigframes-dev`.`sqlglot_test`.`nested_structs_types` -) SELECT `id`, `id` AS `id_1`, 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 edb8d7fbf4..278836093f 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,9 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -) SELECT `rowindex`, `int64_col` 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 a22c845ef1..51fb9a4c7d 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`, 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 59c3687080..a8c1686ab0 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`, diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_groupby_rolling/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_groupby_rolling/out.sql index 11e3f4773e..e7d9bdf818 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,70 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `bool_col`, - `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 SUM(CAST(NOT `bfcol_7` IS NULL AS INT64)) OVER ( - PARTITION BY `bfcol_9` - ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST - ROWS BETWEEN 3 PRECEDING AND CURRENT ROW - ) < 3 - THEN NULL - ELSE COALESCE( - SUM(CAST(`bfcol_7` AS INT64)) OVER ( - PARTITION BY `bfcol_9` - ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST - ROWS BETWEEN 3 PRECEDING AND CURRENT ROW - ), - 0 - ) - END AS `bfcol_15` - FROM `bfcte_2` -), `bfcte_4` AS ( - SELECT - * - FROM `bfcte_3` - WHERE - NOT `bfcol_9` IS NULL -), `bfcte_5` AS ( - SELECT - *, - CASE - WHEN SUM(CAST(NOT `bfcol_8` IS NULL AS INT64)) OVER ( - PARTITION BY `bfcol_9` - ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST - ROWS BETWEEN 3 PRECEDING AND CURRENT ROW - ) < 3 - 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_21` - FROM `bfcte_4` -) SELECT `bfcol_9` AS `bool_col`, `bfcol_6` AS `rowindex`, diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_range_rolling/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_range_rolling/out.sql index 581c81c6b4..dd3af4f888 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 @@ -1,26 +1,3 @@ -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 SUM(CAST(NOT `bfcol_1` IS NULL AS INT64)) OVER ( - ORDER BY UNIX_MICROS(`bfcol_0`) ASC NULLS LAST - RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW - ) < 1 - THEN NULL - ELSE COALESCE( - SUM(`bfcol_1`) OVER ( - ORDER BY UNIX_MICROS(`bfcol_0`) ASC NULLS LAST - RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW - ), - 0 - ) - END AS `bfcol_6` - FROM `bfcte_0` -) SELECT `bfcol_0` AS `ts_col`, `bfcol_6` AS `int_col` 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 788eb49ddf..1b8608bf60 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,21 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `int64_col`, - `rowindex` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` -), `bfcte_1` AS ( - SELECT - *, - CASE - WHEN SUM(CAST(NOT `int64_col` IS NULL AS INT64)) OVER (ORDER BY `rowindex` ASC NULLS LAST ROWS BETWEEN 2 PRECEDING AND CURRENT ROW) < 3 - THEN NULL - ELSE COALESCE( - SUM(`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` 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 5ad435ddbb..1b8608bf60 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,18 +1,3 @@ -WITH `bfcte_0` AS ( - SELECT - `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 830eaf3de5744d175570ffce2d38cccdf560df58 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Tue, 18 Nov 2025 18:51:04 +0000 Subject: [PATCH 08/10] update snapshots --- .../test_binary_compiler/test_corr/out.sql | 10 + .../test_binary_compiler/test_cov/out.sql | 10 + .../test_row_number/out.sql | 24 ++ .../test_row_number_with_window/out.sql | 10 + .../test_nullary_compiler/test_size/out.sql | 23 ++ .../test_array_agg/out.sql | 9 + .../test_string_agg/out.sql | 12 + .../test_unary_compiler/test_all/out.sql | 9 + .../test_all/window_out.sql | 10 + .../test_all/window_partition_out.sql | 11 + .../test_unary_compiler/test_any/out.sql | 9 + .../test_any/window_out.sql | 10 + .../test_any_value/out.sql | 9 + .../test_any_value/window_out.sql | 10 + .../test_any_value/window_partition_out.sql | 11 + .../test_approx_quartiles/out.sql | 11 + .../test_approx_top_count/out.sql | 9 + .../test_unary_compiler/test_count/out.sql | 9 + .../test_count/window_out.sql | 10 + .../test_count/window_partition_out.sql | 11 + .../test_date_series_diff/out.sql | 10 + .../test_dense_rank/out.sql | 10 + .../test_diff/diff_bool.sql | 10 + .../test_diff/diff_int.sql | 10 + .../test_unary_compiler/test_first/out.sql | 10 + .../test_first_non_null/out.sql | 10 + .../test_unary_compiler/test_last/out.sql | 10 + .../test_last_non_null/out.sql | 10 + .../test_unary_compiler/test_max/out.sql | 9 + .../test_max/window_out.sql | 10 + .../test_max/window_partition_out.sql | 11 + .../test_unary_compiler/test_mean/out.sql | 21 ++ .../test_mean/window_out.sql | 10 + .../test_mean/window_partition_out.sql | 11 + .../test_unary_compiler/test_median/out.sql | 13 + .../test_unary_compiler/test_min/out.sql | 9 + .../test_min/window_out.sql | 10 + .../test_min/window_partition_out.sql | 11 + .../test_unary_compiler/test_pop_var/out.sql | 11 + .../test_pop_var/window_out.sql | 10 + .../test_unary_compiler/test_quantile/out.sql | 10 + .../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 | 21 ++ .../test_std/window_out.sql | 10 + .../test_unary_compiler/test_sum/out.sql | 11 + .../test_sum/window_out.sql | 10 + .../test_sum/window_partition_out.sql | 11 + .../test_time_series_diff/out.sql | 14 + .../test_unary_compiler/test_var/out.sql | 11 + .../test_var/window_out.sql | 10 + .../test_ai_ops/test_ai_classify/out.sql | 14 + .../test_ai_ops/test_ai_generate/out.sql | 15 + .../test_ai_ops/test_ai_generate_bool/out.sql | 15 + .../out.sql | 15 + .../test_ai_generate_double/out.sql | 15 + .../out.sql | 15 + .../test_ai_ops/test_ai_generate_int/out.sql | 15 + .../out.sql | 15 + .../test_ai_generate_with_model_param/out.sql | 15 + .../out.sql | 16 + .../snapshots/test_ai_ops/test_ai_if/out.sql | 13 + .../test_ai_ops/test_ai_score/out.sql | 13 + .../test_array_ops/test_array_index/out.sql | 10 + .../test_array_reduce_op/out.sql | 31 ++ .../test_array_slice_with_only_start/out.sql | 16 + .../out.sql | 16 + .../test_array_to_string/out.sql | 10 + .../test_array_ops/test_to_array_op/out.sql | 20 ++ .../test_obj_fetch_metadata/out.sql | 21 ++ .../test_obj_get_access_url/out.sql | 21 ++ .../test_blob_ops/test_obj_make_ref/out.sql | 11 + .../test_bool_ops/test_and_op/out.sql | 24 ++ .../test_bool_ops/test_or_op/out.sql | 24 ++ .../test_bool_ops/test_xor_op/out.sql | 24 ++ .../test_eq_null_match/out.sql | 11 + .../test_eq_numeric/out.sql | 45 +++ .../test_ge_numeric/out.sql | 45 +++ .../test_gt_numeric/out.sql | 45 +++ .../test_comparison_ops/test_is_in/out.sql | 22 ++ .../test_le_numeric/out.sql | 45 +++ .../test_lt_numeric/out.sql | 45 +++ .../test_maximum_op/out.sql | 11 + .../test_minimum_op/out.sql | 11 + .../test_ne_numeric/out.sql | 45 +++ .../test_add_timedelta/out.sql | 50 ++++ .../test_datetime_ops/test_date/out.sql | 10 + .../test_datetime_ops/test_day/out.sql | 10 + .../test_datetime_ops/test_dayofweek/out.sql | 14 + .../test_datetime_ops/test_dayofyear/out.sql | 10 + .../test_datetime_ops/test_floor_dt/out.sql | 22 ++ .../test_datetime_ops/test_hour/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 | 10 + .../test_sub_timedelta/out.sql | 71 +++++ .../test_datetime_ops/test_time/out.sql | 10 + .../test_to_datetime/out.sql | 10 + .../test_to_timestamp/out.sql | 10 + .../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 | 13 + .../test_astype_float/out.sql | 12 + .../test_astype_from_json/out.sql | 14 + .../test_generic_ops/test_astype_int/out.sql | 22 ++ .../test_generic_ops/test_astype_json/out.sql | 18 ++ .../test_astype_string/out.sql | 13 + .../test_astype_time_like/out.sql | 13 + .../test_case_when_op/out.sql | 23 ++ .../test_generic_ops/test_clip/out.sql | 12 + .../test_generic_ops/test_coalesce/out.sql | 12 + .../test_generic_ops/test_fillna/out.sql | 11 + .../test_generic_ops/test_hash/out.sql | 10 + .../test_generic_ops/test_invert/out.sql | 20 ++ .../test_generic_ops/test_isnull/out.sql | 10 + .../test_generic_ops/test_map/out.sql | 10 + .../test_generic_ops/test_notnull/out.sql | 10 + .../test_generic_ops/test_row_key/out.sql | 67 +++++ .../test_sql_scalar_op/out.sql | 11 + .../test_generic_ops/test_where/out.sql | 12 + .../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_st_geogfromtext/out.sql | 10 + .../test_geo_st_geogpoint/out.sql | 11 + .../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_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_string/out.sql | 10 + .../test_numeric_ops/test_abs/out.sql | 10 + .../test_numeric_ops/test_add_numeric/out.sql | 45 +++ .../test_numeric_ops/test_add_string/out.sql | 10 + .../test_add_timedelta/out.sql | 50 ++++ .../test_numeric_ops/test_arccos/out.sql | 14 + .../test_numeric_ops/test_arccosh/out.sql | 14 + .../test_numeric_ops/test_arcsin/out.sql | 14 + .../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 | 14 + .../test_numeric_ops/test_ceil/out.sql | 10 + .../test_numeric_ops/test_cos/out.sql | 10 + .../test_numeric_ops/test_cosh/out.sql | 14 + .../test_cosine_distance/out.sql | 12 + .../test_numeric_ops/test_div_numeric/out.sql | 108 +++++++ .../test_div_timedelta/out.sql | 15 + .../test_euclidean_distance/out.sql | 12 + .../test_numeric_ops/test_exp/out.sql | 14 + .../test_numeric_ops/test_expm1/out.sql | 14 + .../test_numeric_ops/test_floor/out.sql | 10 + .../test_floordiv_timedelta/out.sql | 12 + .../test_numeric_ops/test_ln/out.sql | 10 + .../test_numeric_ops/test_log10/out.sql | 14 + .../test_numeric_ops/test_log1p/out.sql | 14 + .../test_manhattan_distance/out.sql | 12 + .../test_numeric_ops/test_mod_numeric/out.sql | 279 ++++++++++++++++++ .../test_numeric_ops/test_mul_numeric/out.sql | 45 +++ .../test_mul_timedelta/out.sql | 35 +++ .../test_numeric_ops/test_neg/out.sql | 12 + .../test_numeric_ops/test_pos/out.sql | 10 + .../test_numeric_ops/test_round/out.sql | 70 +++++ .../test_numeric_ops/test_sin/out.sql | 10 + .../test_numeric_ops/test_sinh/out.sql | 14 + .../test_numeric_ops/test_sqrt/out.sql | 10 + .../test_numeric_ops/test_sub_numeric/out.sql | 45 +++ .../test_sub_timedelta/out.sql | 71 +++++ .../test_numeric_ops/test_tan/out.sql | 10 + .../test_numeric_ops/test_tanh/out.sql | 10 + .../test_string_ops/test_add_string/out.sql | 10 + .../test_string_ops/test_capitalize/out.sql | 10 + .../test_string_ops/test_endswith/out.sql | 12 + .../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 | 10 + .../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_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 | 12 + .../test_string_ops/test_str_contains/out.sql | 10 + .../test_str_contains_regex/out.sql | 10 + .../test_string_ops/test_str_extract/out.sql | 10 + .../test_string_ops/test_str_find/out.sql | 13 + .../test_string_ops/test_str_get/out.sql | 10 + .../test_string_ops/test_str_pad/out.sql | 20 ++ .../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 | 14 + .../test_struct_ops/test_struct_field/out.sql | 11 + .../test_struct_ops/test_struct_op/out.sql | 18 ++ .../test_timedelta_floor/out.sql | 10 + .../test_to_timedelta/out.sql | 30 ++ .../test_compile_aggregate/out.sql | 21 ++ .../test_compile_aggregate_wo_dropna/out.sql | 19 ++ .../test_compile_concat/out.sql | 73 +++++ .../test_compile_concat_filter_sorted/out.sql | 135 +++++++++ .../test_compile_explode_dataframe/out.sql | 13 + .../test_compile_explode_series/out.sql | 12 + .../test_compile_filter/out.sql | 20 ++ .../test_st_regionstats/out.sql | 26 ++ .../out.sql | 20 ++ .../test_compile_geo/test_st_simplify/out.sql | 10 + .../test_compile_isin/out.sql | 37 +++ .../test_compile_isin_not_nullable/out.sql | 30 ++ .../test_compile_join/out.sql | 28 ++ .../test_compile_join_w_on/bool_col/out.sql | 28 ++ .../float64_col/out.sql | 28 ++ .../test_compile_join_w_on/int64_col/out.sql | 28 ++ .../numeric_col/out.sql | 28 ++ .../test_compile_join_w_on/string_col/out.sql | 28 ++ .../test_compile_join_w_on/time_col/out.sql | 28 ++ .../test_compile_random_sample/out.sql | 165 +++++++++++ .../test_compile_readlocal/out.sql | 167 +++++++++++ .../test_compile_readlocal_w_json_df/out.sql | 5 + .../test_compile_readlocal_w_lists_df/out.sql | 35 +++ .../out.sql | 21 ++ .../test_compile_readtable/out.sql | 19 ++ .../out.sql | 6 + .../test_compile_readtable_w_limit/out.sql | 6 + .../out.sql | 6 + .../test_compile_readtable_w_ordering/out.sql | 6 + .../out.sql | 12 + .../out.sql | 19 ++ .../out.sql | 51 ++++ .../out.sql | 17 ++ .../out.sql | 18 ++ .../out.sql | 15 + 263 files changed, 4917 insertions(+) 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 656304ab25..5c838f4882 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_corr/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_corr/out.sql @@ -1,3 +1,13 @@ +WITH `bfcte_0` AS ( + SELECT + `float64_col`, + `int64_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + CORR(`int64_col`, `float64_col`) AS `bfcol_2` + 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 58e85af16c..eda082250a 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_cov/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_cov/out.sql @@ -1,3 +1,13 @@ +WITH `bfcte_0` AS ( + SELECT + `float64_col`, + `int64_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + COVAR_SAMP(`int64_col`, `float64_col`) AS `bfcol_2` + 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 e259198f92..78cc44fa54 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number/out.sql @@ -1,3 +1,27 @@ +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` +), `bfcte_1` AS ( + SELECT + *, + ROW_NUMBER() OVER () AS `bfcol_32` + FROM `bfcte_0` +) SELECT `bfcol_32` AS `row_number` 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_with_window/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number_with_window/out.sql index 23e9dd0bc2..b63cb1ff61 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number_with_window/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number_with_window/out.sql @@ -1,3 +1,13 @@ +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) AS `bfcol_1` + FROM `bfcte_0` +) SELECT `bfcol_1` AS `row_number` FROM `bfcte_1` \ 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 150235a08e..ed8e0c7619 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_size/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_size/out.sql @@ -1,3 +1,26 @@ +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` +), `bfcte_1` AS ( + SELECT + COUNT(1) AS `bfcol_32` + 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 0f2667b00e..eafbc39daf 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_array_agg/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_array_agg/out.sql @@ -1,3 +1,12 @@ +WITH `bfcte_0` AS ( + SELECT + `int64_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + ARRAY_AGG(`int64_col` IGNORE NULLS ORDER BY `int64_col` IS NULL ASC, `int64_col` ASC) AS `bfcol_1` + 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 dc2aa6a3e2..2ce4124347 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_string_agg/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_string_agg/out.sql @@ -1,3 +1,15 @@ +WITH `bfcte_0` AS ( + SELECT + `string_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + COALESCE( + STRING_AGG(`string_col` ORDER BY `string_col` IS NULL ASC, `string_col` ASC, ','), + '' + ) AS `bfcol_1` + 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 eab455d84a..d31b21f56b 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/out.sql @@ -1,3 +1,12 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + COALESCE(LOGICAL_AND(`bool_col`), TRUE) AS `bfcol_1` + FROM `bfcte_0` +) SELECT `bfcol_1` 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_all/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_out.sql index 5a51967aee..829e5a8836 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_out.sql @@ -1,3 +1,13 @@ +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 diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_partition_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_partition_out.sql index bdb5694fe0..23357817c1 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_partition_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_partition_out.sql @@ -1,3 +1,14 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `string_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + *, + COALESCE(LOGICAL_AND(`bool_col`) OVER (PARTITION BY `string_col`), TRUE) AS `bfcol_2` + FROM `bfcte_0` +) SELECT `bfcol_2` AS `agg_bool` FROM `bfcte_1` \ 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 eab455d84a..03b0d5c151 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 @@ -1,3 +1,12 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + COALESCE(LOGICAL_OR(`bool_col`), FALSE) AS `bfcol_1` + FROM `bfcte_0` +) SELECT `bfcol_1` 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_any/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any/window_out.sql index 5a51967aee..337f0ff963 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any/window_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any/window_out.sql @@ -1,3 +1,13 @@ +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 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 0f2667b00e..4a13901f1c 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/out.sql @@ -1,3 +1,12 @@ +WITH `bfcte_0` AS ( + SELECT + `int64_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + ANY_VALUE(`int64_col`) AS `bfcol_1` + 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 09a787ae98..ea15243d90 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,3 +1,13 @@ +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 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 0f86562a25..e722318fbc 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,3 +1,14 @@ +WITH `bfcte_0` AS ( + SELECT + `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 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 8a8cc9b587..9eabb2d88a 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_approx_quartiles/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_approx_quartiles/out.sql @@ -1,3 +1,14 @@ +WITH `bfcte_0` AS ( + SELECT + `int64_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + APPROX_QUANTILES(`int64_col`, 4)[OFFSET(1)] AS `bfcol_1`, + APPROX_QUANTILES(`int64_col`, 4)[OFFSET(2)] AS `bfcol_2`, + APPROX_QUANTILES(`int64_col`, 4)[OFFSET(3)] AS `bfcol_3` + FROM `bfcte_0` +) SELECT `bfcol_1` AS `q1`, `bfcol_2` AS `q2`, 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 0f2667b00e..b5e6275381 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_approx_top_count/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_approx_top_count/out.sql @@ -1,3 +1,12 @@ +WITH `bfcte_0` AS ( + SELECT + `int64_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + APPROX_TOP_COUNT(`int64_col`, 10) AS `bfcol_1` + 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 0f2667b00e..9d18367cf6 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/out.sql @@ -1,3 +1,12 @@ +WITH `bfcte_0` AS ( + SELECT + `int64_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + COUNT(`int64_col`) AS `bfcol_1` + 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 09a787ae98..0baac95311 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/window_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/window_out.sql @@ -1,3 +1,13 @@ +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 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 0f86562a25..6d3f856459 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/window_partition_out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/window_partition_out.sql @@ -1,3 +1,14 @@ +WITH `bfcte_0` AS ( + SELECT + `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 diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_date_series_diff/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_date_series_diff/out.sql index f96d8d87f5..84c95fd010 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_date_series_diff/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_date_series_diff/out.sql @@ -1,3 +1,13 @@ +WITH `bfcte_0` AS ( + SELECT + `date_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + *, + CAST(DATE_DIFF(`date_col`, LAG(`date_col`, 1) OVER (ORDER BY `date_col` ASC NULLS LAST), DAY) * 86400000000 AS INT64) AS `bfcol_1` + FROM `bfcte_0` +) SELECT `bfcol_1` AS `diff_date` FROM `bfcte_1` \ 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 09a787ae98..76b455a65c 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_dense_rank/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_dense_rank/out.sql @@ -1,3 +1,13 @@ +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 diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_bool.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_bool.sql index d39b4f0cd3..96d23c4747 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_bool.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_bool.sql @@ -1,3 +1,13 @@ +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 diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_int.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_int.sql index 4ed75bf95e..95d786b951 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_int.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_diff/diff_int.sql @@ -1,3 +1,13 @@ +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 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 09a787ae98..bed23226e4 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,3 +1,13 @@ +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 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 09a787ae98..f574a49d96 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first_non_null/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first_non_null/out.sql @@ -1,3 +1,13 @@ +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 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 09a787ae98..db28817808 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,3 +1,13 @@ +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 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 09a787ae98..0fa48b68a2 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last_non_null/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last_non_null/out.sql @@ -1,3 +1,13 @@ +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 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 0f2667b00e..1537d735ea 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/out.sql @@ -1,3 +1,12 @@ +WITH `bfcte_0` AS ( + SELECT + `int64_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + MAX(`int64_col`) AS `bfcol_1` + 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 09a787ae98..f55201418a 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,3 +1,13 @@ +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 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 0f86562a25..ac9b2df84e 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,3 +1,14 @@ +WITH `bfcte_0` AS ( + SELECT + `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 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 ad92b1854b..0b33d0b1d0 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/out.sql @@ -1,3 +1,24 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `duration_col`, + `int64_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + *, + `int64_col` AS `bfcol_6`, + `bool_col` AS `bfcol_7`, + `duration_col` AS `bfcol_8` + FROM `bfcte_0` +), `bfcte_2` 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` +) SELECT `bfcol_12` AS `int64_col`, `bfcol_13` AS `bool_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 09a787ae98..fdb59809c3 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,3 +1,13 @@ +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 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 0f86562a25..d96121e54d 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,3 +1,14 @@ +WITH `bfcte_0` AS ( + SELECT + `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 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 2faf8b433e..bfe94622b3 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_median/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_median/out.sql @@ -1,3 +1,16 @@ +WITH `bfcte_0` AS ( + SELECT + `date_col`, + `int64_col`, + `string_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + APPROX_QUANTILES(`int64_col`, 2)[OFFSET(1)] AS `bfcol_3`, + APPROX_QUANTILES(`date_col`, 2)[OFFSET(1)] AS `bfcol_4`, + APPROX_QUANTILES(`string_col`, 2)[OFFSET(1)] AS `bfcol_5` + FROM `bfcte_0` +) SELECT `bfcol_3` AS `int64_col`, `bfcol_4` AS `date_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 0f2667b00e..0848313456 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/out.sql @@ -1,3 +1,12 @@ +WITH `bfcte_0` AS ( + SELECT + `int64_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + MIN(`int64_col`) AS `bfcol_1` + 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 09a787ae98..cbda2b7d58 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,3 +1,13 @@ +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 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 0f86562a25..d601832950 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,3 +1,14 @@ +WITH `bfcte_0` AS ( + SELECT + `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 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 f4b139576c..2d38311f45 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_pop_var/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_pop_var/out.sql @@ -1,3 +1,14 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `int64_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + VAR_POP(`int64_col`) AS `bfcol_4`, + VAR_POP(CAST(`bool_col` AS INT64)) AS `bfcol_5` + FROM `bfcte_0` +) SELECT `bfcol_4` AS `int64_col`, `bfcol_5` AS `bool_col` 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 09a787ae98..430da33e3c 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,3 +1,13 @@ +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 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 3fad56c87a..b79d8d381f 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_quantile/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_quantile/out.sql @@ -1,3 +1,13 @@ +WITH `bfcte_0` AS ( + SELECT + `int64_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + PERCENTILE_CONT(`int64_col`, 0.5) OVER () AS `bfcol_1`, + CAST(FLOOR(PERCENTILE_CONT(`int64_col`, 0.5) OVER ()) AS INT64) AS `bfcol_2` + FROM `bfcte_0` +) SELECT `bfcol_1` AS `quantile`, `bfcol_2` AS `quantile_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 09a787ae98..96b121bde4 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_rank/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_rank/out.sql @@ -1,3 +1,13 @@ +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 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 2563b3182d..7d1d62f1ae 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_shift/lag.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_shift/lag.sql @@ -1,3 +1,13 @@ +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 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 437e6f22a2..67b40c99db 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_shift/lead.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_shift/lead.sql @@ -1,3 +1,13 @@ +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 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 7b00b5269b..0202cf5c21 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_shift/noop.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_shift/noop.sql @@ -1,3 +1,13 @@ +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 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 ad92b1854b..36a50302a6 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_std/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_std/out.sql @@ -1,3 +1,24 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `duration_col`, + `int64_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + *, + `int64_col` AS `bfcol_6`, + `bool_col` AS `bfcol_7`, + `duration_col` AS `bfcol_8` + FROM `bfcte_0` +), `bfcte_2` 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` +) SELECT `bfcol_12` AS `int64_col`, `bfcol_13` AS `bool_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 09a787ae98..80e0cf5bc6 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,3 +1,13 @@ +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 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 f4b139576c..2bf6c26cd4 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/out.sql @@ -1,3 +1,14 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `int64_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + COALESCE(SUM(`int64_col`), 0) AS `bfcol_4`, + COALESCE(SUM(CAST(`bool_col` AS INT64)), 0) AS `bfcol_5` + FROM `bfcte_0` +) SELECT `bfcol_4` AS `int64_col`, `bfcol_5` AS `bool_col` 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 09a787ae98..47426abcbd 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,3 +1,13 @@ +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 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 0f86562a25..fd1bd4f630 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,3 +1,14 @@ +WITH `bfcte_0` AS ( + SELECT + `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 diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_time_series_diff/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_time_series_diff/out.sql index 3449f376a4..645f583dc1 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_time_series_diff/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_time_series_diff/out.sql @@ -1,3 +1,17 @@ +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` ASC NULLS LAST), + MICROSECOND + ) AS `bfcol_1` + FROM `bfcte_0` +) SELECT `bfcol_1` AS `diff_time` FROM `bfcte_1` \ 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 f4b139576c..733a22438c 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_var/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_var/out.sql @@ -1,3 +1,14 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `int64_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + VARIANCE(`int64_col`) AS `bfcol_4`, + VARIANCE(CAST(`bool_col` AS INT64)) AS `bfcol_5` + FROM `bfcte_0` +) SELECT `bfcol_4` AS `int64_col`, `bfcol_5` AS `bool_col` 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 09a787ae98..e9d6c1cb93 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,3 +1,13 @@ +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 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 5f0b7fdca7..a40784a3ca 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_classify/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_classify/out.sql @@ -1,3 +1,17 @@ +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 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 5f0b7fdca7..19f85b181b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate/out.sql @@ -1,3 +1,18 @@ +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 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 5f0b7fdca7..f844ed1691 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool/out.sql @@ -1,3 +1,18 @@ +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 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 5f0b7fdca7..35538c2ec2 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool_with_model_param/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_bool_with_model_param/out.sql @@ -1,3 +1,18 @@ +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', + 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 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 5f0b7fdca7..fae92515cb 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double/out.sql @@ -1,3 +1,18 @@ +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 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 5f0b7fdca7..f3ddf71014 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double_with_model_param/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_double_with_model_param/out.sql @@ -1,3 +1,18 @@ +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', + 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 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 5f0b7fdca7..a0c92c959c 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int/out.sql @@ -1,3 +1,18 @@ +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 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 5f0b7fdca7..1951e13325 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int_with_model_param/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_int_with_model_param/out.sql @@ -1,3 +1,18 @@ +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', + 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 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 5f0b7fdca7..3419a77c61 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_model_param/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_model_param/out.sql @@ -1,3 +1,18 @@ +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', + 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 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 5f0b7fdca7..e1e1670f12 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_output_schema/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_generate_with_output_schema/out.sql @@ -1,3 +1,19 @@ +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', + 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 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 5f0b7fdca7..275ba8d423 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_if/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_if/out.sql @@ -1,3 +1,16 @@ +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 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 5f0b7fdca7..01c71065b9 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_score/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_ai_ops/test_ai_score/out.sql @@ -1,3 +1,16 @@ +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 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 5abdaa8f21..d8e223d5f8 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_index/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_index/out.sql @@ -1,3 +1,13 @@ +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 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 b342c67533..b9f87bfd1e 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,3 +1,34 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_list_col`, + `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`, 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 5abdaa8f21..0034ffd69c 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_slice_with_only_start/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_slice_with_only_start/out.sql @@ -1,3 +1,19 @@ +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 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 5abdaa8f21..f0638fa3af 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_slice_with_start_and_stop/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_slice_with_start_and_stop/out.sql @@ -1,3 +1,19 @@ +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 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 5abdaa8f21..09446bb8f5 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_to_string/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_to_string/out.sql @@ -1,3 +1,13 @@ +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 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 c85acd114d..3e29701658 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,3 +1,23 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `float64_col`, + `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`, 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 e3169ef0ac..bd99b86064 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_fetch_metadata/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_fetch_metadata/out.sql @@ -1,3 +1,24 @@ +WITH `bfcte_0` AS ( + SELECT + `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` 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 6e45764d75..c65436e530 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_get_access_url/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_get_access_url/out.sql @@ -1,3 +1,24 @@ +WITH `bfcte_0` AS ( + SELECT + `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`) 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` 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 04ab050788..d74449c986 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_make_ref/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_make_ref/out.sql @@ -1,3 +1,14 @@ +WITH `bfcte_0` AS ( + SELECT + `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` 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 02212b4b49..634a936a0e 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_and_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_and_op/out.sql @@ -1,3 +1,27 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `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` +) SELECT `bfcol_14` AS `rowindex`, `bfcol_15` AS `bool_col`, 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 02212b4b49..0069b07d8f 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_or_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_or_op/out.sql @@ -1,3 +1,27 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `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` +) SELECT `bfcol_14` AS `rowindex`, `bfcol_15` AS `bool_col`, 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 02212b4b49..e4c87ed720 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_xor_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_xor_op/out.sql @@ -1,3 +1,27 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `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` +) SELECT `bfcol_14` AS `rowindex`, `bfcol_15` AS `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 591d6c7d1d..57af99a52b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_eq_null_match/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_eq_null_match/out.sql @@ -1,3 +1,14 @@ +WITH `bfcte_0` AS ( + SELECT + `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 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 cf9b22f563..9c7c19e61c 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_eq_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_eq_numeric/out.sql @@ -1,3 +1,48 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `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`, 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 1ad2a52a16..e99fe49c8e 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_ge_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_ge_numeric/out.sql @@ -1,3 +1,48 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `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`, 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 914e091787..4e5aba3d31 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_gt_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_gt_numeric/out.sql @@ -1,3 +1,48 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `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`, 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 1030794065..197ed279fa 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_is_in/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_is_in/out.sql @@ -1,3 +1,25 @@ +WITH `bfcte_0` AS ( + SELECT + `float64_col`, + `int64_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + *, + COALESCE(`int64_col` IN (1, 2, 3), FALSE) AS `bfcol_2`, + ( + `int64_col` IS NULL + ) OR `int64_col` IN (123456) AS `bfcol_3`, + COALESCE(`int64_col` IN (1.0, 2.0, 3.0), FALSE) AS `bfcol_4`, + FALSE AS `bfcol_5`, + COALESCE(`int64_col` IN (2.5, 3), FALSE) AS `bfcol_6`, + FALSE AS `bfcol_7`, + COALESCE(`int64_col` IN (123456), FALSE) AS `bfcol_8`, + ( + `float64_col` IS NULL + ) OR `float64_col` IN (1, 2, 3) AS `bfcol_9` + FROM `bfcte_0` +) SELECT `bfcol_2` AS `ints`, `bfcol_3` 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 9289fae574..97a00d1c88 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_le_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_le_numeric/out.sql @@ -1,3 +1,48 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `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`, 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 fa1ce080c4..addebd3187 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_lt_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_lt_numeric/out.sql @@ -1,3 +1,48 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `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`, 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 90fd50517b..bbef212707 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_maximum_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_maximum_op/out.sql @@ -1,3 +1,14 @@ +WITH `bfcte_0` AS ( + SELECT + `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 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 90fd50517b..1f00f5892e 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_minimum_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_minimum_op/out.sql @@ -1,3 +1,14 @@ +WITH `bfcte_0` AS ( + SELECT + `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 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 cf9b22f563..417d24aa72 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_ne_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_ne_numeric/out.sql @@ -1,3 +1,48 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `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`, 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 385618475a..2fef18eeb8 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_add_timedelta/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_add_timedelta/out.sql @@ -1,3 +1,53 @@ +WITH `bfcte_0` AS ( + SELECT + `date_col`, + `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`, 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 f6e171e2a6..b8f46ceafe 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_date/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_date/out.sql @@ -1,3 +1,13 @@ +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 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 f6e171e2a6..52d80fd2a6 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_day/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_day/out.sql @@ -1,3 +1,13 @@ +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 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 6d00877a3d..0119bbb4e9 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_dayofweek/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_dayofweek/out.sql @@ -1,3 +1,17 @@ +WITH `bfcte_0` AS ( + SELECT + `date_col`, + `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`, 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 f6e171e2a6..521419757a 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_dayofyear/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_dayofyear/out.sql @@ -1,3 +1,13 @@ +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 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 ac2d64656e..fe76efb609 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_floor_dt/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_floor_dt/out.sql @@ -1,3 +1,25 @@ +WITH `bfcte_0` AS ( + SELECT + `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`, 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 f6e171e2a6..5fc6621a7c 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_hour/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_hour/out.sql @@ -1,3 +1,13 @@ +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 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 f6e171e2a6..9422844b34 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_iso_day/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_iso_day/out.sql @@ -1,3 +1,13 @@ +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 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 f6e171e2a6..4db49fb10f 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_iso_week/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_iso_week/out.sql @@ -1,3 +1,13 @@ +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 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 f6e171e2a6..8d49933202 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_iso_year/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_iso_year/out.sql @@ -1,3 +1,13 @@ +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 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 f6e171e2a6..e089a77af5 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_minute/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_minute/out.sql @@ -1,3 +1,13 @@ +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 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 f6e171e2a6..53d135903b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_month/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_month/out.sql @@ -1,3 +1,13 @@ +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 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 f6e171e2a6..b542dfea72 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_normalize/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_normalize/out.sql @@ -1,3 +1,13 @@ +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 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 f6e171e2a6..4a232cb5a3 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_quarter/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_quarter/out.sql @@ -1,3 +1,13 @@ +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 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 f6e171e2a6..e86d830b73 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_second/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_second/out.sql @@ -1,3 +1,13 @@ +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 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 f6e171e2a6..190cd7895b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_strftime/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_strftime/out.sql @@ -1,3 +1,13 @@ +WITH `bfcte_0` AS ( + SELECT + `timestamp_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + *, + FORMAT_TIMESTAMP('%Y-%m-%d', `timestamp_col`) AS `bfcol_1` + FROM `bfcte_0` +) SELECT `bfcol_1` AS `timestamp_col` FROM `bfcte_1` \ 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 bc0cc58449..ebcffd67f6 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_sub_timedelta/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_sub_timedelta/out.sql @@ -1,3 +1,74 @@ +WITH `bfcte_0` AS ( + SELECT + `date_col`, + `duration_col`, + `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`, 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 f6e171e2a6..5a8ab600ba 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_time/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_time/out.sql @@ -1,3 +1,13 @@ +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 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 0f2667b00e..bbba3b1533 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_to_datetime/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_to_datetime/out.sql @@ -1,3 +1,13 @@ +WITH `bfcte_0` AS ( + SELECT + `int64_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + *, + CAST(TIMESTAMP_SECONDS(`int64_col`) AS DATETIME) AS `bfcol_1` + 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/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 0f2667b00e..df01fb3269 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_to_timestamp/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_to_timestamp/out.sql @@ -1,3 +1,13 @@ +WITH `bfcte_0` AS ( + SELECT + `int64_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + *, + TIMESTAMP_SECONDS(`int64_col`) AS `bfcol_1` + 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/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 f6e171e2a6..e6515017f2 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_unix_micros/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_unix_micros/out.sql @@ -1,3 +1,13 @@ +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 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 f6e171e2a6..caec5effe0 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_unix_millis/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_unix_millis/out.sql @@ -1,3 +1,13 @@ +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 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 f6e171e2a6..6dc0ea2a02 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_unix_seconds/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_unix_seconds/out.sql @@ -1,3 +1,13 @@ +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 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 f6e171e2a6..1ceb674137 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_year/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_year/out.sql @@ -1,3 +1,13 @@ +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 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 fcaba91497..1f90accd0b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_bool/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_bool/out.sql @@ -1,3 +1,16 @@ +WITH `bfcte_0` AS ( + SELECT + `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`, 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 0fd94588e7..32c8da56fa 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_float/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_float/out.sql @@ -1,3 +1,15 @@ +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`, 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 c5ccce7446..d1577c0664 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_from_json/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_from_json/out.sql @@ -1,3 +1,17 @@ +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`, 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 c5ae06696b..e0fe2af9a9 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_int/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_int/out.sql @@ -1,3 +1,25 @@ +WITH `bfcte_0` AS ( + SELECT + `datetime_col`, + `float64_col`, + `numeric_col`, + `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`, 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 e3f8a87b74..2defc2e72b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_json/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_json/out.sql @@ -1,3 +1,21 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `float64_col`, + `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`, + PARSE_JSON_IN_SAFE(`string_col`) AS `bfcol_9` + FROM `bfcte_0` +) SELECT `bfcol_4` AS `int64_col`, `bfcol_5` AS `float64_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 6eaaf99cb6..da6eb6ce18 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_string/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_string/out.sql @@ -1,3 +1,16 @@ +WITH `bfcte_0` AS ( + SELECT + `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`, 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 e11068501a..6523d8376c 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_time_like/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_time_like/out.sql @@ -1,3 +1,16 @@ +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`, 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 5c1ca69329..08a489e240 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_case_when_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_case_when_op/out.sql @@ -1,3 +1,26 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `float64_col`, + `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`, 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 52268f97e4..b162593147 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_clip/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_clip/out.sql @@ -1,3 +1,15 @@ +WITH `bfcte_0` AS ( + SELECT + `int64_col`, + `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 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 5857aa58d9..451de48b64 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_coalesce/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_coalesce/out.sql @@ -1,3 +1,15 @@ +WITH `bfcte_0` AS ( + SELECT + `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` 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 90fd50517b..07f2877e74 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,3 +1,14 @@ +WITH `bfcte_0` AS ( + SELECT + `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 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 dc2aa6a3e2..19fce60091 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_hash/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_hash/out.sql @@ -1,3 +1,13 @@ +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 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 2e882be382..1bd2eb7426 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_invert/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_invert/out.sql @@ -1,3 +1,23 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `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`, 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 e3b44a06ef..0a549bdd44 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_isnull/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_isnull/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..52a3174cf9 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_map/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_map/out.sql @@ -1,3 +1,13 @@ +WITH `bfcte_0` AS ( + SELECT + `string_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + *, + CASE `string_col` WHEN 'value1' THEN 'mapped1' END AS `bfcol_1` + 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/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 e3b44a06ef..bf3425fe6d 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_notnull/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_notnull/out.sql @@ -1,3 +1,13 @@ +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 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 b807db1d3e..13b27c2e14 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_row_key/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_row_key/out.sql @@ -1,3 +1,70 @@ +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` +), `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 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 483abf98a3..611cbf4e7e 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_sql_scalar_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_sql_scalar_op/out.sql @@ -1,3 +1,14 @@ +WITH `bfcte_0` AS ( + SELECT + `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 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 52268f97e4..872c794333 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_where/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_where/out.sql @@ -1,3 +1,15 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `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 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 c6d3fc16e3..105b5f1665 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_area/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_area/out.sql @@ -1,3 +1,13 @@ +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 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 c6d3fc16e3..c338baeb5f 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_astext/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_astext/out.sql @@ -1,3 +1,13 @@ +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 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 c6d3fc16e3..2d4ac2e960 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_boundary/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_boundary/out.sql @@ -1,3 +1,13 @@ +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 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 c6d3fc16e3..84b3ab1600 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_buffer/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_buffer/out.sql @@ -1,3 +1,13 @@ +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 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 c6d3fc16e3..733f1e9495 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_centroid/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_centroid/out.sql @@ -1,3 +1,13 @@ +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 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 c6d3fc16e3..11b3b7f691 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_convexhull/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_convexhull/out.sql @@ -1,3 +1,13 @@ +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 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 c6d3fc16e3..4e18216dda 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_difference/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_difference/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..1bbb114349 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_geogfromtext/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_geogfromtext/out.sql @@ -1,3 +1,13 @@ +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 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 7595df6290..f6c953d161 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,3 +1,14 @@ +WITH `bfcte_0` AS ( + SELECT + `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 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 c6d3fc16e3..f9290fe01a 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,3 +1,13 @@ +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 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 c6d3fc16e3..516f175c13 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_isclosed/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_isclosed/out.sql @@ -1,3 +1,13 @@ +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 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 c6d3fc16e3..80eef1c906 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_length/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_length/out.sql @@ -1,3 +1,13 @@ +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 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 c6d3fc16e3..09211270d1 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_x/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_x/out.sql @@ -1,3 +1,13 @@ +WITH `bfcte_0` AS ( + SELECT + `geography_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + *, + SAFE.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 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 c6d3fc16e3..625613ae2a 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_y/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_y/out.sql @@ -1,3 +1,13 @@ +WITH `bfcte_0` AS ( + SELECT + `geography_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + *, + SAFE.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 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 cebf4c7688..435ee96df1 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_extract/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_extract/out.sql @@ -1,3 +1,13 @@ +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 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 cebf4c7688..6c9c02594d 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_extract_array/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_extract_array/out.sql @@ -1,3 +1,13 @@ +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 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 cebf4c7688..a3a51be378 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_extract_string_array/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_extract_string_array/out.sql @@ -1,3 +1,13 @@ +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 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 cebf4c7688..164fe2e426 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_query/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_query/out.sql @@ -1,3 +1,13 @@ +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 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 cebf4c7688..4c3fa8e7e9 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_query_array/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_query_array/out.sql @@ -1,3 +1,13 @@ +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 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 cebf4c7688..f41979ea2e 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_set/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_set/out.sql @@ -1,3 +1,13 @@ +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 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 cebf4c7688..72f7237240 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_value/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_json_value/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..5f80187ba0 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_parse_json/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_parse_json/out.sql @@ -1,3 +1,13 @@ +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 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 cebf4c7688..e282c89c80 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_to_json_string/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_to_json_string/out.sql @@ -1,3 +1,13 @@ +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 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 e3b44a06ef..0fb9589387 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_abs/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_abs/out.sql @@ -1,3 +1,13 @@ +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 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 8515214c24..1707aad8c1 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_add_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_add_numeric/out.sql @@ -1,3 +1,48 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `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`, 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 dc2aa6a3e2..cb674787ff 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_add_string/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_add_string/out.sql @@ -1,3 +1,13 @@ +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 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 385618475a..2fef18eeb8 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_add_timedelta/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_add_timedelta/out.sql @@ -1,3 +1,53 @@ +WITH `bfcte_0` AS ( + SELECT + `date_col`, + `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`, 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 e3b44a06ef..bb1766adf3 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arccos/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arccos/out.sql @@ -1,3 +1,17 @@ +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 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 e3b44a06ef..af556b9c3a 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arccosh/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arccosh/out.sql @@ -1,3 +1,17 @@ +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 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 e3b44a06ef..8243232e0b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arcsin/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arcsin/out.sql @@ -1,3 +1,17 @@ +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 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 e3b44a06ef..e6bf3b339c 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arcsinh/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arcsinh/out.sql @@ -1,3 +1,13 @@ +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 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 e3b44a06ef..a85ff6403c 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctan/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctan/out.sql @@ -1,3 +1,13 @@ +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 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 6024692972..28fc8c869d 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctan2/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctan2/out.sql @@ -1,3 +1,16 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `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` 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 e3b44a06ef..197bf59306 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctanh/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctanh/out.sql @@ -1,3 +1,17 @@ +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 ATANH(`float64_col`) + END AS `bfcol_1` + FROM `bfcte_0` +) SELECT `bfcol_1` AS `float64_col` FROM `bfcte_1` \ 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 e3b44a06ef..922fe5c550 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_ceil/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_ceil/out.sql @@ -1,3 +1,13 @@ +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 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 e3b44a06ef..0acb2bfa94 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_cos/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_cos/out.sql @@ -1,3 +1,13 @@ +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 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 e3b44a06ef..8c84a25047 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_cosh/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_cosh/out.sql @@ -1,3 +1,17 @@ +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 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 7da78a0329..ba6b6bfa9f 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_cosine_distance/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_cosine_distance/out.sql @@ -1,3 +1,15 @@ +WITH `bfcte_0` AS ( + SELECT + `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` 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 65157dc880..db11f1529f 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_div_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_div_numeric/out.sql @@ -1,3 +1,111 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `float64_col`, + `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`, 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 5f490022f7..1a82a67368 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_div_timedelta/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_div_timedelta/out.sql @@ -1,3 +1,18 @@ +WITH `bfcte_0` AS ( + SELECT + `int64_col`, + `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`, 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 2130c978d5..3327a99f4b 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,3 +1,15 @@ +WITH `bfcte_0` AS ( + SELECT + `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` 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 e3b44a06ef..610b96cda7 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_exp/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_exp/out.sql @@ -1,3 +1,17 @@ +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 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 e3b44a06ef..076ad584c2 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_expm1/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_expm1/out.sql @@ -1,3 +1,17 @@ +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 - 1 AS `bfcol_1` + FROM `bfcte_0` +) SELECT `bfcol_1` AS `float64_col` FROM `bfcte_1` \ 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 e3b44a06ef..e0c2e1072e 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_floor/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_floor/out.sql @@ -1,3 +1,13 @@ +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 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 16230f0d51..2fe20fb618 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_floordiv_timedelta/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_floordiv_timedelta/out.sql @@ -1,3 +1,15 @@ +WITH `bfcte_0` AS ( + SELECT + `date_col`, + `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`, 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 e3b44a06ef..776cc33e0f 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_ln/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_ln/out.sql @@ -1,3 +1,13 @@ +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 LN(`float64_col`) END AS `bfcol_1` + FROM `bfcte_0` +) SELECT `bfcol_1` AS `float64_col` FROM `bfcte_1` \ 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 e3b44a06ef..11a318c22d 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_log10/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_log10/out.sql @@ -1,3 +1,17 @@ +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 LOG(10, `float64_col`) + END AS `bfcol_1` + FROM `bfcte_0` +) SELECT `bfcol_1` AS `float64_col` FROM `bfcte_1` \ 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 e3b44a06ef..4297fff227 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_log1p/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_log1p/out.sql @@ -1,3 +1,17 @@ +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 LN(1 + `float64_col`) + END AS `bfcol_1` + FROM `bfcte_0` +) SELECT `bfcol_1` AS `float64_col` FROM `bfcte_1` \ 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 b3093687c1..185bb7b277 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,3 +1,15 @@ +WITH `bfcte_0` AS ( + SELECT + `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` 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 ef38bc9d4d..241ffa0b5e 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mod_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mod_numeric/out.sql @@ -1,3 +1,282 @@ +WITH `bfcte_0` AS ( + SELECT + `float64_col`, + `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`, 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 806619f1ab..d0c537e482 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mul_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mul_numeric/out.sql @@ -1,3 +1,48 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `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`, 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 ffdb393e45..ebdf296b2b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mul_timedelta/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mul_timedelta/out.sql @@ -1,3 +1,38 @@ +WITH `bfcte_0` AS ( + SELECT + `duration_col`, + `int64_col`, + `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`, 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 e3b44a06ef..4374af349b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_neg/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_neg/out.sql @@ -1,3 +1,15 @@ +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 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 e3b44a06ef..1ed016029a 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pos/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_pos/out.sql @@ -1,3 +1,13 @@ +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 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 e75c893014..9ce76f7c63 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_round/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_round/out.sql @@ -1,3 +1,73 @@ +WITH `bfcte_0` AS ( + SELECT + `float64_col`, + `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`, 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 e3b44a06ef..1699b6d8df 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sin/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sin/out.sql @@ -1,3 +1,13 @@ +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 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 e3b44a06ef..c1ea003e2d 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sinh/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sinh/out.sql @@ -1,3 +1,17 @@ +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 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 e3b44a06ef..152545d550 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sqrt/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sqrt/out.sql @@ -1,3 +1,13 @@ +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 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 8515214c24..7e0f07af7b 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sub_numeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sub_numeric/out.sql @@ -1,3 +1,48 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `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`, 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 bc0cc58449..ebcffd67f6 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sub_timedelta/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sub_timedelta/out.sql @@ -1,3 +1,74 @@ +WITH `bfcte_0` AS ( + SELECT + `date_col`, + `duration_col`, + `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`, 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 e3b44a06ef..f09d26a188 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_tan/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_tan/out.sql @@ -1,3 +1,13 @@ +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 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 e3b44a06ef..a5e5a87fbc 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_tanh/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_tanh/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..cb674787ff 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_add_string/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_add_string/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..b429007ffc 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_capitalize/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_capitalize/out.sql @@ -1,3 +1,13 @@ +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 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 96bccbc5b5..eeb2574094 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_endswith/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_endswith/out.sql @@ -1,3 +1,15 @@ +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`, 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 dc2aa6a3e2..61c2643f16 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isalnum/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isalnum/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..2b086f3e3d 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isalpha/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isalpha/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..7355ab7aa7 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isdecimal/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isdecimal/out.sql @@ -1,3 +1,13 @@ +WITH `bfcte_0` AS ( + SELECT + `string_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + *, + REGEXP_CONTAINS(`string_col`, '^\\d+$') AS `bfcol_1` + 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/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 dc2aa6a3e2..d7dd8c0729 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isdigit/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isdigit/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..b6ff57797c 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_islower/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_islower/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..6143b3685a 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isnumeric/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isnumeric/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..47ccd642d4 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isspace/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isspace/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..54f7b55ce3 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isupper/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isupper/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..63e8e160bf 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_len/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_len/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..0a9623162a 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_lower/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_lower/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..ebe4c39bbf 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_lstrip/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_lstrip/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..2fd3365a80 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_regex_replace_str/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_regex_replace_str/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..61b2e2f432 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_replace_str/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_replace_str/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..f9d287a591 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_reverse/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_reverse/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..ebe4c39bbf 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_rstrip/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_rstrip/out.sql @@ -1,3 +1,13 @@ +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 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 96bccbc5b5..54c8adb7b8 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_startswith/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_startswith/out.sql @@ -1,3 +1,15 @@ +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`, 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 dc2aa6a3e2..e973a97136 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_contains/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_contains/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..510e52e254 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_contains_regex/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_contains_regex/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..3e59f617ac 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_extract/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_extract/out.sql @@ -1,3 +1,13 @@ +WITH `bfcte_0` AS ( + SELECT + `string_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + *, + REGEXP_EXTRACT(`string_col`, '([a-z]*)') AS `bfcol_1` + 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/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 4b9130d13b..4927e814a3 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,3 +1,16 @@ +WITH `bfcte_0` AS ( + SELECT + `string_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + *, + STRPOS(`string_col`, 'e') - 1 AS `bfcol_1`, + STRPOS(`string_col`, 'e') - 1 AS `bfcol_2`, + STRPOS(SUBSTRING(`string_col`, 1, 5), 'e') - 1 AS `bfcol_3`, + STRPOS(SUBSTRING(`string_col`, 3, 3), 'e') - 1 AS `bfcol_4` + FROM `bfcte_0` +) SELECT `bfcol_1` AS `none_none`, `bfcol_2` AS `start_none`, 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 dc2aa6a3e2..b2a08e0e9d 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_get/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_get/out.sql @@ -1,3 +1,13 @@ +WITH `bfcte_0` AS ( + SELECT + `string_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + *, + SUBSTRING(`string_col`, 2, 1) AS `bfcol_1` + 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/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 8bd8692e2b..5f157bc5cb 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_pad/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_pad/out.sql @@ -1,3 +1,23 @@ +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(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`, 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 dc2aa6a3e2..90a52a40b1 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_repeat/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_repeat/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..8bd2a5f7fe 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_slice/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_slice/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..cb674787ff 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_strconcat/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_strconcat/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..37b15a0cf9 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_string_split/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_string_split/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..771bb9c49f 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_strip/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_strip/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..aa14c5f05d 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_upper/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_upper/out.sql @@ -1,3 +1,13 @@ +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 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 dc2aa6a3e2..97651ece49 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_zfill/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_zfill/out.sql @@ -1,3 +1,17 @@ +WITH `bfcte_0` AS ( + SELECT + `string_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + *, + CASE + WHEN SUBSTRING(`string_col`, 1, 1) = '-' + THEN CONCAT('-', LPAD(SUBSTRING(`string_col`, 1), 9, '0')) + ELSE LPAD(`string_col`, 10, '0') + END AS `bfcol_1` + FROM `bfcte_0` +) SELECT `bfcol_1` AS `string_col` FROM `bfcte_1` \ 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 f733e5dd3f..b85e88a90a 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_struct_ops/test_struct_field/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_struct_ops/test_struct_field/out.sql @@ -1,3 +1,14 @@ +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` 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 073287839c..575a162080 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_struct_ops/test_struct_op/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_struct_ops/test_struct_op/out.sql @@ -1,3 +1,21 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `float64_col`, + `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 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 0f2667b00e..432aefd7f6 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_timedelta_ops/test_timedelta_floor/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_timedelta_ops/test_timedelta_floor/out.sql @@ -1,3 +1,13 @@ +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 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 53b88a9dc7..3c75cc3e89 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_timedelta_ops/test_to_timedelta/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_timedelta_ops/test_to_timedelta/out.sql @@ -1,3 +1,33 @@ +WITH `bfcte_0` AS ( + SELECT + `int64_col`, + `rowindex` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + *, + `rowindex` AS `bfcol_4`, + `int64_col` AS `bfcol_5`, + `int64_col` AS `bfcol_6` + FROM `bfcte_0` +), `bfcte_2` AS ( + SELECT + *, + `bfcol_4` AS `bfcol_10`, + `bfcol_5` AS `bfcol_11`, + `bfcol_6` AS `bfcol_12`, + `bfcol_5` * 1000000 AS `bfcol_13` + FROM `bfcte_1` +), `bfcte_3` AS ( + SELECT + *, + `bfcol_10` AS `bfcol_18`, + `bfcol_11` AS `bfcol_19`, + `bfcol_12` AS `bfcol_20`, + `bfcol_13` AS `bfcol_21`, + `bfcol_11` * 604800000000 AS `bfcol_22` + FROM `bfcte_2` +) SELECT `bfcol_18` AS `rowindex`, `bfcol_19` AS `int64_col`, 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 cc6a5fe899..949ed82574 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_aggregate/test_compile_aggregate/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_aggregate/test_compile_aggregate/out.sql @@ -1,3 +1,24 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `int64_too` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + *, + `int64_too` AS `bfcol_2`, + `bool_col` AS `bfcol_3` + FROM `bfcte_0` +), `bfcte_2` AS ( + SELECT + `bfcol_3`, + COALESCE(SUM(`bfcol_2`), 0) AS `bfcol_6` + FROM `bfcte_1` + WHERE + NOT `bfcol_3` IS NULL + GROUP BY + `bfcol_3` +) SELECT `bfcol_3` AS `bool_col`, `bfcol_6` AS `int64_too` 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 cc6a5fe899..3c09250858 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_aggregate/test_compile_aggregate_wo_dropna/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_aggregate/test_compile_aggregate_wo_dropna/out.sql @@ -1,3 +1,22 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `int64_too` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + *, + `int64_too` AS `bfcol_2`, + `bool_col` AS `bfcol_3` + FROM `bfcte_0` +), `bfcte_2` AS ( + SELECT + `bfcol_3`, + COALESCE(SUM(`bfcol_2`), 0) AS `bfcol_6` + FROM `bfcte_1` + GROUP BY + `bfcol_3` +) SELECT `bfcol_3` AS `bool_col`, `bfcol_6` AS `int64_too` 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 8a412c22ab..f606de4ed3 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat/out.sql @@ -1,3 +1,76 @@ +WITH `bfcte_1` AS ( + SELECT + `int64_col`, + `rowindex`, + `string_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_3` AS ( + SELECT + *, + ROW_NUMBER() OVER () AS `bfcol_7` + FROM `bfcte_1` +), `bfcte_5` AS ( + SELECT + *, + 0 AS `bfcol_8` + FROM `bfcte_3` +), `bfcte_6` AS ( + 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` +), `bfcte_0` AS ( + SELECT + `int64_col`, + `rowindex`, + `string_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_2` AS ( + SELECT + *, + ROW_NUMBER() OVER () AS `bfcol_22` + FROM `bfcte_0` +), `bfcte_4` AS ( + SELECT + *, + 1 AS `bfcol_23` + FROM `bfcte_2` +), `bfcte_7` AS ( + 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` +), `bfcte_8` AS ( + SELECT + * + FROM ( + SELECT + `bfcol_9` AS `bfcol_30`, + `bfcol_10` AS `bfcol_31`, + `bfcol_11` AS `bfcol_32`, + `bfcol_12` AS `bfcol_33`, + `bfcol_13` AS `bfcol_34`, + `bfcol_14` AS `bfcol_35` + FROM `bfcte_6` + UNION ALL + SELECT + `bfcol_24` AS `bfcol_30`, + `bfcol_25` AS `bfcol_31`, + `bfcol_26` AS `bfcol_32`, + `bfcol_27` AS `bfcol_33`, + `bfcol_28` AS `bfcol_34`, + `bfcol_29` AS `bfcol_35` + FROM `bfcte_7` + ) +) SELECT `bfcol_30` AS `rowindex`, `bfcol_31` AS `rowindex_1`, 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 b35b73d4dc..a67d1943a2 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat_filter_sorted/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat_filter_sorted/out.sql @@ -1,3 +1,138 @@ +WITH `bfcte_2` 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) AS `bfcol_4` + FROM `bfcte_2` +), `bfcte_10` AS ( + SELECT + *, + 0 AS `bfcol_5` + FROM `bfcte_6` +), `bfcte_13` AS ( + SELECT + `float64_col` AS `bfcol_6`, + `int64_col` AS `bfcol_7`, + `bfcol_5` AS `bfcol_8`, + `bfcol_4` AS `bfcol_9` + FROM `bfcte_10` +), `bfcte_0` 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 () AS `bfcol_15` + FROM `bfcte_4` +), `bfcte_12` AS ( + SELECT + *, + 1 AS `bfcol_16` + FROM `bfcte_8` +), `bfcte_14` AS ( + SELECT + `float64_col` AS `bfcol_17`, + `int64_too` AS `bfcol_18`, + `bfcol_16` AS `bfcol_19`, + `bfcol_15` AS `bfcol_20` + FROM `bfcte_12` +), `bfcte_1` 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) AS `bfcol_25` + FROM `bfcte_1` +), `bfcte_9` AS ( + SELECT + *, + 2 AS `bfcol_26` + FROM `bfcte_5` +), `bfcte_15` AS ( + SELECT + `float64_col` AS `bfcol_27`, + `int64_col` AS `bfcol_28`, + `bfcol_26` AS `bfcol_29`, + `bfcol_25` AS `bfcol_30` + FROM `bfcte_9` +), `bfcte_0` AS ( + SELECT + `bool_col`, + `float64_col`, + `int64_too` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_3` AS ( + SELECT + * + FROM `bfcte_0` + WHERE + `bool_col` +), `bfcte_7` AS ( + SELECT + *, + ROW_NUMBER() OVER () AS `bfcol_36` + FROM `bfcte_3` +), `bfcte_11` AS ( + SELECT + *, + 3 AS `bfcol_37` + FROM `bfcte_7` +), `bfcte_16` AS ( + SELECT + `float64_col` AS `bfcol_38`, + `int64_too` AS `bfcol_39`, + `bfcol_37` AS `bfcol_40`, + `bfcol_36` AS `bfcol_41` + FROM `bfcte_11` +), `bfcte_17` AS ( + SELECT + * + FROM ( + SELECT + `bfcol_6` AS `bfcol_42`, + `bfcol_7` AS `bfcol_43`, + `bfcol_8` AS `bfcol_44`, + `bfcol_9` AS `bfcol_45` + FROM `bfcte_13` + UNION ALL + SELECT + `bfcol_17` AS `bfcol_42`, + `bfcol_18` AS `bfcol_43`, + `bfcol_19` AS `bfcol_44`, + `bfcol_20` AS `bfcol_45` + FROM `bfcte_14` + UNION ALL + SELECT + `bfcol_27` AS `bfcol_42`, + `bfcol_28` AS `bfcol_43`, + `bfcol_29` AS `bfcol_44`, + `bfcol_30` AS `bfcol_45` + FROM `bfcte_15` + UNION ALL + SELECT + `bfcol_38` AS `bfcol_42`, + `bfcol_39` AS `bfcol_43`, + `bfcol_40` AS `bfcol_44`, + `bfcol_41` AS `bfcol_45` + FROM `bfcte_16` + ) +) SELECT `bfcol_42` AS `float64_col`, `bfcol_43` AS `int64_col` 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 6f9b5dcb10..e594b67669 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_dataframe/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_dataframe/out.sql @@ -1,3 +1,16 @@ +WITH `bfcte_0` AS ( + SELECT + `int_list_col`, + `rowindex`, + `string_list_col` + FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` +), `bfcte_1` AS ( + SELECT + * + REPLACE (`int_list_col`[SAFE_OFFSET(`bfcol_13`)] AS `int_list_col`, `string_list_col`[SAFE_OFFSET(`bfcol_13`)] AS `string_list_col`) + FROM `bfcte_0` + CROSS JOIN UNNEST(GENERATE_ARRAY(0, LEAST(ARRAY_LENGTH(`int_list_col`) - 1, ARRAY_LENGTH(`string_list_col`) - 1))) AS `bfcol_13` WITH OFFSET AS `bfcol_7` +) SELECT `rowindex`, `rowindex` AS `rowindex_1`, 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 e44937d560..5af0aa0092 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_series/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_series/out.sql @@ -1,3 +1,15 @@ +WITH `bfcte_0` AS ( + SELECT + `int_list_col`, + `rowindex` + FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` +), `bfcte_1` AS ( + SELECT + * + REPLACE (`bfcol_8` AS `int_list_col`) + FROM `bfcte_0` + CROSS JOIN UNNEST(`int_list_col`) AS `bfcol_8` WITH OFFSET AS `bfcol_4` +) SELECT `rowindex`, `int_list_col` 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 5f66d25df4..f5fff16f60 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_filter/test_compile_filter/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_filter/test_compile_filter/out.sql @@ -1,3 +1,23 @@ +WITH `bfcte_0` AS ( + SELECT + `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`, 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 6240763cb0..63076077cf 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 @@ -1,3 +1,29 @@ +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`, 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 6240763cb0..f794711961 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 @@ -1,3 +1,23 @@ +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`, 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 2c3f5cfa4a..b8dd1587a8 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 @@ -1,3 +1,13 @@ +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` 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 cd7ea2f150..77aef6ad8b 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin/out.sql @@ -1,3 +1,40 @@ +WITH `bfcte_1` AS ( + SELECT + `int64_col`, + `rowindex` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_3` AS ( + SELECT + `rowindex` AS `bfcol_2`, + `int64_col` AS `bfcol_3` + FROM `bfcte_1` +), `bfcte_0` AS ( + SELECT + `int64_too` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_2` AS ( + SELECT + `int64_too` + FROM `bfcte_0` + GROUP BY + `int64_too` +), `bfcte_4` AS ( + SELECT + `bfcte_3`.*, + EXISTS( + SELECT + 1 + FROM ( + SELECT + `int64_too` AS `bfcol_4` + FROM `bfcte_2` + ) 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) + ) AS `bfcol_5` + FROM `bfcte_3` +) SELECT `bfcol_2` AS `rowindex`, `bfcol_5` AS `int64_col` 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 998cc9656a..1246dc44a6 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql @@ -1,3 +1,33 @@ +WITH `bfcte_1` AS ( + SELECT + `rowindex`, + `rowindex_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_3` AS ( + SELECT + `rowindex` AS `bfcol_2`, + `rowindex_2` AS `bfcol_3` + FROM `bfcte_1` +), `bfcte_0` AS ( + SELECT + `rowindex_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_2` AS ( + SELECT + `rowindex_2` + FROM `bfcte_0` + GROUP BY + `rowindex_2` +), `bfcte_4` AS ( + SELECT + `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` 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 1ad571e572..3a7ff60d3e 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join/out.sql @@ -1,3 +1,31 @@ +WITH `bfcte_1` AS ( + SELECT + `int64_col`, + `rowindex` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_2` 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 ( + SELECT + `int64_col` AS `bfcol_6`, + `int64_too` AS `bfcol_7` + FROM `bfcte_0` +), `bfcte_4` AS ( + SELECT + * + FROM `bfcte_2` + LEFT JOIN `bfcte_3` + 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` 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 7ed7c73d03..30f363e900 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/bool_col/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/bool_col/out.sql @@ -1,3 +1,31 @@ +WITH `bfcte_1` AS ( + SELECT + `bool_col`, + `rowindex` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_2` 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 ( + SELECT + `rowindex` AS `bfcol_6`, + `bool_col` AS `bfcol_7` + FROM `bfcte_0` +), `bfcte_4` AS ( + SELECT + * + FROM `bfcte_2` + INNER JOIN `bfcte_3` + 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') +) SELECT `bfcol_2` AS `rowindex_x`, `bfcol_3` AS `bool_col`, 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 1c4d42bdd3..9fa7673fb3 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/float64_col/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/float64_col/out.sql @@ -1,3 +1,31 @@ +WITH `bfcte_1` AS ( + SELECT + `float64_col`, + `rowindex` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_2` 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 ( + SELECT + `rowindex` AS `bfcol_6`, + `float64_col` AS `bfcol_7` + FROM `bfcte_0` +), `bfcte_4` AS ( + SELECT + * + FROM `bfcte_2` + INNER JOIN `bfcte_3` + 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)) +) SELECT `bfcol_2` AS `rowindex_x`, `bfcol_3` AS `float64_col`, 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 1d48d684ee..c9fca069d6 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/int64_col/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/int64_col/out.sql @@ -1,3 +1,31 @@ +WITH `bfcte_1` AS ( + SELECT + `int64_col`, + `rowindex` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_2` 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 ( + SELECT + `rowindex` AS `bfcol_6`, + `int64_col` AS `bfcol_7` + FROM `bfcte_0` +), `bfcte_4` AS ( + SELECT + * + FROM `bfcte_2` + INNER JOIN `bfcte_3` + ON COALESCE(`bfcol_3`, 0) = COALESCE(`bfcol_7`, 0) + AND COALESCE(`bfcol_3`, 1) = COALESCE(`bfcol_7`, 1) +) SELECT `bfcol_2` AS `rowindex_x`, `bfcol_3` AS `int64_col`, 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 497136e79a..88649c6518 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/numeric_col/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/numeric_col/out.sql @@ -1,3 +1,31 @@ +WITH `bfcte_1` AS ( + SELECT + `numeric_col`, + `rowindex` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_2` 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 ( + SELECT + `rowindex` AS `bfcol_6`, + `numeric_col` AS `bfcol_7` + FROM `bfcte_0` +), `bfcte_4` AS ( + SELECT + * + FROM `bfcte_2` + INNER JOIN `bfcte_3` + 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)) +) SELECT `bfcol_2` AS `rowindex_x`, `bfcol_3` AS `numeric_col`, 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 63297e6f3a..8758ec8340 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/string_col/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/string_col/out.sql @@ -1,3 +1,31 @@ +WITH `bfcte_1` AS ( + SELECT + `rowindex`, + `string_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_2` AS ( + SELECT + `rowindex` AS `bfcol_0`, + `string_col` AS `bfcol_1` + FROM `bfcte_1` +), `bfcte_0` AS ( + SELECT + `rowindex`, + `string_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_3` AS ( + SELECT + `rowindex` AS `bfcol_4`, + `string_col` AS `bfcol_5` + FROM `bfcte_0` +), `bfcte_4` AS ( + SELECT + * + FROM `bfcte_2` + INNER JOIN `bfcte_3` + ON COALESCE(CAST(`bfcol_1` AS STRING), '0') = COALESCE(CAST(`bfcol_5` AS STRING), '0') + AND COALESCE(CAST(`bfcol_1` AS STRING), '1') = COALESCE(CAST(`bfcol_5` AS STRING), '1') +) SELECT `bfcol_0` AS `rowindex_x`, `bfcol_1` AS `string_col`, 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 1c1b70821e..42fc15cd1d 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/time_col/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/time_col/out.sql @@ -1,3 +1,31 @@ +WITH `bfcte_1` AS ( + SELECT + `rowindex`, + `time_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_2` AS ( + SELECT + `rowindex` AS `bfcol_0`, + `time_col` AS `bfcol_1` + FROM `bfcte_1` +), `bfcte_0` AS ( + SELECT + `rowindex`, + `time_col` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_3` AS ( + SELECT + `rowindex` AS `bfcol_4`, + `time_col` AS `bfcol_5` + FROM `bfcte_0` +), `bfcte_4` AS ( + SELECT + * + FROM `bfcte_2` + INNER JOIN `bfcte_3` + ON COALESCE(CAST(`bfcol_1` AS STRING), '0') = COALESCE(CAST(`bfcol_5` AS STRING), '0') + AND COALESCE(CAST(`bfcol_1` AS STRING), '1') = COALESCE(CAST(`bfcol_5` AS STRING), '1') +) SELECT `bfcol_0` AS `rowindex_x`, `bfcol_1` AS `time_col`, 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 287ebb19d0..aae34716d8 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 @@ -1,3 +1,168 @@ +WITH `bfcte_0` AS ( + SELECT + *, + RAND() AS `bfcol_16` + FROM UNNEST(ARRAY>[STRUCT( + TRUE, + CAST(b'Hello, World!' AS BYTES), + CAST('2021-07-21' AS DATE), + CAST('2021-07-21T11:39:45' AS DATETIME), + ST_GEOGFROMTEXT('POINT(-122.0838511 37.3860517)'), + 123456789, + 0, + CAST(1.234567890 AS NUMERIC), + 1.25, + 0, + 0, + 'Hello, World!', + CAST('11:41:43.076160' AS TIME), + CAST('2021-07-21T17:43:43.945289+00:00' AS TIMESTAMP), + 4, + 0 + ), STRUCT( + FALSE, + CAST(b'\xe3\x81\x93\xe3\x82\x93\xe3\x81\xab\xe3\x81\xa1\xe3\x81\xaf' AS BYTES), + CAST('1991-02-03' AS DATE), + CAST('1991-01-02T03:45:06' AS DATETIME), + ST_GEOGFROMTEXT('POINT(-71.104 42.315)'), + -987654321, + 1, + CAST(1.234567890 AS NUMERIC), + 2.51, + 1, + 1, + 'こんにちは', + CAST('11:14:34.701606' AS TIME), + CAST('2021-07-21T17:43:43.945289+00:00' AS TIMESTAMP), + -1000000, + 1 + ), STRUCT( + TRUE, + CAST(b'\xc2\xa1Hola Mundo!' AS BYTES), + CAST('2023-03-01' AS DATE), + CAST('2023-03-01T10:55:13' AS DATETIME), + ST_GEOGFROMTEXT('POINT(-0.124474760143016 51.5007826749545)'), + 314159, + 0, + CAST(101.101010100 AS NUMERIC), + 25000000000.0, + 2, + 2, + ' ¡Hola Mundo! ', + CAST('23:59:59.999999' AS TIME), + CAST('2023-03-01T10:55:13.250125+00:00' AS TIMESTAMP), + 0, + 2 + ), STRUCT( + CAST(NULL AS BOOLEAN), + CAST(NULL AS BYTES), + CAST(NULL AS DATE), + CAST(NULL AS DATETIME), + CAST(NULL AS GEOGRAPHY), + CAST(NULL AS INT64), + 1, + CAST(NULL AS NUMERIC), + CAST(NULL AS FLOAT64), + 3, + 3, + CAST(NULL AS STRING), + CAST(NULL AS TIME), + CAST(NULL AS TIMESTAMP), + CAST(NULL AS INT64), + 3 + ), STRUCT( + FALSE, + CAST(b'\xe3\x81\x93\xe3\x82\x93\xe3\x81\xab\xe3\x81\xa1\xe3\x81\xaf' AS BYTES), + CAST('2021-07-21' AS DATE), + CAST(NULL AS DATETIME), + CAST(NULL AS GEOGRAPHY), + -234892, + -2345, + CAST(NULL AS NUMERIC), + CAST(NULL AS FLOAT64), + 4, + 4, + 'Hello, World!', + CAST(NULL AS TIME), + CAST(NULL AS TIMESTAMP), + 31540000000000, + 4 + ), STRUCT( + FALSE, + CAST(b'G\xc3\xbcten Tag' AS BYTES), + CAST('1980-03-14' AS DATE), + CAST('1980-03-14T15:16:17' AS DATETIME), + CAST(NULL AS GEOGRAPHY), + 55555, + 0, + CAST(5.555555000 AS NUMERIC), + 555.555, + 5, + 5, + 'Güten Tag!', + CAST('15:16:17.181921' AS TIME), + CAST('1980-03-14T15:16:17.181921+00:00' AS TIMESTAMP), + 4, + 5 + ), STRUCT( + TRUE, + CAST(b'Hello\tBigFrames!\x07' AS BYTES), + CAST('2023-05-23' AS DATE), + CAST('2023-05-23T11:37:01' AS DATETIME), + ST_GEOGFROMTEXT('LINESTRING(-0.127959 51.507728, -0.127026 51.507473)'), + 101202303, + 2, + CAST(-10.090807000 AS NUMERIC), + -123.456, + 6, + 6, + 'capitalize, This ', + CAST('01:02:03.456789' AS TIME), + CAST('2023-05-23T11:42:55.000001+00:00' AS TIMESTAMP), + CAST(NULL AS INT64), + 6 + ), STRUCT( + TRUE, + CAST(NULL AS BYTES), + CAST('2038-01-20' AS DATE), + CAST('2038-01-19T03:14:08' AS DATETIME), + CAST(NULL AS GEOGRAPHY), + -214748367, + 2, + CAST(11111111.100000000 AS NUMERIC), + 42.42, + 7, + 7, + ' سلام', + CAST('12:00:00.000001' AS TIME), + CAST('2038-01-19T03:14:17.999999+00:00' AS TIMESTAMP), + 4, + 7 + ), STRUCT( + FALSE, + CAST(NULL AS BYTES), + CAST(NULL AS DATE), + CAST(NULL AS DATETIME), + CAST(NULL AS GEOGRAPHY), + 2, + 1, + CAST(NULL AS NUMERIC), + 6.87, + 8, + 8, + 'T', + CAST(NULL AS TIME), + CAST(NULL AS TIMESTAMP), + 432000000000, + 8 + )]) +), `bfcte_1` AS ( + SELECT + * + FROM `bfcte_0` + WHERE + `bfcol_16` < 0.1 +) SELECT `bfcol_0` AS `bool_col`, `bfcol_1` AS `bytes_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 671943cdd9..2b080b0b7c 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 @@ -1,3 +1,170 @@ +WITH `bfcte_0` AS ( + SELECT + * + FROM UNNEST(ARRAY>[STRUCT( + 0, + TRUE, + CAST(b'Hello, World!' AS BYTES), + CAST('2021-07-21' AS DATE), + CAST('2021-07-21T11:39:45' AS DATETIME), + ST_GEOGFROMTEXT('POINT(-122.0838511 37.3860517)'), + 123456789, + 0, + CAST(1.234567890 AS NUMERIC), + 1.25, + 0, + 0, + 'Hello, World!', + CAST('11:41:43.076160' AS TIME), + CAST('2021-07-21T17:43:43.945289+00:00' AS TIMESTAMP), + 4, + 0 + ), STRUCT( + 1, + FALSE, + CAST(b'\xe3\x81\x93\xe3\x82\x93\xe3\x81\xab\xe3\x81\xa1\xe3\x81\xaf' AS BYTES), + CAST('1991-02-03' AS DATE), + CAST('1991-01-02T03:45:06' AS DATETIME), + ST_GEOGFROMTEXT('POINT(-71.104 42.315)'), + -987654321, + 1, + CAST(1.234567890 AS NUMERIC), + 2.51, + 1, + 1, + 'こんにちは', + CAST('11:14:34.701606' AS TIME), + CAST('2021-07-21T17:43:43.945289+00:00' AS TIMESTAMP), + -1000000, + 1 + ), STRUCT( + 2, + TRUE, + CAST(b'\xc2\xa1Hola Mundo!' AS BYTES), + CAST('2023-03-01' AS DATE), + CAST('2023-03-01T10:55:13' AS DATETIME), + ST_GEOGFROMTEXT('POINT(-0.124474760143016 51.5007826749545)'), + 314159, + 0, + CAST(101.101010100 AS NUMERIC), + 25000000000.0, + 2, + 2, + ' ¡Hola Mundo! ', + CAST('23:59:59.999999' AS TIME), + CAST('2023-03-01T10:55:13.250125+00:00' AS TIMESTAMP), + 0, + 2 + ), STRUCT( + 3, + CAST(NULL AS BOOLEAN), + CAST(NULL AS BYTES), + CAST(NULL AS DATE), + CAST(NULL AS DATETIME), + CAST(NULL AS GEOGRAPHY), + CAST(NULL AS INT64), + 1, + CAST(NULL AS NUMERIC), + CAST(NULL AS FLOAT64), + 3, + 3, + CAST(NULL AS STRING), + CAST(NULL AS TIME), + CAST(NULL AS TIMESTAMP), + CAST(NULL AS INT64), + 3 + ), STRUCT( + 4, + FALSE, + CAST(b'\xe3\x81\x93\xe3\x82\x93\xe3\x81\xab\xe3\x81\xa1\xe3\x81\xaf' AS BYTES), + CAST('2021-07-21' AS DATE), + CAST(NULL AS DATETIME), + CAST(NULL AS GEOGRAPHY), + -234892, + -2345, + CAST(NULL AS NUMERIC), + CAST(NULL AS FLOAT64), + 4, + 4, + 'Hello, World!', + CAST(NULL AS TIME), + CAST(NULL AS TIMESTAMP), + 31540000000000, + 4 + ), STRUCT( + 5, + FALSE, + CAST(b'G\xc3\xbcten Tag' AS BYTES), + CAST('1980-03-14' AS DATE), + CAST('1980-03-14T15:16:17' AS DATETIME), + CAST(NULL AS GEOGRAPHY), + 55555, + 0, + CAST(5.555555000 AS NUMERIC), + 555.555, + 5, + 5, + 'Güten Tag!', + CAST('15:16:17.181921' AS TIME), + CAST('1980-03-14T15:16:17.181921+00:00' AS TIMESTAMP), + 4, + 5 + ), STRUCT( + 6, + TRUE, + CAST(b'Hello\tBigFrames!\x07' AS BYTES), + CAST('2023-05-23' AS DATE), + CAST('2023-05-23T11:37:01' AS DATETIME), + ST_GEOGFROMTEXT('LINESTRING(-0.127959 51.507728, -0.127026 51.507473)'), + 101202303, + 2, + CAST(-10.090807000 AS NUMERIC), + -123.456, + 6, + 6, + 'capitalize, This ', + CAST('01:02:03.456789' AS TIME), + CAST('2023-05-23T11:42:55.000001+00:00' AS TIMESTAMP), + CAST(NULL AS INT64), + 6 + ), STRUCT( + 7, + TRUE, + CAST(NULL AS BYTES), + CAST('2038-01-20' AS DATE), + CAST('2038-01-19T03:14:08' AS DATETIME), + CAST(NULL AS GEOGRAPHY), + -214748367, + 2, + CAST(11111111.100000000 AS NUMERIC), + 42.42, + 7, + 7, + ' سلام', + CAST('12:00:00.000001' AS TIME), + CAST('2038-01-19T03:14:17.999999+00:00' AS TIMESTAMP), + 4, + 7 + ), STRUCT( + 8, + FALSE, + CAST(NULL AS BYTES), + CAST(NULL AS DATE), + CAST(NULL AS DATETIME), + CAST(NULL AS GEOGRAPHY), + 2, + 1, + CAST(NULL AS NUMERIC), + 6.87, + 8, + 8, + 'T', + CAST(NULL AS TIME), + CAST(NULL AS TIMESTAMP), + 432000000000, + 8 + )]) +) SELECT `bfcol_0` AS `rowindex`, `bfcol_1` AS `bool_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 48ce1a825b..4e21266b87 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 @@ -1,3 +1,8 @@ +WITH `bfcte_0` AS ( + SELECT + * + 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` 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 17cb21c14c..923476aafd 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 @@ -1,3 +1,38 @@ +WITH `bfcte_0` AS ( + SELECT + * + FROM UNNEST(ARRAY, `bfcol_2` ARRAY, `bfcol_3` ARRAY, `bfcol_4` ARRAY, `bfcol_5` ARRAY, `bfcol_6` ARRAY, `bfcol_7` ARRAY, `bfcol_8` INT64>>[STRUCT( + 0, + [1], + [TRUE], + [1.2, 2.3], + ['2021-07-21'], + ['2021-07-21 11:39:45'], + [1.2, 2.3, 3.4], + ['abc', 'de', 'f'], + 0 + ), STRUCT( + 1, + [1, 2], + [TRUE, FALSE], + [1.1], + ['2021-07-21', '1987-03-28'], + ['1999-03-14 17:22:00'], + [5.5, 2.3], + ['a', 'bc', 'de'], + 1 + ), STRUCT( + 2, + [1, 2, 3], + [TRUE], + [0.5, -1.9, 2.3], + ['2017-08-01', '2004-11-22'], + ['1979-06-03 03:20:45'], + [1.7000000000000002], + ['', 'a'], + 2 + )]) +) SELECT `bfcol_0` AS `rowindex`, `bfcol_1` AS `int_list_col`, 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 fcada5055b..7ded9cf5ff 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 @@ -1,3 +1,24 @@ +WITH `bfcte_0` AS ( + SELECT + * + FROM UNNEST(ARRAY>, `bfcol_2` INT64>>[STRUCT( + 1, + STRUCT( + 'Alice' AS `name`, + 30 AS `age`, + STRUCT('New York' AS `city`, 'USA' AS `country`) AS `address` + ), + 0 + ), STRUCT( + 2, + STRUCT( + 'Bob' AS `name`, + 25 AS `age`, + STRUCT('London' AS `city`, 'UK' AS `country`) AS `address` + ), + 1 + )]) +) SELECT `bfcol_0` AS `id`, `bfcol_1` AS `person` 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 e657b5ece1..959a31a2a3 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable/out.sql @@ -1,3 +1,22 @@ +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`, 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 ad0e61b0ce..4b5750d7aa 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_json_types/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_json_types/out.sql @@ -1,3 +1,9 @@ +WITH `bfcte_0` AS ( + SELECT + `json_col`, + `rowindex` + FROM `bigframes-dev`.`sqlglot_test`.`json_types` +) SELECT `rowindex`, `json_col` 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 c60fec7b1b..856c7061da 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_limit/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_limit/out.sql @@ -1,3 +1,9 @@ +WITH `bfcte_0` AS ( + SELECT + `int64_col`, + `rowindex` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +) SELECT `rowindex`, `int64_col` 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 b19839d864..79ae1ac907 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_nested_structs_types/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_nested_structs_types/out.sql @@ -1,3 +1,9 @@ +WITH `bfcte_0` AS ( + SELECT + `id`, + `people` + FROM `bigframes-dev`.`sqlglot_test`.`nested_structs_types` +) SELECT `id`, `id` AS `id_1`, 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 278836093f..edb8d7fbf4 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_ordering/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_ordering/out.sql @@ -1,3 +1,9 @@ +WITH `bfcte_0` AS ( + SELECT + `int64_col`, + `rowindex` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +) SELECT `rowindex`, `int64_col` 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 51fb9a4c7d..a22c845ef1 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_repeated_types/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_repeated_types/out.sql @@ -1,3 +1,15 @@ +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`, 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 a8c1686ab0..59c3687080 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,3 +1,22 @@ +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`, 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 e7d9bdf818..44a0c9ec11 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_groupby_rolling/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_groupby_rolling/out.sql @@ -1,3 +1,54 @@ +WITH `bfcte_0` AS ( + SELECT + `bool_col`, + `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 SUM(CAST(NOT `bfcol_7` IS NULL AS INT64)) OVER (PARTITION BY `bfcol_9` ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW) < 3 + THEN NULL + ELSE COALESCE( + SUM(CAST(`bfcol_7` AS INT64)) OVER (PARTITION BY `bfcol_9` ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW), + 0 + ) + END AS `bfcol_15` + FROM `bfcte_2` +), `bfcte_4` AS ( + SELECT + * + FROM `bfcte_3` + WHERE + NOT `bfcol_9` IS NULL +), `bfcte_5` AS ( + SELECT + *, + CASE + WHEN SUM(CAST(NOT `bfcol_8` IS NULL AS INT64)) OVER (PARTITION BY `bfcol_9` ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW) < 3 + 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_21` + FROM `bfcte_4` +) SELECT `bfcol_9` AS `bool_col`, `bfcol_6` AS `rowindex`, 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 dd3af4f888..d2c7e338bc 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_range_rolling/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_range_rolling/out.sql @@ -1,3 +1,20 @@ +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 SUM(CAST(NOT `bfcol_1` IS NULL AS INT64)) OVER (ORDER BY UNIX_MICROS(`bfcol_0`) ASC NULLS LAST RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW) < 1 + THEN NULL + ELSE COALESCE( + SUM(`bfcol_1`) OVER (ORDER BY UNIX_MICROS(`bfcol_0`) ASC NULLS LAST RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW), + 0 + ) + END AS `bfcol_6` + FROM `bfcte_0` +) SELECT `bfcol_0` AS `ts_col`, `bfcol_6` AS `int_col` 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 1b8608bf60..788eb49ddf 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_skips_nulls_op/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_skips_nulls_op/out.sql @@ -1,3 +1,21 @@ +WITH `bfcte_0` AS ( + SELECT + `int64_col`, + `rowindex` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` +), `bfcte_1` AS ( + SELECT + *, + CASE + WHEN SUM(CAST(NOT `int64_col` IS NULL AS INT64)) OVER (ORDER BY `rowindex` ASC NULLS LAST ROWS BETWEEN 2 PRECEDING AND CURRENT ROW) < 3 + THEN NULL + ELSE COALESCE( + SUM(`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` 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 1b8608bf60..5ad435ddbb 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_wo_skips_nulls_op/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_wo_skips_nulls_op/out.sql @@ -1,3 +1,18 @@ +WITH `bfcte_0` AS ( + SELECT + `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 a5231d25b17286b6b52bcb7072f22b6d8bf53e60 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Tue, 18 Nov 2025 19:04:58 +0000 Subject: [PATCH 09/10] update snapshots --- .../test_string_agg/out.sql | 5 +++- .../test_unary_compiler/test_first/out.sql | 5 +++- .../test_first_non_null/out.sql | 5 +++- .../test_unary_compiler/test_last/out.sql | 5 +++- .../test_last_non_null/out.sql | 5 +++- .../test_string_ops/test_str_find/out.sql | 8 +++---- .../test_compile_isin_not_nullable/out.sql | 6 ++--- .../out.sql | 24 +++++++++++++++---- .../out.sql | 10 ++++++-- 9 files changed, 55 insertions(+), 18 deletions(-) diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_string_agg/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_string_agg/out.sql index 2ce4124347..321341d4a0 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_string_agg/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_string_agg/out.sql @@ -5,7 +5,10 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT COALESCE( - STRING_AGG(`string_col` ORDER BY `string_col` IS NULL ASC, `string_col` ASC, ','), + STRING_AGG(`string_col`, ',' + ORDER BY + `string_col` IS NULL ASC, + `string_col` ASC), '' ) AS `bfcol_1` FROM `bfcte_0` diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first/out.sql index bed23226e4..b053178f58 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 @@ -5,7 +5,10 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - FIRST_VALUE(`int64_col`) OVER (ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS `bfcol_1` + FIRST_VALUE(`int64_col`) OVER ( + ORDER BY `int64_col` DESC + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first_non_null/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first_non_null/out.sql index f574a49d96..2ef7b7151e 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first_non_null/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_first_non_null/out.sql @@ -5,7 +5,10 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - FIRST_VALUE(`int64_col` IGNORE NULLS) OVER (ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS `bfcol_1` + FIRST_VALUE(`int64_col` IGNORE NULLS) OVER ( + ORDER BY `int64_col` ASC NULLS LAST + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last/out.sql index db28817808..61e90ee612 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 @@ -5,7 +5,10 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - LAST_VALUE(`int64_col`) OVER (ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS `bfcol_1` + LAST_VALUE(`int64_col`) OVER ( + ORDER BY `int64_col` DESC + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last_non_null/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last_non_null/out.sql index 0fa48b68a2..c626c263ac 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last_non_null/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_last_non_null/out.sql @@ -5,7 +5,10 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - LAST_VALUE(`int64_col` IGNORE NULLS) OVER (ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS `bfcol_1` + LAST_VALUE(`int64_col` IGNORE NULLS) OVER ( + ORDER BY `int64_col` ASC NULLS LAST + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/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 4927e814a3..82847d5e22 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_find/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_find/out.sql @@ -5,10 +5,10 @@ WITH `bfcte_0` AS ( ), `bfcte_1` AS ( SELECT *, - STRPOS(`string_col`, 'e') - 1 AS `bfcol_1`, - STRPOS(`string_col`, 'e') - 1 AS `bfcol_2`, - STRPOS(SUBSTRING(`string_col`, 1, 5), 'e') - 1 AS `bfcol_3`, - STRPOS(SUBSTRING(`string_col`, 3, 3), 'e') - 1 AS `bfcol_4` + INSTR(`string_col`, 'e', 1) - 1 AS `bfcol_1`, + INSTR(`string_col`, 'e', 3) - 1 AS `bfcol_2`, + INSTR(SUBSTRING(`string_col`, 1, 5), 'e') - 1 AS `bfcol_3`, + INSTR(SUBSTRING(`string_col`, 3, 3), 'e') - 1 AS `bfcol_4` FROM `bfcte_0` ) SELECT diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql index 1246dc44a6..8089c5b462 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql @@ -22,9 +22,9 @@ WITH `bfcte_1` AS ( SELECT `bfcte_3`.*, `bfcte_3`.`bfcol_3` IN (( - SELECT - `rowindex_2` AS `bfcol_4` - FROM `bfcte_2` + SELECT + `rowindex_2` AS `bfcol_4` + FROM `bfcte_2` )) AS `bfcol_5` FROM `bfcte_3` ) diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_groupby_rolling/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_groupby_rolling/out.sql index 44a0c9ec11..11e3f4773e 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_groupby_rolling/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_groupby_rolling/out.sql @@ -22,10 +22,18 @@ WITH `bfcte_0` AS ( SELECT *, CASE - WHEN SUM(CAST(NOT `bfcol_7` IS NULL AS INT64)) OVER (PARTITION BY `bfcol_9` ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW) < 3 + WHEN SUM(CAST(NOT `bfcol_7` IS NULL AS INT64)) OVER ( + PARTITION BY `bfcol_9` + ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST + ROWS BETWEEN 3 PRECEDING AND CURRENT ROW + ) < 3 THEN NULL ELSE COALESCE( - SUM(CAST(`bfcol_7` AS INT64)) OVER (PARTITION BY `bfcol_9` ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW), + SUM(CAST(`bfcol_7` AS INT64)) OVER ( + PARTITION BY `bfcol_9` + ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST + ROWS BETWEEN 3 PRECEDING AND CURRENT ROW + ), 0 ) END AS `bfcol_15` @@ -40,10 +48,18 @@ WITH `bfcte_0` AS ( SELECT *, CASE - WHEN SUM(CAST(NOT `bfcol_8` IS NULL AS INT64)) OVER (PARTITION BY `bfcol_9` ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW) < 3 + WHEN SUM(CAST(NOT `bfcol_8` IS NULL AS INT64)) OVER ( + PARTITION BY `bfcol_9` + ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST + ROWS BETWEEN 3 PRECEDING AND CURRENT ROW + ) < 3 THEN NULL ELSE COALESCE( - SUM(`bfcol_8`) OVER (PARTITION BY `bfcol_9` ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW), + SUM(`bfcol_8`) OVER ( + PARTITION BY `bfcol_9` + ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST + ROWS BETWEEN 3 PRECEDING AND CURRENT ROW + ), 0 ) END AS `bfcol_21` diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_range_rolling/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_range_rolling/out.sql index d2c7e338bc..581c81c6b4 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_range_rolling/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_range_rolling/out.sql @@ -6,10 +6,16 @@ WITH `bfcte_0` AS ( SELECT *, CASE - WHEN SUM(CAST(NOT `bfcol_1` IS NULL AS INT64)) OVER (ORDER BY UNIX_MICROS(`bfcol_0`) ASC NULLS LAST RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW) < 1 + WHEN SUM(CAST(NOT `bfcol_1` IS NULL AS INT64)) OVER ( + ORDER BY UNIX_MICROS(`bfcol_0`) ASC NULLS LAST + RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW + ) < 1 THEN NULL ELSE COALESCE( - SUM(`bfcol_1`) OVER (ORDER BY UNIX_MICROS(`bfcol_0`) ASC NULLS LAST RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW), + SUM(`bfcol_1`) OVER ( + ORDER BY UNIX_MICROS(`bfcol_0`) ASC NULLS LAST + RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW + ), 0 ) END AS `bfcol_6` From 1c036bf4860826477394c36f0c946ee854ad6c76 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Tue, 18 Nov 2025 20:26:47 +0000 Subject: [PATCH 10/10] loosen floordiv dtype assert --- tests/system/small/test_series.py | 3 ++- tests/unit/test_series_polars.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/system/small/test_series.py b/tests/system/small/test_series.py index 4df257423f..6c681596f5 100644 --- a/tests/system/small/test_series.py +++ b/tests/system/small/test_series.py @@ -1031,7 +1031,8 @@ def test_series_int_int_operators_scalar( bf_result = maybe_reversed_op(scalars_df["int64_col"], other_scalar).to_pandas() pd_result = maybe_reversed_op(scalars_pandas_df["int64_col"], other_scalar) - assert_series_equal(pd_result, bf_result) + # don't check dtype, as pandas is a bit unstable here across versions, esp floordiv + assert_series_equal(pd_result, bf_result, check_dtype=False) def test_series_pow_scalar(scalars_dfs): diff --git a/tests/unit/test_series_polars.py b/tests/unit/test_series_polars.py index 6f729b0df0..e98db92b93 100644 --- a/tests/unit/test_series_polars.py +++ b/tests/unit/test_series_polars.py @@ -1036,7 +1036,8 @@ def test_series_int_int_operators_scalar( bf_result = maybe_reversed_op(scalars_df["int64_col"], other_scalar).to_pandas() pd_result = maybe_reversed_op(scalars_pandas_df["int64_col"], other_scalar) - assert_series_equal(pd_result, bf_result) + # don't check dtype, as pandas is a bit unstable here across versions, esp floordiv + assert_series_equal(pd_result, bf_result, check_dtype=False) def test_series_pow_scalar(scalars_dfs):