From bd728a62149c59d58cd20dc4f80dcf368aacd494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Swe=C3=B1a?= Date: Wed, 9 Jul 2025 15:09:15 -0700 Subject: [PATCH 01/10] feat: support INFORMATION_SCHEMA tables in read_gbq --- .../session/_io/bigquery/read_gbq_table.py | 57 +++++++++++++++++-- bigframes/session/loader.py | 11 +--- .../test_read_gbq_information_schema.py | 18 ++++++ 3 files changed, 72 insertions(+), 14 deletions(-) create mode 100644 tests/system/small/pandas/test_read_gbq_information_schema.py diff --git a/bigframes/session/_io/bigquery/read_gbq_table.py b/bigframes/session/_io/bigquery/read_gbq_table.py index 6322040428..341e39061b 100644 --- a/bigframes/session/_io/bigquery/read_gbq_table.py +++ b/bigframes/session/_io/bigquery/read_gbq_table.py @@ -42,17 +42,53 @@ import bigframes.session +def get_information_schema_metadata( + bqclient: bigquery.Client, + table_id: str, + default_project: Optional[str], +) -> bigquery.Table: + job_config = bigquery.QueryJobConfig(dry_run=True) + job = bqclient.query( + # TODO: better escaping? + f"SELECT * FROM `{table_id}`", + job_config=job_config, + ) + parts = table_id.split(".") + if len(parts) < 3: + project = default_project + dataset = parts[0] + table_id_short = ".".join(parts[1:]) + else: + project = parts[0] + dataset = parts[1] + table_id_short = ".".join(parts[2:]) + + table = bigquery.Table.from_api_repr( + { + "tableReference": { + "projectId": project, + "datasetId": dataset, + "tableId": table_id_short, + }, + "location": job.location, + } + ) + table.schema = job.schema + return table + + def get_table_metadata( bqclient: bigquery.Client, - table_ref: google.cloud.bigquery.table.TableReference, - bq_time: datetime.datetime, *, - cache: Dict[bigquery.TableReference, Tuple[datetime.datetime, bigquery.Table]], + table_id: str, + default_project: Optional[str], + bq_time: datetime.datetime, + cache: Dict[str, Tuple[datetime.datetime, bigquery.Table]], use_cache: bool = True, ) -> Tuple[datetime.datetime, google.cloud.bigquery.table.Table]: """Get the table metadata, either from cache or via REST API.""" - cached_table = cache.get(table_ref) + cached_table = cache.get(table_id) if use_cache and cached_table is not None: snapshot_timestamp, _ = cached_table @@ -76,7 +112,16 @@ def get_table_metadata( warnings.warn(msg, stacklevel=7) return cached_table - table = bqclient.get_table(table_ref) + if "INFORMATION_SCHEMA".casefold() in table_id.casefold(): + table = get_information_schema_metadata( + bqclient=bqclient, table_id=table_id, default_project=default_project + ) + else: + table_ref = google.cloud.bigquery.table.TableReference.from_string( + table_id, default_project=default_project + ) + table = bqclient.get_table(table_ref) + # local time will lag a little bit do to network latency # make sure it is at least table creation time. # This is relevant if the table was created immediately before loading it here. @@ -84,7 +129,7 @@ def get_table_metadata( bq_time = table.created cached_table = (bq_time, table) - cache[table_ref] = cached_table + cache[table_id] = cached_table return cached_table diff --git a/bigframes/session/loader.py b/bigframes/session/loader.py index add4efb6ab..76e07af29b 100644 --- a/bigframes/session/loader.py +++ b/bigframes/session/loader.py @@ -268,9 +268,7 @@ def __init__( self._default_index_type = default_index_type self._scan_index_uniqueness = scan_index_uniqueness self._force_total_order = force_total_order - self._df_snapshot: Dict[ - bigquery.TableReference, Tuple[datetime.datetime, bigquery.Table] - ] = {} + self._df_snapshot: Dict[str, Tuple[datetime.datetime, bigquery.Table]] = {} self._metrics = metrics # Unfortunate circular reference, but need to pass reference when constructing objects self._session = session @@ -617,10 +615,6 @@ def read_gbq_table( _check_duplicates("columns", columns) - table_ref = google.cloud.bigquery.table.TableReference.from_string( - table_id, default_project=self._bqclient.project - ) - columns = list(columns) include_all_columns = columns is None or len(columns) == 0 filters = typing.cast(list, list(filters)) @@ -631,7 +625,8 @@ def read_gbq_table( time_travel_timestamp, table = bf_read_gbq_table.get_table_metadata( self._bqclient, - table_ref=table_ref, + table_id=table_id, + default_project=self._bqclient.project, bq_time=self._clock.get_time(), cache=self._df_snapshot, use_cache=use_cache, diff --git a/tests/system/small/pandas/test_read_gbq_information_schema.py b/tests/system/small/pandas/test_read_gbq_information_schema.py new file mode 100644 index 0000000000..86d7ac0c24 --- /dev/null +++ b/tests/system/small/pandas/test_read_gbq_information_schema.py @@ -0,0 +1,18 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +def test_read_gbq_jobs_by_user_returns_schema(session): + df = session.read_gbq("region-US.INFORMATION_SCHEMA.JOBS_BY_USER") + assert df.dtypes is not None From 3ac25fb9460bece221322d83cd4811b761161f8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Swe=C3=B1a?= Date: Wed, 9 Jul 2025 15:54:41 -0700 Subject: [PATCH 02/10] avoid storage semi executor --- .../session/_io/bigquery/read_gbq_table.py | 57 +++++++++++++------ bigframes/session/read_api_execution.py | 3 + .../test_read_gbq_information_schema.py | 14 +++++ 3 files changed, 58 insertions(+), 16 deletions(-) diff --git a/bigframes/session/_io/bigquery/read_gbq_table.py b/bigframes/session/_io/bigquery/read_gbq_table.py index 341e39061b..9620169070 100644 --- a/bigframes/session/_io/bigquery/read_gbq_table.py +++ b/bigframes/session/_io/bigquery/read_gbq_table.py @@ -42,6 +42,32 @@ import bigframes.session +def _convert_information_schema_table_id_to_table_reference( + table_id: str, + default_project: Optional[str], +) -> bigquery.TableReference: + """Squeeze an INFORMATION_SCHEMA reference into a TableReference. + + This is kind-of a hack. INFORMATION_SCHEMA is a view that isn't available + via the tables.get REST API. + """ + parts = table_id.split(".") + parts_casefold = [part.casefold() for part in parts] + dataset_index = parts_casefold.index("INFORMATION_SCHEMA".casefold()) + + if dataset_index == 0: + project = default_project + else: + project = ".".join(parts[:dataset_index]) + + dataset = "INFORMATION_SCHEMA" + table_id_short = ".".join(parts[dataset_index + 1 :]) + return bigquery.TableReference( + bigquery.DatasetReference(project, dataset), + table_id_short, + ) + + def get_information_schema_metadata( bqclient: bigquery.Client, table_id: str, @@ -53,24 +79,17 @@ def get_information_schema_metadata( f"SELECT * FROM `{table_id}`", job_config=job_config, ) - parts = table_id.split(".") - if len(parts) < 3: - project = default_project - dataset = parts[0] - table_id_short = ".".join(parts[1:]) - else: - project = parts[0] - dataset = parts[1] - table_id_short = ".".join(parts[2:]) - + table_ref = _convert_information_schema_table_id_to_table_reference( + table_id=table_id, + default_project=default_project, + ) table = bigquery.Table.from_api_repr( { - "tableReference": { - "projectId": project, - "datasetId": dataset, - "tableId": table_id_short, - }, + "tableReference": table_ref.to_api_repr(), "location": job.location, + # Prevent ourselves from trying to read the table with the BQ + # Storage API. + "type": "VIEW", } ) table.schema = job.schema @@ -112,7 +131,13 @@ def get_table_metadata( warnings.warn(msg, stacklevel=7) return cached_table - if "INFORMATION_SCHEMA".casefold() in table_id.casefold(): + table_id_casefold = table_id.casefold() + if ( + # Ensure we don't have false positives for some user defined dataset + # like MY_INFORMATION_SCHEMA or tables called INFORMATION_SCHEMA. + ".INFORMATION_SCHEMA.".casefold() in table_id_casefold + or table_id_casefold.startswith("INFORMATION_SCHEMA.".casefold()) + ): table = get_information_schema_metadata( bqclient=bqclient, table_id=table_id, default_project=default_project ) diff --git a/bigframes/session/read_api_execution.py b/bigframes/session/read_api_execution.py index d5bcf1dbc7..c5b472760b 100644 --- a/bigframes/session/read_api_execution.py +++ b/bigframes/session/read_api_execution.py @@ -46,6 +46,9 @@ def execute( if node.explicitly_ordered and ordered: return None + if not node.source.table.is_physically_stored: + return None + if limit is not None: if peek is None or limit < peek: peek = limit diff --git a/tests/system/small/pandas/test_read_gbq_information_schema.py b/tests/system/small/pandas/test_read_gbq_information_schema.py index 86d7ac0c24..a0cf70b859 100644 --- a/tests/system/small/pandas/test_read_gbq_information_schema.py +++ b/tests/system/small/pandas/test_read_gbq_information_schema.py @@ -16,3 +16,17 @@ def test_read_gbq_jobs_by_user_returns_schema(session): df = session.read_gbq("region-US.INFORMATION_SCHEMA.JOBS_BY_USER") assert df.dtypes is not None + + +def test_read_gbq_jobs_by_user_can_be_peeked(unordered_session): + df = unordered_session.read_gbq("region-US.INFORMATION_SCHEMA.JOBS_BY_USER") + result = df.peek() + assert result is not None + + +def test_read_gbq_jobs_by_user_four_parts_can_be_peeked(unordered_session): + df = unordered_session.read_gbq( + f"{unordered_session.bqclient.project}.region-US.INFORMATION_SCHEMA.JOBS_BY_USER" + ) + result = df.peek() + assert result is not None From 885d786170a470a36b1326d31fcea4907820cd1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Swe=C3=B1a?= Date: Wed, 9 Jul 2025 15:58:12 -0700 Subject: [PATCH 03/10] use faster tables for peek tests --- .../small/pandas/test_read_gbq_information_schema.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/system/small/pandas/test_read_gbq_information_schema.py b/tests/system/small/pandas/test_read_gbq_information_schema.py index a0cf70b859..af4bc00b7d 100644 --- a/tests/system/small/pandas/test_read_gbq_information_schema.py +++ b/tests/system/small/pandas/test_read_gbq_information_schema.py @@ -18,15 +18,15 @@ def test_read_gbq_jobs_by_user_returns_schema(session): assert df.dtypes is not None -def test_read_gbq_jobs_by_user_can_be_peeked(unordered_session): - df = unordered_session.read_gbq("region-US.INFORMATION_SCHEMA.JOBS_BY_USER") +def test_read_gbq_schemata_can_be_peeked(unordered_session): + df = unordered_session.read_gbq("region-US.INFORMATION_SCHEMA.SCHEMATA") result = df.peek() assert result is not None -def test_read_gbq_jobs_by_user_four_parts_can_be_peeked(unordered_session): +def test_read_gbq_schemata_four_parts_can_be_peeked(unordered_session): df = unordered_session.read_gbq( - f"{unordered_session.bqclient.project}.region-US.INFORMATION_SCHEMA.JOBS_BY_USER" + f"{unordered_session.bqclient.project}.region-US.INFORMATION_SCHEMA.SCHEMATA" ) result = df.peek() assert result is not None From 34bd68564c7a3ef16765b1819ae087ff8203f73d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Swe=C3=B1a?= Date: Wed, 9 Jul 2025 16:05:03 -0700 Subject: [PATCH 04/10] more tests --- .../test_read_gbq_information_schema.py | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/system/small/pandas/test_read_gbq_information_schema.py b/tests/system/small/pandas/test_read_gbq_information_schema.py index af4bc00b7d..efe73f044d 100644 --- a/tests/system/small/pandas/test_read_gbq_information_schema.py +++ b/tests/system/small/pandas/test_read_gbq_information_schema.py @@ -12,9 +12,27 @@ # See the License for the specific language governing permissions and # limitations under the License. +import pytest -def test_read_gbq_jobs_by_user_returns_schema(session): - df = session.read_gbq("region-US.INFORMATION_SCHEMA.JOBS_BY_USER") + +@pytest.mark.parametrize("include_project", [True, False]) +@pytest.mark.parametrize( + "view_id", + [ + # https://cloud.google.com/bigquery/docs/information-schema-intro + "region-US.INFORMATION_SCHEMA.JOBS_BY_USER", + "region-US.INFORMATION_SCHEMA.SCHEMATA", + ], +) +def test_read_gbq_jobs_by_user_returns_schema( + unordered_session, view_id: str, include_project: bool +): + if include_project: + table_id = unordered_session.bqclient.project + "." + view_id + else: + table_id = view_id + + df = unordered_session.read_gbq(table_id) assert df.dtypes is not None From c0175efb8dc1b04d668c8ee9a5a9f176239861b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Swe=C3=B1a?= Date: Thu, 10 Jul 2025 11:39:19 -0700 Subject: [PATCH 05/10] fix mypy --- bigframes/session/_io/bigquery/read_gbq_table.py | 8 ++++++++ tests/unit/session/test_session.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bigframes/session/_io/bigquery/read_gbq_table.py b/bigframes/session/_io/bigquery/read_gbq_table.py index 9620169070..7896dbba39 100644 --- a/bigframes/session/_io/bigquery/read_gbq_table.py +++ b/bigframes/session/_io/bigquery/read_gbq_table.py @@ -60,6 +60,14 @@ def _convert_information_schema_table_id_to_table_reference( else: project = ".".join(parts[:dataset_index]) + if project is None: + message = ( + "Could not determine project ID. " + "Please provide a project or region in your INFORMATION_SCHEMA table ID, " + "For example, 'region-REGION_NAME.INFORMATION_SCHEMA.JOBS'." + ) + raise ValueError(message) + dataset = "INFORMATION_SCHEMA" table_id_short = ".".join(parts[dataset_index + 1 :]) return bigquery.TableReference( diff --git a/tests/unit/session/test_session.py b/tests/unit/session/test_session.py index 26b74a3f8a..e63e53d560 100644 --- a/tests/unit/session/test_session.py +++ b/tests/unit/session/test_session.py @@ -242,7 +242,7 @@ def test_read_gbq_cached_table(): table._properties["numRows"] = "1000000000" table._properties["location"] = session._location table._properties["type"] = "TABLE" - session._loader._df_snapshot[table_ref] = ( + session._loader._df_snapshot[str(table_ref)] = ( datetime.datetime(1999, 1, 2, 3, 4, 5, 678901, tzinfo=datetime.timezone.utc), table, ) From 7028108c8522c717050ce0d739cfb36ef057b8e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Swe=C3=B1a=20=28Swast=29?= Date: Thu, 10 Jul 2025 13:42:01 -0500 Subject: [PATCH 06/10] Update bigframes/session/_io/bigquery/read_gbq_table.py --- bigframes/session/_io/bigquery/read_gbq_table.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bigframes/session/_io/bigquery/read_gbq_table.py b/bigframes/session/_io/bigquery/read_gbq_table.py index 7896dbba39..292eab09b3 100644 --- a/bigframes/session/_io/bigquery/read_gbq_table.py +++ b/bigframes/session/_io/bigquery/read_gbq_table.py @@ -83,7 +83,6 @@ def get_information_schema_metadata( ) -> bigquery.Table: job_config = bigquery.QueryJobConfig(dry_run=True) job = bqclient.query( - # TODO: better escaping? f"SELECT * FROM `{table_id}`", job_config=job_config, ) From 429bea39330aacb0fbaf4f2ff4707899dfa6dce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Swe=C3=B1a?= Date: Thu, 23 Oct 2025 19:52:32 +0000 Subject: [PATCH 07/10] immediately query for information_schema tables --- bigframes/core/array_value.py | 5 +++++ .../session/_io/bigquery/read_gbq_table.py | 22 ++++++++++++------- bigframes/session/loader.py | 19 +++++++++++----- .../test_read_gbq_information_schema.py | 4 ++-- 4 files changed, 34 insertions(+), 16 deletions(-) diff --git a/bigframes/core/array_value.py b/bigframes/core/array_value.py index a89d224ad1..49c33f9e51 100644 --- a/bigframes/core/array_value.py +++ b/bigframes/core/array_value.py @@ -141,6 +141,11 @@ def from_bq_data_source( ) return cls(node) + @staticmethod + def is_table_type_supported(table_type: Optional[str]): + # Some external tables like those in GCS support all the features we want, such as time travel. + return table_type in ("TABLE", "MATERIALIZED_VIEW", "EXTERNAL") + @property def column_ids(self) -> typing.Sequence[str]: """Returns column ids as strings.""" diff --git a/bigframes/session/_io/bigquery/read_gbq_table.py b/bigframes/session/_io/bigquery/read_gbq_table.py index 65c114a5e2..09708b3e1c 100644 --- a/bigframes/session/_io/bigquery/read_gbq_table.py +++ b/bigframes/session/_io/bigquery/read_gbq_table.py @@ -42,7 +42,6 @@ def _convert_information_schema_table_id_to_table_reference( default_project: Optional[str], ) -> bigquery.TableReference: """Squeeze an INFORMATION_SCHEMA reference into a TableReference. - This is kind-of a hack. INFORMATION_SCHEMA is a view that isn't available via the tables.get REST API. """ @@ -152,13 +151,7 @@ def get_table_metadata( return cached_table - table_id_casefold = table_id.casefold() - if ( - # Ensure we don't have false positives for some user defined dataset - # like MY_INFORMATION_SCHEMA or tables called INFORMATION_SCHEMA. - ".INFORMATION_SCHEMA.".casefold() in table_id_casefold - or table_id_casefold.startswith("INFORMATION_SCHEMA.".casefold()) - ): + if is_information_schema(table_id): table = get_information_schema_metadata( bqclient=bqclient, table_id=table_id, default_project=default_project ) @@ -179,6 +172,17 @@ def get_table_metadata( return cached_table +def is_information_schema(table_id: str): + table_id_casefold = table_id.casefold() + # Include the "."s to ensure we don't have false positives for some user + # defined dataset like MY_INFORMATION_SCHEMA or tables called + # INFORMATION_SCHEMA. + return ( + ".INFORMATION_SCHEMA.".casefold() in table_id_casefold + or table_id_casefold.startswith("INFORMATION_SCHEMA.".casefold()) + ) + + def is_time_travel_eligible( bqclient: bigquery.Client, table: google.cloud.bigquery.table.Table, @@ -245,6 +249,8 @@ def is_time_travel_eligible( msg, category=bfe.TimeTravelDisabledWarning, stacklevel=stacklevel ) return False + elif table.table_type == "VIEW": + return False # table might support time travel, lets do a dry-run query with time travel if should_dry_run: diff --git a/bigframes/session/loader.py b/bigframes/session/loader.py index 1aae1a84cc..79779b7ffa 100644 --- a/bigframes/session/loader.py +++ b/bigframes/session/loader.py @@ -47,6 +47,8 @@ import pandas import pyarrow as pa +import bigframes._tools +import bigframes._tools.strings from bigframes.core import guid, identifiers, local_data, nodes, ordering, utils import bigframes.core as core import bigframes.core.blocks as blocks @@ -701,18 +703,23 @@ def read_gbq_table( # Optionally, execute the query # ----------------------------- - # max_results introduces non-determinism and limits the cost on - # clustered tables, so fallback to a query. We do this here so that - # the index is consistent with tables that have primary keys, even - # when max_results is set. - if max_results is not None: + if ( + # max_results introduces non-determinism and limits the cost on + # clustered tables, so fallback to a query. We do this here so that + # the index is consistent with tables that have primary keys, even + # when max_results is set. + max_results is not None + # Views such as INFORMATION_SCHEMA also introduce non-determinism. + # They can update frequently and don't support time travel. + or not core.ArrayValue.is_table_type_supported(table.table_type) + ): # TODO(b/338111344): If we are running a query anyway, we might as # well generate ROW_NUMBER() at the same time. all_columns: Iterable[str] = ( itertools.chain(index_cols, columns) if columns else () ) query = bf_io_bigquery.to_query( - table_id, + f"{table.project}.{table.dataset_id}.{table.table_id}", columns=all_columns, sql_predicate=bf_io_bigquery.compile_filters(filters) if filters diff --git a/tests/system/small/pandas/test_read_gbq_information_schema.py b/tests/system/small/pandas/test_read_gbq_information_schema.py index efe73f044d..32e2dc4712 100644 --- a/tests/system/small/pandas/test_read_gbq_information_schema.py +++ b/tests/system/small/pandas/test_read_gbq_information_schema.py @@ -20,7 +20,7 @@ "view_id", [ # https://cloud.google.com/bigquery/docs/information-schema-intro - "region-US.INFORMATION_SCHEMA.JOBS_BY_USER", + "region-US.INFORMATION_SCHEMA.SESSIONS_BY_USER", "region-US.INFORMATION_SCHEMA.SCHEMATA", ], ) @@ -32,7 +32,7 @@ def test_read_gbq_jobs_by_user_returns_schema( else: table_id = view_id - df = unordered_session.read_gbq(table_id) + df = unordered_session.read_gbq(table_id, max_results=10) assert df.dtypes is not None From 2426436b3b642fcbf7469b3d43e726cfa930ad33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Swe=C3=B1a?= Date: Thu, 23 Oct 2025 20:07:52 +0000 Subject: [PATCH 08/10] Fix mypy errors and temporarily update python version --- tests/unit/session/test_session.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/session/test_session.py b/tests/unit/session/test_session.py index 6ccf0a10bb..f003398706 100644 --- a/tests/unit/session/test_session.py +++ b/tests/unit/session/test_session.py @@ -273,7 +273,7 @@ def test_read_gbq_cached_table_doesnt_warn_for_anonymous_tables_and_doesnt_inclu table._properties["numRows"] = "1000000000" table._properties["location"] = session._location table._properties["type"] = "TABLE" - session._loader._df_snapshot[table_ref] = ( + session._loader._df_snapshot[str(table_ref)] = ( datetime.datetime(1999, 1, 2, 3, 4, 5, 678901, tzinfo=datetime.timezone.utc), table, ) From 49f52c157fa258f78e475d6888f28f7660212208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Swe=C3=B1a?= Date: Thu, 23 Oct 2025 20:50:55 +0000 Subject: [PATCH 09/10] snapshot --- .../test_binary_compiler/test_corr/out.sql | 5 +- .../test_binary_compiler/test_cov/out.sql | 5 +- .../test_row_number/out.sql | 26 +- .../test_row_number_with_window/out.sql | 12 +- .../test_nullary_compiler/test_size/out.sql | 34 +-- .../test_array_agg/out.sql | 10 +- .../test_string_agg/out.sql | 21 +- .../test_unary_compiler/test_all/out.sql | 4 +- .../test_all/window_out.sql | 12 +- .../test_all/window_partition_out.sql | 13 +- .../test_any_value/out.sql | 4 +- .../test_any_value/window_out.sql | 12 +- .../test_any_value/window_partition_out.sql | 13 +- .../test_approx_quartiles/out.sql | 4 +- .../test_approx_top_count/out.sql | 4 +- .../test_unary_compiler/test_count/out.sql | 4 +- .../test_count/window_out.sql | 12 +- .../test_count/window_partition_out.sql | 13 +- .../test_date_series_diff/out.sql | 16 +- .../test_dense_rank/out.sql | 12 +- .../test_diff/diff_bool.sql | 12 +- .../test_diff/diff_int.sql | 12 +- .../test_unary_compiler/test_first/out.sql | 17 +- .../test_first_non_null/out.sql | 14 +- .../test_unary_compiler/test_last/out.sql | 17 +- .../test_last_non_null/out.sql | 14 +- .../test_unary_compiler/test_max/out.sql | 4 +- .../test_max/window_out.sql | 12 +- .../test_max/window_partition_out.sql | 13 +- .../test_unary_compiler/test_mean/out.sql | 6 +- .../test_mean/window_out.sql | 12 +- .../test_mean/window_partition_out.sql | 13 +- .../test_unary_compiler/test_median/out.sql | 6 +- .../test_unary_compiler/test_min/out.sql | 4 +- .../test_min/window_out.sql | 12 +- .../test_min/window_partition_out.sql | 13 +- .../test_unary_compiler/test_quantile/out.sql | 4 +- .../test_unary_compiler/test_rank/out.sql | 12 +- .../test_unary_compiler/test_shift/lag.sql | 12 +- .../test_unary_compiler/test_shift/lead.sql | 12 +- .../test_unary_compiler/test_shift/noop.sql | 12 +- .../test_unary_compiler/test_sum/out.sql | 5 +- .../test_sum/window_out.sql | 12 +- .../test_sum/window_partition_out.sql | 13 +- .../test_time_series_diff/out.sql | 16 +- .../test_ai_ops/test_ai_classify/out.sql | 12 +- .../test_ai_ops/test_ai_generate/out.sql | 12 +- .../test_ai_ops/test_ai_generate_bool/out.sql | 12 +- .../out.sql | 12 +- .../test_ai_generate_double/out.sql | 12 +- .../out.sql | 12 +- .../test_ai_ops/test_ai_generate_int/out.sql | 12 +- .../out.sql | 12 +- .../test_ai_generate_with_model_param/out.sql | 12 +- .../out.sql | 12 +- .../snapshots/test_ai_ops/test_ai_if/out.sql | 12 +- .../test_ai_ops/test_ai_score/out.sql | 12 +- .../test_array_ops/test_array_index/out.sql | 12 +- .../test_array_slice_with_only_start/out.sql | 12 +- .../out.sql | 12 +- .../test_array_to_string/out.sql | 12 +- .../test_obj_fetch_metadata/out.sql | 17 +- .../test_obj_get_access_url/out.sql | 17 +- .../test_blob_ops/test_obj_make_ref/out.sql | 13 +- .../test_bool_ops/test_and_op/out.sql | 38 +-- .../test_bool_ops/test_or_op/out.sql | 38 +-- .../test_bool_ops/test_xor_op/out.sql | 38 +-- .../test_eq_null_match/out.sql | 13 +- .../test_eq_numeric/out.sql | 68 ++--- .../test_ge_numeric/out.sql | 68 ++--- .../test_gt_numeric/out.sql | 68 ++--- .../test_comparison_ops/test_is_in/out.sql | 41 +-- .../test_le_numeric/out.sql | 68 ++--- .../test_lt_numeric/out.sql | 68 ++--- .../test_ne_numeric/out.sql | 68 ++--- .../test_add_timedelta/out.sql | 72 ++--- .../test_datetime_ops/test_date/out.sql | 12 +- .../test_datetime_ops/test_day/out.sql | 12 +- .../test_datetime_ops/test_dayofweek/out.sql | 12 +- .../test_datetime_ops/test_dayofyear/out.sql | 12 +- .../test_datetime_ops/test_floor_dt/out.sql | 12 +- .../test_datetime_ops/test_hour/out.sql | 12 +- .../test_datetime_ops/test_iso_day/out.sql | 12 +- .../test_datetime_ops/test_iso_week/out.sql | 12 +- .../test_datetime_ops/test_iso_year/out.sql | 12 +- .../test_datetime_ops/test_minute/out.sql | 12 +- .../test_datetime_ops/test_month/out.sql | 12 +- .../test_datetime_ops/test_normalize/out.sql | 12 +- .../test_datetime_ops/test_quarter/out.sql | 12 +- .../test_datetime_ops/test_second/out.sql | 12 +- .../test_datetime_ops/test_strftime/out.sql | 12 +- .../test_sub_timedelta/out.sql | 105 ++++--- .../test_datetime_ops/test_time/out.sql | 12 +- .../test_to_datetime/out.sql | 12 +- .../test_to_timestamp/out.sql | 12 +- .../test_unix_micros/out.sql | 12 +- .../test_unix_millis/out.sql | 12 +- .../test_unix_seconds/out.sql | 12 +- .../test_datetime_ops/test_year/out.sql | 12 +- .../test_generic_ops/test_astype_bool/out.sql | 21 +- .../test_astype_float/out.sql | 20 +- .../test_generic_ops/test_astype_int/out.sql | 55 ++-- .../test_generic_ops/test_astype_json/out.sql | 41 +-- .../test_astype_string/out.sql | 21 +- .../test_astype_time_like/out.sql | 24 +- .../test_case_when_op/out.sql | 33 ++- .../test_generic_ops/test_clip/out.sql | 14 +- .../test_generic_ops/test_hash/out.sql | 12 +- .../test_generic_ops/test_invert/out.sql | 22 +- .../test_generic_ops/test_isnull/out.sql | 12 +- .../test_generic_ops/test_map/out.sql | 12 +- .../test_generic_ops/test_notnull/out.sql | 12 +- .../test_generic_ops/test_where/out.sql | 14 +- .../test_geo_ops/test_geo_area/out.sql | 12 +- .../test_geo_ops/test_geo_st_astext/out.sql | 12 +- .../test_geo_ops/test_geo_st_boundary/out.sql | 12 +- .../test_geo_ops/test_geo_st_buffer/out.sql | 12 +- .../test_geo_ops/test_geo_st_centroid/out.sql | 12 +- .../test_geo_st_convexhull/out.sql | 12 +- .../test_geo_st_geogfromtext/out.sql | 12 +- .../test_geo_ops/test_geo_st_isclosed/out.sql | 12 +- .../test_geo_ops/test_geo_st_length/out.sql | 12 +- .../snapshots/test_geo_ops/test_geo_x/out.sql | 12 +- .../snapshots/test_geo_ops/test_geo_y/out.sql | 12 +- .../test_json_ops/test_parse_json/out.sql | 12 +- .../test_numeric_ops/test_abs/out.sql | 12 +- .../test_numeric_ops/test_add_numeric/out.sql | 68 ++--- .../test_numeric_ops/test_arccos/out.sql | 12 +- .../test_numeric_ops/test_arccosh/out.sql | 12 +- .../test_numeric_ops/test_arcsin/out.sql | 12 +- .../test_numeric_ops/test_arcsinh/out.sql | 12 +- .../test_numeric_ops/test_arctan/out.sql | 12 +- .../test_numeric_ops/test_arctanh/out.sql | 12 +- .../test_numeric_ops/test_ceil/out.sql | 12 +- .../test_numeric_ops/test_cos/out.sql | 12 +- .../test_numeric_ops/test_cosh/out.sql | 12 +- .../test_numeric_ops/test_div_numeric/out.sql | 177 ++++++------ .../test_div_timedelta/out.sql | 26 +- .../test_numeric_ops/test_exp/out.sql | 12 +- .../test_numeric_ops/test_expm1/out.sql | 12 +- .../test_numeric_ops/test_floor/out.sql | 12 +- .../test_floordiv_timedelta/out.sql | 14 +- .../test_numeric_ops/test_ln/out.sql | 12 +- .../test_numeric_ops/test_log10/out.sql | 12 +- .../test_numeric_ops/test_log1p/out.sql | 12 +- .../test_numeric_ops/test_mod_numeric/out.sql | 266 +++++++++--------- .../test_numeric_ops/test_mul_numeric/out.sql | 68 ++--- .../test_numeric_ops/test_neg/out.sql | 12 +- .../test_numeric_ops/test_pos/out.sql | 12 +- .../test_numeric_ops/test_sin/out.sql | 12 +- .../test_numeric_ops/test_sinh/out.sql | 12 +- .../test_numeric_ops/test_sqrt/out.sql | 12 +- .../test_numeric_ops/test_sub_numeric/out.sql | 68 ++--- .../test_numeric_ops/test_tan/out.sql | 12 +- .../test_numeric_ops/test_tanh/out.sql | 12 +- .../test_string_ops/test_add_string/out.sql | 12 +- .../test_string_ops/test_capitalize/out.sql | 12 +- .../test_string_ops/test_endswith/out.sql | 20 +- .../test_string_ops/test_isalnum/out.sql | 12 +- .../test_string_ops/test_isalpha/out.sql | 12 +- .../test_string_ops/test_isdecimal/out.sql | 12 +- .../test_string_ops/test_isdigit/out.sql | 12 +- .../test_string_ops/test_islower/out.sql | 12 +- .../test_string_ops/test_isnumeric/out.sql | 12 +- .../test_string_ops/test_isspace/out.sql | 12 +- .../test_string_ops/test_isupper/out.sql | 12 +- .../test_string_ops/test_len/out.sql | 12 +- .../test_string_ops/test_lower/out.sql | 12 +- .../test_string_ops/test_lstrip/out.sql | 12 +- .../test_regex_replace_str/out.sql | 12 +- .../test_string_ops/test_replace_str/out.sql | 12 +- .../test_string_ops/test_reverse/out.sql | 12 +- .../test_string_ops/test_rstrip/out.sql | 12 +- .../test_string_ops/test_startswith/out.sql | 20 +- .../test_string_ops/test_str_contains/out.sql | 12 +- .../test_str_contains_regex/out.sql | 12 +- .../test_string_ops/test_str_extract/out.sql | 12 +- .../test_string_ops/test_str_find/out.sql | 24 +- .../test_string_ops/test_str_get/out.sql | 12 +- .../test_string_ops/test_str_pad/out.sql | 20 +- .../test_string_ops/test_str_repeat/out.sql | 12 +- .../test_string_ops/test_str_slice/out.sql | 12 +- .../test_string_ops/test_strconcat/out.sql | 12 +- .../test_string_ops/test_string_split/out.sql | 12 +- .../test_string_ops/test_strip/out.sql | 12 +- .../test_string_ops/test_upper/out.sql | 12 +- .../test_string_ops/test_zfill/out.sql | 12 +- .../test_struct_ops/test_struct_field/out.sql | 19 +- .../test_timedelta_floor/out.sql | 12 +- .../test_to_timedelta/out.sql | 43 +-- .../test_compile_aggregate/out.sql | 5 +- .../test_compile_aggregate_wo_dropna/out.sql | 5 +- .../test_compile_concat/out.sql | 80 +++--- .../test_compile_concat_filter_sorted/out.sql | 114 ++++---- .../test_compile_explode_dataframe/out.sql | 13 +- .../test_compile_explode_series/out.sql | 12 +- .../test_compile_filter/out.sql | 25 +- .../test_compile_isin/out.sql | 32 ++- .../test_compile_isin_not_nullable/out.sql | 37 ++- .../test_compile_join/out.sql | 10 +- .../test_compile_join_w_on/bool_col/out.sql | 10 +- .../float64_col/out.sql | 10 +- .../test_compile_join_w_on/int64_col/out.sql | 10 +- .../numeric_col/out.sql | 10 +- .../test_compile_join_w_on/string_col/out.sql | 10 +- .../test_compile_join_w_on/time_col/out.sql | 10 +- .../test_compile_readtable/out.sql | 39 +-- .../test_compile_readtable_w_limit/out.sql | 8 +- .../out.sql | 13 +- .../test_compile_readtable_w_ordering/out.sql | 8 +- .../out.sql | 25 +- .../out.sql | 59 ++-- .../out.sql | 22 +- .../out.sql | 22 +- 214 files changed, 2298 insertions(+), 1976 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 8922a71de4..055d93c686 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,8 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `float64_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS FLOAT64))]) ), `bfcte_1` AS ( SELECT CORR(`bfcol_0`, `bfcol_1`) AS `bfcol_2` diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_cov/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_cov/out.sql index 6cf189da31..67718fc554 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,8 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `float64_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS FLOAT64))]) ), `bfcte_1` AS ( SELECT COVAR_SAMP(`bfcol_0`, `bfcol_1`) AS `bfcol_2` diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number/out.sql index b48dcfa01b..8226dee61e 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,15 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `bytes_col` AS `bfcol_1`, - `date_col` AS `bfcol_2`, - `datetime_col` AS `bfcol_3`, - `geography_col` AS `bfcol_4`, - `int64_col` AS `bfcol_5`, - `int64_too` AS `bfcol_6`, - `numeric_col` AS `bfcol_7`, - `float64_col` AS `bfcol_8`, - `rowindex` AS `bfcol_9`, - `rowindex_2` AS `bfcol_10`, - `string_col` AS `bfcol_11`, - `time_col` AS `bfcol_12`, - `timestamp_col` AS `bfcol_13`, - `duration_col` AS `bfcol_14` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), 0)]) ), `bfcte_1` AS ( SELECT *, - ROW_NUMBER() OVER () AS `bfcol_32` + ROW_NUMBER() OVER (ORDER BY `bfcol_1` ASC NULLS LAST) AS `bfcol_3` FROM `bfcte_0` ) SELECT - `bfcol_32` AS `row_number` -FROM `bfcte_1` \ No newline at end of file + `bfcol_3` AS `row_number` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 8dc701e1f9..55b89b63b6 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,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - ROW_NUMBER() OVER (ORDER BY `bfcol_0` ASC NULLS LAST) AS `bfcol_1` + ROW_NUMBER() OVER (ORDER BY `bfcol_0` ASC NULLS LAST, `bfcol_1` ASC NULLS LAST) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `row_number` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `row_number` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 8cda9a3d80..f53a412538 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,21 +1,23 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `bytes_col` AS `bfcol_1`, - `date_col` AS `bfcol_2`, - `datetime_col` AS `bfcol_3`, - `geography_col` AS `bfcol_4`, - `int64_col` AS `bfcol_5`, - `int64_too` AS `bfcol_6`, - `numeric_col` AS `bfcol_7`, - `float64_col` AS `bfcol_8`, - `rowindex` AS `bfcol_9`, - `rowindex_2` AS `bfcol_10`, - `string_col` AS `bfcol_11`, - `time_col` AS `bfcol_12`, - `timestamp_col` AS `bfcol_13`, - `duration_col` AS `bfcol_14` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[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), + CAST(NULL AS INT64), + CAST(NULL AS NUMERIC), + CAST(NULL AS FLOAT64), + CAST(NULL AS INT64), + CAST(NULL AS INT64), + CAST(NULL AS STRING), + CAST(NULL AS TIME), + CAST(NULL AS TIMESTAMP), + CAST(NULL AS INT64) + )]) ), `bfcte_1` AS ( SELECT COUNT(1) AS `bfcol_32` diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_array_agg/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_ordered_unary_compiler/test_array_agg/out.sql index 43e0a03db4..ef6749a7d3 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,14 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT - ARRAY_AGG(`bfcol_0` IGNORE NULLS ORDER BY `bfcol_0` IS NULL ASC, `bfcol_0` ASC) AS `bfcol_1` + ARRAY_AGG( + `bfcol_0` IGNORE NULLS ORDER BY `bfcol_0` IS NULL ASC, `bfcol_0` ASC, `bfcol_1` IS NULL ASC, `bfcol_1` ASC + ) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `int64_col` + `bfcol_2` 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 115d7e37ee..a0ec7d28d2 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,15 +1,22 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT - COALESCE(STRING_AGG(`bfcol_0`, ',' - ORDER BY - `bfcol_0` IS NULL ASC, - `bfcol_0` ASC), '') AS `bfcol_1` + COALESCE( + STRING_AGG( + `bfcol_0`, ',' + ORDER BY + `bfcol_0` IS NULL ASC, + `bfcol_0` ASC, + `bfcol_1` IS NULL ASC, + `bfcol_1` ASC + ), + '' + ) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` + `bfcol_2` 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 7303d758cc..26def41caf 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN))]) ), `bfcte_1` AS ( SELECT COALESCE(LOGICAL_AND(`bfcol_0`), TRUE) AS `bfcol_1` diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_out.sql index a91381d3be..f5bc2fae8a 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -9,9 +9,11 @@ WITH `bfcte_0` AS ( WHEN `bfcol_0` IS NULL THEN NULL ELSE COALESCE(LOGICAL_AND(`bfcol_0`) OVER (), TRUE) - END AS `bfcol_1` + END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_bool` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `agg_bool` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 1a9a020b3e..db700ea803 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,8 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `string_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -10,9 +9,11 @@ WITH `bfcte_0` AS ( WHEN `bfcol_0` IS NULL THEN NULL ELSE COALESCE(LOGICAL_AND(`bfcol_0`) OVER (PARTITION BY `bfcol_1`), TRUE) - END AS `bfcol_2` + END AS `bfcol_3` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_bool` -FROM `bfcte_1` \ No newline at end of file + `bfcol_3` AS `agg_bool` +FROM `bfcte_1` +ORDER BY + `bfcol_2` ASC NULLS LAST \ 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 f95b094a13..de93c3e383 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64))]) ), `bfcte_1` AS ( SELECT ANY_VALUE(`bfcol_0`) AS `bfcol_1` diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/window_out.sql index b262284b88..da43893a9e 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,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE ANY_VALUE(`bfcol_0`) OVER () END AS `bfcol_1` + CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE ANY_VALUE(`bfcol_0`) OVER () END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `agg_int64` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 66933626b5..322a75e931 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,8 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `string_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -10,9 +9,11 @@ WITH `bfcte_0` AS ( WHEN `bfcol_0` IS NULL THEN NULL ELSE ANY_VALUE(`bfcol_0`) OVER (PARTITION BY `bfcol_1`) - END AS `bfcol_2` + END AS `bfcol_3` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + `bfcol_3` AS `agg_int64` +FROM `bfcte_1` +ORDER BY + `bfcol_2` ASC NULLS LAST \ 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 e7bb16e57c..908ca91298 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64))]) ), `bfcte_1` AS ( SELECT APPROX_QUANTILES(`bfcol_0`, 4)[OFFSET(1)] AS `bfcol_1`, diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_approx_top_count/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_approx_top_count/out.sql index b61a72d1b2..47bd104bea 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64))]) ), `bfcte_1` AS ( SELECT APPROX_TOP_COUNT(`bfcol_0`, 10) AS `bfcol_1` diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/out.sql index 01684b4af6..b3d5430f2d 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64))]) ), `bfcte_1` AS ( SELECT COUNT(`bfcol_0`) AS `bfcol_1` diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_count/window_out.sql index beda182992..208fb3d75a 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,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - COUNT(`bfcol_0`) OVER () AS `bfcol_1` + COUNT(`bfcol_0`) OVER () AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `agg_int64` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 d4a12d73f8..2b0a5d3909 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,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `string_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - COUNT(`bfcol_0`) OVER (PARTITION BY `bfcol_1`) AS `bfcol_2` + COUNT(`bfcol_0`) OVER (PARTITION BY `bfcol_1`) AS `bfcol_3` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + `bfcol_3` AS `agg_int64` +FROM `bfcte_1` +ORDER BY + `bfcol_2` ASC NULLS LAST \ 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 cd1cf3ff3b..0a6aaf186e 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,19 @@ WITH `bfcte_0` AS ( SELECT - `date_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS DATE), 0)]) ), `bfcte_1` AS ( SELECT *, - CAST(DATE_DIFF(`bfcol_0`, LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC NULLS LAST), DAY) * 86400000000 AS INT64) AS `bfcol_1` + CAST(DATE_DIFF( + `bfcol_0`, + LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC NULLS LAST, `bfcol_1` ASC NULLS LAST), + DAY + ) * 86400000000 AS INT64) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `diff_date` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `diff_date` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 0f704dd0cc..cf96f0868f 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,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - DENSE_RANK() OVER (ORDER BY `bfcol_0` DESC) AS `bfcol_1` + DENSE_RANK() OVER (ORDER BY `bfcol_0` DESC) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `agg_int64` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 500056928d..7e30410404 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,15 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_0` <> LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` DESC) AS `bfcol_1` + `bfcol_0` <> LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` DESC, `bfcol_1` ASC NULLS LAST) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `diff_bool` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `diff_bool` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 f4fd46ee2d..817789a2b4 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,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_0` - LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC NULLS LAST) AS `bfcol_1` + `bfcol_0` - LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC NULLS LAST, `bfcol_1` ASC NULLS LAST) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `diff_int` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `diff_int` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 df76aa1d33..4bde906378 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,17 +1,22 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, CASE WHEN `bfcol_0` IS NULL THEN NULL - ELSE FIRST_VALUE(`bfcol_0`) OVER (ORDER BY `bfcol_0` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - END AS `bfcol_1` + ELSE FIRST_VALUE(`bfcol_0`) OVER ( + ORDER BY `bfcol_0` DESC, `bfcol_1` ASC NULLS LAST + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) + END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `agg_int64` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 70eeefda7b..0a58c1c835 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,18 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, FIRST_VALUE(`bfcol_0` IGNORE NULLS) OVER ( - ORDER BY `bfcol_0` ASC NULLS LAST + ORDER BY `bfcol_0` ASC NULLS LAST, `bfcol_1` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING - ) AS `bfcol_1` + ) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `agg_int64` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 4a5af9af32..2914034ba1 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,17 +1,22 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, CASE WHEN `bfcol_0` IS NULL THEN NULL - ELSE LAST_VALUE(`bfcol_0`) OVER (ORDER BY `bfcol_0` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - END AS `bfcol_1` + ELSE LAST_VALUE(`bfcol_0`) OVER ( + ORDER BY `bfcol_0` DESC, `bfcol_1` ASC NULLS LAST + ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING + ) + END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `agg_int64` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 a246618ff0..b014744560 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,18 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, LAST_VALUE(`bfcol_0` IGNORE NULLS) OVER ( - ORDER BY `bfcol_0` ASC NULLS LAST + ORDER BY `bfcol_0` ASC NULLS LAST, `bfcol_1` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING - ) AS `bfcol_1` + ) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `agg_int64` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 c88fa58d0f..aa0d8669ea 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64))]) ), `bfcte_1` AS ( SELECT MAX(`bfcol_0`) AS `bfcol_1` diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_max/window_out.sql index 4c86cb38e0..62378aa0b5 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,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE MAX(`bfcol_0`) OVER () END AS `bfcol_1` + CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE MAX(`bfcol_0`) OVER () END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `agg_int64` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 64dc97642b..6ace501522 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,8 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `string_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -10,9 +9,11 @@ WITH `bfcte_0` AS ( WHEN `bfcol_0` IS NULL THEN NULL ELSE MAX(`bfcol_0`) OVER (PARTITION BY `bfcol_1`) - END AS `bfcol_2` + END AS `bfcol_3` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + `bfcol_3` AS `agg_int64` +FROM `bfcte_1` +ORDER BY + `bfcol_2` ASC NULLS LAST \ 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 6d4bb6f89a..8cec0e95c8 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,9 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `duration_col` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64))]) ), `bfcte_1` AS ( SELECT *, diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/window_out.sql index bc89091ca9..06352b99a6 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,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE AVG(`bfcol_0`) OVER () END AS `bfcol_1` + CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE AVG(`bfcol_0`) OVER () END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `agg_int64` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 e6c1cf3bb4..943e23bf22 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,8 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `string_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -10,9 +9,11 @@ WITH `bfcte_0` AS ( WHEN `bfcol_0` IS NULL THEN NULL ELSE AVG(`bfcol_0`) OVER (PARTITION BY `bfcol_1`) - END AS `bfcol_2` + END AS `bfcol_3` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + `bfcol_3` AS `agg_int64` +FROM `bfcte_1` +ORDER BY + `bfcol_2` ASC NULLS LAST \ 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 bf7006ef87..6e9482b5c1 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,9 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `date_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `string_col` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS DATE), CAST(NULL AS INT64), CAST(NULL AS STRING))]) ), `bfcte_1` AS ( SELECT APPROX_QUANTILES(`bfcol_1`, 2)[OFFSET(1)] AS `bfcol_3`, diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/out.sql index b067817218..4942d4a088 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64))]) ), `bfcte_1` AS ( SELECT MIN(`bfcol_0`) AS `bfcol_1` diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_min/window_out.sql index 0e96b56c50..bff6890d0b 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,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE MIN(`bfcol_0`) OVER () END AS `bfcol_1` + CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE MIN(`bfcol_0`) OVER () END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `agg_int64` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 4121e80f43..d856e0158e 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,8 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `string_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -10,9 +9,11 @@ WITH `bfcte_0` AS ( WHEN `bfcol_0` IS NULL THEN NULL ELSE MIN(`bfcol_0`) OVER (PARTITION BY `bfcol_1`) - END AS `bfcol_2` + END AS `bfcol_3` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + `bfcol_3` AS `agg_int64` +FROM `bfcte_1` +ORDER BY + `bfcol_2` ASC NULLS LAST \ 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 c1b3d1fffa..d7188cab44 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64))]) ), `bfcte_1` AS ( SELECT PERCENTILE_CONT(`bfcol_0`, 0.5) OVER () AS `bfcol_1`, diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_rank/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_rank/out.sql index ca3b9e8e54..bdeea1c2f4 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,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - RANK() OVER (ORDER BY `bfcol_0` DESC NULLS FIRST) AS `bfcol_1` + RANK() OVER (ORDER BY `bfcol_0` DESC NULLS FIRST) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `agg_int64` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 32e6eabb9b..667fcb6896 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,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC) AS `bfcol_1` + LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC, `bfcol_1` ASC NULLS LAST) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `lag` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `lag` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 f0797f1e17..aef75a19aa 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,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - LEAD(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC) AS `bfcol_1` + LEAD(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC, `bfcol_1` ASC NULLS LAST) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `lead` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `lead` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 fef4a2bde8..5f5a9cfcaa 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,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_0` AS `bfcol_1` + `bfcol_0` AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `noop` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `noop` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 be684f6768..e93d2fb2dd 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,8 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64))]) ), `bfcte_1` AS ( SELECT COALESCE(SUM(`bfcol_1`), 0) AS `bfcol_4`, diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/window_out.sql index 939b491dd0..1d2c83f1f1 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,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE COALESCE(SUM(`bfcol_0`) OVER (), 0) END AS `bfcol_1` + CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE COALESCE(SUM(`bfcol_0`) OVER (), 0) END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `agg_int64` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 a23842867e..a015c77e78 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,8 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `string_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -10,9 +9,11 @@ WITH `bfcte_0` AS ( WHEN `bfcol_0` IS NULL THEN NULL ELSE COALESCE(SUM(`bfcol_0`) OVER (PARTITION BY `bfcol_1`), 0) - END AS `bfcol_2` + END AS `bfcol_3` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` \ No newline at end of file + `bfcol_3` AS `agg_int64` +FROM `bfcte_1` +ORDER BY + `bfcol_2` ASC NULLS LAST \ 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 692685ee4d..1da836737e 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,13 +1,19 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - TIMESTAMP_DIFF(`bfcol_0`, LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC NULLS LAST), MICROSECOND) AS `bfcol_1` + TIMESTAMP_DIFF( + `bfcol_0`, + LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC NULLS LAST, `bfcol_1` ASC NULLS LAST), + MICROSECOND + ) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `diff_time` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `diff_time` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 bb06760e4d..ec22ecf885 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -9,9 +9,11 @@ WITH `bfcte_0` AS ( input => (`bfcol_0`), categories => ['greeting', 'rejection'], connection_id => 'bigframes-dev.us.bigframes-default-connection' - ) AS `bfcol_1` + ) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `result` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 5c4ccefd7b..08911a4f02 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -10,9 +10,11 @@ WITH `bfcte_0` AS ( connection_id => 'bigframes-dev.us.bigframes-default-connection', endpoint => 'gemini-2.5-flash', request_type => 'SHARED' - ) AS `bfcol_1` + ) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `result` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 28905d0349..eede6ab71b 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -10,9 +10,11 @@ WITH `bfcte_0` AS ( connection_id => 'bigframes-dev.us.bigframes-default-connection', endpoint => 'gemini-2.5-flash', request_type => 'SHARED' - ) AS `bfcol_1` + ) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `result` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 bf52361a52..7f726442c0 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -10,9 +10,11 @@ WITH `bfcte_0` AS ( connection_id => 'bigframes-dev.us.bigframes-default-connection', request_type => 'SHARED', model_params => JSON '{}' - ) AS `bfcol_1` + ) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `result` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 cbb05264e9..1e05710b19 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -10,9 +10,11 @@ WITH `bfcte_0` AS ( connection_id => 'bigframes-dev.us.bigframes-default-connection', endpoint => 'gemini-2.5-flash', request_type => 'SHARED' - ) AS `bfcol_1` + ) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `result` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 a1c1a18664..f2e81eaee4 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -10,9 +10,11 @@ WITH `bfcte_0` AS ( connection_id => 'bigframes-dev.us.bigframes-default-connection', request_type => 'SHARED', model_params => JSON '{}' - ) AS `bfcol_1` + ) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `result` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 ba5febe0cd..a45e419eac 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -10,9 +10,11 @@ WITH `bfcte_0` AS ( connection_id => 'bigframes-dev.us.bigframes-default-connection', endpoint => 'gemini-2.5-flash', request_type => 'SHARED' - ) AS `bfcol_1` + ) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `result` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 996906fe9c..f9f3768d9e 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -10,9 +10,11 @@ WITH `bfcte_0` AS ( connection_id => 'bigframes-dev.us.bigframes-default-connection', request_type => 'SHARED', model_params => JSON '{}' - ) AS `bfcol_1` + ) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `result` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 8726910619..fd18cde0be 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -10,9 +10,11 @@ WITH `bfcte_0` AS ( connection_id => 'bigframes-dev.us.bigframes-default-connection', request_type => 'SHARED', model_params => JSON '{}' - ) AS `bfcol_1` + ) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `result` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 62fc2f9db0..dfbd0be083 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -11,9 +11,11 @@ WITH `bfcte_0` AS ( endpoint => 'gemini-2.5-flash', request_type => 'SHARED', output_schema => 'x INT64, y FLOAT64' - ) AS `bfcol_1` + ) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `result` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 d5b6a9330d..cec2e379b1 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,18 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, AI.IF( prompt => (`bfcol_0`, ' is the same as ', `bfcol_0`), connection_id => 'bigframes-dev.us.bigframes-default-connection' - ) AS `bfcol_1` + ) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `result` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 e2be615921..a965339b88 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,18 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, AI.SCORE( prompt => (`bfcol_0`, ' is the same as ', `bfcol_0`), connection_id => 'bigframes-dev.us.bigframes-default-connection' - ) AS `bfcol_1` + ) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `result` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `result` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 4398084227..83129e52e8 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_list_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` + * + FROM UNNEST(ARRAY, `bfcol_1` INT64>>[STRUCT(ARRAY[], 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_0`[SAFE_OFFSET(1)] AS `bfcol_1` + `bfcol_0`[SAFE_OFFSET(1)] AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_list_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_list_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_slice_with_only_start/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_slice_with_only_start/out.sql index 1ffc3ee8f9..8a31bf521a 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `string_list_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` + * + FROM UNNEST(ARRAY, `bfcol_1` INT64>>[STRUCT(ARRAY[], 0)]) ), `bfcte_1` AS ( SELECT *, @@ -11,9 +11,11 @@ WITH `bfcte_0` AS ( FROM UNNEST(`bfcol_0`) AS el WITH OFFSET AS slice_idx WHERE slice_idx >= 1 - ) AS `bfcol_1` + ) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_list_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_list_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 878b60e5e2..f0c2ffde4c 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `string_list_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` + * + FROM UNNEST(ARRAY, `bfcol_1` INT64>>[STRUCT(ARRAY[], 0)]) ), `bfcte_1` AS ( SELECT *, @@ -11,9 +11,11 @@ WITH `bfcte_0` AS ( FROM UNNEST(`bfcol_0`) AS el WITH OFFSET AS slice_idx WHERE slice_idx >= 1 AND slice_idx < 5 - ) AS `bfcol_1` + ) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_list_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_list_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 4dbd602bea..379eece92d 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_list_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` + * + FROM UNNEST(ARRAY, `bfcol_1` INT64>>[STRUCT(ARRAY[], 0)]) ), `bfcte_1` AS ( SELECT *, - ARRAY_TO_STRING(`bfcol_0`, '.') AS `bfcol_1` + ARRAY_TO_STRING(`bfcol_0`, '.') AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_list_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_list_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_fetch_metadata/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_fetch_metadata/out.sql index 134fdc363b..bc8ed1c445 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,25 +1,26 @@ WITH `bfcte_0` AS ( SELECT - `rowindex` AS `bfcol_0`, - `string_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - OBJ.MAKE_REF(`bfcol_1`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_4` + OBJ.MAKE_REF(`bfcol_1`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_6` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT *, - OBJ.FETCH_METADATA(`bfcol_4`) AS `bfcol_7` + OBJ.FETCH_METADATA(`bfcol_6`) AS `bfcol_10` FROM `bfcte_1` ), `bfcte_3` AS ( SELECT *, - `bfcol_7`.`version` AS `bfcol_10` + `bfcol_10`.`version` AS `bfcol_14` FROM `bfcte_2` ) SELECT `bfcol_0` AS `rowindex`, - `bfcol_10` AS `version` -FROM `bfcte_3` \ No newline at end of file + `bfcol_14` AS `version` +FROM `bfcte_3` +ORDER BY + `bfcol_2` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_get_access_url/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_get_access_url/out.sql index 4a963b4972..80e7d7163e 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,25 +1,26 @@ WITH `bfcte_0` AS ( SELECT - `rowindex` AS `bfcol_0`, - `string_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - OBJ.MAKE_REF(`bfcol_1`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_4` + OBJ.MAKE_REF(`bfcol_1`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_6` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT *, - OBJ.GET_ACCESS_URL(`bfcol_4`) AS `bfcol_7` + OBJ.GET_ACCESS_URL(`bfcol_6`) AS `bfcol_10` FROM `bfcte_1` ), `bfcte_3` AS ( SELECT *, - JSON_VALUE(`bfcol_7`, '$.access_urls.read_url') AS `bfcol_10` + JSON_VALUE(`bfcol_10`, '$.access_urls.read_url') AS `bfcol_14` FROM `bfcte_2` ) SELECT `bfcol_0` AS `rowindex`, - `bfcol_10` AS `string_col` -FROM `bfcte_3` \ No newline at end of file + `bfcol_14` AS `string_col` +FROM `bfcte_3` +ORDER BY + `bfcol_2` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_make_ref/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_make_ref/out.sql index e3228feaaa..4691deef37 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_make_ref/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_make_ref/out.sql @@ -1,15 +1,16 @@ WITH `bfcte_0` AS ( SELECT - `rowindex` AS `bfcol_0`, - `string_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - OBJ.MAKE_REF(`bfcol_1`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_4` + OBJ.MAKE_REF(`bfcol_1`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_6` FROM `bfcte_0` ) SELECT `bfcol_0` AS `rowindex`, - `bfcol_4` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_6` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_2` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_and_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_and_op/out.sql index 42c5847401..e2291338fc 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,31 +1,31 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_0` AS `bfcol_7`, - `bfcol_1` AS `bfcol_8`, - `bfcol_1` & `bfcol_1` AS `bfcol_9` + `bfcol_2` AS `bfcol_8`, + `bfcol_0` AS `bfcol_9`, + `bfcol_1` AS `bfcol_10`, + `bfcol_1` & `bfcol_1` AS `bfcol_11` 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` + `bfcol_8` AS `bfcol_17`, + `bfcol_9` AS `bfcol_18`, + `bfcol_10` AS `bfcol_19`, + `bfcol_11` AS `bfcol_20`, + `bfcol_9` AND `bfcol_9` AS `bfcol_21` FROM `bfcte_1` ) SELECT - `bfcol_14` AS `rowindex`, - `bfcol_15` AS `bool_col`, - `bfcol_16` AS `int64_col`, - `bfcol_17` AS `int_and_int`, - `bfcol_18` AS `bool_and_bool` -FROM `bfcte_2` \ No newline at end of file + `bfcol_17` AS `rowindex`, + `bfcol_18` AS `bool_col`, + `bfcol_19` AS `int64_col`, + `bfcol_20` AS `int_and_int`, + `bfcol_21` AS `bool_and_bool` +FROM `bfcte_2` +ORDER BY + `bfcol_3` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_or_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_or_op/out.sql index d1e7bd1822..695da24141 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,31 +1,31 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_0` AS `bfcol_7`, - `bfcol_1` AS `bfcol_8`, - `bfcol_1` | `bfcol_1` AS `bfcol_9` + `bfcol_2` AS `bfcol_8`, + `bfcol_0` AS `bfcol_9`, + `bfcol_1` AS `bfcol_10`, + `bfcol_1` | `bfcol_1` AS `bfcol_11` 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` + `bfcol_8` AS `bfcol_17`, + `bfcol_9` AS `bfcol_18`, + `bfcol_10` AS `bfcol_19`, + `bfcol_11` AS `bfcol_20`, + `bfcol_9` OR `bfcol_9` AS `bfcol_21` FROM `bfcte_1` ) SELECT - `bfcol_14` AS `rowindex`, - `bfcol_15` AS `bool_col`, - `bfcol_16` AS `int64_col`, - `bfcol_17` AS `int_and_int`, - `bfcol_18` AS `bool_and_bool` -FROM `bfcte_2` \ No newline at end of file + `bfcol_17` AS `rowindex`, + `bfcol_18` AS `bool_col`, + `bfcol_19` AS `int64_col`, + `bfcol_20` AS `int_and_int`, + `bfcol_21` AS `bool_and_bool` +FROM `bfcte_2` +ORDER BY + `bfcol_3` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_xor_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_xor_op/out.sql index 7d5f74ede7..6d2d5bffdd 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,31 +1,31 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_0` AS `bfcol_7`, - `bfcol_1` AS `bfcol_8`, - `bfcol_1` ^ `bfcol_1` AS `bfcol_9` + `bfcol_2` AS `bfcol_8`, + `bfcol_0` AS `bfcol_9`, + `bfcol_1` AS `bfcol_10`, + `bfcol_1` ^ `bfcol_1` AS `bfcol_11` 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` + `bfcol_8` AS `bfcol_17`, + `bfcol_9` AS `bfcol_18`, + `bfcol_10` AS `bfcol_19`, + `bfcol_11` AS `bfcol_20`, + `bfcol_9` AND NOT `bfcol_9` OR NOT `bfcol_9` AND `bfcol_9` AS `bfcol_21` FROM `bfcte_1` ) SELECT - `bfcol_14` AS `rowindex`, - `bfcol_15` AS `bool_col`, - `bfcol_16` AS `int64_col`, - `bfcol_17` AS `int_and_int`, - `bfcol_18` AS `bool_and_bool` -FROM `bfcte_2` \ No newline at end of file + `bfcol_17` AS `rowindex`, + `bfcol_18` AS `bool_col`, + `bfcol_19` AS `int64_col`, + `bfcol_20` AS `int_and_int`, + `bfcol_21` AS `bool_and_bool` +FROM `bfcte_2` +ORDER BY + `bfcol_3` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_eq_null_match/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_eq_null_match/out.sql index 90cbcfe5c7..66f7ad1aea 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,15 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - COALESCE(CAST(`bfcol_1` AS STRING), '$NULL_SENTINEL$') = COALESCE(CAST(CAST(`bfcol_0` AS INT64) AS STRING), '$NULL_SENTINEL$') AS `bfcol_4` + COALESCE(CAST(`bfcol_1` AS STRING), '$NULL_SENTINEL$') = COALESCE(CAST(CAST(`bfcol_0` AS INT64) AS STRING), '$NULL_SENTINEL$') AS `bfcol_6` FROM `bfcte_0` ) SELECT - `bfcol_4` AS `int64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_6` AS `int64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_2` ASC NULLS LAST \ 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 8e3c52310d..b909cd1a08 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,54 +1,54 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_1` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - `bfcol_1` = `bfcol_1` AS `bfcol_9` + `bfcol_2` AS `bfcol_8`, + `bfcol_1` AS `bfcol_9`, + `bfcol_0` AS `bfcol_10`, + `bfcol_1` = `bfcol_1` AS `bfcol_11` 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` + `bfcol_8` AS `bfcol_17`, + `bfcol_9` AS `bfcol_18`, + `bfcol_10` AS `bfcol_19`, + `bfcol_11` AS `bfcol_20`, + `bfcol_9` = 1 AS `bfcol_21` 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` + `bfcol_17` AS `bfcol_28`, + `bfcol_18` AS `bfcol_29`, + `bfcol_19` AS `bfcol_30`, + `bfcol_20` AS `bfcol_31`, + `bfcol_21` AS `bfcol_32`, + `bfcol_18` = CAST(`bfcol_19` AS INT64) AS `bfcol_33` 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` + `bfcol_28` AS `bfcol_41`, + `bfcol_29` AS `bfcol_42`, + `bfcol_30` AS `bfcol_43`, + `bfcol_31` AS `bfcol_44`, + `bfcol_32` AS `bfcol_45`, + `bfcol_33` AS `bfcol_46`, + CAST(`bfcol_30` AS INT64) = `bfcol_29` AS `bfcol_47` FROM `bfcte_3` ) SELECT - `bfcol_36` AS `rowindex`, - `bfcol_37` AS `int64_col`, - `bfcol_38` AS `bool_col`, - `bfcol_39` AS `int_ne_int`, - `bfcol_40` AS `int_ne_1`, - `bfcol_41` AS `int_ne_bool`, - `bfcol_42` AS `bool_ne_int` -FROM `bfcte_4` \ No newline at end of file + `bfcol_41` AS `rowindex`, + `bfcol_42` AS `int64_col`, + `bfcol_43` AS `bool_col`, + `bfcol_44` AS `int_ne_int`, + `bfcol_45` AS `int_ne_1`, + `bfcol_46` AS `int_ne_bool`, + `bfcol_47` AS `bool_ne_int` +FROM `bfcte_4` +ORDER BY + `bfcol_3` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_ge_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_ge_numeric/out.sql index 494cb861a7..c1f5f62120 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,54 +1,54 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_1` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - `bfcol_1` >= `bfcol_1` AS `bfcol_9` + `bfcol_2` AS `bfcol_8`, + `bfcol_1` AS `bfcol_9`, + `bfcol_0` AS `bfcol_10`, + `bfcol_1` >= `bfcol_1` AS `bfcol_11` 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` + `bfcol_8` AS `bfcol_17`, + `bfcol_9` AS `bfcol_18`, + `bfcol_10` AS `bfcol_19`, + `bfcol_11` AS `bfcol_20`, + `bfcol_9` >= 1 AS `bfcol_21` 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` + `bfcol_17` AS `bfcol_28`, + `bfcol_18` AS `bfcol_29`, + `bfcol_19` AS `bfcol_30`, + `bfcol_20` AS `bfcol_31`, + `bfcol_21` AS `bfcol_32`, + `bfcol_18` >= CAST(`bfcol_19` AS INT64) AS `bfcol_33` 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` + `bfcol_28` AS `bfcol_41`, + `bfcol_29` AS `bfcol_42`, + `bfcol_30` AS `bfcol_43`, + `bfcol_31` AS `bfcol_44`, + `bfcol_32` AS `bfcol_45`, + `bfcol_33` AS `bfcol_46`, + CAST(`bfcol_30` AS INT64) >= `bfcol_29` AS `bfcol_47` FROM `bfcte_3` ) SELECT - `bfcol_36` AS `rowindex`, - `bfcol_37` AS `int64_col`, - `bfcol_38` AS `bool_col`, - `bfcol_39` AS `int_ge_int`, - `bfcol_40` AS `int_ge_1`, - `bfcol_41` AS `int_ge_bool`, - `bfcol_42` AS `bool_ge_int` -FROM `bfcte_4` \ No newline at end of file + `bfcol_41` AS `rowindex`, + `bfcol_42` AS `int64_col`, + `bfcol_43` AS `bool_col`, + `bfcol_44` AS `int_ge_int`, + `bfcol_45` AS `int_ge_1`, + `bfcol_46` AS `int_ge_bool`, + `bfcol_47` AS `bool_ge_int` +FROM `bfcte_4` +ORDER BY + `bfcol_3` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_gt_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_gt_numeric/out.sql index b0c8768850..cf513a3507 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,54 +1,54 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_1` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - `bfcol_1` > `bfcol_1` AS `bfcol_9` + `bfcol_2` AS `bfcol_8`, + `bfcol_1` AS `bfcol_9`, + `bfcol_0` AS `bfcol_10`, + `bfcol_1` > `bfcol_1` AS `bfcol_11` 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` + `bfcol_8` AS `bfcol_17`, + `bfcol_9` AS `bfcol_18`, + `bfcol_10` AS `bfcol_19`, + `bfcol_11` AS `bfcol_20`, + `bfcol_9` > 1 AS `bfcol_21` 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` + `bfcol_17` AS `bfcol_28`, + `bfcol_18` AS `bfcol_29`, + `bfcol_19` AS `bfcol_30`, + `bfcol_20` AS `bfcol_31`, + `bfcol_21` AS `bfcol_32`, + `bfcol_18` > CAST(`bfcol_19` AS INT64) AS `bfcol_33` 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` + `bfcol_28` AS `bfcol_41`, + `bfcol_29` AS `bfcol_42`, + `bfcol_30` AS `bfcol_43`, + `bfcol_31` AS `bfcol_44`, + `bfcol_32` AS `bfcol_45`, + `bfcol_33` AS `bfcol_46`, + CAST(`bfcol_30` AS INT64) > `bfcol_29` AS `bfcol_47` FROM `bfcte_3` ) SELECT - `bfcol_36` AS `rowindex`, - `bfcol_37` AS `int64_col`, - `bfcol_38` AS `bool_col`, - `bfcol_39` AS `int_gt_int`, - `bfcol_40` AS `int_gt_1`, - `bfcol_41` AS `int_gt_bool`, - `bfcol_42` AS `bool_gt_int` -FROM `bfcte_4` \ No newline at end of file + `bfcol_41` AS `rowindex`, + `bfcol_42` AS `int64_col`, + `bfcol_43` AS `bool_col`, + `bfcol_44` AS `int_gt_int`, + `bfcol_45` AS `int_gt_1`, + `bfcol_46` AS `int_gt_bool`, + `bfcol_47` AS `bool_gt_int` +FROM `bfcte_4` +ORDER BY + `bfcol_3` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_is_in/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_is_in/out.sql index 7a1a2a743d..5a3fedd111 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,32 +1,33 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `float64_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - COALESCE(`bfcol_0` IN (1, 2, 3), FALSE) AS `bfcol_2`, + COALESCE(`bfcol_0` IN (1, 2, 3), FALSE) AS `bfcol_3`, ( `bfcol_0` IS NULL - ) OR `bfcol_0` IN (123456) AS `bfcol_3`, - COALESCE(`bfcol_0` IN (1.0, 2.0, 3.0), FALSE) AS `bfcol_4`, - FALSE AS `bfcol_5`, - COALESCE(`bfcol_0` IN (2.5, 3), FALSE) AS `bfcol_6`, - FALSE AS `bfcol_7`, - COALESCE(`bfcol_0` IN (123456), FALSE) AS `bfcol_8`, + ) OR `bfcol_0` IN (123456) AS `bfcol_4`, + COALESCE(`bfcol_0` IN (1.0, 2.0, 3.0), FALSE) AS `bfcol_5`, + FALSE AS `bfcol_6`, + COALESCE(`bfcol_0` IN (2.5, 3), FALSE) AS `bfcol_7`, + FALSE AS `bfcol_8`, + COALESCE(`bfcol_0` IN (123456), FALSE) AS `bfcol_9`, ( `bfcol_1` IS NULL - ) OR `bfcol_1` IN (1, 2, 3) AS `bfcol_9` + ) OR `bfcol_1` IN (1, 2, 3) AS `bfcol_10` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `ints`, - `bfcol_3` AS `ints_w_null`, - `bfcol_4` AS `floats`, - `bfcol_5` AS `strings`, - `bfcol_6` AS `mixed`, - `bfcol_7` AS `empty`, - `bfcol_8` AS `ints_wo_match_nulls`, - `bfcol_9` AS `float_in_ints` -FROM `bfcte_1` \ No newline at end of file + `bfcol_3` AS `ints`, + `bfcol_4` AS `ints_w_null`, + `bfcol_5` AS `floats`, + `bfcol_6` AS `strings`, + `bfcol_7` AS `mixed`, + `bfcol_8` AS `empty`, + `bfcol_9` AS `ints_wo_match_nulls`, + `bfcol_10` AS `float_in_ints` +FROM `bfcte_1` +ORDER BY + `bfcol_2` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_le_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_le_numeric/out.sql index 2f642d8cbb..9a8727562e 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,54 +1,54 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_1` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - `bfcol_1` <= `bfcol_1` AS `bfcol_9` + `bfcol_2` AS `bfcol_8`, + `bfcol_1` AS `bfcol_9`, + `bfcol_0` AS `bfcol_10`, + `bfcol_1` <= `bfcol_1` AS `bfcol_11` 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` + `bfcol_8` AS `bfcol_17`, + `bfcol_9` AS `bfcol_18`, + `bfcol_10` AS `bfcol_19`, + `bfcol_11` AS `bfcol_20`, + `bfcol_9` <= 1 AS `bfcol_21` 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` + `bfcol_17` AS `bfcol_28`, + `bfcol_18` AS `bfcol_29`, + `bfcol_19` AS `bfcol_30`, + `bfcol_20` AS `bfcol_31`, + `bfcol_21` AS `bfcol_32`, + `bfcol_18` <= CAST(`bfcol_19` AS INT64) AS `bfcol_33` 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` + `bfcol_28` AS `bfcol_41`, + `bfcol_29` AS `bfcol_42`, + `bfcol_30` AS `bfcol_43`, + `bfcol_31` AS `bfcol_44`, + `bfcol_32` AS `bfcol_45`, + `bfcol_33` AS `bfcol_46`, + CAST(`bfcol_30` AS INT64) <= `bfcol_29` AS `bfcol_47` FROM `bfcte_3` ) SELECT - `bfcol_36` AS `rowindex`, - `bfcol_37` AS `int64_col`, - `bfcol_38` AS `bool_col`, - `bfcol_39` AS `int_le_int`, - `bfcol_40` AS `int_le_1`, - `bfcol_41` AS `int_le_bool`, - `bfcol_42` AS `bool_le_int` -FROM `bfcte_4` \ No newline at end of file + `bfcol_41` AS `rowindex`, + `bfcol_42` AS `int64_col`, + `bfcol_43` AS `bool_col`, + `bfcol_44` AS `int_le_int`, + `bfcol_45` AS `int_le_1`, + `bfcol_46` AS `int_le_bool`, + `bfcol_47` AS `bool_le_int` +FROM `bfcte_4` +ORDER BY + `bfcol_3` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_lt_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_lt_numeric/out.sql index b244e3cbcc..8305f268c8 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,54 +1,54 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_1` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - `bfcol_1` < `bfcol_1` AS `bfcol_9` + `bfcol_2` AS `bfcol_8`, + `bfcol_1` AS `bfcol_9`, + `bfcol_0` AS `bfcol_10`, + `bfcol_1` < `bfcol_1` AS `bfcol_11` 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` + `bfcol_8` AS `bfcol_17`, + `bfcol_9` AS `bfcol_18`, + `bfcol_10` AS `bfcol_19`, + `bfcol_11` AS `bfcol_20`, + `bfcol_9` < 1 AS `bfcol_21` 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` + `bfcol_17` AS `bfcol_28`, + `bfcol_18` AS `bfcol_29`, + `bfcol_19` AS `bfcol_30`, + `bfcol_20` AS `bfcol_31`, + `bfcol_21` AS `bfcol_32`, + `bfcol_18` < CAST(`bfcol_19` AS INT64) AS `bfcol_33` 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` + `bfcol_28` AS `bfcol_41`, + `bfcol_29` AS `bfcol_42`, + `bfcol_30` AS `bfcol_43`, + `bfcol_31` AS `bfcol_44`, + `bfcol_32` AS `bfcol_45`, + `bfcol_33` AS `bfcol_46`, + CAST(`bfcol_30` AS INT64) < `bfcol_29` AS `bfcol_47` FROM `bfcte_3` ) SELECT - `bfcol_36` AS `rowindex`, - `bfcol_37` AS `int64_col`, - `bfcol_38` AS `bool_col`, - `bfcol_39` AS `int_lt_int`, - `bfcol_40` AS `int_lt_1`, - `bfcol_41` AS `int_lt_bool`, - `bfcol_42` AS `bool_lt_int` -FROM `bfcte_4` \ No newline at end of file + `bfcol_41` AS `rowindex`, + `bfcol_42` AS `int64_col`, + `bfcol_43` AS `bool_col`, + `bfcol_44` AS `int_lt_int`, + `bfcol_45` AS `int_lt_1`, + `bfcol_46` AS `int_lt_bool`, + `bfcol_47` AS `bool_lt_int` +FROM `bfcte_4` +ORDER BY + `bfcol_3` ASC NULLS LAST \ 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 6fba4b960f..7665787dbb 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,54 +1,54 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_1` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - `bfcol_1` <> `bfcol_1` AS `bfcol_9` + `bfcol_2` AS `bfcol_8`, + `bfcol_1` AS `bfcol_9`, + `bfcol_0` AS `bfcol_10`, + `bfcol_1` <> `bfcol_1` AS `bfcol_11` 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` + `bfcol_8` AS `bfcol_17`, + `bfcol_9` AS `bfcol_18`, + `bfcol_10` AS `bfcol_19`, + `bfcol_11` AS `bfcol_20`, + `bfcol_9` <> 1 AS `bfcol_21` 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` + `bfcol_17` AS `bfcol_28`, + `bfcol_18` AS `bfcol_29`, + `bfcol_19` AS `bfcol_30`, + `bfcol_20` AS `bfcol_31`, + `bfcol_21` AS `bfcol_32`, + `bfcol_18` <> CAST(`bfcol_19` AS INT64) AS `bfcol_33` 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` + `bfcol_28` AS `bfcol_41`, + `bfcol_29` AS `bfcol_42`, + `bfcol_30` AS `bfcol_43`, + `bfcol_31` AS `bfcol_44`, + `bfcol_32` AS `bfcol_45`, + `bfcol_33` AS `bfcol_46`, + CAST(`bfcol_30` AS INT64) <> `bfcol_29` AS `bfcol_47` FROM `bfcte_3` ) SELECT - `bfcol_36` AS `rowindex`, - `bfcol_37` AS `int64_col`, - `bfcol_38` AS `bool_col`, - `bfcol_39` AS `int_ne_int`, - `bfcol_40` AS `int_ne_1`, - `bfcol_41` AS `int_ne_bool`, - `bfcol_42` AS `bool_ne_int` -FROM `bfcte_4` \ No newline at end of file + `bfcol_41` AS `rowindex`, + `bfcol_42` AS `int64_col`, + `bfcol_43` AS `bool_col`, + `bfcol_44` AS `int_ne_int`, + `bfcol_45` AS `int_ne_1`, + `bfcol_46` AS `int_ne_bool`, + `bfcol_47` AS `bool_ne_int` +FROM `bfcte_4` +ORDER BY + `bfcol_3` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_add_timedelta/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_add_timedelta/out.sql index a47531999b..ae5b663163 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,60 +1,60 @@ WITH `bfcte_0` AS ( SELECT - `date_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1`, - `timestamp_col` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS DATE), CAST(NULL AS INT64), CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_6`, - `bfcol_2` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - TIMESTAMP_ADD(CAST(`bfcol_0` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `bfcol_9` + `bfcol_1` AS `bfcol_8`, + `bfcol_2` AS `bfcol_9`, + `bfcol_0` AS `bfcol_10`, + TIMESTAMP_ADD(CAST(`bfcol_0` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `bfcol_11` 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` + `bfcol_8` AS `bfcol_17`, + `bfcol_9` AS `bfcol_18`, + `bfcol_10` AS `bfcol_19`, + `bfcol_11` AS `bfcol_20`, + TIMESTAMP_ADD(`bfcol_9`, INTERVAL 86400000000 MICROSECOND) AS `bfcol_21` 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` + `bfcol_17` AS `bfcol_28`, + `bfcol_18` AS `bfcol_29`, + `bfcol_19` AS `bfcol_30`, + `bfcol_20` AS `bfcol_31`, + `bfcol_21` AS `bfcol_32`, + TIMESTAMP_ADD(CAST(`bfcol_19` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `bfcol_33` 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` + `bfcol_28` AS `bfcol_41`, + `bfcol_29` AS `bfcol_42`, + `bfcol_30` AS `bfcol_43`, + `bfcol_31` AS `bfcol_44`, + `bfcol_32` AS `bfcol_45`, + `bfcol_33` AS `bfcol_46`, + TIMESTAMP_ADD(`bfcol_29`, INTERVAL 86400000000 MICROSECOND) AS `bfcol_47` FROM `bfcte_3` ), `bfcte_5` AS ( SELECT *, - 172800000000 AS `bfcol_50` + 172800000000 AS `bfcol_56` FROM `bfcte_4` ) SELECT - `bfcol_36` AS `rowindex`, - `bfcol_37` AS `timestamp_col`, - `bfcol_38` AS `date_col`, - `bfcol_39` AS `date_add_timedelta`, - `bfcol_40` AS `timestamp_add_timedelta`, - `bfcol_41` AS `timedelta_add_date`, - `bfcol_42` AS `timedelta_add_timestamp`, - `bfcol_50` AS `timedelta_add_timedelta` -FROM `bfcte_5` \ No newline at end of file + `bfcol_41` AS `rowindex`, + `bfcol_42` AS `timestamp_col`, + `bfcol_43` AS `date_col`, + `bfcol_44` AS `date_add_timedelta`, + `bfcol_45` AS `timestamp_add_timedelta`, + `bfcol_46` AS `timedelta_add_date`, + `bfcol_47` AS `timedelta_add_timestamp`, + `bfcol_56` AS `timedelta_add_timedelta` +FROM `bfcte_5` +ORDER BY + `bfcol_3` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_date/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_date/out.sql index 615a4a92bb..f8241f6b3b 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,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - DATE(`bfcol_0`) AS `bfcol_1` + DATE(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `timestamp_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 460823fa20..60a4b94e23 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,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - EXTRACT(DAY FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(DAY FROM `bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `timestamp_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 e6c17587d0..624d3b1ccc 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,13 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - EXTRACT(DAYOFWEEK FROM `bfcol_0`) - 1 AS `bfcol_1` + EXTRACT(DAYOFWEEK FROM `bfcol_0`) - 1 AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `timestamp_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_dayofyear/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_dayofyear/out.sql index 4b60bcc4ca..f84e11833a 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,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - EXTRACT(DAYOFYEAR FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(DAYOFYEAR FROM `bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `timestamp_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 ad4fdb23a1..bcba25e17c 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,13 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - TIMESTAMP_TRUNC(`bfcol_0`, D) AS `bfcol_1` + TIMESTAMP_TRUNC(`bfcol_0`, D) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `timestamp_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_hour/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_hour/out.sql index 8cc9b9081f..a3b6a32ebc 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,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - EXTRACT(HOUR FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(HOUR FROM `bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `timestamp_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 d389172fda..d69f1a6908 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,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - EXTRACT(DAYOFWEEK FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(DAYOFWEEK FROM `bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `timestamp_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 f22e963bc3..27414c081a 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,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - EXTRACT(ISOWEEK FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(ISOWEEK FROM `bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `timestamp_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 13b56f709c..50f624522a 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,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - EXTRACT(ISOYEAR FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(ISOYEAR FROM `bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `timestamp_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 4ef9b8142f..7cbb1c2259 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,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - EXTRACT(MINUTE FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(MINUTE FROM `bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `timestamp_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 4912622898..c11921092d 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,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - EXTRACT(MONTH FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(MONTH FROM `bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `timestamp_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 3c7efd3098..c7088fe7d8 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,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - TIMESTAMP_TRUNC(`bfcol_0`, DAY) AS `bfcol_1` + TIMESTAMP_TRUNC(`bfcol_0`, DAY) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `timestamp_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 2be2866661..90fa2e89c5 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,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - EXTRACT(QUARTER FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(QUARTER FROM `bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `timestamp_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 144b704788..5ee7c35820 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,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - EXTRACT(SECOND FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(SECOND FROM `bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `timestamp_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 077c30e7cb..054a86a676 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,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - FORMAT_TIMESTAMP('%Y-%m-%d', `bfcol_0`) AS `bfcol_1` + FORMAT_TIMESTAMP('%Y-%m-%d', `bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `timestamp_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 2d615fcca6..ae8a4c479f 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,82 +1,81 @@ WITH `bfcte_0` AS ( SELECT - `date_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1`, - `timestamp_col` AS `bfcol_2`, - `duration_col` AS `bfcol_3` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS DATE), CAST(NULL AS INT64), CAST(NULL AS TIMESTAMP), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_8`, - `bfcol_2` AS `bfcol_9`, - `bfcol_0` AS `bfcol_10`, - `bfcol_3` AS `bfcol_11` + `bfcol_1` AS `bfcol_10`, + `bfcol_2` AS `bfcol_11`, + `bfcol_0` AS `bfcol_12`, + `bfcol_3` AS `bfcol_13` 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` + `bfcol_11` AS `bfcol_20`, + `bfcol_13` AS `bfcol_21`, + `bfcol_12` AS `bfcol_22`, + TIMESTAMP_SUB(CAST(`bfcol_12` AS DATETIME), INTERVAL `bfcol_13` MICROSECOND) AS `bfcol_23` 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` + `bfcol_19` AS `bfcol_30`, + `bfcol_20` AS `bfcol_31`, + `bfcol_21` AS `bfcol_32`, + `bfcol_22` AS `bfcol_33`, + `bfcol_23` AS `bfcol_34`, + TIMESTAMP_SUB(`bfcol_20`, INTERVAL `bfcol_21` MICROSECOND) AS `bfcol_35` 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` + `bfcol_30` AS `bfcol_43`, + `bfcol_31` AS `bfcol_44`, + `bfcol_32` AS `bfcol_45`, + `bfcol_33` AS `bfcol_46`, + `bfcol_34` AS `bfcol_47`, + `bfcol_35` AS `bfcol_48`, + TIMESTAMP_DIFF(CAST(`bfcol_33` AS DATETIME), CAST(`bfcol_33` AS DATETIME), MICROSECOND) AS `bfcol_49` 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` + `bfcol_43` AS `bfcol_58`, + `bfcol_44` AS `bfcol_59`, + `bfcol_45` AS `bfcol_60`, + `bfcol_46` AS `bfcol_61`, + `bfcol_47` AS `bfcol_62`, + `bfcol_48` AS `bfcol_63`, + `bfcol_49` AS `bfcol_64`, + TIMESTAMP_DIFF(`bfcol_44`, `bfcol_44`, MICROSECOND) AS `bfcol_65` 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` + `bfcol_58` AS `bfcol_75`, + `bfcol_59` AS `bfcol_76`, + `bfcol_60` AS `bfcol_77`, + `bfcol_61` AS `bfcol_78`, + `bfcol_62` AS `bfcol_79`, + `bfcol_63` AS `bfcol_80`, + `bfcol_64` AS `bfcol_81`, + `bfcol_65` AS `bfcol_82`, + `bfcol_60` - `bfcol_60` AS `bfcol_83` FROM `bfcte_5` ) SELECT - `bfcol_68` AS `rowindex`, - `bfcol_69` AS `timestamp_col`, - `bfcol_70` AS `duration_col`, - `bfcol_71` AS `date_col`, - `bfcol_72` AS `date_sub_timedelta`, - `bfcol_73` AS `timestamp_sub_timedelta`, - `bfcol_74` AS `timestamp_sub_date`, - `bfcol_75` AS `date_sub_timestamp`, - `bfcol_76` AS `timedelta_sub_timedelta` -FROM `bfcte_6` \ No newline at end of file + `bfcol_75` AS `rowindex`, + `bfcol_76` AS `timestamp_col`, + `bfcol_77` AS `duration_col`, + `bfcol_78` AS `date_col`, + `bfcol_79` AS `date_sub_timedelta`, + `bfcol_80` AS `timestamp_sub_timedelta`, + `bfcol_81` AS `timestamp_sub_date`, + `bfcol_82` AS `date_sub_timestamp`, + `bfcol_83` AS `timedelta_sub_timedelta` +FROM `bfcte_6` +ORDER BY + `bfcol_4` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_time/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_time/out.sql index 6b74efafd5..1bf6562037 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,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - TIME(`bfcol_0`) AS `bfcol_1` + TIME(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `timestamp_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 096f14cc85..dc203ec67b 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,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - CAST(TIMESTAMP_SECONDS(`bfcol_0`) AS DATETIME) AS `bfcol_1` + CAST(TIMESTAMP_SECONDS(`bfcol_0`) AS DATETIME) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `int64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `int64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 b1e66ce3e7..ceb17dd586 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,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - TIMESTAMP_SECONDS(`bfcol_0`) AS `bfcol_1` + TIMESTAMP_SECONDS(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `int64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `int64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 dcbf0be5c2..25e899da96 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,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - UNIX_MICROS(`bfcol_0`) AS `bfcol_1` + UNIX_MICROS(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `timestamp_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 ca58fbc97c..7a4b667714 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,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - UNIX_MILLIS(`bfcol_0`) AS `bfcol_1` + UNIX_MILLIS(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `timestamp_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 21f0b7b8c8..6d12a05137 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,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - UNIX_SECONDS(`bfcol_0`) AS `bfcol_1` + UNIX_SECONDS(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `timestamp_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 8352a65e9e..d50b17e013 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,15 @@ WITH `bfcte_0` AS ( SELECT - `timestamp_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - EXTRACT(YEAR FROM `bfcol_0`) AS `bfcol_1` + EXTRACT(YEAR FROM `bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `timestamp_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `timestamp_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 440aea9161..049b2ec82d 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,18 +1,19 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `float64_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_0` AS `bfcol_2`, - `bfcol_1` <> 0 AS `bfcol_3`, - `bfcol_1` <> 0 AS `bfcol_4` + `bfcol_0` AS `bfcol_3`, + `bfcol_1` <> 0 AS `bfcol_4`, + `bfcol_1` <> 0 AS `bfcol_5` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `bool_col`, - `bfcol_3` AS `float64_col`, - `bfcol_4` AS `float64_w_safe` -FROM `bfcte_1` \ No newline at end of file + `bfcol_3` AS `bool_col`, + `bfcol_4` AS `float64_col`, + `bfcol_5` AS `float64_w_safe` +FROM `bfcte_1` +ORDER BY + `bfcol_2` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_float/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_float/out.sql index 81a8805f47..e0709f0359 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,17 +1,19 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), 0)]) ), `bfcte_1` AS ( SELECT *, - CAST(CAST(`bfcol_0` AS INT64) AS FLOAT64) AS `bfcol_1`, - CAST('1.34235e4' AS FLOAT64) AS `bfcol_2`, - SAFE_CAST(SAFE_CAST(`bfcol_0` AS INT64) AS FLOAT64) AS `bfcol_3` + CAST(CAST(`bfcol_0` AS INT64) AS FLOAT64) AS `bfcol_2`, + CAST('1.34235e4' AS FLOAT64) AS `bfcol_3`, + SAFE_CAST(SAFE_CAST(`bfcol_0` AS INT64) AS FLOAT64) AS `bfcol_4` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `bool_col`, - `bfcol_2` AS `str_const`, - `bfcol_3` AS `bool_w_safe` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `bool_col`, + `bfcol_3` AS `str_const`, + `bfcol_4` AS `bool_w_safe` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_int/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_int/out.sql index 22aa2cf91a..629562dd41 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,33 +1,38 @@ WITH `bfcte_0` AS ( SELECT - `datetime_col` AS `bfcol_0`, - `numeric_col` AS `bfcol_1`, - `float64_col` AS `bfcol_2`, - `time_col` AS `bfcol_3`, - `timestamp_col` AS `bfcol_4` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT( + CAST(NULL AS DATETIME), + CAST(NULL AS NUMERIC), + CAST(NULL AS FLOAT64), + CAST(NULL AS TIME), + CAST(NULL AS TIMESTAMP), + 0 + )]) ), `bfcte_1` AS ( SELECT *, - UNIX_MICROS(CAST(`bfcol_0` AS TIMESTAMP)) AS `bfcol_5`, - UNIX_MICROS(SAFE_CAST(`bfcol_0` AS TIMESTAMP)) AS `bfcol_6`, - TIME_DIFF(CAST(`bfcol_3` AS TIME), '00:00:00', MICROSECOND) AS `bfcol_7`, - TIME_DIFF(SAFE_CAST(`bfcol_3` AS TIME), '00:00:00', MICROSECOND) AS `bfcol_8`, - UNIX_MICROS(`bfcol_4`) AS `bfcol_9`, - CAST(TRUNC(`bfcol_1`) AS INT64) AS `bfcol_10`, - CAST(TRUNC(`bfcol_2`) AS INT64) AS `bfcol_11`, - SAFE_CAST(TRUNC(`bfcol_2`) AS INT64) AS `bfcol_12`, - CAST('100' AS INT64) AS `bfcol_13` + UNIX_MICROS(CAST(`bfcol_0` AS TIMESTAMP)) AS `bfcol_6`, + UNIX_MICROS(SAFE_CAST(`bfcol_0` AS TIMESTAMP)) AS `bfcol_7`, + TIME_DIFF(CAST(`bfcol_3` AS TIME), '00:00:00', MICROSECOND) AS `bfcol_8`, + TIME_DIFF(SAFE_CAST(`bfcol_3` AS TIME), '00:00:00', MICROSECOND) AS `bfcol_9`, + UNIX_MICROS(`bfcol_4`) AS `bfcol_10`, + CAST(TRUNC(`bfcol_1`) AS INT64) AS `bfcol_11`, + CAST(TRUNC(`bfcol_2`) AS INT64) AS `bfcol_12`, + SAFE_CAST(TRUNC(`bfcol_2`) AS INT64) AS `bfcol_13`, + CAST('100' AS INT64) AS `bfcol_14` FROM `bfcte_0` ) SELECT - `bfcol_5` AS `datetime_col`, - `bfcol_6` AS `datetime_w_safe`, - `bfcol_7` AS `time_col`, - `bfcol_8` AS `time_w_safe`, - `bfcol_9` AS `timestamp_col`, - `bfcol_10` AS `numeric_col`, - `bfcol_11` AS `float64_col`, - `bfcol_12` AS `float64_w_safe`, - `bfcol_13` AS `str_const` -FROM `bfcte_1` \ No newline at end of file + `bfcol_6` AS `datetime_col`, + `bfcol_7` AS `datetime_w_safe`, + `bfcol_8` AS `time_col`, + `bfcol_9` AS `time_w_safe`, + `bfcol_10` AS `timestamp_col`, + `bfcol_11` AS `numeric_col`, + `bfcol_12` AS `float64_col`, + `bfcol_13` AS `float64_w_safe`, + `bfcol_14` AS `str_const` +FROM `bfcte_1` +ORDER BY + `bfcol_5` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_json/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_json/out.sql index 8230b4a60b..459f8d63ec 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,26 +1,31 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `float64_col` AS `bfcol_2`, - `string_col` AS `bfcol_3` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT( + CAST(NULL AS BOOLEAN), + CAST(NULL AS INT64), + CAST(NULL AS FLOAT64), + CAST(NULL AS STRING), + 0 + )]) ), `bfcte_1` AS ( SELECT *, - PARSE_JSON(CAST(`bfcol_1` AS STRING)) AS `bfcol_4`, - PARSE_JSON(CAST(`bfcol_2` AS STRING)) AS `bfcol_5`, - PARSE_JSON(CAST(`bfcol_0` AS STRING)) AS `bfcol_6`, - PARSE_JSON(`bfcol_3`) AS `bfcol_7`, - PARSE_JSON(CAST(`bfcol_0` AS STRING)) AS `bfcol_8`, - PARSE_JSON_IN_SAFE(`bfcol_3`) AS `bfcol_9` + PARSE_JSON(CAST(`bfcol_1` AS STRING)) AS `bfcol_5`, + PARSE_JSON(CAST(`bfcol_2` AS STRING)) AS `bfcol_6`, + PARSE_JSON(CAST(`bfcol_0` AS STRING)) AS `bfcol_7`, + PARSE_JSON(`bfcol_3`) AS `bfcol_8`, + PARSE_JSON(CAST(`bfcol_0` AS STRING)) AS `bfcol_9`, + PARSE_JSON_IN_SAFE(`bfcol_3`) AS `bfcol_10` FROM `bfcte_0` ) SELECT - `bfcol_4` AS `int64_col`, - `bfcol_5` AS `float64_col`, - `bfcol_6` AS `bool_col`, - `bfcol_7` AS `string_col`, - `bfcol_8` AS `bool_w_safe`, - `bfcol_9` AS `string_w_safe` -FROM `bfcte_1` \ No newline at end of file + `bfcol_5` AS `int64_col`, + `bfcol_6` AS `float64_col`, + `bfcol_7` AS `bool_col`, + `bfcol_8` AS `string_col`, + `bfcol_9` AS `bool_w_safe`, + `bfcol_10` AS `string_w_safe` +FROM `bfcte_1` +ORDER BY + `bfcol_4` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_string/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_string/out.sql index f230a3799e..c0bba40e2d 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,18 +1,19 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - CAST(`bfcol_1` AS STRING) AS `bfcol_2`, - INITCAP(CAST(`bfcol_0` AS STRING)) AS `bfcol_3`, - INITCAP(SAFE_CAST(`bfcol_0` AS STRING)) AS `bfcol_4` + CAST(`bfcol_1` AS STRING) AS `bfcol_3`, + INITCAP(CAST(`bfcol_0` AS STRING)) AS `bfcol_4`, + INITCAP(SAFE_CAST(`bfcol_0` AS STRING)) AS `bfcol_5` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `int64_col`, - `bfcol_3` AS `bool_col`, - `bfcol_4` AS `bool_w_safe` -FROM `bfcte_1` \ No newline at end of file + `bfcol_3` AS `int64_col`, + `bfcol_4` AS `bool_col`, + `bfcol_5` AS `bool_w_safe` +FROM `bfcte_1` +ORDER BY + `bfcol_2` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_time_like/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_astype_time_like/out.sql index 141b7ffa9a..92012ad8e4 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,19 +1,21 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - CAST(TIMESTAMP_MICROS(`bfcol_0`) AS DATETIME) AS `bfcol_1`, - CAST(TIMESTAMP_MICROS(`bfcol_0`) AS TIME) AS `bfcol_2`, - CAST(TIMESTAMP_MICROS(`bfcol_0`) AS TIMESTAMP) AS `bfcol_3`, - SAFE_CAST(TIMESTAMP_MICROS(`bfcol_0`) AS TIME) AS `bfcol_4` + CAST(TIMESTAMP_MICROS(`bfcol_0`) AS DATETIME) AS `bfcol_2`, + CAST(TIMESTAMP_MICROS(`bfcol_0`) AS TIME) AS `bfcol_3`, + CAST(TIMESTAMP_MICROS(`bfcol_0`) AS TIMESTAMP) AS `bfcol_4`, + SAFE_CAST(TIMESTAMP_MICROS(`bfcol_0`) AS TIME) AS `bfcol_5` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `int64_to_datetime`, - `bfcol_2` AS `int64_to_time`, - `bfcol_3` AS `int64_to_timestamp`, - `bfcol_4` AS `int64_to_time_safe` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `int64_to_datetime`, + `bfcol_3` AS `int64_to_time`, + `bfcol_4` AS `int64_to_timestamp`, + `bfcol_5` AS `int64_to_time_safe` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_case_when_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_case_when_op/out.sql index 08db34a632..a70826525c 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,16 +1,19 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `int64_too` AS `bfcol_2`, - `float64_col` AS `bfcol_3` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT( + CAST(NULL AS BOOLEAN), + CAST(NULL AS INT64), + CAST(NULL AS INT64), + CAST(NULL AS FLOAT64), + 0 + )]) ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` THEN `bfcol_1` END AS `bfcol_4`, - CASE WHEN `bfcol_0` THEN `bfcol_1` WHEN `bfcol_0` THEN `bfcol_2` END AS `bfcol_5`, - CASE WHEN `bfcol_0` THEN `bfcol_0` WHEN `bfcol_0` THEN `bfcol_0` END AS `bfcol_6`, + CASE WHEN `bfcol_0` THEN `bfcol_1` END AS `bfcol_5`, + CASE WHEN `bfcol_0` THEN `bfcol_1` WHEN `bfcol_0` THEN `bfcol_2` END AS `bfcol_6`, + CASE WHEN `bfcol_0` THEN `bfcol_0` WHEN `bfcol_0` THEN `bfcol_0` END AS `bfcol_7`, CASE WHEN `bfcol_0` THEN `bfcol_1` @@ -18,12 +21,14 @@ WITH `bfcte_0` AS ( THEN CAST(`bfcol_0` AS INT64) WHEN `bfcol_0` THEN `bfcol_3` - END AS `bfcol_7` + END AS `bfcol_8` FROM `bfcte_0` ) SELECT - `bfcol_4` AS `single_case`, - `bfcol_5` AS `double_case`, - `bfcol_6` AS `bool_types_case`, - `bfcol_7` AS `mixed_types_cast` -FROM `bfcte_1` \ No newline at end of file + `bfcol_5` AS `single_case`, + `bfcol_6` AS `double_case`, + `bfcol_7` AS `bool_types_case`, + `bfcol_8` AS `mixed_types_cast` +FROM `bfcte_1` +ORDER BY + `bfcol_4` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_clip/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_clip/out.sql index 172e1f53e7..3cf0f409e7 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,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `int64_too` AS `bfcol_1`, - `rowindex` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - GREATEST(LEAST(`bfcol_2`, `bfcol_1`), `bfcol_0`) AS `bfcol_3` + GREATEST(LEAST(`bfcol_2`, `bfcol_1`), `bfcol_0`) AS `bfcol_4` FROM `bfcte_0` ) SELECT - `bfcol_3` AS `result_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_4` AS `result_col` +FROM `bfcte_1` +ORDER BY + `bfcol_3` ASC NULLS LAST \ 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 14d6df6d22..051cff69ce 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - FARM_FINGERPRINT(`bfcol_0`) AS `bfcol_1` + FARM_FINGERPRINT(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 b5a5b92b52..bdd35b256f 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,19 +1,19 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `bytes_col` AS `bfcol_1`, - `int64_col` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS BYTES), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - ~`bfcol_2` AS `bfcol_6`, - ~`bfcol_1` AS `bfcol_7`, - NOT `bfcol_0` AS `bfcol_8` + ~`bfcol_2` AS `bfcol_8`, + ~`bfcol_1` AS `bfcol_9`, + NOT `bfcol_0` AS `bfcol_10` FROM `bfcte_0` ) SELECT - `bfcol_6` AS `int64_col`, - `bfcol_7` AS `bytes_col`, - `bfcol_8` AS `bool_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_8` AS `int64_col`, + `bfcol_9` AS `bytes_col`, + `bfcol_10` AS `bool_col` +FROM `bfcte_1` +ORDER BY + `bfcol_3` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_isnull/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_isnull/out.sql index 55a2ebb970..e1f53fe90c 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,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_0` IS NULL AS `bfcol_1` + `bfcol_0` IS NULL AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 a17d6584ce..37702cc7b0 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - CASE `bfcol_0` WHEN 'value1' THEN 'mapped1' END AS `bfcol_1` + CASE `bfcol_0` WHEN 'value1' THEN 'mapped1' END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 c1961f9d62..f636fd3ab3 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,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - NOT `bfcol_0` IS NULL AS `bfcol_1` + NOT `bfcol_0` IS NULL AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 678208e9ba..b97acc82fd 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,15 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `float64_col` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - IF(`bfcol_0`, `bfcol_1`, `bfcol_2`) AS `bfcol_3` + IF(`bfcol_0`, `bfcol_1`, `bfcol_2`) AS `bfcol_4` FROM `bfcte_0` ) SELECT - `bfcol_3` AS `result_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_4` AS `result_col` +FROM `bfcte_1` +ORDER BY + `bfcol_3` ASC NULLS LAST \ 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 9b4b6894e0..593266aa41 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,15 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS GEOGRAPHY), 0)]) ), `bfcte_1` AS ( SELECT *, - ST_AREA(`bfcol_0`) AS `bfcol_1` + ST_AREA(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `geography_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 9557e2f1d6..0c5b6881b3 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,15 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS GEOGRAPHY), 0)]) ), `bfcte_1` AS ( SELECT *, - ST_ASTEXT(`bfcol_0`) AS `bfcol_1` + ST_ASTEXT(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `geography_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 31c0b45034..d621a5c238 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,15 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS GEOGRAPHY), 0)]) ), `bfcte_1` AS ( SELECT *, - ST_BOUNDARY(`bfcol_0`) AS `bfcol_1` + ST_BOUNDARY(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `geography_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 9669c39a9f..0cdc4e3e82 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,15 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS GEOGRAPHY), 0)]) ), `bfcte_1` AS ( SELECT *, - ST_BUFFER(`bfcol_0`, 1.0, 8.0, FALSE) AS `bfcol_1` + ST_BUFFER(`bfcol_0`, 1.0, 8.0, FALSE) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `geography_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 97867318ad..ff4aca3596 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,15 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS GEOGRAPHY), 0)]) ), `bfcte_1` AS ( SELECT *, - ST_CENTROID(`bfcol_0`) AS `bfcol_1` + ST_CENTROID(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `geography_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 8bb5801173..3c7709a703 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,15 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS GEOGRAPHY), 0)]) ), `bfcte_1` AS ( SELECT *, - ST_CONVEXHULL(`bfcol_0`) AS `bfcol_1` + ST_CONVEXHULL(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `geography_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 ba4d9dd182..639a70aec4 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - SAFE.ST_GEOGFROMTEXT(`bfcol_0`) AS `bfcol_1` + SAFE.ST_GEOGFROMTEXT(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 d905e8470b..12f390c236 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,15 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS GEOGRAPHY), 0)]) ), `bfcte_1` AS ( SELECT *, - ST_ISCLOSED(`bfcol_0`) AS `bfcol_1` + ST_ISCLOSED(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `geography_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 a023691d63..bb10d2767c 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,15 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS GEOGRAPHY), 0)]) ), `bfcte_1` AS ( SELECT *, - ST_LENGTH(`bfcol_0`) AS `bfcol_1` + ST_LENGTH(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `geography_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 d4c0370ca8..9d88db6e61 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,15 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS GEOGRAPHY), 0)]) ), `bfcte_1` AS ( SELECT *, - SAFE.ST_X(`bfcol_0`) AS `bfcol_1` + SAFE.ST_X(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `geography_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 196c2fcad6..e6e0eb82f2 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,15 @@ WITH `bfcte_0` AS ( SELECT - `geography_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS GEOGRAPHY), 0)]) ), `bfcte_1` AS ( SELECT *, - SAFE.ST_Y(`bfcol_0`) AS `bfcol_1` + SAFE.ST_Y(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `geography_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `geography_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 cdb091ae39..08b709b7a5 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - PARSE_JSON(`bfcol_0`) AS `bfcol_1` + PARSE_JSON(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 6f315f8113..58edade190 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,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - ABS(`bfcol_0`) AS `bfcol_1` + ABS(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 44335805e4..ffc2572ca4 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,54 +1,54 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_1` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - `bfcol_1` + `bfcol_1` AS `bfcol_9` + `bfcol_2` AS `bfcol_8`, + `bfcol_1` AS `bfcol_9`, + `bfcol_0` AS `bfcol_10`, + `bfcol_1` + `bfcol_1` AS `bfcol_11` 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` + `bfcol_8` AS `bfcol_17`, + `bfcol_9` AS `bfcol_18`, + `bfcol_10` AS `bfcol_19`, + `bfcol_11` AS `bfcol_20`, + `bfcol_9` + 1 AS `bfcol_21` 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` + `bfcol_17` AS `bfcol_28`, + `bfcol_18` AS `bfcol_29`, + `bfcol_19` AS `bfcol_30`, + `bfcol_20` AS `bfcol_31`, + `bfcol_21` AS `bfcol_32`, + `bfcol_18` + CAST(`bfcol_19` AS INT64) AS `bfcol_33` 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` + `bfcol_28` AS `bfcol_41`, + `bfcol_29` AS `bfcol_42`, + `bfcol_30` AS `bfcol_43`, + `bfcol_31` AS `bfcol_44`, + `bfcol_32` AS `bfcol_45`, + `bfcol_33` AS `bfcol_46`, + CAST(`bfcol_30` AS INT64) + `bfcol_29` AS `bfcol_47` FROM `bfcte_3` ) SELECT - `bfcol_36` AS `rowindex`, - `bfcol_37` AS `int64_col`, - `bfcol_38` AS `bool_col`, - `bfcol_39` AS `int_add_int`, - `bfcol_40` AS `int_add_1`, - `bfcol_41` AS `int_add_bool`, - `bfcol_42` AS `bool_add_int` -FROM `bfcte_4` \ No newline at end of file + `bfcol_41` AS `rowindex`, + `bfcol_42` AS `int64_col`, + `bfcol_43` AS `bool_col`, + `bfcol_44` AS `int_add_int`, + `bfcol_45` AS `int_add_1`, + `bfcol_46` AS `int_add_bool`, + `bfcol_47` AS `bool_add_int` +FROM `bfcte_4` +ORDER BY + `bfcol_3` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arccos/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arccos/out.sql index df695b7fbc..d3e8c2630b 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,13 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - CASE WHEN ABS(`bfcol_0`) > 1 THEN CAST('NaN' AS FLOAT64) ELSE ACOS(`bfcol_0`) END AS `bfcol_1` + CASE WHEN ABS(`bfcol_0`) > 1 THEN CAST('NaN' AS FLOAT64) ELSE ACOS(`bfcol_0`) END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 5272e4a6a8..d31d1cd5d2 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,13 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` < 1 THEN CAST('NaN' AS FLOAT64) ELSE ACOSH(`bfcol_0`) END AS `bfcol_1` + CASE WHEN `bfcol_0` < 1 THEN CAST('NaN' AS FLOAT64) ELSE ACOSH(`bfcol_0`) END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 3afc7c64b8..6e5f9f88e9 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,13 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - CASE WHEN ABS(`bfcol_0`) > 1 THEN CAST('NaN' AS FLOAT64) ELSE ASIN(`bfcol_0`) END AS `bfcol_1` + CASE WHEN ABS(`bfcol_0`) > 1 THEN CAST('NaN' AS FLOAT64) ELSE ASIN(`bfcol_0`) END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 6313e80e5f..26620bbf30 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,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - ASINH(`bfcol_0`) AS `bfcol_1` + ASINH(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 ec6a22e653..2b03e47671 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,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - ATAN(`bfcol_0`) AS `bfcol_1` + ATAN(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctanh/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctanh/out.sql index 39b5f565fe..1134dfa6be 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,13 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - CASE WHEN ABS(`bfcol_0`) > 1 THEN CAST('NaN' AS FLOAT64) ELSE ATANH(`bfcol_0`) END AS `bfcol_1` + CASE WHEN ABS(`bfcol_0`) > 1 THEN CAST('NaN' AS FLOAT64) ELSE ATANH(`bfcol_0`) END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 0959f3a0ad..ab9047b05b 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,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - CEIL(`bfcol_0`) AS `bfcol_1` + CEIL(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 126d2a63f2..6b25d8a5f8 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,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - COS(`bfcol_0`) AS `bfcol_1` + COS(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 f44dfaac41..2fdd864a9c 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -9,9 +9,11 @@ WITH `bfcte_0` AS ( WHEN ABS(`bfcol_0`) > 709.78 THEN CAST('Infinity' AS FLOAT64) ELSE COSH(`bfcol_0`) - END AS `bfcol_1` + END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_div_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_div_numeric/out.sql index 03d48276a0..b8c95bd9ff 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,122 +1,127 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `float64_col` AS `bfcol_2`, - `rowindex` AS `bfcol_3` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT( + CAST(NULL AS BOOLEAN), + CAST(NULL AS INT64), + CAST(NULL AS FLOAT64), + CAST(NULL AS INT64), + 0 + )]) ), `bfcte_1` AS ( SELECT *, - `bfcol_3` AS `bfcol_8`, - `bfcol_1` AS `bfcol_9`, - `bfcol_0` AS `bfcol_10`, - `bfcol_2` AS `bfcol_11`, - IEEE_DIVIDE(`bfcol_1`, `bfcol_1`) AS `bfcol_12` + `bfcol_3` AS `bfcol_10`, + `bfcol_1` AS `bfcol_11`, + `bfcol_0` AS `bfcol_12`, + `bfcol_2` AS `bfcol_13`, + IEEE_DIVIDE(`bfcol_1`, `bfcol_1`) AS `bfcol_14` 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` + `bfcol_10` AS `bfcol_21`, + `bfcol_11` AS `bfcol_22`, + `bfcol_12` AS `bfcol_23`, + `bfcol_13` AS `bfcol_24`, + `bfcol_14` AS `bfcol_25`, + IEEE_DIVIDE(`bfcol_11`, 1) AS `bfcol_26` 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` + `bfcol_21` AS `bfcol_34`, + `bfcol_22` AS `bfcol_35`, + `bfcol_23` AS `bfcol_36`, + `bfcol_24` AS `bfcol_37`, + `bfcol_25` AS `bfcol_38`, + `bfcol_26` AS `bfcol_39`, + IEEE_DIVIDE(`bfcol_22`, 0.0) AS `bfcol_40` 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` + `bfcol_34` AS `bfcol_49`, + `bfcol_35` AS `bfcol_50`, + `bfcol_36` AS `bfcol_51`, + `bfcol_37` AS `bfcol_52`, + `bfcol_38` AS `bfcol_53`, + `bfcol_39` AS `bfcol_54`, + `bfcol_40` AS `bfcol_55`, + IEEE_DIVIDE(`bfcol_35`, `bfcol_37`) AS `bfcol_56` 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` + `bfcol_49` AS `bfcol_66`, + `bfcol_50` AS `bfcol_67`, + `bfcol_51` AS `bfcol_68`, + `bfcol_52` AS `bfcol_69`, + `bfcol_53` AS `bfcol_70`, + `bfcol_54` AS `bfcol_71`, + `bfcol_55` AS `bfcol_72`, + `bfcol_56` AS `bfcol_73`, + IEEE_DIVIDE(`bfcol_52`, `bfcol_50`) AS `bfcol_74` 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` + `bfcol_66` AS `bfcol_85`, + `bfcol_67` AS `bfcol_86`, + `bfcol_68` AS `bfcol_87`, + `bfcol_69` AS `bfcol_88`, + `bfcol_70` AS `bfcol_89`, + `bfcol_71` AS `bfcol_90`, + `bfcol_72` AS `bfcol_91`, + `bfcol_73` AS `bfcol_92`, + `bfcol_74` AS `bfcol_93`, + IEEE_DIVIDE(`bfcol_69`, 0.0) AS `bfcol_94` 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` + `bfcol_85` AS `bfcol_106`, + `bfcol_86` AS `bfcol_107`, + `bfcol_87` AS `bfcol_108`, + `bfcol_88` AS `bfcol_109`, + `bfcol_89` AS `bfcol_110`, + `bfcol_90` AS `bfcol_111`, + `bfcol_91` AS `bfcol_112`, + `bfcol_92` AS `bfcol_113`, + `bfcol_93` AS `bfcol_114`, + `bfcol_94` AS `bfcol_115`, + IEEE_DIVIDE(`bfcol_86`, CAST(`bfcol_87` AS INT64)) AS `bfcol_116` 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` + `bfcol_106` AS `bfcol_129`, + `bfcol_107` AS `bfcol_130`, + `bfcol_108` AS `bfcol_131`, + `bfcol_109` AS `bfcol_132`, + `bfcol_110` AS `bfcol_133`, + `bfcol_111` AS `bfcol_134`, + `bfcol_112` AS `bfcol_135`, + `bfcol_113` AS `bfcol_136`, + `bfcol_114` AS `bfcol_137`, + `bfcol_115` AS `bfcol_138`, + `bfcol_116` AS `bfcol_139`, + IEEE_DIVIDE(CAST(`bfcol_108` AS INT64), `bfcol_107`) AS `bfcol_140` FROM `bfcte_7` ) SELECT - `bfcol_120` AS `rowindex`, - `bfcol_121` AS `int64_col`, - `bfcol_122` AS `bool_col`, - `bfcol_123` AS `float64_col`, - `bfcol_124` AS `int_div_int`, - `bfcol_125` AS `int_div_1`, - `bfcol_126` AS `int_div_0`, - `bfcol_127` AS `int_div_float`, - `bfcol_128` AS `float_div_int`, - `bfcol_129` AS `float_div_0`, - `bfcol_130` AS `int_div_bool`, - `bfcol_131` AS `bool_div_int` -FROM `bfcte_8` \ No newline at end of file + `bfcol_129` AS `rowindex`, + `bfcol_130` AS `int64_col`, + `bfcol_131` AS `bool_col`, + `bfcol_132` AS `float64_col`, + `bfcol_133` AS `int_div_int`, + `bfcol_134` AS `int_div_1`, + `bfcol_135` AS `int_div_0`, + `bfcol_136` AS `int_div_float`, + `bfcol_137` AS `float_div_int`, + `bfcol_138` AS `float_div_0`, + `bfcol_139` AS `int_div_bool`, + `bfcol_140` AS `bool_div_int` +FROM `bfcte_8` +ORDER BY + `bfcol_4` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_div_timedelta/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_div_timedelta/out.sql index 6e05302fc9..d1c3e1a1a7 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,21 +1,21 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1`, - `timestamp_col` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_6`, - `bfcol_2` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - CAST(FLOOR(IEEE_DIVIDE(86400000000, `bfcol_0`)) AS INT64) AS `bfcol_9` + `bfcol_1` AS `bfcol_8`, + `bfcol_2` AS `bfcol_9`, + `bfcol_0` AS `bfcol_10`, + CAST(FLOOR(IEEE_DIVIDE(86400000000, `bfcol_0`)) AS INT64) AS `bfcol_11` FROM `bfcte_0` ) SELECT - `bfcol_6` AS `rowindex`, - `bfcol_7` AS `timestamp_col`, - `bfcol_8` AS `int64_col`, - `bfcol_9` AS `timedelta_div_numeric` -FROM `bfcte_1` \ No newline at end of file + `bfcol_8` AS `rowindex`, + `bfcol_9` AS `timestamp_col`, + `bfcol_10` AS `int64_col`, + `bfcol_11` AS `timedelta_div_numeric` +FROM `bfcte_1` +ORDER BY + `bfcol_3` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_exp/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_exp/out.sql index 6afa3f85a5..a8e383f459 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -9,9 +9,11 @@ WITH `bfcte_0` AS ( WHEN `bfcol_0` > 709.78 THEN CAST('Infinity' AS FLOAT64) ELSE EXP(`bfcol_0`) - END AS `bfcol_1` + END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 f3768deb4a..6d9feaad03 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -9,9 +9,11 @@ WITH `bfcte_0` AS ( WHEN `bfcol_0` > 709.78 THEN CAST('Infinity' AS FLOAT64) ELSE EXP(`bfcol_0`) - END - 1 AS `bfcol_1` + END - 1 AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 56be1019e5..75ee81ab97 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,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - FLOOR(`bfcol_0`) AS `bfcol_1` + FLOOR(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 bc4f94d306..fae4c326ae 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,18 +1,18 @@ WITH `bfcte_0` AS ( SELECT - `date_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1`, - `timestamp_col` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS DATE), CAST(NULL AS INT64), CAST(NULL AS TIMESTAMP), 0)]) ), `bfcte_1` AS ( SELECT *, - 43200000000 AS `bfcol_6` + 43200000000 AS `bfcol_8` FROM `bfcte_0` ) SELECT `bfcol_1` AS `rowindex`, `bfcol_2` AS `timestamp_col`, `bfcol_0` AS `date_col`, - `bfcol_6` AS `timedelta_div_numeric` -FROM `bfcte_1` \ No newline at end of file + `bfcol_8` AS `timedelta_div_numeric` +FROM `bfcte_1` +ORDER BY + `bfcol_3` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_ln/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_ln/out.sql index 5d3d1ae09b..d6af10d7d8 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,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` <= 0 THEN CAST('NaN' AS FLOAT64) ELSE LN(`bfcol_0`) END AS `bfcol_1` + CASE WHEN `bfcol_0` <= 0 THEN CAST('NaN' AS FLOAT64) ELSE LN(`bfcol_0`) END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 532776278d..d7ae478c2e 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,13 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` <= 0 THEN CAST('NaN' AS FLOAT64) ELSE LOG(10, `bfcol_0`) END AS `bfcol_1` + CASE WHEN `bfcol_0` <= 0 THEN CAST('NaN' AS FLOAT64) ELSE LOG(10, `bfcol_0`) END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 3904025cf8..b2901207bf 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,13 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` <= -1 THEN CAST('NaN' AS FLOAT64) ELSE LN(1 + `bfcol_0`) END AS `bfcol_1` + CASE WHEN `bfcol_0` <= -1 THEN CAST('NaN' AS FLOAT64) ELSE LN(1 + `bfcol_0`) END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mod_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mod_numeric/out.sql index 7913b43aa6..44c92972e8 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `float64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS FLOAT64), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_0` AS `bfcol_7`, - `bfcol_1` AS `bfcol_8`, + `bfcol_2` AS `bfcol_8`, + `bfcol_0` AS `bfcol_9`, + `bfcol_1` AS `bfcol_10`, CASE WHEN `bfcol_0` = CAST(0 AS INT64) THEN CAST(0 AS INT64) * `bfcol_0` @@ -28,225 +26,227 @@ WITH `bfcte_0` AS ( MOD(`bfcol_0`, `bfcol_0`) ) ELSE MOD(`bfcol_0`, `bfcol_0`) - END AS `bfcol_9` + END AS `bfcol_11` 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_8` AS `bfcol_17`, + `bfcol_9` AS `bfcol_18`, + `bfcol_10` AS `bfcol_19`, + `bfcol_11` AS `bfcol_20`, CASE - WHEN -`bfcol_7` = CAST(0 AS INT64) - THEN CAST(0 AS INT64) * `bfcol_7` - WHEN -`bfcol_7` < CAST(0 AS INT64) + WHEN -`bfcol_9` = CAST(0 AS INT64) + THEN CAST(0 AS INT64) * `bfcol_9` + WHEN -`bfcol_9` < CAST(0 AS INT64) AND ( - MOD(`bfcol_7`, -`bfcol_7`) + MOD(`bfcol_9`, -`bfcol_9`) ) > CAST(0 AS INT64) - THEN -`bfcol_7` + ( - MOD(`bfcol_7`, -`bfcol_7`) + THEN -`bfcol_9` + ( + MOD(`bfcol_9`, -`bfcol_9`) ) - WHEN -`bfcol_7` > CAST(0 AS INT64) + WHEN -`bfcol_9` > CAST(0 AS INT64) AND ( - MOD(`bfcol_7`, -`bfcol_7`) + MOD(`bfcol_9`, -`bfcol_9`) ) < CAST(0 AS INT64) - THEN -`bfcol_7` + ( - MOD(`bfcol_7`, -`bfcol_7`) + THEN -`bfcol_9` + ( + MOD(`bfcol_9`, -`bfcol_9`) ) - ELSE MOD(`bfcol_7`, -`bfcol_7`) - END AS `bfcol_18` + ELSE MOD(`bfcol_9`, -`bfcol_9`) + END AS `bfcol_21` 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_17` AS `bfcol_28`, + `bfcol_18` AS `bfcol_29`, + `bfcol_19` AS `bfcol_30`, + `bfcol_20` AS `bfcol_31`, + `bfcol_21` AS `bfcol_32`, CASE WHEN 1 = CAST(0 AS INT64) - THEN CAST(0 AS INT64) * `bfcol_15` + THEN CAST(0 AS INT64) * `bfcol_18` WHEN 1 < CAST(0 AS INT64) AND ( - MOD(`bfcol_15`, 1) + MOD(`bfcol_18`, 1) ) > CAST(0 AS INT64) THEN 1 + ( - MOD(`bfcol_15`, 1) + MOD(`bfcol_18`, 1) ) WHEN 1 > CAST(0 AS INT64) AND ( - MOD(`bfcol_15`, 1) + MOD(`bfcol_18`, 1) ) < CAST(0 AS INT64) THEN 1 + ( - MOD(`bfcol_15`, 1) + MOD(`bfcol_18`, 1) ) - ELSE MOD(`bfcol_15`, 1) - END AS `bfcol_29` + ELSE MOD(`bfcol_18`, 1) + END AS `bfcol_33` FROM `bfcte_2` ), `bfcte_4` AS ( SELECT *, - `bfcol_24` AS `bfcol_36`, - `bfcol_25` AS `bfcol_37`, - `bfcol_26` AS `bfcol_38`, - `bfcol_27` AS `bfcol_39`, - `bfcol_28` AS `bfcol_40`, - `bfcol_29` AS `bfcol_41`, + `bfcol_28` AS `bfcol_41`, + `bfcol_29` AS `bfcol_42`, + `bfcol_30` AS `bfcol_43`, + `bfcol_31` AS `bfcol_44`, + `bfcol_32` AS `bfcol_45`, + `bfcol_33` AS `bfcol_46`, CASE WHEN 0 = CAST(0 AS INT64) - THEN CAST(0 AS INT64) * `bfcol_25` + THEN CAST(0 AS INT64) * `bfcol_29` WHEN 0 < CAST(0 AS INT64) AND ( - MOD(`bfcol_25`, 0) + MOD(`bfcol_29`, 0) ) > CAST(0 AS INT64) THEN 0 + ( - MOD(`bfcol_25`, 0) + MOD(`bfcol_29`, 0) ) WHEN 0 > CAST(0 AS INT64) AND ( - MOD(`bfcol_25`, 0) + MOD(`bfcol_29`, 0) ) < CAST(0 AS INT64) THEN 0 + ( - MOD(`bfcol_25`, 0) + MOD(`bfcol_29`, 0) ) - ELSE MOD(`bfcol_25`, 0) - END AS `bfcol_42` + ELSE MOD(`bfcol_29`, 0) + END AS `bfcol_47` 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`, + `bfcol_41` AS `bfcol_56`, + `bfcol_42` AS `bfcol_57`, + `bfcol_43` AS `bfcol_58`, + `bfcol_44` AS `bfcol_59`, + `bfcol_45` AS `bfcol_60`, + `bfcol_46` AS `bfcol_61`, + `bfcol_47` AS `bfcol_62`, 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) + WHEN CAST(`bfcol_43` AS BIGNUMERIC) = CAST(0 AS INT64) + THEN CAST('NaN' AS FLOAT64) * CAST(`bfcol_43` AS BIGNUMERIC) + WHEN CAST(`bfcol_43` AS BIGNUMERIC) < CAST(0 AS INT64) AND ( - MOD(CAST(`bfcol_38` AS BIGNUMERIC), CAST(`bfcol_38` AS BIGNUMERIC)) + MOD(CAST(`bfcol_43` AS BIGNUMERIC), CAST(`bfcol_43` AS BIGNUMERIC)) ) > CAST(0 AS INT64) - THEN CAST(`bfcol_38` AS BIGNUMERIC) + ( - MOD(CAST(`bfcol_38` AS BIGNUMERIC), CAST(`bfcol_38` AS BIGNUMERIC)) + THEN CAST(`bfcol_43` AS BIGNUMERIC) + ( + MOD(CAST(`bfcol_43` AS BIGNUMERIC), CAST(`bfcol_43` AS BIGNUMERIC)) ) - WHEN CAST(`bfcol_38` AS BIGNUMERIC) > CAST(0 AS INT64) + WHEN CAST(`bfcol_43` AS BIGNUMERIC) > CAST(0 AS INT64) AND ( - MOD(CAST(`bfcol_38` AS BIGNUMERIC), CAST(`bfcol_38` AS BIGNUMERIC)) + MOD(CAST(`bfcol_43` AS BIGNUMERIC), CAST(`bfcol_43` AS BIGNUMERIC)) ) < CAST(0 AS INT64) - THEN CAST(`bfcol_38` AS BIGNUMERIC) + ( - MOD(CAST(`bfcol_38` AS BIGNUMERIC), CAST(`bfcol_38` AS BIGNUMERIC)) + THEN CAST(`bfcol_43` AS BIGNUMERIC) + ( + MOD(CAST(`bfcol_43` AS BIGNUMERIC), CAST(`bfcol_43` AS BIGNUMERIC)) ) - ELSE MOD(CAST(`bfcol_38` AS BIGNUMERIC), CAST(`bfcol_38` AS BIGNUMERIC)) - END AS `bfcol_57` + ELSE MOD(CAST(`bfcol_43` AS BIGNUMERIC), CAST(`bfcol_43` AS BIGNUMERIC)) + END AS `bfcol_63` 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`, + `bfcol_56` AS `bfcol_73`, + `bfcol_57` AS `bfcol_74`, + `bfcol_58` AS `bfcol_75`, + `bfcol_59` AS `bfcol_76`, + `bfcol_60` AS `bfcol_77`, + `bfcol_61` AS `bfcol_78`, + `bfcol_62` AS `bfcol_79`, + `bfcol_63` AS `bfcol_80`, 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) + WHEN CAST(-`bfcol_58` AS BIGNUMERIC) = CAST(0 AS INT64) + THEN CAST('NaN' AS FLOAT64) * CAST(`bfcol_58` AS BIGNUMERIC) + WHEN CAST(-`bfcol_58` AS BIGNUMERIC) < CAST(0 AS INT64) AND ( - MOD(CAST(`bfcol_52` AS BIGNUMERIC), CAST(-`bfcol_52` AS BIGNUMERIC)) + MOD(CAST(`bfcol_58` AS BIGNUMERIC), CAST(-`bfcol_58` AS BIGNUMERIC)) ) > CAST(0 AS INT64) - THEN CAST(-`bfcol_52` AS BIGNUMERIC) + ( - MOD(CAST(`bfcol_52` AS BIGNUMERIC), CAST(-`bfcol_52` AS BIGNUMERIC)) + THEN CAST(-`bfcol_58` AS BIGNUMERIC) + ( + MOD(CAST(`bfcol_58` AS BIGNUMERIC), CAST(-`bfcol_58` AS BIGNUMERIC)) ) - WHEN CAST(-`bfcol_52` AS BIGNUMERIC) > CAST(0 AS INT64) + WHEN CAST(-`bfcol_58` AS BIGNUMERIC) > CAST(0 AS INT64) AND ( - MOD(CAST(`bfcol_52` AS BIGNUMERIC), CAST(-`bfcol_52` AS BIGNUMERIC)) + MOD(CAST(`bfcol_58` AS BIGNUMERIC), CAST(-`bfcol_58` AS BIGNUMERIC)) ) < CAST(0 AS INT64) - THEN CAST(-`bfcol_52` AS BIGNUMERIC) + ( - MOD(CAST(`bfcol_52` AS BIGNUMERIC), CAST(-`bfcol_52` AS BIGNUMERIC)) + THEN CAST(-`bfcol_58` AS BIGNUMERIC) + ( + MOD(CAST(`bfcol_58` AS BIGNUMERIC), CAST(-`bfcol_58` AS BIGNUMERIC)) ) - ELSE MOD(CAST(`bfcol_52` AS BIGNUMERIC), CAST(-`bfcol_52` AS BIGNUMERIC)) - END AS `bfcol_74` + ELSE MOD(CAST(`bfcol_58` AS BIGNUMERIC), CAST(-`bfcol_58` AS BIGNUMERIC)) + END AS `bfcol_81` 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`, + `bfcol_73` AS `bfcol_92`, + `bfcol_74` AS `bfcol_93`, + `bfcol_75` AS `bfcol_94`, + `bfcol_76` AS `bfcol_95`, + `bfcol_77` AS `bfcol_96`, + `bfcol_78` AS `bfcol_97`, + `bfcol_79` AS `bfcol_98`, + `bfcol_80` AS `bfcol_99`, + `bfcol_81` AS `bfcol_100`, CASE WHEN CAST(1 AS BIGNUMERIC) = CAST(0 AS INT64) - THEN CAST('NaN' AS FLOAT64) * CAST(`bfcol_68` AS BIGNUMERIC) + THEN CAST('NaN' AS FLOAT64) * CAST(`bfcol_75` AS BIGNUMERIC) WHEN CAST(1 AS BIGNUMERIC) < CAST(0 AS INT64) AND ( - MOD(CAST(`bfcol_68` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) + MOD(CAST(`bfcol_75` 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)) + MOD(CAST(`bfcol_75` 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)) + MOD(CAST(`bfcol_75` 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)) + MOD(CAST(`bfcol_75` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) ) - ELSE MOD(CAST(`bfcol_68` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) - END AS `bfcol_93` + ELSE MOD(CAST(`bfcol_75` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) + END AS `bfcol_101` 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`, + `bfcol_92` AS `bfcol_113`, + `bfcol_93` AS `bfcol_114`, + `bfcol_94` AS `bfcol_115`, + `bfcol_95` AS `bfcol_116`, + `bfcol_96` AS `bfcol_117`, + `bfcol_97` AS `bfcol_118`, + `bfcol_98` AS `bfcol_119`, + `bfcol_99` AS `bfcol_120`, + `bfcol_100` AS `bfcol_121`, + `bfcol_101` AS `bfcol_122`, CASE WHEN CAST(0 AS BIGNUMERIC) = CAST(0 AS INT64) - THEN CAST('NaN' AS FLOAT64) * CAST(`bfcol_86` AS BIGNUMERIC) + THEN CAST('NaN' AS FLOAT64) * CAST(`bfcol_94` AS BIGNUMERIC) WHEN CAST(0 AS BIGNUMERIC) < CAST(0 AS INT64) AND ( - MOD(CAST(`bfcol_86` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) + MOD(CAST(`bfcol_94` 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)) + MOD(CAST(`bfcol_94` 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)) + MOD(CAST(`bfcol_94` 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)) + MOD(CAST(`bfcol_94` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) ) - ELSE MOD(CAST(`bfcol_86` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) - END AS `bfcol_114` + ELSE MOD(CAST(`bfcol_94` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) + END AS `bfcol_123` FROM `bfcte_7` ) SELECT - `bfcol_104` AS `rowindex`, - `bfcol_105` AS `int64_col`, - `bfcol_106` AS `float64_col`, - `bfcol_107` AS `int_mod_int`, - `bfcol_108` AS `int_mod_int_neg`, - `bfcol_109` AS `int_mod_1`, - `bfcol_110` AS `int_mod_0`, - `bfcol_111` AS `float_mod_float`, - `bfcol_112` AS `float_mod_float_neg`, - `bfcol_113` AS `float_mod_1`, - `bfcol_114` AS `float_mod_0` -FROM `bfcte_8` \ No newline at end of file + `bfcol_113` AS `rowindex`, + `bfcol_114` AS `int64_col`, + `bfcol_115` AS `float64_col`, + `bfcol_116` AS `int_mod_int`, + `bfcol_117` AS `int_mod_int_neg`, + `bfcol_118` AS `int_mod_1`, + `bfcol_119` AS `int_mod_0`, + `bfcol_120` AS `float_mod_float`, + `bfcol_121` AS `float_mod_float_neg`, + `bfcol_122` AS `float_mod_1`, + `bfcol_123` AS `float_mod_0` +FROM `bfcte_8` +ORDER BY + `bfcol_3` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mul_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mul_numeric/out.sql index a9c81f4744..e40e992a3b 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,54 +1,54 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_1` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - `bfcol_1` * `bfcol_1` AS `bfcol_9` + `bfcol_2` AS `bfcol_8`, + `bfcol_1` AS `bfcol_9`, + `bfcol_0` AS `bfcol_10`, + `bfcol_1` * `bfcol_1` AS `bfcol_11` 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` + `bfcol_8` AS `bfcol_17`, + `bfcol_9` AS `bfcol_18`, + `bfcol_10` AS `bfcol_19`, + `bfcol_11` AS `bfcol_20`, + `bfcol_9` * 1 AS `bfcol_21` 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` + `bfcol_17` AS `bfcol_28`, + `bfcol_18` AS `bfcol_29`, + `bfcol_19` AS `bfcol_30`, + `bfcol_20` AS `bfcol_31`, + `bfcol_21` AS `bfcol_32`, + `bfcol_18` * CAST(`bfcol_19` AS INT64) AS `bfcol_33` 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` + `bfcol_28` AS `bfcol_41`, + `bfcol_29` AS `bfcol_42`, + `bfcol_30` AS `bfcol_43`, + `bfcol_31` AS `bfcol_44`, + `bfcol_32` AS `bfcol_45`, + `bfcol_33` AS `bfcol_46`, + CAST(`bfcol_30` AS INT64) * `bfcol_29` AS `bfcol_47` FROM `bfcte_3` ) SELECT - `bfcol_36` AS `rowindex`, - `bfcol_37` AS `int64_col`, - `bfcol_38` AS `bool_col`, - `bfcol_39` AS `int_mul_int`, - `bfcol_40` AS `int_mul_1`, - `bfcol_41` AS `int_mul_bool`, - `bfcol_42` AS `bool_mul_int` -FROM `bfcte_4` \ No newline at end of file + `bfcol_41` AS `rowindex`, + `bfcol_42` AS `int64_col`, + `bfcol_43` AS `bool_col`, + `bfcol_44` AS `int_mul_int`, + `bfcol_45` AS `int_mul_1`, + `bfcol_46` AS `int_mul_bool`, + `bfcol_47` AS `bool_mul_int` +FROM `bfcte_4` +ORDER BY + `bfcol_3` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_neg/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_neg/out.sql index 46c58f766d..8a05f47150 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,13 +1,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - -`bfcol_0` AS `bfcol_1` + -`bfcol_0` AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 2d6322a182..e2af61f23d 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,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_0` AS `bfcol_1` + `bfcol_0` AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sin/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sin/out.sql index 62a5cff0b5..f5855f9651 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,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - SIN(`bfcol_0`) AS `bfcol_1` + SIN(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 711dba94a9..6658def692 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -9,9 +9,11 @@ WITH `bfcte_0` AS ( WHEN ABS(`bfcol_0`) > 709.78 THEN SIGN(`bfcol_0`) * CAST('Infinity' AS FLOAT64) ELSE SINH(`bfcol_0`) - END AS `bfcol_1` + END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 e6a93e5e6c..4dd094832e 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,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` < 0 THEN CAST('NaN' AS FLOAT64) ELSE SQRT(`bfcol_0`) END AS `bfcol_1` + CASE WHEN `bfcol_0` < 0 THEN CAST('NaN' AS FLOAT64) ELSE SQRT(`bfcol_0`) END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 a43fa2df67..37518df445 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,54 +1,54 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_1` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8`, - `bfcol_1` - `bfcol_1` AS `bfcol_9` + `bfcol_2` AS `bfcol_8`, + `bfcol_1` AS `bfcol_9`, + `bfcol_0` AS `bfcol_10`, + `bfcol_1` - `bfcol_1` AS `bfcol_11` 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` + `bfcol_8` AS `bfcol_17`, + `bfcol_9` AS `bfcol_18`, + `bfcol_10` AS `bfcol_19`, + `bfcol_11` AS `bfcol_20`, + `bfcol_9` - 1 AS `bfcol_21` 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` + `bfcol_17` AS `bfcol_28`, + `bfcol_18` AS `bfcol_29`, + `bfcol_19` AS `bfcol_30`, + `bfcol_20` AS `bfcol_31`, + `bfcol_21` AS `bfcol_32`, + `bfcol_18` - CAST(`bfcol_19` AS INT64) AS `bfcol_33` 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` + `bfcol_28` AS `bfcol_41`, + `bfcol_29` AS `bfcol_42`, + `bfcol_30` AS `bfcol_43`, + `bfcol_31` AS `bfcol_44`, + `bfcol_32` AS `bfcol_45`, + `bfcol_33` AS `bfcol_46`, + CAST(`bfcol_30` AS INT64) - `bfcol_29` AS `bfcol_47` FROM `bfcte_3` ) SELECT - `bfcol_36` AS `rowindex`, - `bfcol_37` AS `int64_col`, - `bfcol_38` AS `bool_col`, - `bfcol_39` AS `int_add_int`, - `bfcol_40` AS `int_add_1`, - `bfcol_41` AS `int_add_bool`, - `bfcol_42` AS `bool_add_int` -FROM `bfcte_4` \ No newline at end of file + `bfcol_41` AS `rowindex`, + `bfcol_42` AS `int64_col`, + `bfcol_43` AS `bool_col`, + `bfcol_44` AS `int_add_int`, + `bfcol_45` AS `int_add_1`, + `bfcol_46` AS `int_add_bool`, + `bfcol_47` AS `bool_add_int` +FROM `bfcte_4` +ORDER BY + `bfcol_3` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_tan/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_tan/out.sql index 5fac274b6b..8a3d3e16e4 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,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - TAN(`bfcol_0`) AS `bfcol_1` + TAN(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 5d1a5a5320..e94733dc1f 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,15 @@ WITH `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) ), `bfcte_1` AS ( SELECT *, - TANH(`bfcol_0`) AS `bfcol_1` + TANH(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `float64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `float64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 de5129a6a3..9b3b4b9216 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - CONCAT(`bfcol_0`, 'a') AS `bfcol_1` + CONCAT(`bfcol_0`, 'a') AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 7af1708347..2063145ad0 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - INITCAP(`bfcol_0`) AS `bfcol_1` + INITCAP(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 e3ac5ec033..f8cea746e9 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,17 +1,19 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - ENDS_WITH(`bfcol_0`, 'ab') AS `bfcol_1`, - ENDS_WITH(`bfcol_0`, 'ab') OR ENDS_WITH(`bfcol_0`, 'cd') AS `bfcol_2`, - FALSE AS `bfcol_3` + ENDS_WITH(`bfcol_0`, 'ab') AS `bfcol_2`, + ENDS_WITH(`bfcol_0`, 'ab') OR ENDS_WITH(`bfcol_0`, 'cd') AS `bfcol_3`, + FALSE AS `bfcol_4` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `single`, - `bfcol_2` AS `double`, - `bfcol_3` AS `empty` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `single`, + `bfcol_3` AS `double`, + `bfcol_4` AS `empty` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isalnum/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isalnum/out.sql index 02e0094742..6eb636c49f 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, '^(\\p{N}|\\p{L})+$') AS `bfcol_1` + REGEXP_CONTAINS(`bfcol_0`, '^(\\p{N}|\\p{L})+$') AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 2615d0452f..162f3494a1 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, '^\\p{L}+$') AS `bfcol_1` + REGEXP_CONTAINS(`bfcol_0`, '^\\p{L}+$') AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 bc1fce3dbc..dfdef672ca 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, '^\\d+$') AS `bfcol_1` + REGEXP_CONTAINS(`bfcol_0`, '^\\d+$') AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 1cb3a883ab..90b81a177e 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, '^\\p{Nd}+$') AS `bfcol_1` + REGEXP_CONTAINS(`bfcol_0`, '^\\p{Nd}+$') AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 a621b71a3b..3d6cd802e2 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - LOWER(`bfcol_0`) = `bfcol_0` AND UPPER(`bfcol_0`) <> `bfcol_0` AS `bfcol_1` + LOWER(`bfcol_0`) = `bfcol_0` AND UPPER(`bfcol_0`) <> `bfcol_0` AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 6566c1dd4c..8610b3bb9b 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, '^\\pN+$') AS `bfcol_1` + REGEXP_CONTAINS(`bfcol_0`, '^\\pN+$') AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 aff12102be..df777d073f 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, '^\\s+$') AS `bfcol_1` + REGEXP_CONTAINS(`bfcol_0`, '^\\s+$') AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 03fe005910..2c28f657fb 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - UPPER(`bfcol_0`) = `bfcol_0` AND LOWER(`bfcol_0`) <> `bfcol_0` AS `bfcol_1` + UPPER(`bfcol_0`) = `bfcol_0` AND LOWER(`bfcol_0`) <> `bfcol_0` AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 35fd087bc7..b4fbd15fd6 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - LENGTH(`bfcol_0`) AS `bfcol_1` + LENGTH(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 e730cdee15..e595bee41d 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - LOWER(`bfcol_0`) AS `bfcol_1` + LOWER(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 49ed89b40b..b9d506a61b 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - TRIM(`bfcol_0`, ' ') AS `bfcol_1` + TRIM(`bfcol_0`, ' ') AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 149df6706c..18f08df220 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - REGEXP_REPLACE(`bfcol_0`, 'e', 'a') AS `bfcol_1` + REGEXP_REPLACE(`bfcol_0`, 'e', 'a') AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 3bd7e0e47e..47915478bb 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - REPLACE(`bfcol_0`, 'e', 'a') AS `bfcol_1` + REPLACE(`bfcol_0`, 'e', 'a') AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 1ef1074149..50173b61c0 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - REVERSE(`bfcol_0`) AS `bfcol_1` + REVERSE(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 49ed89b40b..b9d506a61b 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - TRIM(`bfcol_0`, ' ') AS `bfcol_1` + TRIM(`bfcol_0`, ' ') AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 9679c95f75..44a2f5ce33 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,17 +1,19 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - STARTS_WITH(`bfcol_0`, 'ab') AS `bfcol_1`, - STARTS_WITH(`bfcol_0`, 'ab') OR STARTS_WITH(`bfcol_0`, 'cd') AS `bfcol_2`, - FALSE AS `bfcol_3` + STARTS_WITH(`bfcol_0`, 'ab') AS `bfcol_2`, + STARTS_WITH(`bfcol_0`, 'ab') OR STARTS_WITH(`bfcol_0`, 'cd') AS `bfcol_3`, + FALSE AS `bfcol_4` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `single`, - `bfcol_2` AS `double`, - `bfcol_3` AS `empty` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `single`, + `bfcol_3` AS `double`, + `bfcol_4` AS `empty` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_contains/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_contains/out.sql index a1aa0539ee..41834fe04a 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_0` LIKE '%e%' AS `bfcol_1` + `bfcol_0` LIKE '%e%' AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 d0383172cb..7dda9e2e16 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, 'e') AS `bfcol_1` + REGEXP_CONTAINS(`bfcol_0`, 'e') AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 a7fac093e2..8008fd89c5 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - REGEXP_EXTRACT(`bfcol_0`, '([a-z]*)') AS `bfcol_1` + REGEXP_EXTRACT(`bfcol_0`, '([a-z]*)') AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 b850262d80..54535ea4da 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,19 +1,21 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - INSTR(`bfcol_0`, 'e', 1) - 1 AS `bfcol_1`, - INSTR(`bfcol_0`, 'e', 3) - 1 AS `bfcol_2`, - INSTR(SUBSTRING(`bfcol_0`, 1, 5), 'e') - 1 AS `bfcol_3`, - INSTR(SUBSTRING(`bfcol_0`, 3, 3), 'e') - 1 AS `bfcol_4` + INSTR(`bfcol_0`, 'e', 1) - 1 AS `bfcol_2`, + INSTR(`bfcol_0`, 'e', 3) - 1 AS `bfcol_3`, + INSTR(SUBSTRING(`bfcol_0`, 1, 5), 'e') - 1 AS `bfcol_4`, + INSTR(SUBSTRING(`bfcol_0`, 3, 3), 'e') - 1 AS `bfcol_5` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `none_none`, - `bfcol_2` AS `start_none`, - `bfcol_3` AS `none_end`, - `bfcol_4` AS `start_end` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `none_none`, + `bfcol_3` AS `start_none`, + `bfcol_4` AS `none_end`, + `bfcol_5` AS `start_end` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_get/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_get/out.sql index 1278c3435d..5762b04966 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - SUBSTRING(`bfcol_0`, 2, 1) AS `bfcol_1` + SUBSTRING(`bfcol_0`, 2, 1) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 4226843122..4adc5586cb 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,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - LPAD(`bfcol_0`, GREATEST(LENGTH(`bfcol_0`), 10), '-') AS `bfcol_1`, - RPAD(`bfcol_0`, GREATEST(LENGTH(`bfcol_0`), 10), '-') AS `bfcol_2`, + LPAD(`bfcol_0`, GREATEST(LENGTH(`bfcol_0`), 10), '-') AS `bfcol_2`, + RPAD(`bfcol_0`, GREATEST(LENGTH(`bfcol_0`), 10), '-') AS `bfcol_3`, RPAD( LPAD( `bfcol_0`, @@ -15,11 +15,13 @@ WITH `bfcte_0` AS ( ), GREATEST(LENGTH(`bfcol_0`), 10), '-' - ) AS `bfcol_3` + ) AS `bfcol_4` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `left`, - `bfcol_2` AS `right`, - `bfcol_3` AS `both` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `left`, + `bfcol_3` AS `right`, + `bfcol_4` AS `both` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_repeat/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_repeat/out.sql index 1c94cfafe2..842f88d7da 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - REPEAT(`bfcol_0`, 2) AS `bfcol_1` + REPEAT(`bfcol_0`, 2) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 4f97ab3ac6..ae0a2da354 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - SUBSTRING(`bfcol_0`, 2, 2) AS `bfcol_1` + SUBSTRING(`bfcol_0`, 2, 2) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 de5129a6a3..9b3b4b9216 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - CONCAT(`bfcol_0`, 'a') AS `bfcol_1` + CONCAT(`bfcol_0`, 'a') AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 fea0d6eaf1..b4f6245041 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - SPLIT(`bfcol_0`, ',') AS `bfcol_1` + SPLIT(`bfcol_0`, ',') AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 311f2c1727..93a2721d8d 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - TRIM(' ', `bfcol_0`) AS `bfcol_1` + TRIM(' ', `bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 d22c8cff5a..80aa899391 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,15 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, - UPPER(`bfcol_0`) AS `bfcol_1` + UPPER(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 e5d70ab44b..631baad999 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `string_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) ), `bfcte_1` AS ( SELECT *, @@ -9,9 +9,11 @@ WITH `bfcte_0` AS ( WHEN SUBSTRING(`bfcol_0`, 1, 1) = '-' THEN CONCAT('-', LPAD(SUBSTRING(`bfcol_0`, 1), 9, '0')) ELSE LPAD(`bfcol_0`, 10, '0') - END AS `bfcol_1` + END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 60ae78b755..34c4f05361 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,15 +1,20 @@ WITH `bfcte_0` AS ( SELECT - `people` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`nested_structs_types` + * + FROM UNNEST(ARRAY>, `bfcol_1` INT64>>[STRUCT( + STRUCT('' AS `name`, 0 AS `age`, STRUCT('' AS `city`, '' AS `country`) AS `address`), + 0 + )]) ), `bfcte_1` AS ( SELECT *, - `bfcol_0`.`name` AS `bfcol_1`, - `bfcol_0`.`name` AS `bfcol_2` + `bfcol_0`.`name` AS `bfcol_2`, + `bfcol_0`.`name` AS `bfcol_3` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `string`, - `bfcol_2` AS `int` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `string`, + `bfcol_3` AS `int` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 1a8b9f4e39..0e93434b14 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,15 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - FLOOR(`bfcol_0`) AS `bfcol_1` + FLOOR(`bfcol_0`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_1` AS `int64_col` -FROM `bfcte_1` \ No newline at end of file + `bfcol_2` AS `int64_col` +FROM `bfcte_1` +ORDER BY + `bfcol_1` ASC NULLS LAST \ 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 057e6c778e..643bcb0b5b 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,37 +1,38 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_4`, - `bfcol_0` AS `bfcol_5`, - `bfcol_0` AS `bfcol_6` + `bfcol_1` AS `bfcol_6`, + `bfcol_0` AS `bfcol_7`, + `bfcol_0` AS `bfcol_8` 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` + `bfcol_6` AS `bfcol_13`, + `bfcol_7` AS `bfcol_14`, + `bfcol_8` AS `bfcol_15`, + `bfcol_7` * 1000000 AS `bfcol_16` 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` + `bfcol_13` AS `bfcol_22`, + `bfcol_14` AS `bfcol_23`, + `bfcol_15` AS `bfcol_24`, + `bfcol_16` AS `bfcol_25`, + `bfcol_14` * 604800000000 AS `bfcol_26` FROM `bfcte_2` ) SELECT - `bfcol_18` AS `rowindex`, - `bfcol_19` AS `int64_col`, - `bfcol_20` AS `duration_us`, - `bfcol_21` AS `duration_s`, - `bfcol_22` AS `duration_w` -FROM `bfcte_3` \ No newline at end of file + `bfcol_22` AS `rowindex`, + `bfcol_23` AS `int64_col`, + `bfcol_24` AS `duration_us`, + `bfcol_25` AS `duration_s`, + `bfcol_26` AS `duration_w` +FROM `bfcte_3` +ORDER BY + `bfcol_2` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_aggregate/test_compile_aggregate/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_aggregate/test_compile_aggregate/out.sql index 02bba41a22..4fb550cd04 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,8 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_too` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64))]) ), `bfcte_1` AS ( SELECT *, diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_aggregate/test_compile_aggregate_wo_dropna/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_aggregate/test_compile_aggregate_wo_dropna/out.sql index b8e127eb77..983e8050d1 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,8 +1,7 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_too` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64))]) ), `bfcte_1` AS ( SELECT *, diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat/out.sql index faff452761..930fea1fca 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,82 +1,78 @@ WITH `bfcte_1` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1`, - `string_col` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) ), `bfcte_3` AS ( SELECT *, - ROW_NUMBER() OVER () AS `bfcol_7` + ROW_NUMBER() OVER (ORDER BY `bfcol_3` ASC NULLS LAST) AS `bfcol_9` FROM `bfcte_1` ), `bfcte_5` AS ( SELECT *, - 0 AS `bfcol_8` + 0 AS `bfcol_15` FROM `bfcte_3` ), `bfcte_6` AS ( SELECT - `bfcol_1` AS `bfcol_9`, - `bfcol_1` AS `bfcol_10`, - `bfcol_0` AS `bfcol_11`, - `bfcol_2` AS `bfcol_12`, - `bfcol_8` AS `bfcol_13`, - `bfcol_7` AS `bfcol_14` + `bfcol_1` AS `bfcol_16`, + `bfcol_1` AS `bfcol_17`, + `bfcol_0` AS `bfcol_18`, + `bfcol_2` AS `bfcol_19`, + `bfcol_15` AS `bfcol_20`, + `bfcol_9` AS `bfcol_21` FROM `bfcte_5` ), `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_15`, - `rowindex` AS `bfcol_16`, - `string_col` AS `bfcol_17` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) ), `bfcte_2` AS ( SELECT *, - ROW_NUMBER() OVER () AS `bfcol_22` + ROW_NUMBER() OVER (ORDER BY `bfcol_25` ASC NULLS LAST) AS `bfcol_31` FROM `bfcte_0` ), `bfcte_4` AS ( SELECT *, - 1 AS `bfcol_23` + 1 AS `bfcol_37` FROM `bfcte_2` ), `bfcte_7` AS ( SELECT - `bfcol_16` AS `bfcol_24`, - `bfcol_16` AS `bfcol_25`, - `bfcol_15` AS `bfcol_26`, - `bfcol_17` AS `bfcol_27`, - `bfcol_23` AS `bfcol_28`, - `bfcol_22` AS `bfcol_29` + `bfcol_23` AS `bfcol_38`, + `bfcol_23` AS `bfcol_39`, + `bfcol_22` AS `bfcol_40`, + `bfcol_24` AS `bfcol_41`, + `bfcol_37` AS `bfcol_42`, + `bfcol_31` AS `bfcol_43` 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` + `bfcol_16` AS `bfcol_44`, + `bfcol_17` AS `bfcol_45`, + `bfcol_18` AS `bfcol_46`, + `bfcol_19` AS `bfcol_47`, + `bfcol_20` AS `bfcol_48`, + `bfcol_21` AS `bfcol_49` 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` + `bfcol_38` AS `bfcol_44`, + `bfcol_39` AS `bfcol_45`, + `bfcol_40` AS `bfcol_46`, + `bfcol_41` AS `bfcol_47`, + `bfcol_42` AS `bfcol_48`, + `bfcol_43` AS `bfcol_49` FROM `bfcte_7` ) ) SELECT - `bfcol_30` AS `rowindex`, - `bfcol_31` AS `rowindex_1`, - `bfcol_32` AS `int64_col`, - `bfcol_33` AS `string_col` + `bfcol_44` AS `rowindex`, + `bfcol_45` AS `rowindex_1`, + `bfcol_46` AS `int64_col`, + `bfcol_47` AS `string_col` FROM `bfcte_8` ORDER BY - `bfcol_34` ASC NULLS LAST, - `bfcol_35` ASC NULLS LAST \ No newline at end of file + `bfcol_48` ASC NULLS LAST, + `bfcol_49` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat_filter_sorted/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat_filter_sorted/out.sql index 90825afd20..96789de8d7 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,142 +1,136 @@ WITH `bfcte_3` AS ( SELECT - `int64_col` AS `bfcol_0`, - `float64_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS FLOAT64), 0)]) ), `bfcte_7` AS ( SELECT *, - ROW_NUMBER() OVER (ORDER BY `bfcol_0` ASC NULLS LAST) AS `bfcol_4` + ROW_NUMBER() OVER (ORDER BY `bfcol_0` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST) AS `bfcol_6` FROM `bfcte_3` ), `bfcte_11` AS ( SELECT *, - 0 AS `bfcol_5` + 0 AS `bfcol_10` FROM `bfcte_7` ), `bfcte_14` AS ( SELECT - `bfcol_1` AS `bfcol_6`, - `bfcol_0` AS `bfcol_7`, - `bfcol_5` AS `bfcol_8`, - `bfcol_4` AS `bfcol_9` + `bfcol_1` AS `bfcol_11`, + `bfcol_0` AS `bfcol_12`, + `bfcol_10` AS `bfcol_13`, + `bfcol_6` AS `bfcol_14` FROM `bfcte_11` ), `bfcte_2` AS ( SELECT - `bool_col` AS `bfcol_10`, - `int64_too` AS `bfcol_11`, - `float64_col` AS `bfcol_12` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS FLOAT64), 0)]) ), `bfcte_6` AS ( SELECT * FROM `bfcte_2` WHERE - `bfcol_10` + `bfcol_15` ), `bfcte_10` AS ( SELECT *, - ROW_NUMBER() OVER () AS `bfcol_15` + ROW_NUMBER() OVER (ORDER BY `bfcol_18` ASC NULLS LAST) AS `bfcol_22` FROM `bfcte_6` ), `bfcte_13` AS ( SELECT *, - 1 AS `bfcol_16` + 1 AS `bfcol_26` FROM `bfcte_10` ), `bfcte_15` AS ( SELECT - `bfcol_12` AS `bfcol_17`, - `bfcol_11` AS `bfcol_18`, - `bfcol_16` AS `bfcol_19`, - `bfcol_15` AS `bfcol_20` + `bfcol_17` AS `bfcol_27`, + `bfcol_16` AS `bfcol_28`, + `bfcol_26` AS `bfcol_29`, + `bfcol_22` AS `bfcol_30` FROM `bfcte_13` ), `bfcte_1` AS ( SELECT - `int64_col` AS `bfcol_21`, - `float64_col` AS `bfcol_22` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS FLOAT64), 0)]) ), `bfcte_5` AS ( SELECT *, - ROW_NUMBER() OVER (ORDER BY `bfcol_21` ASC NULLS LAST) AS `bfcol_25` + ROW_NUMBER() OVER (ORDER BY `bfcol_31` ASC NULLS LAST, `bfcol_33` ASC NULLS LAST) AS `bfcol_37` FROM `bfcte_1` ), `bfcte_9` AS ( SELECT *, - 2 AS `bfcol_26` + 2 AS `bfcol_41` FROM `bfcte_5` ), `bfcte_16` AS ( SELECT - `bfcol_22` AS `bfcol_27`, - `bfcol_21` AS `bfcol_28`, - `bfcol_26` AS `bfcol_29`, - `bfcol_25` AS `bfcol_30` + `bfcol_32` AS `bfcol_42`, + `bfcol_31` AS `bfcol_43`, + `bfcol_41` AS `bfcol_44`, + `bfcol_37` AS `bfcol_45` FROM `bfcte_9` ), `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_31`, - `int64_too` AS `bfcol_32`, - `float64_col` AS `bfcol_33` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS FLOAT64), 0)]) ), `bfcte_4` AS ( SELECT * FROM `bfcte_0` WHERE - `bfcol_31` + `bfcol_46` ), `bfcte_8` AS ( SELECT *, - ROW_NUMBER() OVER () AS `bfcol_36` + ROW_NUMBER() OVER (ORDER BY `bfcol_49` ASC NULLS LAST) AS `bfcol_53` FROM `bfcte_4` ), `bfcte_12` AS ( SELECT *, - 3 AS `bfcol_37` + 3 AS `bfcol_57` FROM `bfcte_8` ), `bfcte_17` AS ( SELECT - `bfcol_33` AS `bfcol_38`, - `bfcol_32` AS `bfcol_39`, - `bfcol_37` AS `bfcol_40`, - `bfcol_36` AS `bfcol_41` + `bfcol_48` AS `bfcol_58`, + `bfcol_47` AS `bfcol_59`, + `bfcol_57` AS `bfcol_60`, + `bfcol_53` AS `bfcol_61` FROM `bfcte_12` ), `bfcte_18` AS ( SELECT * FROM ( SELECT - `bfcol_6` AS `bfcol_42`, - `bfcol_7` AS `bfcol_43`, - `bfcol_8` AS `bfcol_44`, - `bfcol_9` AS `bfcol_45` + `bfcol_11` AS `bfcol_62`, + `bfcol_12` AS `bfcol_63`, + `bfcol_13` AS `bfcol_64`, + `bfcol_14` AS `bfcol_65` FROM `bfcte_14` UNION ALL SELECT - `bfcol_17` AS `bfcol_42`, - `bfcol_18` AS `bfcol_43`, - `bfcol_19` AS `bfcol_44`, - `bfcol_20` AS `bfcol_45` + `bfcol_27` AS `bfcol_62`, + `bfcol_28` AS `bfcol_63`, + `bfcol_29` AS `bfcol_64`, + `bfcol_30` AS `bfcol_65` FROM `bfcte_15` UNION ALL SELECT - `bfcol_27` AS `bfcol_42`, - `bfcol_28` AS `bfcol_43`, - `bfcol_29` AS `bfcol_44`, - `bfcol_30` AS `bfcol_45` + `bfcol_42` AS `bfcol_62`, + `bfcol_43` AS `bfcol_63`, + `bfcol_44` AS `bfcol_64`, + `bfcol_45` AS `bfcol_65` FROM `bfcte_16` UNION ALL SELECT - `bfcol_38` AS `bfcol_42`, - `bfcol_39` AS `bfcol_43`, - `bfcol_40` AS `bfcol_44`, - `bfcol_41` AS `bfcol_45` + `bfcol_58` AS `bfcol_62`, + `bfcol_59` AS `bfcol_63`, + `bfcol_60` AS `bfcol_64`, + `bfcol_61` AS `bfcol_65` FROM `bfcte_17` ) ) SELECT - `bfcol_42` AS `float64_col`, - `bfcol_43` AS `int64_col` + `bfcol_62` AS `float64_col`, + `bfcol_63` AS `int64_col` FROM `bfcte_18` ORDER BY - `bfcol_44` ASC NULLS LAST, - `bfcol_45` ASC NULLS LAST \ No newline at end of file + `bfcol_64` ASC NULLS LAST, + `bfcol_65` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_dataframe/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_dataframe/out.sql index 679da58f44..447df54be1 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - `rowindex` AS `bfcol_0`, - `int_list_col` AS `bfcol_1`, - `string_list_col` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` + * + FROM UNNEST(ARRAY, `bfcol_2` ARRAY, `bfcol_3` INT64>>[STRUCT(CAST(NULL AS INT64), ARRAY[], ARRAY[], 0)]) ), `bfcte_1` AS ( SELECT * - REPLACE (`bfcol_1`[SAFE_OFFSET(`bfcol_13`)] AS `bfcol_1`, `bfcol_2`[SAFE_OFFSET(`bfcol_13`)] AS `bfcol_2`) + REPLACE (`bfcol_1`[SAFE_OFFSET(`bfcol_16`)] AS `bfcol_1`, `bfcol_2`[SAFE_OFFSET(`bfcol_16`)] AS `bfcol_2`) FROM `bfcte_0` - CROSS JOIN UNNEST(GENERATE_ARRAY(0, LEAST(ARRAY_LENGTH(`bfcol_1`) - 1, ARRAY_LENGTH(`bfcol_2`) - 1))) AS `bfcol_13` WITH OFFSET AS `bfcol_7` + CROSS JOIN UNNEST(GENERATE_ARRAY(0, LEAST(ARRAY_LENGTH(`bfcol_1`) - 1, ARRAY_LENGTH(`bfcol_2`) - 1))) AS `bfcol_16` WITH OFFSET AS `bfcol_9` ) SELECT `bfcol_0` AS `rowindex`, @@ -18,4 +16,5 @@ SELECT `bfcol_2` AS `string_list_col` FROM `bfcte_1` ORDER BY - `bfcol_7` ASC NULLS LAST \ No newline at end of file + `bfcol_3` ASC NULLS LAST, + `bfcol_9` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_series/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_series/out.sql index 8bfd1eb005..9e3ba3012e 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_series/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_series/out.sql @@ -1,18 +1,18 @@ WITH `bfcte_0` AS ( SELECT - `rowindex` AS `bfcol_0`, - `int_list_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` + * + FROM UNNEST(ARRAY, `bfcol_2` INT64>>[STRUCT(CAST(NULL AS INT64), ARRAY[], 0)]) ), `bfcte_1` AS ( SELECT * - REPLACE (`bfcol_8` AS `bfcol_1`) + REPLACE (`bfcol_11` AS `bfcol_1`) FROM `bfcte_0` - CROSS JOIN UNNEST(`bfcol_1`) AS `bfcol_8` WITH OFFSET AS `bfcol_4` + CROSS JOIN UNNEST(`bfcol_1`) AS `bfcol_11` WITH OFFSET AS `bfcol_6` ) SELECT `bfcol_0` AS `rowindex`, `bfcol_1` AS `int_list_col` FROM `bfcte_1` ORDER BY - `bfcol_4` ASC NULLS LAST \ No newline at end of file + `bfcol_2` ASC NULLS LAST, + `bfcol_6` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_filter/test_compile_filter/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_filter/test_compile_filter/out.sql index 9ca7fb6a74..556fd13bb5 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,25 +1,26 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_5`, - `bfcol_1` AS `bfcol_6`, - `bfcol_0` AS `bfcol_7`, - `bfcol_1` >= 1 AS `bfcol_8` + `bfcol_1` AS `bfcol_7`, + `bfcol_1` AS `bfcol_8`, + `bfcol_0` AS `bfcol_9`, + `bfcol_1` >= 1 AS `bfcol_10` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT * FROM `bfcte_1` WHERE - `bfcol_8` + `bfcol_10` ) SELECT - `bfcol_5` AS `rowindex`, - `bfcol_6` AS `rowindex_1`, - `bfcol_7` AS `int64_col` -FROM `bfcte_2` \ No newline at end of file + `bfcol_7` AS `rowindex`, + `bfcol_8` AS `rowindex_1`, + `bfcol_9` AS `int64_col` +FROM `bfcte_2` +ORDER BY + `bfcol_2` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin/out.sql index e3bb0f9eba..8e7ee6ea87 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,17 +1,17 @@ WITH `bfcte_1` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ), `bfcte_2` AS ( SELECT - `bfcol_1` AS `bfcol_2`, - `bfcol_0` AS `bfcol_3` + `bfcol_1` AS `bfcol_3`, + `bfcol_0` AS `bfcol_4`, + `bfcol_2` AS `bfcol_5` FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - `int64_too` AS `bfcol_4` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64))]) ), `bfcte_3` AS ( SELECT `bfcte_2`.*, @@ -20,18 +20,20 @@ WITH `bfcte_1` AS ( 1 FROM ( SELECT - `bfcol_4` + `bfcol_6` FROM `bfcte_0` GROUP BY - `bfcol_4` + `bfcol_6` ) AS `bft_0` WHERE - COALESCE(`bfcte_2`.`bfcol_3`, 0) = COALESCE(`bft_0`.`bfcol_4`, 0) - AND COALESCE(`bfcte_2`.`bfcol_3`, 1) = COALESCE(`bft_0`.`bfcol_4`, 1) - ) AS `bfcol_5` + COALESCE(`bfcte_2`.`bfcol_4`, 0) = COALESCE(`bft_0`.`bfcol_6`, 0) + AND COALESCE(`bfcte_2`.`bfcol_4`, 1) = COALESCE(`bft_0`.`bfcol_6`, 1) + ) AS `bfcol_7` FROM `bfcte_2` ) SELECT - `bfcol_2` AS `rowindex`, - `bfcol_5` AS `int64_col` -FROM `bfcte_3` \ No newline at end of file + `bfcol_3` AS `rowindex`, + `bfcol_7` AS `int64_col` +FROM `bfcte_3` +ORDER BY + `bfcol_5` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql index f96a9816dc..f6ff106a08 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql @@ -1,30 +1,39 @@ WITH `bfcte_1` AS ( SELECT - `rowindex` AS `bfcol_0`, - `rowindex_2` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ), `bfcte_2` AS ( SELECT - `bfcol_0` AS `bfcol_2`, - `bfcol_1` AS `bfcol_3` + `bfcol_0` AS `bfcol_3`, + `bfcol_1` AS `bfcol_4`, + `bfcol_2` AS `bfcol_5` FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - `rowindex_2` AS `bfcol_4` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64))]) ), `bfcte_3` AS ( SELECT `bfcte_2`.*, - `bfcte_2`.`bfcol_3` IN (( + EXISTS( + SELECT + 1 + FROM ( SELECT - `bfcol_4` + `bfcol_6` FROM `bfcte_0` GROUP BY - `bfcol_4` - )) AS `bfcol_5` + `bfcol_6` + ) AS `bft_0` + WHERE + COALESCE(`bfcte_2`.`bfcol_4`, 0) = COALESCE(`bft_0`.`bfcol_6`, 0) + AND COALESCE(`bfcte_2`.`bfcol_4`, 1) = COALESCE(`bft_0`.`bfcol_6`, 1) + ) AS `bfcol_7` FROM `bfcte_2` ) SELECT - `bfcol_2` AS `rowindex`, - `bfcol_5` AS `rowindex_2` -FROM `bfcte_3` \ No newline at end of file + `bfcol_3` AS `rowindex`, + `bfcol_7` AS `rowindex_2` +FROM `bfcte_3` +ORDER BY + `bfcol_5` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join/out.sql index 04ee767f8a..16fe1ac340 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,8 +1,7 @@ WITH `bfcte_1` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64))]) ), `bfcte_2` AS ( SELECT `bfcol_1` AS `bfcol_2`, @@ -10,9 +9,8 @@ WITH `bfcte_1` AS ( FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_4`, - `int64_too` AS `bfcol_5` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64))]) ), `bfcte_3` AS ( SELECT `bfcol_4` AS `bfcol_6`, diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/bool_col/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/bool_col/out.sql index 05d5fd0695..dc8d98c7f1 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,8 +1,7 @@ WITH `bfcte_1` AS ( SELECT - `bool_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64))]) ), `bfcte_2` AS ( SELECT `bfcol_1` AS `bfcol_2`, @@ -10,9 +9,8 @@ WITH `bfcte_1` AS ( FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_4`, - `rowindex` AS `bfcol_5` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64))]) ), `bfcte_3` AS ( SELECT `bfcol_5` AS `bfcol_6`, diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/float64_col/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/float64_col/out.sql index 9e6a4094b2..42dadb7c8e 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,8 +1,7 @@ WITH `bfcte_1` AS ( SELECT - `float64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), CAST(NULL AS INT64))]) ), `bfcte_2` AS ( SELECT `bfcol_1` AS `bfcol_2`, @@ -10,9 +9,8 @@ WITH `bfcte_1` AS ( FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - `float64_col` AS `bfcol_4`, - `rowindex` AS `bfcol_5` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), CAST(NULL AS INT64))]) ), `bfcte_3` AS ( SELECT `bfcol_5` AS `bfcol_6`, diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/int64_col/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/int64_col/out.sql index bd03e05cba..bbe02bfc22 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,8 +1,7 @@ WITH `bfcte_1` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64))]) ), `bfcte_2` AS ( SELECT `bfcol_1` AS `bfcol_2`, @@ -10,9 +9,8 @@ WITH `bfcte_1` AS ( FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_4`, - `rowindex` AS `bfcol_5` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64))]) ), `bfcte_3` AS ( SELECT `bfcol_5` AS `bfcol_6`, diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/numeric_col/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/numeric_col/out.sql index 6b77ead97c..0d313b678c 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,8 +1,7 @@ WITH `bfcte_1` AS ( SELECT - `numeric_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS NUMERIC), CAST(NULL AS INT64))]) ), `bfcte_2` AS ( SELECT `bfcol_1` AS `bfcol_2`, @@ -10,9 +9,8 @@ WITH `bfcte_1` AS ( FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - `numeric_col` AS `bfcol_4`, - `rowindex` AS `bfcol_5` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS NUMERIC), CAST(NULL AS INT64))]) ), `bfcte_3` AS ( SELECT `bfcol_5` AS `bfcol_6`, diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/string_col/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/string_col/out.sql index 1903d5fc22..734a058f0e 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,13 +1,11 @@ WITH `bfcte_1` AS ( SELECT - `rowindex` AS `bfcol_0`, - `string_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING))]) ), `bfcte_0` AS ( SELECT - `rowindex` AS `bfcol_2`, - `string_col` AS `bfcol_3` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING))]) ), `bfcte_2` AS ( SELECT `bfcol_2` AS `bfcol_4`, diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/time_col/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join_w_on/time_col/out.sql index 9e3477d4a9..d96308cc3a 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,13 +1,11 @@ WITH `bfcte_1` AS ( SELECT - `rowindex` AS `bfcol_0`, - `time_col` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS TIME))]) ), `bfcte_0` AS ( SELECT - `rowindex` AS `bfcol_2`, - `time_col` AS `bfcol_3` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS TIME))]) ), `bfcte_2` AS ( SELECT `bfcol_2` AS `bfcol_4`, diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable/out.sql index 10c2a2088a..4f1dd73dc1 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,21 +1,24 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `bytes_col` AS `bfcol_1`, - `date_col` AS `bfcol_2`, - `datetime_col` AS `bfcol_3`, - `geography_col` AS `bfcol_4`, - `int64_col` AS `bfcol_5`, - `int64_too` AS `bfcol_6`, - `numeric_col` AS `bfcol_7`, - `float64_col` AS `bfcol_8`, - `rowindex` AS `bfcol_9`, - `rowindex_2` AS `bfcol_10`, - `string_col` AS `bfcol_11`, - `time_col` AS `bfcol_12`, - `timestamp_col` AS `bfcol_13`, - `duration_col` AS `bfcol_14` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[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), + CAST(NULL AS INT64), + CAST(NULL AS NUMERIC), + CAST(NULL AS FLOAT64), + CAST(NULL AS INT64), + CAST(NULL AS INT64), + CAST(NULL AS STRING), + CAST(NULL AS TIME), + CAST(NULL AS TIMESTAMP), + CAST(NULL AS INT64), + 0 + )]) ) SELECT `bfcol_9` AS `rowindex`, @@ -34,4 +37,6 @@ SELECT `bfcol_12` AS `time_col`, `bfcol_13` AS `timestamp_col`, `bfcol_14` AS `duration_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bfcte_0` +ORDER BY + `bfcol_15` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_limit/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_limit/out.sql index f97eb7bf06..707f8900e0 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_limit/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_limit/out.sql @@ -1,13 +1,13 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ) SELECT `bfcol_1` AS `rowindex`, `bfcol_0` AS `int64_col` FROM `bfcte_0` ORDER BY - `bfcol_1` ASC NULLS LAST + `bfcol_1` ASC NULLS LAST, + `bfcol_2` ASC NULLS LAST LIMIT 10 \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_nested_structs_types/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_nested_structs_types/out.sql index 75c4a86e18..f84a5b7e43 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_nested_structs_types/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_nested_structs_types/out.sql @@ -1,11 +1,16 @@ WITH `bfcte_0` AS ( SELECT - `id` AS `bfcol_0`, - `people` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`nested_structs_types` + * + FROM UNNEST(ARRAY>, `bfcol_2` INT64>>[STRUCT( + CAST(NULL AS INT64), + STRUCT('' AS `name`, 0 AS `age`, STRUCT('' AS `city`, '' AS `country`) AS `address`), + 0 + )]) ) SELECT `bfcol_0` AS `id`, `bfcol_0` AS `id_1`, `bfcol_1` AS `people` -FROM `bfcte_0` \ No newline at end of file +FROM `bfcte_0` +ORDER BY + `bfcol_2` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_ordering/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_ordering/out.sql index 6a16b98baa..4f290b1261 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_ordering/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_ordering/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ) SELECT `bfcol_1` AS `rowindex`, `bfcol_0` AS `int64_col` FROM `bfcte_0` ORDER BY - `bfcol_0` ASC NULLS LAST \ No newline at end of file + `bfcol_0` ASC NULLS LAST, + `bfcol_2` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_repeated_types/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_repeated_types/out.sql index 2436c01a44..9fb34eb673 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,14 +1,17 @@ WITH `bfcte_0` AS ( SELECT - `rowindex` AS `bfcol_0`, - `int_list_col` AS `bfcol_1`, - `bool_list_col` AS `bfcol_2`, - `float_list_col` AS `bfcol_3`, - `date_list_col` AS `bfcol_4`, - `date_time_list_col` AS `bfcol_5`, - `numeric_list_col` AS `bfcol_6`, - `string_list_col` AS `bfcol_7` - FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` + * + 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( + CAST(NULL AS INT64), + ARRAY[], + ARRAY[], + ARRAY[], + ARRAY[], + ARRAY[], + ARRAY[], + ARRAY[], + 0 + )]) ) SELECT `bfcol_0` AS `rowindex`, @@ -20,4 +23,6 @@ SELECT `bfcol_5` AS `date_time_list_col`, `bfcol_6` AS `numeric_list_col`, `bfcol_7` AS `string_list_col` -FROM `bfcte_0` \ No newline at end of file +FROM `bfcte_0` +ORDER BY + `bfcol_8` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_groupby_rolling/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_groupby_rolling/out.sql index f280933a74..4d3e5bc161 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,76 +1,75 @@ WITH `bfcte_0` AS ( SELECT - `bool_col` AS `bfcol_0`, - `int64_col` AS `bfcol_1`, - `rowindex` AS `bfcol_2` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_6`, - `bfcol_0` AS `bfcol_7`, - `bfcol_1` AS `bfcol_8`, - `bfcol_0` AS `bfcol_9` + `bfcol_2` AS `bfcol_8`, + `bfcol_0` AS `bfcol_9`, + `bfcol_1` AS `bfcol_10`, + `bfcol_0` AS `bfcol_11` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT * FROM `bfcte_1` WHERE - NOT `bfcol_9` IS NULL + NOT `bfcol_11` 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, `bfcol_2` ASC NULLS LAST + WHEN SUM(CAST(NOT `bfcol_9` IS NULL AS INT64)) OVER ( + PARTITION BY `bfcol_11` + ORDER BY `bfcol_11` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST, `bfcol_3` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW ) < 3 THEN NULL ELSE COALESCE( - SUM(CAST(`bfcol_7` AS INT64)) OVER ( - PARTITION BY `bfcol_9` - ORDER BY `bfcol_9` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST + SUM(CAST(`bfcol_9` AS INT64)) OVER ( + PARTITION BY `bfcol_11` + ORDER BY `bfcol_11` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST, `bfcol_3` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW ), 0 ) - END AS `bfcol_15` + END AS `bfcol_18` FROM `bfcte_2` ), `bfcte_4` AS ( SELECT * FROM `bfcte_3` WHERE - NOT `bfcol_9` IS NULL + NOT `bfcol_11` 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, `bfcol_2` ASC NULLS LAST + WHEN SUM(CAST(NOT `bfcol_10` IS NULL AS INT64)) OVER ( + PARTITION BY `bfcol_11` + ORDER BY `bfcol_11` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST, `bfcol_3` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW ) < 3 THEN NULL ELSE COALESCE( - SUM(`bfcol_8`) OVER ( - PARTITION BY `bfcol_9` - ORDER BY `bfcol_9` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST + SUM(`bfcol_10`) OVER ( + PARTITION BY `bfcol_11` + ORDER BY `bfcol_11` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST, `bfcol_3` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW ), 0 ) - END AS `bfcol_21` + END AS `bfcol_25` FROM `bfcte_4` ) SELECT - `bfcol_9` AS `bool_col`, - `bfcol_6` AS `rowindex`, - `bfcol_15` AS `bool_col_1`, - `bfcol_21` AS `int64_col` + `bfcol_11` AS `bool_col`, + `bfcol_8` AS `rowindex`, + `bfcol_18` AS `bool_col_1`, + `bfcol_25` AS `int64_col` FROM `bfcte_5` ORDER BY - `bfcol_9` ASC NULLS LAST, - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `bfcol_11` ASC NULLS LAST, + `bfcol_2` ASC NULLS LAST, + `bfcol_3` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_skips_nulls_op/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_skips_nulls_op/out.sql index f22ef37b7e..eecd94e0d3 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_skips_nulls_op/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_skips_nulls_op/out.sql @@ -1,24 +1,30 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, CASE - WHEN SUM(CAST(NOT `bfcol_0` IS NULL AS INT64)) OVER (ORDER BY `bfcol_1` ASC NULLS LAST ROWS BETWEEN 2 PRECEDING AND CURRENT ROW) < 3 + WHEN SUM(CAST(NOT `bfcol_0` IS NULL AS INT64)) OVER ( + ORDER BY `bfcol_1` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST + ROWS BETWEEN 2 PRECEDING AND CURRENT ROW + ) < 3 THEN NULL ELSE COALESCE( - SUM(`bfcol_0`) OVER (ORDER BY `bfcol_1` ASC NULLS LAST ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM(`bfcol_0`) OVER ( + ORDER BY `bfcol_1` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST + ROWS BETWEEN 2 PRECEDING AND CURRENT ROW + ), 0 ) - END AS `bfcol_4` + END AS `bfcol_6` FROM `bfcte_0` ) SELECT `bfcol_1` AS `rowindex`, - `bfcol_4` AS `int64_col` + `bfcol_6` AS `int64_col` FROM `bfcte_1` ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `bfcol_1` ASC NULLS LAST, + `bfcol_2` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_wo_skips_nulls_op/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_wo_skips_nulls_op/out.sql index dcf52f2e82..736704cd72 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_wo_skips_nulls_op/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_wo_skips_nulls_op/out.sql @@ -1,21 +1,27 @@ WITH `bfcte_0` AS ( SELECT - `int64_col` AS `bfcol_0`, - `rowindex` AS `bfcol_1` - FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` + * + FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) ), `bfcte_1` AS ( SELECT *, CASE - WHEN COUNT(CAST(NOT `bfcol_0` IS NULL AS INT64)) OVER (ORDER BY `bfcol_1` ASC NULLS LAST ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) < 5 + WHEN COUNT(CAST(NOT `bfcol_0` IS NULL AS INT64)) OVER ( + ORDER BY `bfcol_1` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST + ROWS BETWEEN 4 PRECEDING AND CURRENT ROW + ) < 5 THEN NULL - ELSE COUNT(`bfcol_0`) OVER (ORDER BY `bfcol_1` ASC NULLS LAST ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) - END AS `bfcol_4` + ELSE COUNT(`bfcol_0`) OVER ( + ORDER BY `bfcol_1` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST + ROWS BETWEEN 4 PRECEDING AND CURRENT ROW + ) + END AS `bfcol_6` FROM `bfcte_0` ) SELECT `bfcol_1` AS `rowindex`, - `bfcol_4` AS `int64_col` + `bfcol_6` AS `int64_col` FROM `bfcte_1` ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `bfcol_1` ASC NULLS LAST, + `bfcol_2` ASC NULLS LAST \ No newline at end of file From 3c69a4d1c5d4c462daa57d120506f0b8d395f09a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Swe=C3=B1a?= Date: Thu, 23 Oct 2025 20:55:48 +0000 Subject: [PATCH 10/10] snapshot again --- bigframes/core/array_value.py | 5 - .../session/_io/bigquery/read_gbq_table.py | 1 + bigframes/session/loader.py | 4 +- .../test_binary_compiler/test_corr/out.sql | 5 +- .../test_binary_compiler/test_cov/out.sql | 5 +- .../test_row_number/out.sql | 26 +- .../test_row_number_with_window/out.sql | 12 +- .../test_nullary_compiler/test_size/out.sql | 34 ++- .../test_array_agg/out.sql | 10 +- .../test_string_agg/out.sql | 21 +- .../test_unary_compiler/test_all/out.sql | 4 +- .../test_all/window_out.sql | 12 +- .../test_all/window_partition_out.sql | 13 +- .../test_any_value/out.sql | 4 +- .../test_any_value/window_out.sql | 12 +- .../test_any_value/window_partition_out.sql | 13 +- .../test_approx_quartiles/out.sql | 4 +- .../test_approx_top_count/out.sql | 4 +- .../test_unary_compiler/test_count/out.sql | 4 +- .../test_count/window_out.sql | 12 +- .../test_count/window_partition_out.sql | 13 +- .../test_date_series_diff/out.sql | 16 +- .../test_dense_rank/out.sql | 12 +- .../test_diff/diff_bool.sql | 12 +- .../test_diff/diff_int.sql | 12 +- .../test_unary_compiler/test_first/out.sql | 17 +- .../test_first_non_null/out.sql | 14 +- .../test_unary_compiler/test_last/out.sql | 17 +- .../test_last_non_null/out.sql | 14 +- .../test_unary_compiler/test_max/out.sql | 4 +- .../test_max/window_out.sql | 12 +- .../test_max/window_partition_out.sql | 13 +- .../test_unary_compiler/test_mean/out.sql | 6 +- .../test_mean/window_out.sql | 12 +- .../test_mean/window_partition_out.sql | 13 +- .../test_unary_compiler/test_median/out.sql | 6 +- .../test_unary_compiler/test_min/out.sql | 4 +- .../test_min/window_out.sql | 12 +- .../test_min/window_partition_out.sql | 13 +- .../test_unary_compiler/test_quantile/out.sql | 4 +- .../test_unary_compiler/test_rank/out.sql | 12 +- .../test_unary_compiler/test_shift/lag.sql | 12 +- .../test_unary_compiler/test_shift/lead.sql | 12 +- .../test_unary_compiler/test_shift/noop.sql | 12 +- .../test_unary_compiler/test_sum/out.sql | 5 +- .../test_sum/window_out.sql | 12 +- .../test_sum/window_partition_out.sql | 13 +- .../test_time_series_diff/out.sql | 16 +- .../test_ai_ops/test_ai_classify/out.sql | 12 +- .../test_ai_ops/test_ai_generate/out.sql | 12 +- .../test_ai_ops/test_ai_generate_bool/out.sql | 12 +- .../out.sql | 12 +- .../test_ai_generate_double/out.sql | 12 +- .../out.sql | 12 +- .../test_ai_ops/test_ai_generate_int/out.sql | 12 +- .../out.sql | 12 +- .../test_ai_generate_with_model_param/out.sql | 12 +- .../out.sql | 12 +- .../snapshots/test_ai_ops/test_ai_if/out.sql | 12 +- .../test_ai_ops/test_ai_score/out.sql | 12 +- .../test_array_ops/test_array_index/out.sql | 12 +- .../test_array_slice_with_only_start/out.sql | 12 +- .../out.sql | 12 +- .../test_array_to_string/out.sql | 12 +- .../test_obj_fetch_metadata/out.sql | 17 +- .../test_obj_get_access_url/out.sql | 17 +- .../test_blob_ops/test_obj_make_ref/out.sql | 13 +- .../test_bool_ops/test_and_op/out.sql | 38 +-- .../test_bool_ops/test_or_op/out.sql | 38 +-- .../test_bool_ops/test_xor_op/out.sql | 38 +-- .../test_eq_null_match/out.sql | 13 +- .../test_eq_numeric/out.sql | 68 ++--- .../test_ge_numeric/out.sql | 68 ++--- .../test_gt_numeric/out.sql | 68 ++--- .../test_comparison_ops/test_is_in/out.sql | 41 ++- .../test_le_numeric/out.sql | 68 ++--- .../test_lt_numeric/out.sql | 68 ++--- .../test_ne_numeric/out.sql | 68 ++--- .../test_add_timedelta/out.sql | 72 ++--- .../test_datetime_ops/test_date/out.sql | 12 +- .../test_datetime_ops/test_day/out.sql | 12 +- .../test_datetime_ops/test_dayofweek/out.sql | 12 +- .../test_datetime_ops/test_dayofyear/out.sql | 12 +- .../test_datetime_ops/test_floor_dt/out.sql | 12 +- .../test_datetime_ops/test_hour/out.sql | 12 +- .../test_datetime_ops/test_iso_day/out.sql | 12 +- .../test_datetime_ops/test_iso_week/out.sql | 12 +- .../test_datetime_ops/test_iso_year/out.sql | 12 +- .../test_datetime_ops/test_minute/out.sql | 12 +- .../test_datetime_ops/test_month/out.sql | 12 +- .../test_datetime_ops/test_normalize/out.sql | 12 +- .../test_datetime_ops/test_quarter/out.sql | 12 +- .../test_datetime_ops/test_second/out.sql | 12 +- .../test_datetime_ops/test_strftime/out.sql | 12 +- .../test_sub_timedelta/out.sql | 105 +++---- .../test_datetime_ops/test_time/out.sql | 12 +- .../test_to_datetime/out.sql | 12 +- .../test_to_timestamp/out.sql | 12 +- .../test_unix_micros/out.sql | 12 +- .../test_unix_millis/out.sql | 12 +- .../test_unix_seconds/out.sql | 12 +- .../test_datetime_ops/test_year/out.sql | 12 +- .../test_generic_ops/test_astype_bool/out.sql | 21 +- .../test_astype_float/out.sql | 20 +- .../test_generic_ops/test_astype_int/out.sql | 55 ++-- .../test_generic_ops/test_astype_json/out.sql | 41 ++- .../test_astype_string/out.sql | 21 +- .../test_astype_time_like/out.sql | 24 +- .../test_case_when_op/out.sql | 33 +-- .../test_generic_ops/test_clip/out.sql | 14 +- .../test_generic_ops/test_hash/out.sql | 12 +- .../test_generic_ops/test_invert/out.sql | 22 +- .../test_generic_ops/test_isnull/out.sql | 12 +- .../test_generic_ops/test_map/out.sql | 12 +- .../test_generic_ops/test_notnull/out.sql | 12 +- .../test_generic_ops/test_where/out.sql | 14 +- .../test_geo_ops/test_geo_area/out.sql | 12 +- .../test_geo_ops/test_geo_st_astext/out.sql | 12 +- .../test_geo_ops/test_geo_st_boundary/out.sql | 12 +- .../test_geo_ops/test_geo_st_buffer/out.sql | 12 +- .../test_geo_ops/test_geo_st_centroid/out.sql | 12 +- .../test_geo_st_convexhull/out.sql | 12 +- .../test_geo_st_geogfromtext/out.sql | 12 +- .../test_geo_ops/test_geo_st_isclosed/out.sql | 12 +- .../test_geo_ops/test_geo_st_length/out.sql | 12 +- .../snapshots/test_geo_ops/test_geo_x/out.sql | 12 +- .../snapshots/test_geo_ops/test_geo_y/out.sql | 12 +- .../test_json_ops/test_parse_json/out.sql | 12 +- .../test_numeric_ops/test_abs/out.sql | 12 +- .../test_numeric_ops/test_add_numeric/out.sql | 68 ++--- .../test_numeric_ops/test_arccos/out.sql | 12 +- .../test_numeric_ops/test_arccosh/out.sql | 12 +- .../test_numeric_ops/test_arcsin/out.sql | 12 +- .../test_numeric_ops/test_arcsinh/out.sql | 12 +- .../test_numeric_ops/test_arctan/out.sql | 12 +- .../test_numeric_ops/test_arctanh/out.sql | 12 +- .../test_numeric_ops/test_ceil/out.sql | 12 +- .../test_numeric_ops/test_cos/out.sql | 12 +- .../test_numeric_ops/test_cosh/out.sql | 12 +- .../test_numeric_ops/test_div_numeric/out.sql | 177 ++++++------ .../test_div_timedelta/out.sql | 26 +- .../test_numeric_ops/test_exp/out.sql | 12 +- .../test_numeric_ops/test_expm1/out.sql | 12 +- .../test_numeric_ops/test_floor/out.sql | 12 +- .../test_floordiv_timedelta/out.sql | 14 +- .../test_numeric_ops/test_ln/out.sql | 12 +- .../test_numeric_ops/test_log10/out.sql | 12 +- .../test_numeric_ops/test_log1p/out.sql | 12 +- .../test_numeric_ops/test_mod_numeric/out.sql | 266 +++++++++--------- .../test_numeric_ops/test_mul_numeric/out.sql | 68 ++--- .../test_numeric_ops/test_neg/out.sql | 12 +- .../test_numeric_ops/test_pos/out.sql | 12 +- .../test_numeric_ops/test_sin/out.sql | 12 +- .../test_numeric_ops/test_sinh/out.sql | 12 +- .../test_numeric_ops/test_sqrt/out.sql | 12 +- .../test_numeric_ops/test_sub_numeric/out.sql | 68 ++--- .../test_numeric_ops/test_tan/out.sql | 12 +- .../test_numeric_ops/test_tanh/out.sql | 12 +- .../test_string_ops/test_add_string/out.sql | 12 +- .../test_string_ops/test_capitalize/out.sql | 12 +- .../test_string_ops/test_endswith/out.sql | 20 +- .../test_string_ops/test_isalnum/out.sql | 12 +- .../test_string_ops/test_isalpha/out.sql | 12 +- .../test_string_ops/test_isdecimal/out.sql | 12 +- .../test_string_ops/test_isdigit/out.sql | 12 +- .../test_string_ops/test_islower/out.sql | 12 +- .../test_string_ops/test_isnumeric/out.sql | 12 +- .../test_string_ops/test_isspace/out.sql | 12 +- .../test_string_ops/test_isupper/out.sql | 12 +- .../test_string_ops/test_len/out.sql | 12 +- .../test_string_ops/test_lower/out.sql | 12 +- .../test_string_ops/test_lstrip/out.sql | 12 +- .../test_regex_replace_str/out.sql | 12 +- .../test_string_ops/test_replace_str/out.sql | 12 +- .../test_string_ops/test_reverse/out.sql | 12 +- .../test_string_ops/test_rstrip/out.sql | 12 +- .../test_string_ops/test_startswith/out.sql | 20 +- .../test_string_ops/test_str_contains/out.sql | 12 +- .../test_str_contains_regex/out.sql | 12 +- .../test_string_ops/test_str_extract/out.sql | 12 +- .../test_string_ops/test_str_find/out.sql | 24 +- .../test_string_ops/test_str_get/out.sql | 12 +- .../test_string_ops/test_str_pad/out.sql | 20 +- .../test_string_ops/test_str_repeat/out.sql | 12 +- .../test_string_ops/test_str_slice/out.sql | 12 +- .../test_string_ops/test_strconcat/out.sql | 12 +- .../test_string_ops/test_string_split/out.sql | 12 +- .../test_string_ops/test_strip/out.sql | 12 +- .../test_string_ops/test_upper/out.sql | 12 +- .../test_string_ops/test_zfill/out.sql | 12 +- .../test_struct_ops/test_struct_field/out.sql | 19 +- .../test_timedelta_floor/out.sql | 12 +- .../test_to_timedelta/out.sql | 43 ++- .../test_compile_aggregate/out.sql | 5 +- .../test_compile_aggregate_wo_dropna/out.sql | 5 +- .../test_compile_concat/out.sql | 80 +++--- .../test_compile_concat_filter_sorted/out.sql | 114 ++++---- .../test_compile_explode_dataframe/out.sql | 13 +- .../test_compile_explode_series/out.sql | 12 +- .../test_compile_filter/out.sql | 25 +- .../test_compile_isin/out.sql | 32 +-- .../test_compile_isin_not_nullable/out.sql | 37 +-- .../test_compile_join/out.sql | 10 +- .../test_compile_join_w_on/bool_col/out.sql | 10 +- .../float64_col/out.sql | 10 +- .../test_compile_join_w_on/int64_col/out.sql | 10 +- .../numeric_col/out.sql | 10 +- .../test_compile_join_w_on/string_col/out.sql | 10 +- .../test_compile_join_w_on/time_col/out.sql | 10 +- .../test_compile_readtable/out.sql | 39 ++- .../test_compile_readtable_w_limit/out.sql | 8 +- .../out.sql | 13 +- .../test_compile_readtable_w_ordering/out.sql | 8 +- .../out.sql | 25 +- .../out.sql | 59 ++-- .../out.sql | 22 +- .../out.sql | 22 +- 217 files changed, 1979 insertions(+), 2305 deletions(-) diff --git a/bigframes/core/array_value.py b/bigframes/core/array_value.py index 49c33f9e51..a89d224ad1 100644 --- a/bigframes/core/array_value.py +++ b/bigframes/core/array_value.py @@ -141,11 +141,6 @@ def from_bq_data_source( ) return cls(node) - @staticmethod - def is_table_type_supported(table_type: Optional[str]): - # Some external tables like those in GCS support all the features we want, such as time travel. - return table_type in ("TABLE", "MATERIALIZED_VIEW", "EXTERNAL") - @property def column_ids(self) -> typing.Sequence[str]: """Returns column ids as strings.""" diff --git a/bigframes/session/_io/bigquery/read_gbq_table.py b/bigframes/session/_io/bigquery/read_gbq_table.py index 09708b3e1c..465fa08187 100644 --- a/bigframes/session/_io/bigquery/read_gbq_table.py +++ b/bigframes/session/_io/bigquery/read_gbq_table.py @@ -28,6 +28,7 @@ import google.cloud.bigquery as bigquery import google.cloud.bigquery.table +import bigframes.core import bigframes.core.events import bigframes.exceptions as bfe import bigframes.session._io.bigquery diff --git a/bigframes/session/loader.py b/bigframes/session/loader.py index 79779b7ffa..2d5dec13e6 100644 --- a/bigframes/session/loader.py +++ b/bigframes/session/loader.py @@ -709,9 +709,9 @@ def read_gbq_table( # the index is consistent with tables that have primary keys, even # when max_results is set. max_results is not None - # Views such as INFORMATION_SCHEMA also introduce non-determinism. + # Views such as INFORMATION_SCHEMA can introduce non-determinism. # They can update frequently and don't support time travel. - or not core.ArrayValue.is_table_type_supported(table.table_type) + or bf_read_gbq_table.is_information_schema(table_id) ): # TODO(b/338111344): If we are running a query anyway, we might as # well generate ROW_NUMBER() at the same time. 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 055d93c686..8922a71de4 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_corr/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_corr/out.sql @@ -1,7 +1,8 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS FLOAT64))]) + `int64_col` AS `bfcol_0`, + `float64_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT CORR(`bfcol_0`, `bfcol_1`) AS `bfcol_2` 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 67718fc554..6cf189da31 100644 --- a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_cov/out.sql +++ b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_cov/out.sql @@ -1,7 +1,8 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS FLOAT64))]) + `int64_col` AS `bfcol_0`, + `float64_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT COVAR_SAMP(`bfcol_0`, `bfcol_1`) AS `bfcol_2` 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 8226dee61e..b48dcfa01b 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,15 +1,27 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), 0)]) + `bool_col` AS `bfcol_0`, + `bytes_col` AS `bfcol_1`, + `date_col` AS `bfcol_2`, + `datetime_col` AS `bfcol_3`, + `geography_col` AS `bfcol_4`, + `int64_col` AS `bfcol_5`, + `int64_too` AS `bfcol_6`, + `numeric_col` AS `bfcol_7`, + `float64_col` AS `bfcol_8`, + `rowindex` AS `bfcol_9`, + `rowindex_2` AS `bfcol_10`, + `string_col` AS `bfcol_11`, + `time_col` AS `bfcol_12`, + `timestamp_col` AS `bfcol_13`, + `duration_col` AS `bfcol_14` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ROW_NUMBER() OVER (ORDER BY `bfcol_1` ASC NULLS LAST) AS `bfcol_3` + ROW_NUMBER() OVER () AS `bfcol_32` FROM `bfcte_0` ) SELECT - `bfcol_3` AS `row_number` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 55b89b63b6..8dc701e1f9 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ROW_NUMBER() OVER (ORDER BY `bfcol_0` ASC NULLS LAST, `bfcol_1` ASC NULLS LAST) AS `bfcol_2` + ROW_NUMBER() OVER (ORDER BY `bfcol_0` ASC NULLS LAST) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `row_number` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 f53a412538..8cda9a3d80 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,23 +1,21 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[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), - CAST(NULL AS INT64), - CAST(NULL AS NUMERIC), - CAST(NULL AS FLOAT64), - CAST(NULL AS INT64), - CAST(NULL AS INT64), - CAST(NULL AS STRING), - CAST(NULL AS TIME), - CAST(NULL AS TIMESTAMP), - CAST(NULL AS INT64) - )]) + `bool_col` AS `bfcol_0`, + `bytes_col` AS `bfcol_1`, + `date_col` AS `bfcol_2`, + `datetime_col` AS `bfcol_3`, + `geography_col` AS `bfcol_4`, + `int64_col` AS `bfcol_5`, + `int64_too` AS `bfcol_6`, + `numeric_col` AS `bfcol_7`, + `float64_col` AS `bfcol_8`, + `rowindex` AS `bfcol_9`, + `rowindex_2` AS `bfcol_10`, + `string_col` AS `bfcol_11`, + `time_col` AS `bfcol_12`, + `timestamp_col` AS `bfcol_13`, + `duration_col` AS `bfcol_14` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT COUNT(1) AS `bfcol_32` 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 ef6749a7d3..43e0a03db4 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,14 +1,12 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - ARRAY_AGG( - `bfcol_0` IGNORE NULLS ORDER BY `bfcol_0` IS NULL ASC, `bfcol_0` ASC, `bfcol_1` IS NULL ASC, `bfcol_1` ASC - ) AS `bfcol_2` + ARRAY_AGG(`bfcol_0` IGNORE NULLS ORDER BY `bfcol_0` IS NULL ASC, `bfcol_0` ASC) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `int64_col` + `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 a0ec7d28d2..115d7e37ee 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,22 +1,15 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT - COALESCE( - STRING_AGG( - `bfcol_0`, ',' - ORDER BY - `bfcol_0` IS NULL ASC, - `bfcol_0` ASC, - `bfcol_1` IS NULL ASC, - `bfcol_1` ASC - ), - '' - ) AS `bfcol_2` + COALESCE(STRING_AGG(`bfcol_0`, ',' + ORDER BY + `bfcol_0` IS NULL ASC, + `bfcol_0` ASC), '') AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` + `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 26def41caf..7303d758cc 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN))]) + `bool_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT COALESCE(LOGICAL_AND(`bfcol_0`), TRUE) AS `bfcol_1` 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 f5bc2fae8a..a91381d3be 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), 0)]) + `bool_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -9,11 +9,9 @@ WITH `bfcte_0` AS ( WHEN `bfcol_0` IS NULL THEN NULL ELSE COALESCE(LOGICAL_AND(`bfcol_0`) OVER (), TRUE) - END AS `bfcol_2` + END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_bool` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 db700ea803..1a9a020b3e 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,7 +1,8 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS STRING), 0)]) + `bool_col` AS `bfcol_0`, + `string_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -9,11 +10,9 @@ WITH `bfcte_0` AS ( WHEN `bfcol_0` IS NULL THEN NULL ELSE COALESCE(LOGICAL_AND(`bfcol_0`) OVER (PARTITION BY `bfcol_1`), TRUE) - END AS `bfcol_3` + END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_3` AS `agg_bool` -FROM `bfcte_1` -ORDER BY - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `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_value/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_any_value/out.sql index de93c3e383..f95b094a13 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64))]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT ANY_VALUE(`bfcol_0`) AS `bfcol_1` 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 da43893a9e..b262284b88 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE ANY_VALUE(`bfcol_0`) OVER () END AS `bfcol_2` + CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE ANY_VALUE(`bfcol_0`) OVER () END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 322a75e931..66933626b5 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,7 +1,8 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) + `int64_col` AS `bfcol_0`, + `string_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -9,11 +10,9 @@ WITH `bfcte_0` AS ( WHEN `bfcol_0` IS NULL THEN NULL ELSE ANY_VALUE(`bfcol_0`) OVER (PARTITION BY `bfcol_1`) - END AS `bfcol_3` + END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_3` AS `agg_int64` -FROM `bfcte_1` -ORDER BY - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `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 908ca91298..e7bb16e57c 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64))]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT APPROX_QUANTILES(`bfcol_0`, 4)[OFFSET(1)] AS `bfcol_1`, 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 47bd104bea..b61a72d1b2 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64))]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT APPROX_TOP_COUNT(`bfcol_0`, 10) AS `bfcol_1` 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 b3d5430f2d..01684b4af6 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64))]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT COUNT(`bfcol_0`) AS `bfcol_1` 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 208fb3d75a..beda182992 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - COUNT(`bfcol_0`) OVER () AS `bfcol_2` + COUNT(`bfcol_0`) OVER () AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 2b0a5d3909..d4a12d73f8 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,15 +1,14 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) + `int64_col` AS `bfcol_0`, + `string_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - COUNT(`bfcol_0`) OVER (PARTITION BY `bfcol_1`) AS `bfcol_3` + COUNT(`bfcol_0`) OVER (PARTITION BY `bfcol_1`) AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_3` AS `agg_int64` -FROM `bfcte_1` -ORDER BY - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `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 0a6aaf186e..cd1cf3ff3b 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,19 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS DATE), 0)]) + `date_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CAST(DATE_DIFF( - `bfcol_0`, - LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC NULLS LAST, `bfcol_1` ASC NULLS LAST), - DAY - ) * 86400000000 AS INT64) AS `bfcol_2` + CAST(DATE_DIFF(`bfcol_0`, LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC NULLS LAST), DAY) * 86400000000 AS INT64) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `diff_date` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 cf96f0868f..0f704dd0cc 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - DENSE_RANK() OVER (ORDER BY `bfcol_0` DESC) AS `bfcol_2` + DENSE_RANK() OVER (ORDER BY `bfcol_0` DESC) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 7e30410404..500056928d 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), 0)]) + `bool_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_0` <> LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` DESC, `bfcol_1` ASC NULLS LAST) AS `bfcol_2` + `bfcol_0` <> LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` DESC) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `diff_bool` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 817789a2b4..f4fd46ee2d 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_0` - LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC NULLS LAST, `bfcol_1` ASC NULLS LAST) AS `bfcol_2` + `bfcol_0` - LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC NULLS LAST) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `diff_int` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 4bde906378..df76aa1d33 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,22 +1,17 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, CASE WHEN `bfcol_0` IS NULL THEN NULL - ELSE FIRST_VALUE(`bfcol_0`) OVER ( - ORDER BY `bfcol_0` DESC, `bfcol_1` ASC NULLS LAST - ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING - ) - END AS `bfcol_2` + ELSE FIRST_VALUE(`bfcol_0`) OVER (ORDER BY `bfcol_0` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) + END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 0a58c1c835..70eeefda7b 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,18 +1,16 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, FIRST_VALUE(`bfcol_0` IGNORE NULLS) OVER ( - ORDER BY `bfcol_0` ASC NULLS LAST, `bfcol_1` ASC NULLS LAST + ORDER BY `bfcol_0` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING - ) AS `bfcol_2` + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 2914034ba1..4a5af9af32 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,22 +1,17 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, CASE WHEN `bfcol_0` IS NULL THEN NULL - ELSE LAST_VALUE(`bfcol_0`) OVER ( - ORDER BY `bfcol_0` DESC, `bfcol_1` ASC NULLS LAST - ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING - ) - END AS `bfcol_2` + ELSE LAST_VALUE(`bfcol_0`) OVER (ORDER BY `bfcol_0` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) + END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 b014744560..a246618ff0 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,18 +1,16 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, LAST_VALUE(`bfcol_0` IGNORE NULLS) OVER ( - ORDER BY `bfcol_0` ASC NULLS LAST, `bfcol_1` ASC NULLS LAST + ORDER BY `bfcol_0` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING - ) AS `bfcol_2` + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 aa0d8669ea..c88fa58d0f 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64))]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT MAX(`bfcol_0`) AS `bfcol_1` 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 62378aa0b5..4c86cb38e0 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE MAX(`bfcol_0`) OVER () END AS `bfcol_2` + CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE MAX(`bfcol_0`) OVER () END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 6ace501522..64dc97642b 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,7 +1,8 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) + `int64_col` AS `bfcol_0`, + `string_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -9,11 +10,9 @@ WITH `bfcte_0` AS ( WHEN `bfcol_0` IS NULL THEN NULL ELSE MAX(`bfcol_0`) OVER (PARTITION BY `bfcol_1`) - END AS `bfcol_3` + END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_3` AS `agg_int64` -FROM `bfcte_1` -ORDER BY - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `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 8cec0e95c8..6d4bb6f89a 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,7 +1,9 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64))]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1`, + `duration_col` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, diff --git a/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/window_out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/window_out.sql index 06352b99a6..bc89091ca9 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE AVG(`bfcol_0`) OVER () END AS `bfcol_2` + CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE AVG(`bfcol_0`) OVER () END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 943e23bf22..e6c1cf3bb4 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,7 +1,8 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) + `int64_col` AS `bfcol_0`, + `string_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -9,11 +10,9 @@ WITH `bfcte_0` AS ( WHEN `bfcol_0` IS NULL THEN NULL ELSE AVG(`bfcol_0`) OVER (PARTITION BY `bfcol_1`) - END AS `bfcol_3` + END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_3` AS `agg_int64` -FROM `bfcte_1` -ORDER BY - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `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 6e9482b5c1..bf7006ef87 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,7 +1,9 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS DATE), CAST(NULL AS INT64), CAST(NULL AS STRING))]) + `date_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1`, + `string_col` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT APPROX_QUANTILES(`bfcol_1`, 2)[OFFSET(1)] AS `bfcol_3`, 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 4942d4a088..b067817218 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64))]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT MIN(`bfcol_0`) AS `bfcol_1` 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 bff6890d0b..0e96b56c50 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE MIN(`bfcol_0`) OVER () END AS `bfcol_2` + CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE MIN(`bfcol_0`) OVER () END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 d856e0158e..4121e80f43 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,7 +1,8 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) + `int64_col` AS `bfcol_0`, + `string_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -9,11 +10,9 @@ WITH `bfcte_0` AS ( WHEN `bfcol_0` IS NULL THEN NULL ELSE MIN(`bfcol_0`) OVER (PARTITION BY `bfcol_1`) - END AS `bfcol_3` + END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_3` AS `agg_int64` -FROM `bfcte_1` -ORDER BY - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `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_quantile/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_quantile/out.sql index d7188cab44..c1b3d1fffa 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64))]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT PERCENTILE_CONT(`bfcol_0`, 0.5) OVER () AS `bfcol_1`, 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 bdeea1c2f4..ca3b9e8e54 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - RANK() OVER (ORDER BY `bfcol_0` DESC NULLS FIRST) AS `bfcol_2` + RANK() OVER (ORDER BY `bfcol_0` DESC NULLS FIRST) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 667fcb6896..32e6eabb9b 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC, `bfcol_1` ASC NULLS LAST) AS `bfcol_2` + LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `lag` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 aef75a19aa..f0797f1e17 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - LEAD(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC, `bfcol_1` ASC NULLS LAST) AS `bfcol_2` + LEAD(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `lead` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 5f5a9cfcaa..fef4a2bde8 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_0` AS `bfcol_2` + `bfcol_0` AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `noop` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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_sum/out.sql b/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_sum/out.sql index e93d2fb2dd..be684f6768 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,7 +1,8 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64))]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT COALESCE(SUM(`bfcol_1`), 0) AS `bfcol_4`, 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 1d2c83f1f1..939b491dd0 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE COALESCE(SUM(`bfcol_0`) OVER (), 0) END AS `bfcol_2` + CASE WHEN `bfcol_0` IS NULL THEN NULL ELSE COALESCE(SUM(`bfcol_0`) OVER (), 0) END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `agg_int64` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 a015c77e78..a23842867e 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,7 +1,8 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) + `int64_col` AS `bfcol_0`, + `string_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -9,11 +10,9 @@ WITH `bfcte_0` AS ( WHEN `bfcol_0` IS NULL THEN NULL ELSE COALESCE(SUM(`bfcol_0`) OVER (PARTITION BY `bfcol_1`), 0) - END AS `bfcol_3` + END AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_3` AS `agg_int64` -FROM `bfcte_1` -ORDER BY - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `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 1da836737e..692685ee4d 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,19 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - TIMESTAMP_DIFF( - `bfcol_0`, - LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC NULLS LAST, `bfcol_1` ASC NULLS LAST), - MICROSECOND - ) AS `bfcol_2` + TIMESTAMP_DIFF(`bfcol_0`, LAG(`bfcol_0`, 1) OVER (ORDER BY `bfcol_0` ASC NULLS LAST), MICROSECOND) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `diff_time` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `bfcol_1` AS `diff_time` +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 ec22ecf885..bb06760e4d 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -9,11 +9,9 @@ WITH `bfcte_0` AS ( input => (`bfcol_0`), categories => ['greeting', 'rejection'], connection_id => 'bigframes-dev.us.bigframes-default-connection' - ) AS `bfcol_2` + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `result` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 08911a4f02..5c4ccefd7b 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -10,11 +10,9 @@ WITH `bfcte_0` AS ( connection_id => 'bigframes-dev.us.bigframes-default-connection', endpoint => 'gemini-2.5-flash', request_type => 'SHARED' - ) AS `bfcol_2` + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `result` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 eede6ab71b..28905d0349 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -10,11 +10,9 @@ WITH `bfcte_0` AS ( connection_id => 'bigframes-dev.us.bigframes-default-connection', endpoint => 'gemini-2.5-flash', request_type => 'SHARED' - ) AS `bfcol_2` + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `result` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 7f726442c0..bf52361a52 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -10,11 +10,9 @@ WITH `bfcte_0` AS ( connection_id => 'bigframes-dev.us.bigframes-default-connection', request_type => 'SHARED', model_params => JSON '{}' - ) AS `bfcol_2` + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `result` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 1e05710b19..cbb05264e9 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -10,11 +10,9 @@ WITH `bfcte_0` AS ( connection_id => 'bigframes-dev.us.bigframes-default-connection', endpoint => 'gemini-2.5-flash', request_type => 'SHARED' - ) AS `bfcol_2` + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `result` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 f2e81eaee4..a1c1a18664 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -10,11 +10,9 @@ WITH `bfcte_0` AS ( connection_id => 'bigframes-dev.us.bigframes-default-connection', request_type => 'SHARED', model_params => JSON '{}' - ) AS `bfcol_2` + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `result` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 a45e419eac..ba5febe0cd 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -10,11 +10,9 @@ WITH `bfcte_0` AS ( connection_id => 'bigframes-dev.us.bigframes-default-connection', endpoint => 'gemini-2.5-flash', request_type => 'SHARED' - ) AS `bfcol_2` + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `result` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 f9f3768d9e..996906fe9c 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -10,11 +10,9 @@ WITH `bfcte_0` AS ( connection_id => 'bigframes-dev.us.bigframes-default-connection', request_type => 'SHARED', model_params => JSON '{}' - ) AS `bfcol_2` + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `result` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 fd18cde0be..8726910619 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -10,11 +10,9 @@ WITH `bfcte_0` AS ( connection_id => 'bigframes-dev.us.bigframes-default-connection', request_type => 'SHARED', model_params => JSON '{}' - ) AS `bfcol_2` + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `result` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 dfbd0be083..62fc2f9db0 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -11,11 +11,9 @@ WITH `bfcte_0` AS ( endpoint => 'gemini-2.5-flash', request_type => 'SHARED', output_schema => 'x INT64, y FLOAT64' - ) AS `bfcol_2` + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `result` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 cec2e379b1..d5b6a9330d 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,18 +1,16 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, AI.IF( prompt => (`bfcol_0`, ' is the same as ', `bfcol_0`), connection_id => 'bigframes-dev.us.bigframes-default-connection' - ) AS `bfcol_2` + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `result` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 a965339b88..e2be615921 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,18 +1,16 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, AI.SCORE( prompt => (`bfcol_0`, ' is the same as ', `bfcol_0`), connection_id => 'bigframes-dev.us.bigframes-default-connection' - ) AS `bfcol_2` + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `result` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 83129e52e8..4398084227 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY, `bfcol_1` INT64>>[STRUCT(ARRAY[], 0)]) + `string_list_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_0`[SAFE_OFFSET(1)] AS `bfcol_2` + `bfcol_0`[SAFE_OFFSET(1)] AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_list_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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_only_start/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_array_slice_with_only_start/out.sql index 8a31bf521a..1ffc3ee8f9 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY, `bfcol_1` INT64>>[STRUCT(ARRAY[], 0)]) + `string_list_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ), `bfcte_1` AS ( SELECT *, @@ -11,11 +11,9 @@ WITH `bfcte_0` AS ( FROM UNNEST(`bfcol_0`) AS el WITH OFFSET AS slice_idx WHERE slice_idx >= 1 - ) AS `bfcol_2` + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_list_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 f0c2ffde4c..878b60e5e2 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY, `bfcol_1` INT64>>[STRUCT(ARRAY[], 0)]) + `string_list_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ), `bfcte_1` AS ( SELECT *, @@ -11,11 +11,9 @@ WITH `bfcte_0` AS ( FROM UNNEST(`bfcol_0`) AS el WITH OFFSET AS slice_idx WHERE slice_idx >= 1 AND slice_idx < 5 - ) AS `bfcol_2` + ) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_list_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 379eece92d..4dbd602bea 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY, `bfcol_1` INT64>>[STRUCT(ARRAY[], 0)]) + `string_list_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ), `bfcte_1` AS ( SELECT *, - ARRAY_TO_STRING(`bfcol_0`, '.') AS `bfcol_2` + ARRAY_TO_STRING(`bfcol_0`, '.') AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_list_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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_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 bc8ed1c445..134fdc363b 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,26 +1,25 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) + `rowindex` AS `bfcol_0`, + `string_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - OBJ.MAKE_REF(`bfcol_1`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_6` + OBJ.MAKE_REF(`bfcol_1`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_4` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT *, - OBJ.FETCH_METADATA(`bfcol_6`) AS `bfcol_10` + OBJ.FETCH_METADATA(`bfcol_4`) AS `bfcol_7` FROM `bfcte_1` ), `bfcte_3` AS ( SELECT *, - `bfcol_10`.`version` AS `bfcol_14` + `bfcol_7`.`version` AS `bfcol_10` FROM `bfcte_2` ) SELECT `bfcol_0` AS `rowindex`, - `bfcol_14` AS `version` -FROM `bfcte_3` -ORDER BY - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `bfcol_10` AS `version` +FROM `bfcte_3` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_get_access_url/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_get_access_url/out.sql index 80e7d7163e..4a963b4972 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,26 +1,25 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) + `rowindex` AS `bfcol_0`, + `string_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - OBJ.MAKE_REF(`bfcol_1`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_6` + OBJ.MAKE_REF(`bfcol_1`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_4` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT *, - OBJ.GET_ACCESS_URL(`bfcol_6`) AS `bfcol_10` + OBJ.GET_ACCESS_URL(`bfcol_4`) AS `bfcol_7` FROM `bfcte_1` ), `bfcte_3` AS ( SELECT *, - JSON_VALUE(`bfcol_10`, '$.access_urls.read_url') AS `bfcol_14` + JSON_VALUE(`bfcol_7`, '$.access_urls.read_url') AS `bfcol_10` FROM `bfcte_2` ) SELECT `bfcol_0` AS `rowindex`, - `bfcol_14` AS `string_col` -FROM `bfcte_3` -ORDER BY - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `bfcol_10` AS `string_col` +FROM `bfcte_3` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_make_ref/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_make_ref/out.sql index 4691deef37..e3228feaaa 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,16 +1,15 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) + `rowindex` AS `bfcol_0`, + `string_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - OBJ.MAKE_REF(`bfcol_1`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_6` + OBJ.MAKE_REF(`bfcol_1`, 'bigframes-dev.test-region.bigframes-default-connection') AS `bfcol_4` FROM `bfcte_0` ) SELECT `bfcol_0` AS `rowindex`, - `bfcol_6` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `bfcol_4` AS `string_col` +FROM `bfcte_1` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_and_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_and_op/out.sql index e2291338fc..42c5847401 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,31 +1,31 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1`, + `rowindex` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_8`, - `bfcol_0` AS `bfcol_9`, - `bfcol_1` AS `bfcol_10`, - `bfcol_1` & `bfcol_1` AS `bfcol_11` + `bfcol_2` AS `bfcol_6`, + `bfcol_0` AS `bfcol_7`, + `bfcol_1` AS `bfcol_8`, + `bfcol_1` & `bfcol_1` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT *, - `bfcol_8` AS `bfcol_17`, - `bfcol_9` AS `bfcol_18`, - `bfcol_10` AS `bfcol_19`, - `bfcol_11` AS `bfcol_20`, - `bfcol_9` AND `bfcol_9` AS `bfcol_21` + `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_17` AS `rowindex`, - `bfcol_18` AS `bool_col`, - `bfcol_19` AS `int64_col`, - `bfcol_20` AS `int_and_int`, - `bfcol_21` AS `bool_and_bool` -FROM `bfcte_2` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file + `bfcol_14` AS `rowindex`, + `bfcol_15` AS `bool_col`, + `bfcol_16` AS `int64_col`, + `bfcol_17` AS `int_and_int`, + `bfcol_18` AS `bool_and_bool` +FROM `bfcte_2` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_or_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_or_op/out.sql index 695da24141..d1e7bd1822 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,31 +1,31 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1`, + `rowindex` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_8`, - `bfcol_0` AS `bfcol_9`, - `bfcol_1` AS `bfcol_10`, - `bfcol_1` | `bfcol_1` AS `bfcol_11` + `bfcol_2` AS `bfcol_6`, + `bfcol_0` AS `bfcol_7`, + `bfcol_1` AS `bfcol_8`, + `bfcol_1` | `bfcol_1` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT *, - `bfcol_8` AS `bfcol_17`, - `bfcol_9` AS `bfcol_18`, - `bfcol_10` AS `bfcol_19`, - `bfcol_11` AS `bfcol_20`, - `bfcol_9` OR `bfcol_9` AS `bfcol_21` + `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_17` AS `rowindex`, - `bfcol_18` AS `bool_col`, - `bfcol_19` AS `int64_col`, - `bfcol_20` AS `int_and_int`, - `bfcol_21` AS `bool_and_bool` -FROM `bfcte_2` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file + `bfcol_14` AS `rowindex`, + `bfcol_15` AS `bool_col`, + `bfcol_16` AS `int64_col`, + `bfcol_17` AS `int_and_int`, + `bfcol_18` AS `bool_and_bool` +FROM `bfcte_2` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_xor_op/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_bool_ops/test_xor_op/out.sql index 6d2d5bffdd..7d5f74ede7 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,31 +1,31 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1`, + `rowindex` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_8`, - `bfcol_0` AS `bfcol_9`, - `bfcol_1` AS `bfcol_10`, - `bfcol_1` ^ `bfcol_1` AS `bfcol_11` + `bfcol_2` AS `bfcol_6`, + `bfcol_0` AS `bfcol_7`, + `bfcol_1` AS `bfcol_8`, + `bfcol_1` ^ `bfcol_1` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT *, - `bfcol_8` AS `bfcol_17`, - `bfcol_9` AS `bfcol_18`, - `bfcol_10` AS `bfcol_19`, - `bfcol_11` AS `bfcol_20`, - `bfcol_9` AND NOT `bfcol_9` OR NOT `bfcol_9` AND `bfcol_9` AS `bfcol_21` + `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_17` AS `rowindex`, - `bfcol_18` AS `bool_col`, - `bfcol_19` AS `int64_col`, - `bfcol_20` AS `int_and_int`, - `bfcol_21` AS `bool_and_bool` -FROM `bfcte_2` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file + `bfcol_14` AS `rowindex`, + `bfcol_15` AS `bool_col`, + `bfcol_16` AS `int64_col`, + `bfcol_17` AS `int_and_int`, + `bfcol_18` AS `bool_and_bool` +FROM `bfcte_2` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_eq_null_match/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_eq_null_match/out.sql index 66f7ad1aea..90cbcfe5c7 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,15 +1,14 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), 0)]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - COALESCE(CAST(`bfcol_1` AS STRING), '$NULL_SENTINEL$') = COALESCE(CAST(CAST(`bfcol_0` AS INT64) AS STRING), '$NULL_SENTINEL$') AS `bfcol_6` + COALESCE(CAST(`bfcol_1` AS STRING), '$NULL_SENTINEL$') = COALESCE(CAST(CAST(`bfcol_0` AS INT64) AS STRING), '$NULL_SENTINEL$') AS `bfcol_4` FROM `bfcte_0` ) SELECT - `bfcol_6` AS `int64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `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 b909cd1a08..8e3c52310d 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,54 +1,54 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1`, + `rowindex` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_8`, - `bfcol_1` AS `bfcol_9`, - `bfcol_0` AS `bfcol_10`, - `bfcol_1` = `bfcol_1` AS `bfcol_11` + `bfcol_2` AS `bfcol_6`, + `bfcol_1` AS `bfcol_7`, + `bfcol_0` AS `bfcol_8`, + `bfcol_1` = `bfcol_1` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT *, - `bfcol_8` AS `bfcol_17`, - `bfcol_9` AS `bfcol_18`, - `bfcol_10` AS `bfcol_19`, - `bfcol_11` AS `bfcol_20`, - `bfcol_9` = 1 AS `bfcol_21` + `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_17` AS `bfcol_28`, - `bfcol_18` AS `bfcol_29`, - `bfcol_19` AS `bfcol_30`, - `bfcol_20` AS `bfcol_31`, - `bfcol_21` AS `bfcol_32`, - `bfcol_18` = CAST(`bfcol_19` AS INT64) AS `bfcol_33` + `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_28` AS `bfcol_41`, - `bfcol_29` AS `bfcol_42`, - `bfcol_30` AS `bfcol_43`, - `bfcol_31` AS `bfcol_44`, - `bfcol_32` AS `bfcol_45`, - `bfcol_33` AS `bfcol_46`, - CAST(`bfcol_30` AS INT64) = `bfcol_29` AS `bfcol_47` + `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_41` AS `rowindex`, - `bfcol_42` AS `int64_col`, - `bfcol_43` AS `bool_col`, - `bfcol_44` AS `int_ne_int`, - `bfcol_45` AS `int_ne_1`, - `bfcol_46` AS `int_ne_bool`, - `bfcol_47` AS `bool_ne_int` -FROM `bfcte_4` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file + `bfcol_36` AS `rowindex`, + `bfcol_37` AS `int64_col`, + `bfcol_38` AS `bool_col`, + `bfcol_39` AS `int_ne_int`, + `bfcol_40` AS `int_ne_1`, + `bfcol_41` AS `int_ne_bool`, + `bfcol_42` AS `bool_ne_int` +FROM `bfcte_4` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_ge_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_ge_numeric/out.sql index c1f5f62120..494cb861a7 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,54 +1,54 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1`, + `rowindex` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_8`, - `bfcol_1` AS `bfcol_9`, - `bfcol_0` AS `bfcol_10`, - `bfcol_1` >= `bfcol_1` AS `bfcol_11` + `bfcol_2` AS `bfcol_6`, + `bfcol_1` AS `bfcol_7`, + `bfcol_0` AS `bfcol_8`, + `bfcol_1` >= `bfcol_1` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT *, - `bfcol_8` AS `bfcol_17`, - `bfcol_9` AS `bfcol_18`, - `bfcol_10` AS `bfcol_19`, - `bfcol_11` AS `bfcol_20`, - `bfcol_9` >= 1 AS `bfcol_21` + `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_17` AS `bfcol_28`, - `bfcol_18` AS `bfcol_29`, - `bfcol_19` AS `bfcol_30`, - `bfcol_20` AS `bfcol_31`, - `bfcol_21` AS `bfcol_32`, - `bfcol_18` >= CAST(`bfcol_19` AS INT64) AS `bfcol_33` + `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_28` AS `bfcol_41`, - `bfcol_29` AS `bfcol_42`, - `bfcol_30` AS `bfcol_43`, - `bfcol_31` AS `bfcol_44`, - `bfcol_32` AS `bfcol_45`, - `bfcol_33` AS `bfcol_46`, - CAST(`bfcol_30` AS INT64) >= `bfcol_29` AS `bfcol_47` + `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_41` AS `rowindex`, - `bfcol_42` AS `int64_col`, - `bfcol_43` AS `bool_col`, - `bfcol_44` AS `int_ge_int`, - `bfcol_45` AS `int_ge_1`, - `bfcol_46` AS `int_ge_bool`, - `bfcol_47` AS `bool_ge_int` -FROM `bfcte_4` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file + `bfcol_36` AS `rowindex`, + `bfcol_37` AS `int64_col`, + `bfcol_38` AS `bool_col`, + `bfcol_39` AS `int_ge_int`, + `bfcol_40` AS `int_ge_1`, + `bfcol_41` AS `int_ge_bool`, + `bfcol_42` AS `bool_ge_int` +FROM `bfcte_4` \ No newline at end of file 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 cf513a3507..b0c8768850 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,54 +1,54 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1`, + `rowindex` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_8`, - `bfcol_1` AS `bfcol_9`, - `bfcol_0` AS `bfcol_10`, - `bfcol_1` > `bfcol_1` AS `bfcol_11` + `bfcol_2` AS `bfcol_6`, + `bfcol_1` AS `bfcol_7`, + `bfcol_0` AS `bfcol_8`, + `bfcol_1` > `bfcol_1` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT *, - `bfcol_8` AS `bfcol_17`, - `bfcol_9` AS `bfcol_18`, - `bfcol_10` AS `bfcol_19`, - `bfcol_11` AS `bfcol_20`, - `bfcol_9` > 1 AS `bfcol_21` + `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_17` AS `bfcol_28`, - `bfcol_18` AS `bfcol_29`, - `bfcol_19` AS `bfcol_30`, - `bfcol_20` AS `bfcol_31`, - `bfcol_21` AS `bfcol_32`, - `bfcol_18` > CAST(`bfcol_19` AS INT64) AS `bfcol_33` + `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_28` AS `bfcol_41`, - `bfcol_29` AS `bfcol_42`, - `bfcol_30` AS `bfcol_43`, - `bfcol_31` AS `bfcol_44`, - `bfcol_32` AS `bfcol_45`, - `bfcol_33` AS `bfcol_46`, - CAST(`bfcol_30` AS INT64) > `bfcol_29` AS `bfcol_47` + `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_41` AS `rowindex`, - `bfcol_42` AS `int64_col`, - `bfcol_43` AS `bool_col`, - `bfcol_44` AS `int_gt_int`, - `bfcol_45` AS `int_gt_1`, - `bfcol_46` AS `int_gt_bool`, - `bfcol_47` AS `bool_gt_int` -FROM `bfcte_4` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file + `bfcol_36` AS `rowindex`, + `bfcol_37` AS `int64_col`, + `bfcol_38` AS `bool_col`, + `bfcol_39` AS `int_gt_int`, + `bfcol_40` AS `int_gt_1`, + `bfcol_41` AS `int_gt_bool`, + `bfcol_42` AS `bool_gt_int` +FROM `bfcte_4` \ No newline at end of file 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 5a3fedd111..7a1a2a743d 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,33 +1,32 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS FLOAT64), 0)]) + `int64_col` AS `bfcol_0`, + `float64_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - COALESCE(`bfcol_0` IN (1, 2, 3), FALSE) AS `bfcol_3`, + COALESCE(`bfcol_0` IN (1, 2, 3), FALSE) AS `bfcol_2`, ( `bfcol_0` IS NULL - ) OR `bfcol_0` IN (123456) AS `bfcol_4`, - COALESCE(`bfcol_0` IN (1.0, 2.0, 3.0), FALSE) AS `bfcol_5`, - FALSE AS `bfcol_6`, - COALESCE(`bfcol_0` IN (2.5, 3), FALSE) AS `bfcol_7`, - FALSE AS `bfcol_8`, - COALESCE(`bfcol_0` IN (123456), FALSE) AS `bfcol_9`, + ) OR `bfcol_0` IN (123456) AS `bfcol_3`, + COALESCE(`bfcol_0` IN (1.0, 2.0, 3.0), FALSE) AS `bfcol_4`, + FALSE AS `bfcol_5`, + COALESCE(`bfcol_0` IN (2.5, 3), FALSE) AS `bfcol_6`, + FALSE AS `bfcol_7`, + COALESCE(`bfcol_0` IN (123456), FALSE) AS `bfcol_8`, ( `bfcol_1` IS NULL - ) OR `bfcol_1` IN (1, 2, 3) AS `bfcol_10` + ) OR `bfcol_1` IN (1, 2, 3) AS `bfcol_9` FROM `bfcte_0` ) SELECT - `bfcol_3` AS `ints`, - `bfcol_4` AS `ints_w_null`, - `bfcol_5` AS `floats`, - `bfcol_6` AS `strings`, - `bfcol_7` AS `mixed`, - `bfcol_8` AS `empty`, - `bfcol_9` AS `ints_wo_match_nulls`, - `bfcol_10` AS `float_in_ints` -FROM `bfcte_1` -ORDER BY - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `bfcol_2` AS `ints`, + `bfcol_3` AS `ints_w_null`, + `bfcol_4` AS `floats`, + `bfcol_5` AS `strings`, + `bfcol_6` AS `mixed`, + `bfcol_7` AS `empty`, + `bfcol_8` AS `ints_wo_match_nulls`, + `bfcol_9` AS `float_in_ints` +FROM `bfcte_1` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_le_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_le_numeric/out.sql index 9a8727562e..2f642d8cbb 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,54 +1,54 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1`, + `rowindex` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_8`, - `bfcol_1` AS `bfcol_9`, - `bfcol_0` AS `bfcol_10`, - `bfcol_1` <= `bfcol_1` AS `bfcol_11` + `bfcol_2` AS `bfcol_6`, + `bfcol_1` AS `bfcol_7`, + `bfcol_0` AS `bfcol_8`, + `bfcol_1` <= `bfcol_1` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT *, - `bfcol_8` AS `bfcol_17`, - `bfcol_9` AS `bfcol_18`, - `bfcol_10` AS `bfcol_19`, - `bfcol_11` AS `bfcol_20`, - `bfcol_9` <= 1 AS `bfcol_21` + `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_17` AS `bfcol_28`, - `bfcol_18` AS `bfcol_29`, - `bfcol_19` AS `bfcol_30`, - `bfcol_20` AS `bfcol_31`, - `bfcol_21` AS `bfcol_32`, - `bfcol_18` <= CAST(`bfcol_19` AS INT64) AS `bfcol_33` + `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_28` AS `bfcol_41`, - `bfcol_29` AS `bfcol_42`, - `bfcol_30` AS `bfcol_43`, - `bfcol_31` AS `bfcol_44`, - `bfcol_32` AS `bfcol_45`, - `bfcol_33` AS `bfcol_46`, - CAST(`bfcol_30` AS INT64) <= `bfcol_29` AS `bfcol_47` + `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_41` AS `rowindex`, - `bfcol_42` AS `int64_col`, - `bfcol_43` AS `bool_col`, - `bfcol_44` AS `int_le_int`, - `bfcol_45` AS `int_le_1`, - `bfcol_46` AS `int_le_bool`, - `bfcol_47` AS `bool_le_int` -FROM `bfcte_4` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file + `bfcol_36` AS `rowindex`, + `bfcol_37` AS `int64_col`, + `bfcol_38` AS `bool_col`, + `bfcol_39` AS `int_le_int`, + `bfcol_40` AS `int_le_1`, + `bfcol_41` AS `int_le_bool`, + `bfcol_42` AS `bool_le_int` +FROM `bfcte_4` \ No newline at end of file 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 8305f268c8..b244e3cbcc 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,54 +1,54 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1`, + `rowindex` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_8`, - `bfcol_1` AS `bfcol_9`, - `bfcol_0` AS `bfcol_10`, - `bfcol_1` < `bfcol_1` AS `bfcol_11` + `bfcol_2` AS `bfcol_6`, + `bfcol_1` AS `bfcol_7`, + `bfcol_0` AS `bfcol_8`, + `bfcol_1` < `bfcol_1` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT *, - `bfcol_8` AS `bfcol_17`, - `bfcol_9` AS `bfcol_18`, - `bfcol_10` AS `bfcol_19`, - `bfcol_11` AS `bfcol_20`, - `bfcol_9` < 1 AS `bfcol_21` + `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_17` AS `bfcol_28`, - `bfcol_18` AS `bfcol_29`, - `bfcol_19` AS `bfcol_30`, - `bfcol_20` AS `bfcol_31`, - `bfcol_21` AS `bfcol_32`, - `bfcol_18` < CAST(`bfcol_19` AS INT64) AS `bfcol_33` + `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_28` AS `bfcol_41`, - `bfcol_29` AS `bfcol_42`, - `bfcol_30` AS `bfcol_43`, - `bfcol_31` AS `bfcol_44`, - `bfcol_32` AS `bfcol_45`, - `bfcol_33` AS `bfcol_46`, - CAST(`bfcol_30` AS INT64) < `bfcol_29` AS `bfcol_47` + `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_41` AS `rowindex`, - `bfcol_42` AS `int64_col`, - `bfcol_43` AS `bool_col`, - `bfcol_44` AS `int_lt_int`, - `bfcol_45` AS `int_lt_1`, - `bfcol_46` AS `int_lt_bool`, - `bfcol_47` AS `bool_lt_int` -FROM `bfcte_4` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file + `bfcol_36` AS `rowindex`, + `bfcol_37` AS `int64_col`, + `bfcol_38` AS `bool_col`, + `bfcol_39` AS `int_lt_int`, + `bfcol_40` AS `int_lt_1`, + `bfcol_41` AS `int_lt_bool`, + `bfcol_42` AS `bool_lt_int` +FROM `bfcte_4` \ No newline at end of file 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 7665787dbb..6fba4b960f 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,54 +1,54 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1`, + `rowindex` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_8`, - `bfcol_1` AS `bfcol_9`, - `bfcol_0` AS `bfcol_10`, - `bfcol_1` <> `bfcol_1` AS `bfcol_11` + `bfcol_2` AS `bfcol_6`, + `bfcol_1` AS `bfcol_7`, + `bfcol_0` AS `bfcol_8`, + `bfcol_1` <> `bfcol_1` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT *, - `bfcol_8` AS `bfcol_17`, - `bfcol_9` AS `bfcol_18`, - `bfcol_10` AS `bfcol_19`, - `bfcol_11` AS `bfcol_20`, - `bfcol_9` <> 1 AS `bfcol_21` + `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_17` AS `bfcol_28`, - `bfcol_18` AS `bfcol_29`, - `bfcol_19` AS `bfcol_30`, - `bfcol_20` AS `bfcol_31`, - `bfcol_21` AS `bfcol_32`, - `bfcol_18` <> CAST(`bfcol_19` AS INT64) AS `bfcol_33` + `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_28` AS `bfcol_41`, - `bfcol_29` AS `bfcol_42`, - `bfcol_30` AS `bfcol_43`, - `bfcol_31` AS `bfcol_44`, - `bfcol_32` AS `bfcol_45`, - `bfcol_33` AS `bfcol_46`, - CAST(`bfcol_30` AS INT64) <> `bfcol_29` AS `bfcol_47` + `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_41` AS `rowindex`, - `bfcol_42` AS `int64_col`, - `bfcol_43` AS `bool_col`, - `bfcol_44` AS `int_ne_int`, - `bfcol_45` AS `int_ne_1`, - `bfcol_46` AS `int_ne_bool`, - `bfcol_47` AS `bool_ne_int` -FROM `bfcte_4` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file + `bfcol_36` AS `rowindex`, + `bfcol_37` AS `int64_col`, + `bfcol_38` AS `bool_col`, + `bfcol_39` AS `int_ne_int`, + `bfcol_40` AS `int_ne_1`, + `bfcol_41` AS `int_ne_bool`, + `bfcol_42` AS `bool_ne_int` +FROM `bfcte_4` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_add_timedelta/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_add_timedelta/out.sql index ae5b663163..a47531999b 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,60 +1,60 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS DATE), CAST(NULL AS INT64), CAST(NULL AS TIMESTAMP), 0)]) + `date_col` AS `bfcol_0`, + `rowindex` AS `bfcol_1`, + `timestamp_col` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_8`, - `bfcol_2` AS `bfcol_9`, - `bfcol_0` AS `bfcol_10`, - TIMESTAMP_ADD(CAST(`bfcol_0` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `bfcol_11` + `bfcol_1` AS `bfcol_6`, + `bfcol_2` AS `bfcol_7`, + `bfcol_0` AS `bfcol_8`, + TIMESTAMP_ADD(CAST(`bfcol_0` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT *, - `bfcol_8` AS `bfcol_17`, - `bfcol_9` AS `bfcol_18`, - `bfcol_10` AS `bfcol_19`, - `bfcol_11` AS `bfcol_20`, - TIMESTAMP_ADD(`bfcol_9`, INTERVAL 86400000000 MICROSECOND) AS `bfcol_21` + `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_17` AS `bfcol_28`, - `bfcol_18` AS `bfcol_29`, - `bfcol_19` AS `bfcol_30`, - `bfcol_20` AS `bfcol_31`, - `bfcol_21` AS `bfcol_32`, - TIMESTAMP_ADD(CAST(`bfcol_19` AS DATETIME), INTERVAL 86400000000 MICROSECOND) AS `bfcol_33` + `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_28` AS `bfcol_41`, - `bfcol_29` AS `bfcol_42`, - `bfcol_30` AS `bfcol_43`, - `bfcol_31` AS `bfcol_44`, - `bfcol_32` AS `bfcol_45`, - `bfcol_33` AS `bfcol_46`, - TIMESTAMP_ADD(`bfcol_29`, INTERVAL 86400000000 MICROSECOND) AS `bfcol_47` + `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_56` + 172800000000 AS `bfcol_50` FROM `bfcte_4` ) SELECT - `bfcol_41` AS `rowindex`, - `bfcol_42` AS `timestamp_col`, - `bfcol_43` AS `date_col`, - `bfcol_44` AS `date_add_timedelta`, - `bfcol_45` AS `timestamp_add_timedelta`, - `bfcol_46` AS `timedelta_add_date`, - `bfcol_47` AS `timedelta_add_timestamp`, - `bfcol_56` AS `timedelta_add_timedelta` -FROM `bfcte_5` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file + `bfcol_36` AS `rowindex`, + `bfcol_37` AS `timestamp_col`, + `bfcol_38` AS `date_col`, + `bfcol_39` AS `date_add_timedelta`, + `bfcol_40` AS `timestamp_add_timedelta`, + `bfcol_41` AS `timedelta_add_date`, + `bfcol_42` AS `timedelta_add_timestamp`, + `bfcol_50` AS `timedelta_add_timedelta` +FROM `bfcte_5` \ No newline at end of file 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 f8241f6b3b..615a4a92bb 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - DATE(`bfcol_0`) AS `bfcol_2` + DATE(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `timestamp_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 60a4b94e23..460823fa20 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(DAY FROM `bfcol_0`) AS `bfcol_2` + EXTRACT(DAY FROM `bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `timestamp_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 624d3b1ccc..e6c17587d0 100644 --- a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_dayofweek/out.sql +++ b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_dayofweek/out.sql @@ -1,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(DAYOFWEEK FROM `bfcol_0`) - 1 AS `bfcol_2` + EXTRACT(DAYOFWEEK FROM `bfcol_0`) - 1 AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `timestamp_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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_dayofyear/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_dayofyear/out.sql index f84e11833a..4b60bcc4ca 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(DAYOFYEAR FROM `bfcol_0`) AS `bfcol_2` + EXTRACT(DAYOFYEAR FROM `bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `timestamp_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 bcba25e17c..ad4fdb23a1 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - TIMESTAMP_TRUNC(`bfcol_0`, D) AS `bfcol_2` + TIMESTAMP_TRUNC(`bfcol_0`, D) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `timestamp_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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_hour/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_datetime_ops/test_hour/out.sql index a3b6a32ebc..8cc9b9081f 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(HOUR FROM `bfcol_0`) AS `bfcol_2` + EXTRACT(HOUR FROM `bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `timestamp_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 d69f1a6908..d389172fda 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(DAYOFWEEK FROM `bfcol_0`) AS `bfcol_2` + EXTRACT(DAYOFWEEK FROM `bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `timestamp_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 27414c081a..f22e963bc3 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(ISOWEEK FROM `bfcol_0`) AS `bfcol_2` + EXTRACT(ISOWEEK FROM `bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `timestamp_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 50f624522a..13b56f709c 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(ISOYEAR FROM `bfcol_0`) AS `bfcol_2` + EXTRACT(ISOYEAR FROM `bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `timestamp_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 7cbb1c2259..4ef9b8142f 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(MINUTE FROM `bfcol_0`) AS `bfcol_2` + EXTRACT(MINUTE FROM `bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `timestamp_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 c11921092d..4912622898 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(MONTH FROM `bfcol_0`) AS `bfcol_2` + EXTRACT(MONTH FROM `bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `timestamp_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 c7088fe7d8..3c7efd3098 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - TIMESTAMP_TRUNC(`bfcol_0`, DAY) AS `bfcol_2` + TIMESTAMP_TRUNC(`bfcol_0`, DAY) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `timestamp_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 90fa2e89c5..2be2866661 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(QUARTER FROM `bfcol_0`) AS `bfcol_2` + EXTRACT(QUARTER FROM `bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `timestamp_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 5ee7c35820..144b704788 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(SECOND FROM `bfcol_0`) AS `bfcol_2` + EXTRACT(SECOND FROM `bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `timestamp_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 054a86a676..077c30e7cb 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - FORMAT_TIMESTAMP('%Y-%m-%d', `bfcol_0`) AS `bfcol_2` + FORMAT_TIMESTAMP('%Y-%m-%d', `bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `timestamp_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 ae8a4c479f..2d615fcca6 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,81 +1,82 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS DATE), CAST(NULL AS INT64), CAST(NULL AS TIMESTAMP), CAST(NULL AS INT64), 0)]) + `date_col` AS `bfcol_0`, + `rowindex` AS `bfcol_1`, + `timestamp_col` AS `bfcol_2`, + `duration_col` AS `bfcol_3` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_10`, - `bfcol_2` AS `bfcol_11`, - `bfcol_0` AS `bfcol_12`, - `bfcol_3` AS `bfcol_13` + `bfcol_1` AS `bfcol_8`, + `bfcol_2` AS `bfcol_9`, + `bfcol_0` AS `bfcol_10`, + `bfcol_3` 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`, - `bfcol_11` AS `bfcol_20`, - `bfcol_13` AS `bfcol_21`, - `bfcol_12` AS `bfcol_22`, - TIMESTAMP_SUB(CAST(`bfcol_12` AS DATETIME), INTERVAL `bfcol_13` MICROSECOND) AS `bfcol_23` + TIMESTAMP_SUB(CAST(`bfcol_10` AS DATETIME), INTERVAL `bfcol_11` MICROSECOND) AS `bfcol_20` FROM `bfcte_1` ), `bfcte_3` AS ( SELECT *, - `bfcol_19` AS `bfcol_30`, - `bfcol_20` AS `bfcol_31`, - `bfcol_21` AS `bfcol_32`, - `bfcol_22` AS `bfcol_33`, - `bfcol_23` AS `bfcol_34`, - TIMESTAMP_SUB(`bfcol_20`, INTERVAL `bfcol_21` MICROSECOND) AS `bfcol_35` + `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_30` AS `bfcol_43`, - `bfcol_31` AS `bfcol_44`, - `bfcol_32` AS `bfcol_45`, - `bfcol_33` AS `bfcol_46`, - `bfcol_34` AS `bfcol_47`, - `bfcol_35` AS `bfcol_48`, - TIMESTAMP_DIFF(CAST(`bfcol_33` AS DATETIME), CAST(`bfcol_33` AS DATETIME), MICROSECOND) AS `bfcol_49` + `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_43` AS `bfcol_58`, - `bfcol_44` AS `bfcol_59`, - `bfcol_45` AS `bfcol_60`, - `bfcol_46` AS `bfcol_61`, - `bfcol_47` AS `bfcol_62`, - `bfcol_48` AS `bfcol_63`, - `bfcol_49` AS `bfcol_64`, - TIMESTAMP_DIFF(`bfcol_44`, `bfcol_44`, MICROSECOND) AS `bfcol_65` + `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_58` AS `bfcol_75`, - `bfcol_59` AS `bfcol_76`, - `bfcol_60` AS `bfcol_77`, - `bfcol_61` AS `bfcol_78`, - `bfcol_62` AS `bfcol_79`, - `bfcol_63` AS `bfcol_80`, - `bfcol_64` AS `bfcol_81`, - `bfcol_65` AS `bfcol_82`, - `bfcol_60` - `bfcol_60` AS `bfcol_83` + `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_75` AS `rowindex`, - `bfcol_76` AS `timestamp_col`, - `bfcol_77` AS `duration_col`, - `bfcol_78` AS `date_col`, - `bfcol_79` AS `date_sub_timedelta`, - `bfcol_80` AS `timestamp_sub_timedelta`, - `bfcol_81` AS `timestamp_sub_date`, - `bfcol_82` AS `date_sub_timestamp`, - `bfcol_83` AS `timedelta_sub_timedelta` -FROM `bfcte_6` -ORDER BY - `bfcol_4` ASC NULLS LAST \ No newline at end of file + `bfcol_68` AS `rowindex`, + `bfcol_69` AS `timestamp_col`, + `bfcol_70` AS `duration_col`, + `bfcol_71` AS `date_col`, + `bfcol_72` AS `date_sub_timedelta`, + `bfcol_73` AS `timestamp_sub_timedelta`, + `bfcol_74` AS `timestamp_sub_date`, + `bfcol_75` AS `date_sub_timestamp`, + `bfcol_76` AS `timedelta_sub_timedelta` +FROM `bfcte_6` \ No newline at end of file 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 1bf6562037..6b74efafd5 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - TIME(`bfcol_0`) AS `bfcol_2` + TIME(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `timestamp_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 dc203ec67b..096f14cc85 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CAST(TIMESTAMP_SECONDS(`bfcol_0`) AS DATETIME) AS `bfcol_2` + CAST(TIMESTAMP_SECONDS(`bfcol_0`) AS DATETIME) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `int64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 ceb17dd586..b1e66ce3e7 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - TIMESTAMP_SECONDS(`bfcol_0`) AS `bfcol_2` + TIMESTAMP_SECONDS(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `int64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 25e899da96..dcbf0be5c2 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - UNIX_MICROS(`bfcol_0`) AS `bfcol_2` + UNIX_MICROS(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `timestamp_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 7a4b667714..ca58fbc97c 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - UNIX_MILLIS(`bfcol_0`) AS `bfcol_2` + UNIX_MILLIS(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `timestamp_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 6d12a05137..21f0b7b8c8 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - UNIX_SECONDS(`bfcol_0`) AS `bfcol_2` + UNIX_SECONDS(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `timestamp_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 d50b17e013..8352a65e9e 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS TIMESTAMP), 0)]) + `timestamp_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - EXTRACT(YEAR FROM `bfcol_0`) AS `bfcol_2` + EXTRACT(YEAR FROM `bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `timestamp_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 049b2ec82d..440aea9161 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,19 +1,18 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS FLOAT64), 0)]) + `bool_col` AS `bfcol_0`, + `float64_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_0` AS `bfcol_3`, - `bfcol_1` <> 0 AS `bfcol_4`, - `bfcol_1` <> 0 AS `bfcol_5` + `bfcol_0` AS `bfcol_2`, + `bfcol_1` <> 0 AS `bfcol_3`, + `bfcol_1` <> 0 AS `bfcol_4` FROM `bfcte_0` ) SELECT - `bfcol_3` AS `bool_col`, - `bfcol_4` AS `float64_col`, - `bfcol_5` AS `float64_w_safe` -FROM `bfcte_1` -ORDER BY - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `bfcol_2` AS `bool_col`, + `bfcol_3` AS `float64_col`, + `bfcol_4` AS `float64_w_safe` +FROM `bfcte_1` \ No newline at end of file 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 e0709f0359..81a8805f47 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,19 +1,17 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), 0)]) + `bool_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CAST(CAST(`bfcol_0` AS INT64) AS FLOAT64) AS `bfcol_2`, - CAST('1.34235e4' AS FLOAT64) AS `bfcol_3`, - SAFE_CAST(SAFE_CAST(`bfcol_0` AS INT64) AS FLOAT64) AS `bfcol_4` + CAST(CAST(`bfcol_0` AS INT64) AS FLOAT64) AS `bfcol_1`, + CAST('1.34235e4' AS FLOAT64) AS `bfcol_2`, + SAFE_CAST(SAFE_CAST(`bfcol_0` AS INT64) AS FLOAT64) AS `bfcol_3` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `bool_col`, - `bfcol_3` AS `str_const`, - `bfcol_4` AS `bool_w_safe` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `bfcol_1` AS `bool_col`, + `bfcol_2` AS `str_const`, + `bfcol_3` AS `bool_w_safe` +FROM `bfcte_1` \ No newline at end of file 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 629562dd41..22aa2cf91a 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,38 +1,33 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT( - CAST(NULL AS DATETIME), - CAST(NULL AS NUMERIC), - CAST(NULL AS FLOAT64), - CAST(NULL AS TIME), - CAST(NULL AS TIMESTAMP), - 0 - )]) + `datetime_col` AS `bfcol_0`, + `numeric_col` AS `bfcol_1`, + `float64_col` AS `bfcol_2`, + `time_col` AS `bfcol_3`, + `timestamp_col` AS `bfcol_4` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - UNIX_MICROS(CAST(`bfcol_0` AS TIMESTAMP)) AS `bfcol_6`, - UNIX_MICROS(SAFE_CAST(`bfcol_0` AS TIMESTAMP)) AS `bfcol_7`, - TIME_DIFF(CAST(`bfcol_3` AS TIME), '00:00:00', MICROSECOND) AS `bfcol_8`, - TIME_DIFF(SAFE_CAST(`bfcol_3` AS TIME), '00:00:00', MICROSECOND) AS `bfcol_9`, - UNIX_MICROS(`bfcol_4`) AS `bfcol_10`, - CAST(TRUNC(`bfcol_1`) AS INT64) AS `bfcol_11`, - CAST(TRUNC(`bfcol_2`) AS INT64) AS `bfcol_12`, - SAFE_CAST(TRUNC(`bfcol_2`) AS INT64) AS `bfcol_13`, - CAST('100' AS INT64) AS `bfcol_14` + UNIX_MICROS(CAST(`bfcol_0` AS TIMESTAMP)) AS `bfcol_5`, + UNIX_MICROS(SAFE_CAST(`bfcol_0` AS TIMESTAMP)) AS `bfcol_6`, + TIME_DIFF(CAST(`bfcol_3` AS TIME), '00:00:00', MICROSECOND) AS `bfcol_7`, + TIME_DIFF(SAFE_CAST(`bfcol_3` AS TIME), '00:00:00', MICROSECOND) AS `bfcol_8`, + UNIX_MICROS(`bfcol_4`) AS `bfcol_9`, + CAST(TRUNC(`bfcol_1`) AS INT64) AS `bfcol_10`, + CAST(TRUNC(`bfcol_2`) AS INT64) AS `bfcol_11`, + SAFE_CAST(TRUNC(`bfcol_2`) AS INT64) AS `bfcol_12`, + CAST('100' AS INT64) AS `bfcol_13` FROM `bfcte_0` ) SELECT - `bfcol_6` AS `datetime_col`, - `bfcol_7` AS `datetime_w_safe`, - `bfcol_8` AS `time_col`, - `bfcol_9` AS `time_w_safe`, - `bfcol_10` AS `timestamp_col`, - `bfcol_11` AS `numeric_col`, - `bfcol_12` AS `float64_col`, - `bfcol_13` AS `float64_w_safe`, - `bfcol_14` AS `str_const` -FROM `bfcte_1` -ORDER BY - `bfcol_5` ASC NULLS LAST \ No newline at end of file + `bfcol_5` AS `datetime_col`, + `bfcol_6` AS `datetime_w_safe`, + `bfcol_7` AS `time_col`, + `bfcol_8` AS `time_w_safe`, + `bfcol_9` AS `timestamp_col`, + `bfcol_10` AS `numeric_col`, + `bfcol_11` AS `float64_col`, + `bfcol_12` AS `float64_w_safe`, + `bfcol_13` AS `str_const` +FROM `bfcte_1` \ No newline at end of file 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 459f8d63ec..8230b4a60b 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,31 +1,26 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT( - CAST(NULL AS BOOLEAN), - CAST(NULL AS INT64), - CAST(NULL AS FLOAT64), - CAST(NULL AS STRING), - 0 - )]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1`, + `float64_col` AS `bfcol_2`, + `string_col` AS `bfcol_3` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - PARSE_JSON(CAST(`bfcol_1` AS STRING)) AS `bfcol_5`, - PARSE_JSON(CAST(`bfcol_2` AS STRING)) AS `bfcol_6`, - PARSE_JSON(CAST(`bfcol_0` AS STRING)) AS `bfcol_7`, - PARSE_JSON(`bfcol_3`) AS `bfcol_8`, - PARSE_JSON(CAST(`bfcol_0` AS STRING)) AS `bfcol_9`, - PARSE_JSON_IN_SAFE(`bfcol_3`) AS `bfcol_10` + PARSE_JSON(CAST(`bfcol_1` AS STRING)) AS `bfcol_4`, + PARSE_JSON(CAST(`bfcol_2` AS STRING)) AS `bfcol_5`, + PARSE_JSON(CAST(`bfcol_0` AS STRING)) AS `bfcol_6`, + PARSE_JSON(`bfcol_3`) AS `bfcol_7`, + PARSE_JSON(CAST(`bfcol_0` AS STRING)) AS `bfcol_8`, + PARSE_JSON_IN_SAFE(`bfcol_3`) AS `bfcol_9` FROM `bfcte_0` ) SELECT - `bfcol_5` AS `int64_col`, - `bfcol_6` AS `float64_col`, - `bfcol_7` AS `bool_col`, - `bfcol_8` AS `string_col`, - `bfcol_9` AS `bool_w_safe`, - `bfcol_10` AS `string_w_safe` -FROM `bfcte_1` -ORDER BY - `bfcol_4` ASC NULLS LAST \ No newline at end of file + `bfcol_4` AS `int64_col`, + `bfcol_5` AS `float64_col`, + `bfcol_6` AS `bool_col`, + `bfcol_7` AS `string_col`, + `bfcol_8` AS `bool_w_safe`, + `bfcol_9` AS `string_w_safe` +FROM `bfcte_1` \ No newline at end of file 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 c0bba40e2d..f230a3799e 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,19 +1,18 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), 0)]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CAST(`bfcol_1` AS STRING) AS `bfcol_3`, - INITCAP(CAST(`bfcol_0` AS STRING)) AS `bfcol_4`, - INITCAP(SAFE_CAST(`bfcol_0` AS STRING)) AS `bfcol_5` + CAST(`bfcol_1` AS STRING) AS `bfcol_2`, + INITCAP(CAST(`bfcol_0` AS STRING)) AS `bfcol_3`, + INITCAP(SAFE_CAST(`bfcol_0` AS STRING)) AS `bfcol_4` FROM `bfcte_0` ) SELECT - `bfcol_3` AS `int64_col`, - `bfcol_4` AS `bool_col`, - `bfcol_5` AS `bool_w_safe` -FROM `bfcte_1` -ORDER BY - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `bfcol_2` AS `int64_col`, + `bfcol_3` AS `bool_col`, + `bfcol_4` AS `bool_w_safe` +FROM `bfcte_1` \ No newline at end of file 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 92012ad8e4..141b7ffa9a 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,21 +1,19 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CAST(TIMESTAMP_MICROS(`bfcol_0`) AS DATETIME) AS `bfcol_2`, - CAST(TIMESTAMP_MICROS(`bfcol_0`) AS TIME) AS `bfcol_3`, - CAST(TIMESTAMP_MICROS(`bfcol_0`) AS TIMESTAMP) AS `bfcol_4`, - SAFE_CAST(TIMESTAMP_MICROS(`bfcol_0`) AS TIME) AS `bfcol_5` + CAST(TIMESTAMP_MICROS(`bfcol_0`) AS DATETIME) AS `bfcol_1`, + CAST(TIMESTAMP_MICROS(`bfcol_0`) AS TIME) AS `bfcol_2`, + CAST(TIMESTAMP_MICROS(`bfcol_0`) AS TIMESTAMP) AS `bfcol_3`, + SAFE_CAST(TIMESTAMP_MICROS(`bfcol_0`) AS TIME) AS `bfcol_4` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `int64_to_datetime`, - `bfcol_3` AS `int64_to_time`, - `bfcol_4` AS `int64_to_timestamp`, - `bfcol_5` AS `int64_to_time_safe` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `bfcol_1` AS `int64_to_datetime`, + `bfcol_2` AS `int64_to_time`, + `bfcol_3` AS `int64_to_timestamp`, + `bfcol_4` AS `int64_to_time_safe` +FROM `bfcte_1` \ No newline at end of file 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 a70826525c..08db34a632 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,19 +1,16 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT( - CAST(NULL AS BOOLEAN), - CAST(NULL AS INT64), - CAST(NULL AS INT64), - CAST(NULL AS FLOAT64), - 0 - )]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1`, + `int64_too` AS `bfcol_2`, + `float64_col` AS `bfcol_3` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` THEN `bfcol_1` END AS `bfcol_5`, - CASE WHEN `bfcol_0` THEN `bfcol_1` WHEN `bfcol_0` THEN `bfcol_2` END AS `bfcol_6`, - CASE WHEN `bfcol_0` THEN `bfcol_0` WHEN `bfcol_0` THEN `bfcol_0` END AS `bfcol_7`, + CASE WHEN `bfcol_0` THEN `bfcol_1` END AS `bfcol_4`, + CASE WHEN `bfcol_0` THEN `bfcol_1` WHEN `bfcol_0` THEN `bfcol_2` END AS `bfcol_5`, + CASE WHEN `bfcol_0` THEN `bfcol_0` WHEN `bfcol_0` THEN `bfcol_0` END AS `bfcol_6`, CASE WHEN `bfcol_0` THEN `bfcol_1` @@ -21,14 +18,12 @@ WITH `bfcte_0` AS ( THEN CAST(`bfcol_0` AS INT64) WHEN `bfcol_0` THEN `bfcol_3` - END AS `bfcol_8` + END AS `bfcol_7` FROM `bfcte_0` ) SELECT - `bfcol_5` AS `single_case`, - `bfcol_6` AS `double_case`, - `bfcol_7` AS `bool_types_case`, - `bfcol_8` AS `mixed_types_cast` -FROM `bfcte_1` -ORDER BY - `bfcol_4` ASC NULLS LAST \ No newline at end of file + `bfcol_4` AS `single_case`, + `bfcol_5` AS `double_case`, + `bfcol_6` AS `bool_types_case`, + `bfcol_7` AS `mixed_types_cast` +FROM `bfcte_1` \ No newline at end of file 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 3cf0f409e7..172e1f53e7 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,15 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0`, + `int64_too` AS `bfcol_1`, + `rowindex` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - GREATEST(LEAST(`bfcol_2`, `bfcol_1`), `bfcol_0`) AS `bfcol_4` + GREATEST(LEAST(`bfcol_2`, `bfcol_1`), `bfcol_0`) AS `bfcol_3` FROM `bfcte_0` ) SELECT - `bfcol_4` AS `result_col` -FROM `bfcte_1` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file + `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_hash/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_hash/out.sql index 051cff69ce..14d6df6d22 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - FARM_FINGERPRINT(`bfcol_0`) AS `bfcol_2` + FARM_FINGERPRINT(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 bdd35b256f..b5a5b92b52 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,19 +1,19 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS BYTES), CAST(NULL AS INT64), 0)]) + `bool_col` AS `bfcol_0`, + `bytes_col` AS `bfcol_1`, + `int64_col` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ~`bfcol_2` AS `bfcol_8`, - ~`bfcol_1` AS `bfcol_9`, - NOT `bfcol_0` AS `bfcol_10` + ~`bfcol_2` AS `bfcol_6`, + ~`bfcol_1` AS `bfcol_7`, + NOT `bfcol_0` AS `bfcol_8` FROM `bfcte_0` ) SELECT - `bfcol_8` AS `int64_col`, - `bfcol_9` AS `bytes_col`, - `bfcol_10` AS `bool_col` -FROM `bfcte_1` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file + `bfcol_6` AS `int64_col`, + `bfcol_7` AS `bytes_col`, + `bfcol_8` 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_isnull/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_isnull/out.sql index e1f53fe90c..55a2ebb970 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_0` IS NULL AS `bfcol_2` + `bfcol_0` IS NULL AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 37702cc7b0..a17d6584ce 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE `bfcol_0` WHEN 'value1' THEN 'mapped1' END AS `bfcol_2` + CASE `bfcol_0` WHEN 'value1' THEN 'mapped1' END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 f636fd3ab3..c1961f9d62 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - NOT `bfcol_0` IS NULL AS `bfcol_2` + NOT `bfcol_0` IS NULL AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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_where/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_where/out.sql index b97acc82fd..678208e9ba 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,15 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS FLOAT64), 0)]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1`, + `float64_col` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - IF(`bfcol_0`, `bfcol_1`, `bfcol_2`) AS `bfcol_4` + IF(`bfcol_0`, `bfcol_1`, `bfcol_2`) AS `bfcol_3` FROM `bfcte_0` ) SELECT - `bfcol_4` AS `result_col` -FROM `bfcte_1` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file + `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 593266aa41..9b4b6894e0 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS GEOGRAPHY), 0)]) + `geography_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ST_AREA(`bfcol_0`) AS `bfcol_2` + ST_AREA(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `geography_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 0c5b6881b3..9557e2f1d6 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS GEOGRAPHY), 0)]) + `geography_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ST_ASTEXT(`bfcol_0`) AS `bfcol_2` + ST_ASTEXT(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `geography_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 d621a5c238..31c0b45034 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS GEOGRAPHY), 0)]) + `geography_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ST_BOUNDARY(`bfcol_0`) AS `bfcol_2` + ST_BOUNDARY(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `geography_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 0cdc4e3e82..9669c39a9f 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS GEOGRAPHY), 0)]) + `geography_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ST_BUFFER(`bfcol_0`, 1.0, 8.0, FALSE) AS `bfcol_2` + ST_BUFFER(`bfcol_0`, 1.0, 8.0, FALSE) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `geography_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 ff4aca3596..97867318ad 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS GEOGRAPHY), 0)]) + `geography_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ST_CENTROID(`bfcol_0`) AS `bfcol_2` + ST_CENTROID(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `geography_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 3c7709a703..8bb5801173 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS GEOGRAPHY), 0)]) + `geography_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ST_CONVEXHULL(`bfcol_0`) AS `bfcol_2` + ST_CONVEXHULL(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `geography_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 639a70aec4..ba4d9dd182 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - SAFE.ST_GEOGFROMTEXT(`bfcol_0`) AS `bfcol_2` + SAFE.ST_GEOGFROMTEXT(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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_isclosed/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_geo_ops/test_geo_st_isclosed/out.sql index 12f390c236..d905e8470b 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS GEOGRAPHY), 0)]) + `geography_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ST_ISCLOSED(`bfcol_0`) AS `bfcol_2` + ST_ISCLOSED(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `geography_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 bb10d2767c..a023691d63 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS GEOGRAPHY), 0)]) + `geography_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ST_LENGTH(`bfcol_0`) AS `bfcol_2` + ST_LENGTH(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `geography_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 9d88db6e61..d4c0370ca8 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS GEOGRAPHY), 0)]) + `geography_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - SAFE.ST_X(`bfcol_0`) AS `bfcol_2` + SAFE.ST_X(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `geography_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 e6e0eb82f2..196c2fcad6 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS GEOGRAPHY), 0)]) + `geography_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - SAFE.ST_Y(`bfcol_0`) AS `bfcol_2` + SAFE.ST_Y(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `geography_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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_parse_json/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_json_ops/test_parse_json/out.sql index 08b709b7a5..cdb091ae39 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - PARSE_JSON(`bfcol_0`) AS `bfcol_2` + PARSE_JSON(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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_abs/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_abs/out.sql index 58edade190..6f315f8113 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ABS(`bfcol_0`) AS `bfcol_2` + ABS(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 ffc2572ca4..44335805e4 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,54 +1,54 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1`, + `rowindex` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_8`, - `bfcol_1` AS `bfcol_9`, - `bfcol_0` AS `bfcol_10`, - `bfcol_1` + `bfcol_1` AS `bfcol_11` + `bfcol_2` AS `bfcol_6`, + `bfcol_1` AS `bfcol_7`, + `bfcol_0` AS `bfcol_8`, + `bfcol_1` + `bfcol_1` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT *, - `bfcol_8` AS `bfcol_17`, - `bfcol_9` AS `bfcol_18`, - `bfcol_10` AS `bfcol_19`, - `bfcol_11` AS `bfcol_20`, - `bfcol_9` + 1 AS `bfcol_21` + `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_17` AS `bfcol_28`, - `bfcol_18` AS `bfcol_29`, - `bfcol_19` AS `bfcol_30`, - `bfcol_20` AS `bfcol_31`, - `bfcol_21` AS `bfcol_32`, - `bfcol_18` + CAST(`bfcol_19` AS INT64) AS `bfcol_33` + `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_28` AS `bfcol_41`, - `bfcol_29` AS `bfcol_42`, - `bfcol_30` AS `bfcol_43`, - `bfcol_31` AS `bfcol_44`, - `bfcol_32` AS `bfcol_45`, - `bfcol_33` AS `bfcol_46`, - CAST(`bfcol_30` AS INT64) + `bfcol_29` AS `bfcol_47` + `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_41` AS `rowindex`, - `bfcol_42` AS `int64_col`, - `bfcol_43` AS `bool_col`, - `bfcol_44` AS `int_add_int`, - `bfcol_45` AS `int_add_1`, - `bfcol_46` AS `int_add_bool`, - `bfcol_47` AS `bool_add_int` -FROM `bfcte_4` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file + `bfcol_36` AS `rowindex`, + `bfcol_37` AS `int64_col`, + `bfcol_38` AS `bool_col`, + `bfcol_39` AS `int_add_int`, + `bfcol_40` AS `int_add_1`, + `bfcol_41` AS `int_add_bool`, + `bfcol_42` AS `bool_add_int` +FROM `bfcte_4` \ No newline at end of file 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 d3e8c2630b..df695b7fbc 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN ABS(`bfcol_0`) > 1 THEN CAST('NaN' AS FLOAT64) ELSE ACOS(`bfcol_0`) END AS `bfcol_2` + CASE WHEN ABS(`bfcol_0`) > 1 THEN CAST('NaN' AS FLOAT64) ELSE ACOS(`bfcol_0`) END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 d31d1cd5d2..5272e4a6a8 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` < 1 THEN CAST('NaN' AS FLOAT64) ELSE ACOSH(`bfcol_0`) END AS `bfcol_2` + CASE WHEN `bfcol_0` < 1 THEN CAST('NaN' AS FLOAT64) ELSE ACOSH(`bfcol_0`) END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 6e5f9f88e9..3afc7c64b8 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN ABS(`bfcol_0`) > 1 THEN CAST('NaN' AS FLOAT64) ELSE ASIN(`bfcol_0`) END AS `bfcol_2` + CASE WHEN ABS(`bfcol_0`) > 1 THEN CAST('NaN' AS FLOAT64) ELSE ASIN(`bfcol_0`) END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 26620bbf30..6313e80e5f 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ASINH(`bfcol_0`) AS `bfcol_2` + ASINH(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 2b03e47671..ec6a22e653 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ATAN(`bfcol_0`) AS `bfcol_2` + ATAN(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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_arctanh/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_arctanh/out.sql index 1134dfa6be..39b5f565fe 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN ABS(`bfcol_0`) > 1 THEN CAST('NaN' AS FLOAT64) ELSE ATANH(`bfcol_0`) END AS `bfcol_2` + CASE WHEN ABS(`bfcol_0`) > 1 THEN CAST('NaN' AS FLOAT64) ELSE ATANH(`bfcol_0`) END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 ab9047b05b..0959f3a0ad 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CEIL(`bfcol_0`) AS `bfcol_2` + CEIL(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 6b25d8a5f8..126d2a63f2 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - COS(`bfcol_0`) AS `bfcol_2` + COS(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 2fdd864a9c..f44dfaac41 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -9,11 +9,9 @@ WITH `bfcte_0` AS ( WHEN ABS(`bfcol_0`) > 709.78 THEN CAST('Infinity' AS FLOAT64) ELSE COSH(`bfcol_0`) - END AS `bfcol_2` + END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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_div_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_div_numeric/out.sql index b8c95bd9ff..03d48276a0 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,127 +1,122 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT( - CAST(NULL AS BOOLEAN), - CAST(NULL AS INT64), - CAST(NULL AS FLOAT64), - CAST(NULL AS INT64), - 0 - )]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1`, + `float64_col` AS `bfcol_2`, + `rowindex` AS `bfcol_3` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_3` AS `bfcol_10`, - `bfcol_1` AS `bfcol_11`, - `bfcol_0` AS `bfcol_12`, - `bfcol_2` AS `bfcol_13`, - IEEE_DIVIDE(`bfcol_1`, `bfcol_1`) AS `bfcol_14` + `bfcol_3` AS `bfcol_8`, + `bfcol_1` AS `bfcol_9`, + `bfcol_0` AS `bfcol_10`, + `bfcol_2` AS `bfcol_11`, + IEEE_DIVIDE(`bfcol_1`, `bfcol_1`) AS `bfcol_12` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT *, - `bfcol_10` AS `bfcol_21`, - `bfcol_11` AS `bfcol_22`, - `bfcol_12` AS `bfcol_23`, - `bfcol_13` AS `bfcol_24`, - `bfcol_14` AS `bfcol_25`, - IEEE_DIVIDE(`bfcol_11`, 1) AS `bfcol_26` + `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_21` AS `bfcol_34`, - `bfcol_22` AS `bfcol_35`, - `bfcol_23` AS `bfcol_36`, - `bfcol_24` AS `bfcol_37`, - `bfcol_25` AS `bfcol_38`, - `bfcol_26` AS `bfcol_39`, - IEEE_DIVIDE(`bfcol_22`, 0.0) AS `bfcol_40` + `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_34` AS `bfcol_49`, - `bfcol_35` AS `bfcol_50`, - `bfcol_36` AS `bfcol_51`, - `bfcol_37` AS `bfcol_52`, - `bfcol_38` AS `bfcol_53`, - `bfcol_39` AS `bfcol_54`, - `bfcol_40` AS `bfcol_55`, - IEEE_DIVIDE(`bfcol_35`, `bfcol_37`) AS `bfcol_56` + `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_49` AS `bfcol_66`, - `bfcol_50` AS `bfcol_67`, - `bfcol_51` AS `bfcol_68`, - `bfcol_52` AS `bfcol_69`, - `bfcol_53` AS `bfcol_70`, - `bfcol_54` AS `bfcol_71`, - `bfcol_55` AS `bfcol_72`, - `bfcol_56` AS `bfcol_73`, - IEEE_DIVIDE(`bfcol_52`, `bfcol_50`) AS `bfcol_74` + `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_66` AS `bfcol_85`, - `bfcol_67` AS `bfcol_86`, - `bfcol_68` AS `bfcol_87`, - `bfcol_69` AS `bfcol_88`, - `bfcol_70` AS `bfcol_89`, - `bfcol_71` AS `bfcol_90`, - `bfcol_72` AS `bfcol_91`, - `bfcol_73` AS `bfcol_92`, - `bfcol_74` AS `bfcol_93`, - IEEE_DIVIDE(`bfcol_69`, 0.0) AS `bfcol_94` + `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_85` AS `bfcol_106`, - `bfcol_86` AS `bfcol_107`, - `bfcol_87` AS `bfcol_108`, - `bfcol_88` AS `bfcol_109`, - `bfcol_89` AS `bfcol_110`, - `bfcol_90` AS `bfcol_111`, - `bfcol_91` AS `bfcol_112`, - `bfcol_92` AS `bfcol_113`, - `bfcol_93` AS `bfcol_114`, - `bfcol_94` AS `bfcol_115`, - IEEE_DIVIDE(`bfcol_86`, CAST(`bfcol_87` AS INT64)) AS `bfcol_116` + `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_106` AS `bfcol_129`, - `bfcol_107` AS `bfcol_130`, - `bfcol_108` AS `bfcol_131`, - `bfcol_109` AS `bfcol_132`, - `bfcol_110` AS `bfcol_133`, - `bfcol_111` AS `bfcol_134`, - `bfcol_112` AS `bfcol_135`, - `bfcol_113` AS `bfcol_136`, - `bfcol_114` AS `bfcol_137`, - `bfcol_115` AS `bfcol_138`, - `bfcol_116` AS `bfcol_139`, - IEEE_DIVIDE(CAST(`bfcol_108` AS INT64), `bfcol_107`) AS `bfcol_140` + `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_129` AS `rowindex`, - `bfcol_130` AS `int64_col`, - `bfcol_131` AS `bool_col`, - `bfcol_132` AS `float64_col`, - `bfcol_133` AS `int_div_int`, - `bfcol_134` AS `int_div_1`, - `bfcol_135` AS `int_div_0`, - `bfcol_136` AS `int_div_float`, - `bfcol_137` AS `float_div_int`, - `bfcol_138` AS `float_div_0`, - `bfcol_139` AS `int_div_bool`, - `bfcol_140` AS `bool_div_int` -FROM `bfcte_8` -ORDER BY - `bfcol_4` ASC NULLS LAST \ No newline at end of file + `bfcol_120` AS `rowindex`, + `bfcol_121` AS `int64_col`, + `bfcol_122` AS `bool_col`, + `bfcol_123` AS `float64_col`, + `bfcol_124` AS `int_div_int`, + `bfcol_125` AS `int_div_1`, + `bfcol_126` AS `int_div_0`, + `bfcol_127` AS `int_div_float`, + `bfcol_128` AS `float_div_int`, + `bfcol_129` AS `float_div_0`, + `bfcol_130` AS `int_div_bool`, + `bfcol_131` AS `bool_div_int` +FROM `bfcte_8` \ No newline at end of file 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 d1c3e1a1a7..6e05302fc9 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,21 +1,21 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), CAST(NULL AS TIMESTAMP), 0)]) + `int64_col` AS `bfcol_0`, + `rowindex` AS `bfcol_1`, + `timestamp_col` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_8`, - `bfcol_2` AS `bfcol_9`, - `bfcol_0` AS `bfcol_10`, - CAST(FLOOR(IEEE_DIVIDE(86400000000, `bfcol_0`)) AS INT64) AS `bfcol_11` + `bfcol_1` AS `bfcol_6`, + `bfcol_2` AS `bfcol_7`, + `bfcol_0` AS `bfcol_8`, + CAST(FLOOR(IEEE_DIVIDE(86400000000, `bfcol_0`)) AS INT64) AS `bfcol_9` FROM `bfcte_0` ) SELECT - `bfcol_8` AS `rowindex`, - `bfcol_9` AS `timestamp_col`, - `bfcol_10` AS `int64_col`, - `bfcol_11` AS `timedelta_div_numeric` -FROM `bfcte_1` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file + `bfcol_6` AS `rowindex`, + `bfcol_7` AS `timestamp_col`, + `bfcol_8` AS `int64_col`, + `bfcol_9` AS `timedelta_div_numeric` +FROM `bfcte_1` \ No newline at end of file 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 a8e383f459..6afa3f85a5 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -9,11 +9,9 @@ WITH `bfcte_0` AS ( WHEN `bfcol_0` > 709.78 THEN CAST('Infinity' AS FLOAT64) ELSE EXP(`bfcol_0`) - END AS `bfcol_2` + END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 6d9feaad03..f3768deb4a 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -9,11 +9,9 @@ WITH `bfcte_0` AS ( WHEN `bfcol_0` > 709.78 THEN CAST('Infinity' AS FLOAT64) ELSE EXP(`bfcol_0`) - END - 1 AS `bfcol_2` + END - 1 AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 75ee81ab97..56be1019e5 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - FLOOR(`bfcol_0`) AS `bfcol_2` + FLOOR(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 fae4c326ae..bc4f94d306 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,18 +1,18 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS DATE), CAST(NULL AS INT64), CAST(NULL AS TIMESTAMP), 0)]) + `date_col` AS `bfcol_0`, + `rowindex` AS `bfcol_1`, + `timestamp_col` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - 43200000000 AS `bfcol_8` + 43200000000 AS `bfcol_6` FROM `bfcte_0` ) SELECT `bfcol_1` AS `rowindex`, `bfcol_2` AS `timestamp_col`, `bfcol_0` AS `date_col`, - `bfcol_8` AS `timedelta_div_numeric` -FROM `bfcte_1` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file + `bfcol_6` AS `timedelta_div_numeric` +FROM `bfcte_1` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_ln/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_ln/out.sql index d6af10d7d8..5d3d1ae09b 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` <= 0 THEN CAST('NaN' AS FLOAT64) ELSE LN(`bfcol_0`) END AS `bfcol_2` + CASE WHEN `bfcol_0` <= 0 THEN CAST('NaN' AS FLOAT64) ELSE LN(`bfcol_0`) END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 d7ae478c2e..532776278d 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` <= 0 THEN CAST('NaN' AS FLOAT64) ELSE LOG(10, `bfcol_0`) END AS `bfcol_2` + CASE WHEN `bfcol_0` <= 0 THEN CAST('NaN' AS FLOAT64) ELSE LOG(10, `bfcol_0`) END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 b2901207bf..3904025cf8 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` <= -1 THEN CAST('NaN' AS FLOAT64) ELSE LN(1 + `bfcol_0`) END AS `bfcol_2` + CASE WHEN `bfcol_0` <= -1 THEN CAST('NaN' AS FLOAT64) ELSE LN(1 + `bfcol_0`) END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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_mod_numeric/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_mod_numeric/out.sql index 44c92972e8..7913b43aa6 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,13 +1,15 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS FLOAT64), CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0`, + `float64_col` AS `bfcol_1`, + `rowindex` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_8`, - `bfcol_0` AS `bfcol_9`, - `bfcol_1` AS `bfcol_10`, + `bfcol_2` AS `bfcol_6`, + `bfcol_0` AS `bfcol_7`, + `bfcol_1` AS `bfcol_8`, CASE WHEN `bfcol_0` = CAST(0 AS INT64) THEN CAST(0 AS INT64) * `bfcol_0` @@ -26,227 +28,225 @@ WITH `bfcte_0` AS ( MOD(`bfcol_0`, `bfcol_0`) ) ELSE MOD(`bfcol_0`, `bfcol_0`) - END AS `bfcol_11` + END AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT *, - `bfcol_8` AS `bfcol_17`, - `bfcol_9` AS `bfcol_18`, - `bfcol_10` AS `bfcol_19`, - `bfcol_11` AS `bfcol_20`, + `bfcol_6` AS `bfcol_14`, + `bfcol_7` AS `bfcol_15`, + `bfcol_8` AS `bfcol_16`, + `bfcol_9` AS `bfcol_17`, CASE - WHEN -`bfcol_9` = CAST(0 AS INT64) - THEN CAST(0 AS INT64) * `bfcol_9` - WHEN -`bfcol_9` < CAST(0 AS INT64) + WHEN -`bfcol_7` = CAST(0 AS INT64) + THEN CAST(0 AS INT64) * `bfcol_7` + WHEN -`bfcol_7` < CAST(0 AS INT64) AND ( - MOD(`bfcol_9`, -`bfcol_9`) + MOD(`bfcol_7`, -`bfcol_7`) ) > CAST(0 AS INT64) - THEN -`bfcol_9` + ( - MOD(`bfcol_9`, -`bfcol_9`) + THEN -`bfcol_7` + ( + MOD(`bfcol_7`, -`bfcol_7`) ) - WHEN -`bfcol_9` > CAST(0 AS INT64) + WHEN -`bfcol_7` > CAST(0 AS INT64) AND ( - MOD(`bfcol_9`, -`bfcol_9`) + MOD(`bfcol_7`, -`bfcol_7`) ) < CAST(0 AS INT64) - THEN -`bfcol_9` + ( - MOD(`bfcol_9`, -`bfcol_9`) + THEN -`bfcol_7` + ( + MOD(`bfcol_7`, -`bfcol_7`) ) - ELSE MOD(`bfcol_9`, -`bfcol_9`) - END AS `bfcol_21` + ELSE MOD(`bfcol_7`, -`bfcol_7`) + END AS `bfcol_18` FROM `bfcte_1` ), `bfcte_3` AS ( SELECT *, - `bfcol_17` AS `bfcol_28`, - `bfcol_18` AS `bfcol_29`, - `bfcol_19` AS `bfcol_30`, - `bfcol_20` AS `bfcol_31`, - `bfcol_21` AS `bfcol_32`, + `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_18` + THEN CAST(0 AS INT64) * `bfcol_15` WHEN 1 < CAST(0 AS INT64) AND ( - MOD(`bfcol_18`, 1) + MOD(`bfcol_15`, 1) ) > CAST(0 AS INT64) THEN 1 + ( - MOD(`bfcol_18`, 1) + MOD(`bfcol_15`, 1) ) WHEN 1 > CAST(0 AS INT64) AND ( - MOD(`bfcol_18`, 1) + MOD(`bfcol_15`, 1) ) < CAST(0 AS INT64) THEN 1 + ( - MOD(`bfcol_18`, 1) + MOD(`bfcol_15`, 1) ) - ELSE MOD(`bfcol_18`, 1) - END AS `bfcol_33` + ELSE MOD(`bfcol_15`, 1) + END AS `bfcol_29` FROM `bfcte_2` ), `bfcte_4` AS ( SELECT *, - `bfcol_28` AS `bfcol_41`, - `bfcol_29` AS `bfcol_42`, - `bfcol_30` AS `bfcol_43`, - `bfcol_31` AS `bfcol_44`, - `bfcol_32` AS `bfcol_45`, - `bfcol_33` AS `bfcol_46`, + `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_29` + THEN CAST(0 AS INT64) * `bfcol_25` WHEN 0 < CAST(0 AS INT64) AND ( - MOD(`bfcol_29`, 0) + MOD(`bfcol_25`, 0) ) > CAST(0 AS INT64) THEN 0 + ( - MOD(`bfcol_29`, 0) + MOD(`bfcol_25`, 0) ) WHEN 0 > CAST(0 AS INT64) AND ( - MOD(`bfcol_29`, 0) + MOD(`bfcol_25`, 0) ) < CAST(0 AS INT64) THEN 0 + ( - MOD(`bfcol_29`, 0) + MOD(`bfcol_25`, 0) ) - ELSE MOD(`bfcol_29`, 0) - END AS `bfcol_47` + ELSE MOD(`bfcol_25`, 0) + END AS `bfcol_42` FROM `bfcte_3` ), `bfcte_5` AS ( SELECT *, - `bfcol_41` AS `bfcol_56`, - `bfcol_42` AS `bfcol_57`, - `bfcol_43` AS `bfcol_58`, - `bfcol_44` AS `bfcol_59`, - `bfcol_45` AS `bfcol_60`, - `bfcol_46` AS `bfcol_61`, - `bfcol_47` AS `bfcol_62`, + `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_43` AS BIGNUMERIC) = CAST(0 AS INT64) - THEN CAST('NaN' AS FLOAT64) * CAST(`bfcol_43` AS BIGNUMERIC) - WHEN CAST(`bfcol_43` AS BIGNUMERIC) < CAST(0 AS INT64) + 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_43` AS BIGNUMERIC), CAST(`bfcol_43` AS BIGNUMERIC)) + MOD(CAST(`bfcol_38` AS BIGNUMERIC), CAST(`bfcol_38` AS BIGNUMERIC)) ) > CAST(0 AS INT64) - THEN CAST(`bfcol_43` AS BIGNUMERIC) + ( - MOD(CAST(`bfcol_43` AS BIGNUMERIC), CAST(`bfcol_43` AS BIGNUMERIC)) + THEN CAST(`bfcol_38` AS BIGNUMERIC) + ( + MOD(CAST(`bfcol_38` AS BIGNUMERIC), CAST(`bfcol_38` AS BIGNUMERIC)) ) - WHEN CAST(`bfcol_43` AS BIGNUMERIC) > CAST(0 AS INT64) + WHEN CAST(`bfcol_38` AS BIGNUMERIC) > CAST(0 AS INT64) AND ( - MOD(CAST(`bfcol_43` AS BIGNUMERIC), CAST(`bfcol_43` AS BIGNUMERIC)) + MOD(CAST(`bfcol_38` AS BIGNUMERIC), CAST(`bfcol_38` AS BIGNUMERIC)) ) < CAST(0 AS INT64) - THEN CAST(`bfcol_43` AS BIGNUMERIC) + ( - MOD(CAST(`bfcol_43` AS BIGNUMERIC), CAST(`bfcol_43` AS BIGNUMERIC)) + THEN CAST(`bfcol_38` AS BIGNUMERIC) + ( + MOD(CAST(`bfcol_38` AS BIGNUMERIC), CAST(`bfcol_38` AS BIGNUMERIC)) ) - ELSE MOD(CAST(`bfcol_43` AS BIGNUMERIC), CAST(`bfcol_43` AS BIGNUMERIC)) - END AS `bfcol_63` + ELSE MOD(CAST(`bfcol_38` AS BIGNUMERIC), CAST(`bfcol_38` AS BIGNUMERIC)) + END AS `bfcol_57` FROM `bfcte_4` ), `bfcte_6` AS ( SELECT *, - `bfcol_56` AS `bfcol_73`, - `bfcol_57` AS `bfcol_74`, - `bfcol_58` AS `bfcol_75`, - `bfcol_59` AS `bfcol_76`, - `bfcol_60` AS `bfcol_77`, - `bfcol_61` AS `bfcol_78`, - `bfcol_62` AS `bfcol_79`, - `bfcol_63` AS `bfcol_80`, + `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_58` AS BIGNUMERIC) = CAST(0 AS INT64) - THEN CAST('NaN' AS FLOAT64) * CAST(`bfcol_58` AS BIGNUMERIC) - WHEN CAST(-`bfcol_58` AS BIGNUMERIC) < CAST(0 AS INT64) + 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_58` AS BIGNUMERIC), CAST(-`bfcol_58` AS BIGNUMERIC)) + MOD(CAST(`bfcol_52` AS BIGNUMERIC), CAST(-`bfcol_52` AS BIGNUMERIC)) ) > CAST(0 AS INT64) - THEN CAST(-`bfcol_58` AS BIGNUMERIC) + ( - MOD(CAST(`bfcol_58` AS BIGNUMERIC), CAST(-`bfcol_58` AS BIGNUMERIC)) + THEN CAST(-`bfcol_52` AS BIGNUMERIC) + ( + MOD(CAST(`bfcol_52` AS BIGNUMERIC), CAST(-`bfcol_52` AS BIGNUMERIC)) ) - WHEN CAST(-`bfcol_58` AS BIGNUMERIC) > CAST(0 AS INT64) + WHEN CAST(-`bfcol_52` AS BIGNUMERIC) > CAST(0 AS INT64) AND ( - MOD(CAST(`bfcol_58` AS BIGNUMERIC), CAST(-`bfcol_58` AS BIGNUMERIC)) + MOD(CAST(`bfcol_52` AS BIGNUMERIC), CAST(-`bfcol_52` AS BIGNUMERIC)) ) < CAST(0 AS INT64) - THEN CAST(-`bfcol_58` AS BIGNUMERIC) + ( - MOD(CAST(`bfcol_58` AS BIGNUMERIC), CAST(-`bfcol_58` AS BIGNUMERIC)) + THEN CAST(-`bfcol_52` AS BIGNUMERIC) + ( + MOD(CAST(`bfcol_52` AS BIGNUMERIC), CAST(-`bfcol_52` AS BIGNUMERIC)) ) - ELSE MOD(CAST(`bfcol_58` AS BIGNUMERIC), CAST(-`bfcol_58` AS BIGNUMERIC)) - END AS `bfcol_81` + ELSE MOD(CAST(`bfcol_52` AS BIGNUMERIC), CAST(-`bfcol_52` AS BIGNUMERIC)) + END AS `bfcol_74` FROM `bfcte_5` ), `bfcte_7` AS ( SELECT *, - `bfcol_73` AS `bfcol_92`, - `bfcol_74` AS `bfcol_93`, - `bfcol_75` AS `bfcol_94`, - `bfcol_76` AS `bfcol_95`, - `bfcol_77` AS `bfcol_96`, - `bfcol_78` AS `bfcol_97`, - `bfcol_79` AS `bfcol_98`, - `bfcol_80` AS `bfcol_99`, - `bfcol_81` AS `bfcol_100`, + `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_75` AS BIGNUMERIC) + THEN CAST('NaN' AS FLOAT64) * CAST(`bfcol_68` AS BIGNUMERIC) WHEN CAST(1 AS BIGNUMERIC) < CAST(0 AS INT64) AND ( - MOD(CAST(`bfcol_75` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) + MOD(CAST(`bfcol_68` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) ) > CAST(0 AS INT64) THEN CAST(1 AS BIGNUMERIC) + ( - MOD(CAST(`bfcol_75` AS BIGNUMERIC), 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_75` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) + MOD(CAST(`bfcol_68` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) ) < CAST(0 AS INT64) THEN CAST(1 AS BIGNUMERIC) + ( - MOD(CAST(`bfcol_75` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) + MOD(CAST(`bfcol_68` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) ) - ELSE MOD(CAST(`bfcol_75` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) - END AS `bfcol_101` + ELSE MOD(CAST(`bfcol_68` AS BIGNUMERIC), CAST(1 AS BIGNUMERIC)) + END AS `bfcol_93` FROM `bfcte_6` ), `bfcte_8` AS ( SELECT *, - `bfcol_92` AS `bfcol_113`, - `bfcol_93` AS `bfcol_114`, - `bfcol_94` AS `bfcol_115`, - `bfcol_95` AS `bfcol_116`, - `bfcol_96` AS `bfcol_117`, - `bfcol_97` AS `bfcol_118`, - `bfcol_98` AS `bfcol_119`, - `bfcol_99` AS `bfcol_120`, - `bfcol_100` AS `bfcol_121`, - `bfcol_101` AS `bfcol_122`, + `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_94` AS BIGNUMERIC) + THEN CAST('NaN' AS FLOAT64) * CAST(`bfcol_86` AS BIGNUMERIC) WHEN CAST(0 AS BIGNUMERIC) < CAST(0 AS INT64) AND ( - MOD(CAST(`bfcol_94` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) + MOD(CAST(`bfcol_86` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) ) > CAST(0 AS INT64) THEN CAST(0 AS BIGNUMERIC) + ( - MOD(CAST(`bfcol_94` AS BIGNUMERIC), 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_94` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) + MOD(CAST(`bfcol_86` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) ) < CAST(0 AS INT64) THEN CAST(0 AS BIGNUMERIC) + ( - MOD(CAST(`bfcol_94` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) + MOD(CAST(`bfcol_86` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) ) - ELSE MOD(CAST(`bfcol_94` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) - END AS `bfcol_123` + ELSE MOD(CAST(`bfcol_86` AS BIGNUMERIC), CAST(0 AS BIGNUMERIC)) + END AS `bfcol_114` FROM `bfcte_7` ) SELECT - `bfcol_113` AS `rowindex`, - `bfcol_114` AS `int64_col`, - `bfcol_115` AS `float64_col`, - `bfcol_116` AS `int_mod_int`, - `bfcol_117` AS `int_mod_int_neg`, - `bfcol_118` AS `int_mod_1`, - `bfcol_119` AS `int_mod_0`, - `bfcol_120` AS `float_mod_float`, - `bfcol_121` AS `float_mod_float_neg`, - `bfcol_122` AS `float_mod_1`, - `bfcol_123` AS `float_mod_0` -FROM `bfcte_8` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file + `bfcol_104` AS `rowindex`, + `bfcol_105` AS `int64_col`, + `bfcol_106` AS `float64_col`, + `bfcol_107` AS `int_mod_int`, + `bfcol_108` AS `int_mod_int_neg`, + `bfcol_109` AS `int_mod_1`, + `bfcol_110` AS `int_mod_0`, + `bfcol_111` AS `float_mod_float`, + `bfcol_112` AS `float_mod_float_neg`, + `bfcol_113` AS `float_mod_1`, + `bfcol_114` AS `float_mod_0` +FROM `bfcte_8` \ No newline at end of file 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 e40e992a3b..a9c81f4744 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,54 +1,54 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1`, + `rowindex` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_8`, - `bfcol_1` AS `bfcol_9`, - `bfcol_0` AS `bfcol_10`, - `bfcol_1` * `bfcol_1` AS `bfcol_11` + `bfcol_2` AS `bfcol_6`, + `bfcol_1` AS `bfcol_7`, + `bfcol_0` AS `bfcol_8`, + `bfcol_1` * `bfcol_1` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT *, - `bfcol_8` AS `bfcol_17`, - `bfcol_9` AS `bfcol_18`, - `bfcol_10` AS `bfcol_19`, - `bfcol_11` AS `bfcol_20`, - `bfcol_9` * 1 AS `bfcol_21` + `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_17` AS `bfcol_28`, - `bfcol_18` AS `bfcol_29`, - `bfcol_19` AS `bfcol_30`, - `bfcol_20` AS `bfcol_31`, - `bfcol_21` AS `bfcol_32`, - `bfcol_18` * CAST(`bfcol_19` AS INT64) AS `bfcol_33` + `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_28` AS `bfcol_41`, - `bfcol_29` AS `bfcol_42`, - `bfcol_30` AS `bfcol_43`, - `bfcol_31` AS `bfcol_44`, - `bfcol_32` AS `bfcol_45`, - `bfcol_33` AS `bfcol_46`, - CAST(`bfcol_30` AS INT64) * `bfcol_29` AS `bfcol_47` + `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_41` AS `rowindex`, - `bfcol_42` AS `int64_col`, - `bfcol_43` AS `bool_col`, - `bfcol_44` AS `int_mul_int`, - `bfcol_45` AS `int_mul_1`, - `bfcol_46` AS `int_mul_bool`, - `bfcol_47` AS `bool_mul_int` -FROM `bfcte_4` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file + `bfcol_36` AS `rowindex`, + `bfcol_37` AS `int64_col`, + `bfcol_38` AS `bool_col`, + `bfcol_39` AS `int_mul_int`, + `bfcol_40` AS `int_mul_1`, + `bfcol_41` AS `int_mul_bool`, + `bfcol_42` AS `bool_mul_int` +FROM `bfcte_4` \ No newline at end of file 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 8a05f47150..46c58f766d 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,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - -`bfcol_0` AS `bfcol_2` + -`bfcol_0` AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 e2af61f23d..2d6322a182 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_0` AS `bfcol_2` + `bfcol_0` AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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_sin/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_numeric_ops/test_sin/out.sql index f5855f9651..62a5cff0b5 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - SIN(`bfcol_0`) AS `bfcol_2` + SIN(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 6658def692..711dba94a9 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -9,11 +9,9 @@ WITH `bfcte_0` AS ( WHEN ABS(`bfcol_0`) > 709.78 THEN SIGN(`bfcol_0`) * CAST('Infinity' AS FLOAT64) ELSE SINH(`bfcol_0`) - END AS `bfcol_2` + END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 4dd094832e..e6a93e5e6c 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CASE WHEN `bfcol_0` < 0 THEN CAST('NaN' AS FLOAT64) ELSE SQRT(`bfcol_0`) END AS `bfcol_2` + CASE WHEN `bfcol_0` < 0 THEN CAST('NaN' AS FLOAT64) ELSE SQRT(`bfcol_0`) END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 37518df445..a43fa2df67 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,54 +1,54 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1`, + `rowindex` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_8`, - `bfcol_1` AS `bfcol_9`, - `bfcol_0` AS `bfcol_10`, - `bfcol_1` - `bfcol_1` AS `bfcol_11` + `bfcol_2` AS `bfcol_6`, + `bfcol_1` AS `bfcol_7`, + `bfcol_0` AS `bfcol_8`, + `bfcol_1` - `bfcol_1` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT *, - `bfcol_8` AS `bfcol_17`, - `bfcol_9` AS `bfcol_18`, - `bfcol_10` AS `bfcol_19`, - `bfcol_11` AS `bfcol_20`, - `bfcol_9` - 1 AS `bfcol_21` + `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_17` AS `bfcol_28`, - `bfcol_18` AS `bfcol_29`, - `bfcol_19` AS `bfcol_30`, - `bfcol_20` AS `bfcol_31`, - `bfcol_21` AS `bfcol_32`, - `bfcol_18` - CAST(`bfcol_19` AS INT64) AS `bfcol_33` + `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_28` AS `bfcol_41`, - `bfcol_29` AS `bfcol_42`, - `bfcol_30` AS `bfcol_43`, - `bfcol_31` AS `bfcol_44`, - `bfcol_32` AS `bfcol_45`, - `bfcol_33` AS `bfcol_46`, - CAST(`bfcol_30` AS INT64) - `bfcol_29` AS `bfcol_47` + `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_41` AS `rowindex`, - `bfcol_42` AS `int64_col`, - `bfcol_43` AS `bool_col`, - `bfcol_44` AS `int_add_int`, - `bfcol_45` AS `int_add_1`, - `bfcol_46` AS `int_add_bool`, - `bfcol_47` AS `bool_add_int` -FROM `bfcte_4` -ORDER BY - `bfcol_3` ASC NULLS LAST \ No newline at end of file + `bfcol_36` AS `rowindex`, + `bfcol_37` AS `int64_col`, + `bfcol_38` AS `bool_col`, + `bfcol_39` AS `int_add_int`, + `bfcol_40` AS `int_add_1`, + `bfcol_41` AS `int_add_bool`, + `bfcol_42` AS `bool_add_int` +FROM `bfcte_4` \ No newline at end of file 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 8a3d3e16e4..5fac274b6b 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - TAN(`bfcol_0`) AS `bfcol_2` + TAN(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 e94733dc1f..5d1a5a5320 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), 0)]) + `float64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - TANH(`bfcol_0`) AS `bfcol_2` + TANH(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `float64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 9b3b4b9216..de5129a6a3 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CONCAT(`bfcol_0`, 'a') AS `bfcol_2` + CONCAT(`bfcol_0`, 'a') AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 2063145ad0..7af1708347 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - INITCAP(`bfcol_0`) AS `bfcol_2` + INITCAP(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 f8cea746e9..e3ac5ec033 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,19 +1,17 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - ENDS_WITH(`bfcol_0`, 'ab') AS `bfcol_2`, - ENDS_WITH(`bfcol_0`, 'ab') OR ENDS_WITH(`bfcol_0`, 'cd') AS `bfcol_3`, - FALSE AS `bfcol_4` + ENDS_WITH(`bfcol_0`, 'ab') AS `bfcol_1`, + ENDS_WITH(`bfcol_0`, 'ab') OR ENDS_WITH(`bfcol_0`, 'cd') AS `bfcol_2`, + FALSE AS `bfcol_3` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `single`, - `bfcol_3` AS `double`, - `bfcol_4` AS `empty` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `bfcol_1` AS `single`, + `bfcol_2` AS `double`, + `bfcol_3` AS `empty` +FROM `bfcte_1` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isalnum/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_isalnum/out.sql index 6eb636c49f..02e0094742 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, '^(\\p{N}|\\p{L})+$') AS `bfcol_2` + REGEXP_CONTAINS(`bfcol_0`, '^(\\p{N}|\\p{L})+$') AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 162f3494a1..2615d0452f 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, '^\\p{L}+$') AS `bfcol_2` + REGEXP_CONTAINS(`bfcol_0`, '^\\p{L}+$') AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 dfdef672ca..bc1fce3dbc 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, '^\\d+$') AS `bfcol_2` + REGEXP_CONTAINS(`bfcol_0`, '^\\d+$') AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 90b81a177e..1cb3a883ab 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, '^\\p{Nd}+$') AS `bfcol_2` + REGEXP_CONTAINS(`bfcol_0`, '^\\p{Nd}+$') AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 3d6cd802e2..a621b71a3b 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - LOWER(`bfcol_0`) = `bfcol_0` AND UPPER(`bfcol_0`) <> `bfcol_0` AS `bfcol_2` + LOWER(`bfcol_0`) = `bfcol_0` AND UPPER(`bfcol_0`) <> `bfcol_0` AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 8610b3bb9b..6566c1dd4c 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, '^\\pN+$') AS `bfcol_2` + REGEXP_CONTAINS(`bfcol_0`, '^\\pN+$') AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 df777d073f..aff12102be 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, '^\\s+$') AS `bfcol_2` + REGEXP_CONTAINS(`bfcol_0`, '^\\s+$') AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 2c28f657fb..03fe005910 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - UPPER(`bfcol_0`) = `bfcol_0` AND LOWER(`bfcol_0`) <> `bfcol_0` AS `bfcol_2` + UPPER(`bfcol_0`) = `bfcol_0` AND LOWER(`bfcol_0`) <> `bfcol_0` AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 b4fbd15fd6..35fd087bc7 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - LENGTH(`bfcol_0`) AS `bfcol_2` + LENGTH(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 e595bee41d..e730cdee15 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - LOWER(`bfcol_0`) AS `bfcol_2` + LOWER(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 b9d506a61b..49ed89b40b 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - TRIM(`bfcol_0`, ' ') AS `bfcol_2` + TRIM(`bfcol_0`, ' ') AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 18f08df220..149df6706c 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REGEXP_REPLACE(`bfcol_0`, 'e', 'a') AS `bfcol_2` + REGEXP_REPLACE(`bfcol_0`, 'e', 'a') AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 47915478bb..3bd7e0e47e 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REPLACE(`bfcol_0`, 'e', 'a') AS `bfcol_2` + REPLACE(`bfcol_0`, 'e', 'a') AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 50173b61c0..1ef1074149 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REVERSE(`bfcol_0`) AS `bfcol_2` + REVERSE(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 b9d506a61b..49ed89b40b 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - TRIM(`bfcol_0`, ' ') AS `bfcol_2` + TRIM(`bfcol_0`, ' ') AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 44a2f5ce33..9679c95f75 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,19 +1,17 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - STARTS_WITH(`bfcol_0`, 'ab') AS `bfcol_2`, - STARTS_WITH(`bfcol_0`, 'ab') OR STARTS_WITH(`bfcol_0`, 'cd') AS `bfcol_3`, - FALSE AS `bfcol_4` + STARTS_WITH(`bfcol_0`, 'ab') AS `bfcol_1`, + STARTS_WITH(`bfcol_0`, 'ab') OR STARTS_WITH(`bfcol_0`, 'cd') AS `bfcol_2`, + FALSE AS `bfcol_3` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `single`, - `bfcol_3` AS `double`, - `bfcol_4` AS `empty` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `bfcol_1` AS `single`, + `bfcol_2` AS `double`, + `bfcol_3` AS `empty` +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/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_contains/out.sql index 41834fe04a..a1aa0539ee 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_0` LIKE '%e%' AS `bfcol_2` + `bfcol_0` LIKE '%e%' AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 7dda9e2e16..d0383172cb 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REGEXP_CONTAINS(`bfcol_0`, 'e') AS `bfcol_2` + REGEXP_CONTAINS(`bfcol_0`, 'e') AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 8008fd89c5..a7fac093e2 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REGEXP_EXTRACT(`bfcol_0`, '([a-z]*)') AS `bfcol_2` + REGEXP_EXTRACT(`bfcol_0`, '([a-z]*)') AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 54535ea4da..b850262d80 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,21 +1,19 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - INSTR(`bfcol_0`, 'e', 1) - 1 AS `bfcol_2`, - INSTR(`bfcol_0`, 'e', 3) - 1 AS `bfcol_3`, - INSTR(SUBSTRING(`bfcol_0`, 1, 5), 'e') - 1 AS `bfcol_4`, - INSTR(SUBSTRING(`bfcol_0`, 3, 3), 'e') - 1 AS `bfcol_5` + INSTR(`bfcol_0`, 'e', 1) - 1 AS `bfcol_1`, + INSTR(`bfcol_0`, 'e', 3) - 1 AS `bfcol_2`, + INSTR(SUBSTRING(`bfcol_0`, 1, 5), 'e') - 1 AS `bfcol_3`, + INSTR(SUBSTRING(`bfcol_0`, 3, 3), 'e') - 1 AS `bfcol_4` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `none_none`, - `bfcol_3` AS `start_none`, - `bfcol_4` AS `none_end`, - `bfcol_5` AS `start_end` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `bfcol_1` AS `none_none`, + `bfcol_2` AS `start_none`, + `bfcol_3` AS `none_end`, + `bfcol_4` AS `start_end` +FROM `bfcte_1` \ No newline at end of file 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 5762b04966..1278c3435d 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - SUBSTRING(`bfcol_0`, 2, 1) AS `bfcol_2` + SUBSTRING(`bfcol_0`, 2, 1) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 4adc5586cb..4226843122 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,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - LPAD(`bfcol_0`, GREATEST(LENGTH(`bfcol_0`), 10), '-') AS `bfcol_2`, - RPAD(`bfcol_0`, GREATEST(LENGTH(`bfcol_0`), 10), '-') AS `bfcol_3`, + LPAD(`bfcol_0`, GREATEST(LENGTH(`bfcol_0`), 10), '-') AS `bfcol_1`, + RPAD(`bfcol_0`, GREATEST(LENGTH(`bfcol_0`), 10), '-') AS `bfcol_2`, RPAD( LPAD( `bfcol_0`, @@ -15,13 +15,11 @@ WITH `bfcte_0` AS ( ), GREATEST(LENGTH(`bfcol_0`), 10), '-' - ) AS `bfcol_4` + ) AS `bfcol_3` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `left`, - `bfcol_3` AS `right`, - `bfcol_4` AS `both` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `bfcol_1` AS `left`, + `bfcol_2` AS `right`, + `bfcol_3` AS `both` +FROM `bfcte_1` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_repeat/out.sql b/tests/unit/core/compile/sqlglot/expressions/snapshots/test_string_ops/test_str_repeat/out.sql index 842f88d7da..1c94cfafe2 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - REPEAT(`bfcol_0`, 2) AS `bfcol_2` + REPEAT(`bfcol_0`, 2) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 ae0a2da354..4f97ab3ac6 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - SUBSTRING(`bfcol_0`, 2, 2) AS `bfcol_2` + SUBSTRING(`bfcol_0`, 2, 2) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 9b3b4b9216..de5129a6a3 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - CONCAT(`bfcol_0`, 'a') AS `bfcol_2` + CONCAT(`bfcol_0`, 'a') AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 b4f6245041..fea0d6eaf1 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - SPLIT(`bfcol_0`, ',') AS `bfcol_2` + SPLIT(`bfcol_0`, ',') AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 93a2721d8d..311f2c1727 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - TRIM(' ', `bfcol_0`) AS `bfcol_2` + TRIM(' ', `bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 80aa899391..d22c8cff5a 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - UPPER(`bfcol_0`) AS `bfcol_2` + UPPER(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 631baad999..e5d70ab44b 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,7 +1,7 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS STRING), 0)]) + `string_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, @@ -9,11 +9,9 @@ WITH `bfcte_0` AS ( WHEN SUBSTRING(`bfcol_0`, 1, 1) = '-' THEN CONCAT('-', LPAD(SUBSTRING(`bfcol_0`, 1), 9, '0')) ELSE LPAD(`bfcol_0`, 10, '0') - END AS `bfcol_2` + END AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 34c4f05361..60ae78b755 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,20 +1,15 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>, `bfcol_1` INT64>>[STRUCT( - STRUCT('' AS `name`, 0 AS `age`, STRUCT('' AS `city`, '' AS `country`) AS `address`), - 0 - )]) + `people` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`nested_structs_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_0`.`name` AS `bfcol_2`, - `bfcol_0`.`name` AS `bfcol_3` + `bfcol_0`.`name` AS `bfcol_1`, + `bfcol_0`.`name` AS `bfcol_2` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `string`, - `bfcol_3` AS `int` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `bfcol_1` AS `string`, + `bfcol_2` AS `int` +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 0e93434b14..1a8b9f4e39 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,15 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - FLOOR(`bfcol_0`) AS `bfcol_2` + FLOOR(`bfcol_0`) AS `bfcol_1` FROM `bfcte_0` ) SELECT - `bfcol_2` AS `int64_col` -FROM `bfcte_1` -ORDER BY - `bfcol_1` ASC NULLS LAST \ No newline at end of file + `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 643bcb0b5b..057e6c778e 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,38 +1,37 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0`, + `rowindex` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_6`, - `bfcol_0` AS `bfcol_7`, - `bfcol_0` AS `bfcol_8` + `bfcol_1` AS `bfcol_4`, + `bfcol_0` AS `bfcol_5`, + `bfcol_0` AS `bfcol_6` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT *, - `bfcol_6` AS `bfcol_13`, - `bfcol_7` AS `bfcol_14`, - `bfcol_8` AS `bfcol_15`, - `bfcol_7` * 1000000 AS `bfcol_16` + `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_13` AS `bfcol_22`, - `bfcol_14` AS `bfcol_23`, - `bfcol_15` AS `bfcol_24`, - `bfcol_16` AS `bfcol_25`, - `bfcol_14` * 604800000000 AS `bfcol_26` + `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_22` AS `rowindex`, - `bfcol_23` AS `int64_col`, - `bfcol_24` AS `duration_us`, - `bfcol_25` AS `duration_s`, - `bfcol_26` AS `duration_w` -FROM `bfcte_3` -ORDER BY - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `bfcol_18` AS `rowindex`, + `bfcol_19` AS `int64_col`, + `bfcol_20` AS `duration_us`, + `bfcol_21` AS `duration_s`, + `bfcol_22` AS `duration_w` +FROM `bfcte_3` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_aggregate/test_compile_aggregate/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_aggregate/test_compile_aggregate/out.sql index 4fb550cd04..02bba41a22 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,7 +1,8 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64))]) + `bool_col` AS `bfcol_0`, + `int64_too` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_aggregate/test_compile_aggregate_wo_dropna/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_aggregate/test_compile_aggregate_wo_dropna/out.sql index 983e8050d1..b8e127eb77 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,7 +1,8 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64))]) + `bool_col` AS `bfcol_0`, + `int64_too` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat/out.sql index 930fea1fca..faff452761 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,78 +1,82 @@ WITH `bfcte_1` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) + `int64_col` AS `bfcol_0`, + `rowindex` AS `bfcol_1`, + `string_col` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT *, - ROW_NUMBER() OVER (ORDER BY `bfcol_3` ASC NULLS LAST) AS `bfcol_9` + ROW_NUMBER() OVER () AS `bfcol_7` FROM `bfcte_1` ), `bfcte_5` AS ( SELECT *, - 0 AS `bfcol_15` + 0 AS `bfcol_8` FROM `bfcte_3` ), `bfcte_6` AS ( SELECT - `bfcol_1` AS `bfcol_16`, - `bfcol_1` AS `bfcol_17`, - `bfcol_0` AS `bfcol_18`, - `bfcol_2` AS `bfcol_19`, - `bfcol_15` AS `bfcol_20`, - `bfcol_9` AS `bfcol_21` + `bfcol_1` AS `bfcol_9`, + `bfcol_1` AS `bfcol_10`, + `bfcol_0` AS `bfcol_11`, + `bfcol_2` AS `bfcol_12`, + `bfcol_8` AS `bfcol_13`, + `bfcol_7` AS `bfcol_14` FROM `bfcte_5` ), `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), CAST(NULL AS STRING), 0)]) + `int64_col` AS `bfcol_15`, + `rowindex` AS `bfcol_16`, + `string_col` AS `bfcol_17` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT *, - ROW_NUMBER() OVER (ORDER BY `bfcol_25` ASC NULLS LAST) AS `bfcol_31` + ROW_NUMBER() OVER () AS `bfcol_22` FROM `bfcte_0` ), `bfcte_4` AS ( SELECT *, - 1 AS `bfcol_37` + 1 AS `bfcol_23` FROM `bfcte_2` ), `bfcte_7` AS ( SELECT - `bfcol_23` AS `bfcol_38`, - `bfcol_23` AS `bfcol_39`, - `bfcol_22` AS `bfcol_40`, - `bfcol_24` AS `bfcol_41`, - `bfcol_37` AS `bfcol_42`, - `bfcol_31` AS `bfcol_43` + `bfcol_16` AS `bfcol_24`, + `bfcol_16` AS `bfcol_25`, + `bfcol_15` AS `bfcol_26`, + `bfcol_17` AS `bfcol_27`, + `bfcol_23` AS `bfcol_28`, + `bfcol_22` AS `bfcol_29` FROM `bfcte_4` ), `bfcte_8` AS ( SELECT * FROM ( SELECT - `bfcol_16` AS `bfcol_44`, - `bfcol_17` AS `bfcol_45`, - `bfcol_18` AS `bfcol_46`, - `bfcol_19` AS `bfcol_47`, - `bfcol_20` AS `bfcol_48`, - `bfcol_21` AS `bfcol_49` + `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_38` AS `bfcol_44`, - `bfcol_39` AS `bfcol_45`, - `bfcol_40` AS `bfcol_46`, - `bfcol_41` AS `bfcol_47`, - `bfcol_42` AS `bfcol_48`, - `bfcol_43` AS `bfcol_49` + `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_44` AS `rowindex`, - `bfcol_45` AS `rowindex_1`, - `bfcol_46` AS `int64_col`, - `bfcol_47` AS `string_col` + `bfcol_30` AS `rowindex`, + `bfcol_31` AS `rowindex_1`, + `bfcol_32` AS `int64_col`, + `bfcol_33` AS `string_col` FROM `bfcte_8` ORDER BY - `bfcol_48` ASC NULLS LAST, - `bfcol_49` ASC NULLS LAST \ No newline at end of file + `bfcol_34` ASC NULLS LAST, + `bfcol_35` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat_filter_sorted/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat_filter_sorted/out.sql index 96789de8d7..90825afd20 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,136 +1,142 @@ WITH `bfcte_3` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS FLOAT64), 0)]) + `int64_col` AS `bfcol_0`, + `float64_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_7` AS ( SELECT *, - ROW_NUMBER() OVER (ORDER BY `bfcol_0` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST) AS `bfcol_6` + ROW_NUMBER() OVER (ORDER BY `bfcol_0` ASC NULLS LAST) AS `bfcol_4` FROM `bfcte_3` ), `bfcte_11` AS ( SELECT *, - 0 AS `bfcol_10` + 0 AS `bfcol_5` FROM `bfcte_7` ), `bfcte_14` AS ( SELECT - `bfcol_1` AS `bfcol_11`, - `bfcol_0` AS `bfcol_12`, - `bfcol_10` AS `bfcol_13`, - `bfcol_6` AS `bfcol_14` + `bfcol_1` AS `bfcol_6`, + `bfcol_0` AS `bfcol_7`, + `bfcol_5` AS `bfcol_8`, + `bfcol_4` AS `bfcol_9` FROM `bfcte_11` ), `bfcte_2` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS FLOAT64), 0)]) + `bool_col` AS `bfcol_10`, + `int64_too` AS `bfcol_11`, + `float64_col` AS `bfcol_12` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_6` AS ( SELECT * FROM `bfcte_2` WHERE - `bfcol_15` + `bfcol_10` ), `bfcte_10` AS ( SELECT *, - ROW_NUMBER() OVER (ORDER BY `bfcol_18` ASC NULLS LAST) AS `bfcol_22` + ROW_NUMBER() OVER () AS `bfcol_15` FROM `bfcte_6` ), `bfcte_13` AS ( SELECT *, - 1 AS `bfcol_26` + 1 AS `bfcol_16` FROM `bfcte_10` ), `bfcte_15` AS ( SELECT - `bfcol_17` AS `bfcol_27`, - `bfcol_16` AS `bfcol_28`, - `bfcol_26` AS `bfcol_29`, - `bfcol_22` AS `bfcol_30` + `bfcol_12` AS `bfcol_17`, + `bfcol_11` AS `bfcol_18`, + `bfcol_16` AS `bfcol_19`, + `bfcol_15` AS `bfcol_20` FROM `bfcte_13` ), `bfcte_1` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS FLOAT64), 0)]) + `int64_col` AS `bfcol_21`, + `float64_col` AS `bfcol_22` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_5` AS ( SELECT *, - ROW_NUMBER() OVER (ORDER BY `bfcol_31` ASC NULLS LAST, `bfcol_33` ASC NULLS LAST) AS `bfcol_37` + ROW_NUMBER() OVER (ORDER BY `bfcol_21` ASC NULLS LAST) AS `bfcol_25` FROM `bfcte_1` ), `bfcte_9` AS ( SELECT *, - 2 AS `bfcol_41` + 2 AS `bfcol_26` FROM `bfcte_5` ), `bfcte_16` AS ( SELECT - `bfcol_32` AS `bfcol_42`, - `bfcol_31` AS `bfcol_43`, - `bfcol_41` AS `bfcol_44`, - `bfcol_37` AS `bfcol_45` + `bfcol_22` AS `bfcol_27`, + `bfcol_21` AS `bfcol_28`, + `bfcol_26` AS `bfcol_29`, + `bfcol_25` AS `bfcol_30` FROM `bfcte_9` ), `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS FLOAT64), 0)]) + `bool_col` AS `bfcol_31`, + `int64_too` AS `bfcol_32`, + `float64_col` AS `bfcol_33` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_4` AS ( SELECT * FROM `bfcte_0` WHERE - `bfcol_46` + `bfcol_31` ), `bfcte_8` AS ( SELECT *, - ROW_NUMBER() OVER (ORDER BY `bfcol_49` ASC NULLS LAST) AS `bfcol_53` + ROW_NUMBER() OVER () AS `bfcol_36` FROM `bfcte_4` ), `bfcte_12` AS ( SELECT *, - 3 AS `bfcol_57` + 3 AS `bfcol_37` FROM `bfcte_8` ), `bfcte_17` AS ( SELECT - `bfcol_48` AS `bfcol_58`, - `bfcol_47` AS `bfcol_59`, - `bfcol_57` AS `bfcol_60`, - `bfcol_53` AS `bfcol_61` + `bfcol_33` AS `bfcol_38`, + `bfcol_32` AS `bfcol_39`, + `bfcol_37` AS `bfcol_40`, + `bfcol_36` AS `bfcol_41` FROM `bfcte_12` ), `bfcte_18` AS ( SELECT * FROM ( SELECT - `bfcol_11` AS `bfcol_62`, - `bfcol_12` AS `bfcol_63`, - `bfcol_13` AS `bfcol_64`, - `bfcol_14` AS `bfcol_65` + `bfcol_6` AS `bfcol_42`, + `bfcol_7` AS `bfcol_43`, + `bfcol_8` AS `bfcol_44`, + `bfcol_9` AS `bfcol_45` FROM `bfcte_14` UNION ALL SELECT - `bfcol_27` AS `bfcol_62`, - `bfcol_28` AS `bfcol_63`, - `bfcol_29` AS `bfcol_64`, - `bfcol_30` AS `bfcol_65` + `bfcol_17` AS `bfcol_42`, + `bfcol_18` AS `bfcol_43`, + `bfcol_19` AS `bfcol_44`, + `bfcol_20` AS `bfcol_45` FROM `bfcte_15` UNION ALL SELECT - `bfcol_42` AS `bfcol_62`, - `bfcol_43` AS `bfcol_63`, - `bfcol_44` AS `bfcol_64`, - `bfcol_45` AS `bfcol_65` + `bfcol_27` AS `bfcol_42`, + `bfcol_28` AS `bfcol_43`, + `bfcol_29` AS `bfcol_44`, + `bfcol_30` AS `bfcol_45` FROM `bfcte_16` UNION ALL SELECT - `bfcol_58` AS `bfcol_62`, - `bfcol_59` AS `bfcol_63`, - `bfcol_60` AS `bfcol_64`, - `bfcol_61` AS `bfcol_65` + `bfcol_38` AS `bfcol_42`, + `bfcol_39` AS `bfcol_43`, + `bfcol_40` AS `bfcol_44`, + `bfcol_41` AS `bfcol_45` FROM `bfcte_17` ) ) SELECT - `bfcol_62` AS `float64_col`, - `bfcol_63` AS `int64_col` + `bfcol_42` AS `float64_col`, + `bfcol_43` AS `int64_col` FROM `bfcte_18` ORDER BY - `bfcol_64` ASC NULLS LAST, - `bfcol_65` ASC NULLS LAST \ No newline at end of file + `bfcol_44` ASC NULLS LAST, + `bfcol_45` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_dataframe/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_dataframe/out.sql index 447df54be1..679da58f44 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,13 +1,15 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY, `bfcol_2` ARRAY, `bfcol_3` INT64>>[STRUCT(CAST(NULL AS INT64), ARRAY[], ARRAY[], 0)]) + `rowindex` AS `bfcol_0`, + `int_list_col` AS `bfcol_1`, + `string_list_col` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ), `bfcte_1` AS ( SELECT * - REPLACE (`bfcol_1`[SAFE_OFFSET(`bfcol_16`)] AS `bfcol_1`, `bfcol_2`[SAFE_OFFSET(`bfcol_16`)] AS `bfcol_2`) + REPLACE (`bfcol_1`[SAFE_OFFSET(`bfcol_13`)] AS `bfcol_1`, `bfcol_2`[SAFE_OFFSET(`bfcol_13`)] AS `bfcol_2`) FROM `bfcte_0` - CROSS JOIN UNNEST(GENERATE_ARRAY(0, LEAST(ARRAY_LENGTH(`bfcol_1`) - 1, ARRAY_LENGTH(`bfcol_2`) - 1))) AS `bfcol_16` WITH OFFSET AS `bfcol_9` + CROSS JOIN UNNEST(GENERATE_ARRAY(0, LEAST(ARRAY_LENGTH(`bfcol_1`) - 1, ARRAY_LENGTH(`bfcol_2`) - 1))) AS `bfcol_13` WITH OFFSET AS `bfcol_7` ) SELECT `bfcol_0` AS `rowindex`, @@ -16,5 +18,4 @@ SELECT `bfcol_2` AS `string_list_col` FROM `bfcte_1` ORDER BY - `bfcol_3` ASC NULLS LAST, - `bfcol_9` ASC NULLS LAST \ No newline at end of file + `bfcol_7` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_series/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_series/out.sql index 9e3ba3012e..8bfd1eb005 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_series/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_explode/test_compile_explode_series/out.sql @@ -1,18 +1,18 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY, `bfcol_2` INT64>>[STRUCT(CAST(NULL AS INT64), ARRAY[], 0)]) + `rowindex` AS `bfcol_0`, + `int_list_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ), `bfcte_1` AS ( SELECT * - REPLACE (`bfcol_11` AS `bfcol_1`) + REPLACE (`bfcol_8` AS `bfcol_1`) FROM `bfcte_0` - CROSS JOIN UNNEST(`bfcol_1`) AS `bfcol_11` WITH OFFSET AS `bfcol_6` + CROSS JOIN UNNEST(`bfcol_1`) AS `bfcol_8` WITH OFFSET AS `bfcol_4` ) SELECT `bfcol_0` AS `rowindex`, `bfcol_1` AS `int_list_col` FROM `bfcte_1` ORDER BY - `bfcol_2` ASC NULLS LAST, - `bfcol_6` ASC NULLS LAST \ No newline at end of file + `bfcol_4` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_filter/test_compile_filter/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_filter/test_compile_filter/out.sql index 556fd13bb5..9ca7fb6a74 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,26 +1,25 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0`, + `rowindex` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_1` AS `bfcol_7`, - `bfcol_1` AS `bfcol_8`, - `bfcol_0` AS `bfcol_9`, - `bfcol_1` >= 1 AS `bfcol_10` + `bfcol_1` AS `bfcol_5`, + `bfcol_1` AS `bfcol_6`, + `bfcol_0` AS `bfcol_7`, + `bfcol_1` >= 1 AS `bfcol_8` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT * FROM `bfcte_1` WHERE - `bfcol_10` + `bfcol_8` ) SELECT - `bfcol_7` AS `rowindex`, - `bfcol_8` AS `rowindex_1`, - `bfcol_9` AS `int64_col` -FROM `bfcte_2` -ORDER BY - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `bfcol_5` AS `rowindex`, + `bfcol_6` AS `rowindex_1`, + `bfcol_7` AS `int64_col` +FROM `bfcte_2` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin/out.sql index 8e7ee6ea87..e3bb0f9eba 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,17 +1,17 @@ WITH `bfcte_1` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0`, + `rowindex` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT - `bfcol_1` AS `bfcol_3`, - `bfcol_0` AS `bfcol_4`, - `bfcol_2` AS `bfcol_5` + `bfcol_1` AS `bfcol_2`, + `bfcol_0` AS `bfcol_3` FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64))]) + `int64_too` AS `bfcol_4` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT `bfcte_2`.*, @@ -20,20 +20,18 @@ WITH `bfcte_1` AS ( 1 FROM ( SELECT - `bfcol_6` + `bfcol_4` FROM `bfcte_0` GROUP BY - `bfcol_6` + `bfcol_4` ) AS `bft_0` WHERE - COALESCE(`bfcte_2`.`bfcol_4`, 0) = COALESCE(`bft_0`.`bfcol_6`, 0) - AND COALESCE(`bfcte_2`.`bfcol_4`, 1) = COALESCE(`bft_0`.`bfcol_6`, 1) - ) AS `bfcol_7` + COALESCE(`bfcte_2`.`bfcol_3`, 0) = COALESCE(`bft_0`.`bfcol_4`, 0) + AND COALESCE(`bfcte_2`.`bfcol_3`, 1) = COALESCE(`bft_0`.`bfcol_4`, 1) + ) AS `bfcol_5` FROM `bfcte_2` ) SELECT - `bfcol_3` AS `rowindex`, - `bfcol_7` AS `int64_col` -FROM `bfcte_3` -ORDER BY - `bfcol_5` ASC NULLS LAST \ No newline at end of file + `bfcol_2` AS `rowindex`, + `bfcol_5` AS `int64_col` +FROM `bfcte_3` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_isin/test_compile_isin_not_nullable/out.sql index f6ff106a08..f96a9816dc 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,39 +1,30 @@ WITH `bfcte_1` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `rowindex` AS `bfcol_0`, + `rowindex_2` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT - `bfcol_0` AS `bfcol_3`, - `bfcol_1` AS `bfcol_4`, - `bfcol_2` AS `bfcol_5` + `bfcol_0` AS `bfcol_2`, + `bfcol_1` AS `bfcol_3` FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64))]) + `rowindex_2` AS `bfcol_4` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT `bfcte_2`.*, - EXISTS( - SELECT - 1 - FROM ( + `bfcte_2`.`bfcol_3` IN (( SELECT - `bfcol_6` + `bfcol_4` FROM `bfcte_0` GROUP BY - `bfcol_6` - ) AS `bft_0` - WHERE - COALESCE(`bfcte_2`.`bfcol_4`, 0) = COALESCE(`bft_0`.`bfcol_6`, 0) - AND COALESCE(`bfcte_2`.`bfcol_4`, 1) = COALESCE(`bft_0`.`bfcol_6`, 1) - ) AS `bfcol_7` + `bfcol_4` + )) AS `bfcol_5` FROM `bfcte_2` ) SELECT - `bfcol_3` AS `rowindex`, - `bfcol_7` AS `rowindex_2` -FROM `bfcte_3` -ORDER BY - `bfcol_5` ASC NULLS LAST \ No newline at end of file + `bfcol_2` AS `rowindex`, + `bfcol_5` AS `rowindex_2` +FROM `bfcte_3` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_join/test_compile_join/out.sql index 16fe1ac340..04ee767f8a 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,7 +1,8 @@ WITH `bfcte_1` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64))]) + `int64_col` AS `bfcol_0`, + `rowindex` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT `bfcol_1` AS `bfcol_2`, @@ -9,8 +10,9 @@ WITH `bfcte_1` AS ( FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64))]) + `int64_col` AS `bfcol_4`, + `int64_too` AS `bfcol_5` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT `bfcol_4` AS `bfcol_6`, 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 dc8d98c7f1..05d5fd0695 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,7 +1,8 @@ WITH `bfcte_1` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64))]) + `bool_col` AS `bfcol_0`, + `rowindex` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT `bfcol_1` AS `bfcol_2`, @@ -9,8 +10,9 @@ WITH `bfcte_1` AS ( FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64))]) + `bool_col` AS `bfcol_4`, + `rowindex` AS `bfcol_5` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT `bfcol_5` AS `bfcol_6`, 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 42dadb7c8e..9e6a4094b2 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,7 +1,8 @@ WITH `bfcte_1` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), CAST(NULL AS INT64))]) + `float64_col` AS `bfcol_0`, + `rowindex` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT `bfcol_1` AS `bfcol_2`, @@ -9,8 +10,9 @@ WITH `bfcte_1` AS ( FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS FLOAT64), CAST(NULL AS INT64))]) + `float64_col` AS `bfcol_4`, + `rowindex` AS `bfcol_5` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT `bfcol_5` AS `bfcol_6`, 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 bbe02bfc22..bd03e05cba 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,7 +1,8 @@ WITH `bfcte_1` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64))]) + `int64_col` AS `bfcol_0`, + `rowindex` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT `bfcol_1` AS `bfcol_2`, @@ -9,8 +10,9 @@ WITH `bfcte_1` AS ( FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64))]) + `int64_col` AS `bfcol_4`, + `rowindex` AS `bfcol_5` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT `bfcol_5` AS `bfcol_6`, 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 0d313b678c..6b77ead97c 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,7 +1,8 @@ WITH `bfcte_1` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS NUMERIC), CAST(NULL AS INT64))]) + `numeric_col` AS `bfcol_0`, + `rowindex` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT `bfcol_1` AS `bfcol_2`, @@ -9,8 +10,9 @@ WITH `bfcte_1` AS ( FROM `bfcte_1` ), `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS NUMERIC), CAST(NULL AS INT64))]) + `numeric_col` AS `bfcol_4`, + `rowindex` AS `bfcol_5` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_3` AS ( SELECT `bfcol_5` AS `bfcol_6`, 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 734a058f0e..1903d5fc22 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,11 +1,13 @@ WITH `bfcte_1` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING))]) + `rowindex` AS `bfcol_0`, + `string_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS STRING))]) + `rowindex` AS `bfcol_2`, + `string_col` AS `bfcol_3` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT `bfcol_2` AS `bfcol_4`, 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 d96308cc3a..9e3477d4a9 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,11 +1,13 @@ WITH `bfcte_1` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS TIME))]) + `rowindex` AS `bfcol_0`, + `time_col` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS TIME))]) + `rowindex` AS `bfcol_2`, + `time_col` AS `bfcol_3` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_2` AS ( SELECT `bfcol_2` AS `bfcol_4`, 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 4f1dd73dc1..10c2a2088a 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,24 +1,21 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[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), - CAST(NULL AS INT64), - CAST(NULL AS NUMERIC), - CAST(NULL AS FLOAT64), - CAST(NULL AS INT64), - CAST(NULL AS INT64), - CAST(NULL AS STRING), - CAST(NULL AS TIME), - CAST(NULL AS TIMESTAMP), - CAST(NULL AS INT64), - 0 - )]) + `bool_col` AS `bfcol_0`, + `bytes_col` AS `bfcol_1`, + `date_col` AS `bfcol_2`, + `datetime_col` AS `bfcol_3`, + `geography_col` AS `bfcol_4`, + `int64_col` AS `bfcol_5`, + `int64_too` AS `bfcol_6`, + `numeric_col` AS `bfcol_7`, + `float64_col` AS `bfcol_8`, + `rowindex` AS `bfcol_9`, + `rowindex_2` AS `bfcol_10`, + `string_col` AS `bfcol_11`, + `time_col` AS `bfcol_12`, + `timestamp_col` AS `bfcol_13`, + `duration_col` AS `bfcol_14` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT `bfcol_9` AS `rowindex`, @@ -37,6 +34,4 @@ SELECT `bfcol_12` AS `time_col`, `bfcol_13` AS `timestamp_col`, `bfcol_14` AS `duration_col` -FROM `bfcte_0` -ORDER BY - `bfcol_15` ASC NULLS LAST \ No newline at end of file +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_limit/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_limit/out.sql index 707f8900e0..f97eb7bf06 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_limit/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_limit/out.sql @@ -1,13 +1,13 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0`, + `rowindex` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT `bfcol_1` AS `rowindex`, `bfcol_0` AS `int64_col` FROM `bfcte_0` ORDER BY - `bfcol_1` ASC NULLS LAST, - `bfcol_2` ASC NULLS LAST + `bfcol_1` ASC NULLS LAST LIMIT 10 \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_nested_structs_types/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_nested_structs_types/out.sql index f84a5b7e43..75c4a86e18 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,16 +1,11 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>, `bfcol_2` INT64>>[STRUCT( - CAST(NULL AS INT64), - STRUCT('' AS `name`, 0 AS `age`, STRUCT('' AS `city`, '' AS `country`) AS `address`), - 0 - )]) + `id` AS `bfcol_0`, + `people` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`nested_structs_types` ) SELECT `bfcol_0` AS `id`, `bfcol_0` AS `id_1`, `bfcol_1` AS `people` -FROM `bfcte_0` -ORDER BY - `bfcol_2` ASC NULLS LAST \ No newline at end of file +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_ordering/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_ordering/out.sql index 4f290b1261..6a16b98baa 100644 --- a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_ordering/out.sql +++ b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_ordering/out.sql @@ -1,12 +1,12 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0`, + `rowindex` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ) SELECT `bfcol_1` AS `rowindex`, `bfcol_0` AS `int64_col` FROM `bfcte_0` ORDER BY - `bfcol_0` ASC NULLS LAST, - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `bfcol_0` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_repeated_types/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_readtable/test_compile_readtable_w_repeated_types/out.sql index 9fb34eb673..2436c01a44 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,17 +1,14 @@ 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( - CAST(NULL AS INT64), - ARRAY[], - ARRAY[], - ARRAY[], - ARRAY[], - ARRAY[], - ARRAY[], - ARRAY[], - 0 - )]) + `rowindex` AS `bfcol_0`, + `int_list_col` AS `bfcol_1`, + `bool_list_col` AS `bfcol_2`, + `float_list_col` AS `bfcol_3`, + `date_list_col` AS `bfcol_4`, + `date_time_list_col` AS `bfcol_5`, + `numeric_list_col` AS `bfcol_6`, + `string_list_col` AS `bfcol_7` + FROM `bigframes-dev`.`sqlglot_test`.`repeated_types` ) SELECT `bfcol_0` AS `rowindex`, @@ -23,6 +20,4 @@ SELECT `bfcol_5` AS `date_time_list_col`, `bfcol_6` AS `numeric_list_col`, `bfcol_7` AS `string_list_col` -FROM `bfcte_0` -ORDER BY - `bfcol_8` ASC NULLS LAST \ No newline at end of file +FROM `bfcte_0` \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_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 4d3e5bc161..f280933a74 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,75 +1,76 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS BOOLEAN), CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `bool_col` AS `bfcol_0`, + `int64_col` AS `bfcol_1`, + `rowindex` AS `bfcol_2` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, - `bfcol_2` AS `bfcol_8`, - `bfcol_0` AS `bfcol_9`, - `bfcol_1` AS `bfcol_10`, - `bfcol_0` AS `bfcol_11` + `bfcol_2` AS `bfcol_6`, + `bfcol_0` AS `bfcol_7`, + `bfcol_1` AS `bfcol_8`, + `bfcol_0` AS `bfcol_9` FROM `bfcte_0` ), `bfcte_2` AS ( SELECT * FROM `bfcte_1` WHERE - NOT `bfcol_11` IS NULL + NOT `bfcol_9` IS NULL ), `bfcte_3` AS ( SELECT *, CASE - WHEN SUM(CAST(NOT `bfcol_9` IS NULL AS INT64)) OVER ( - PARTITION BY `bfcol_11` - ORDER BY `bfcol_11` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST, `bfcol_3` ASC NULLS LAST + WHEN SUM(CAST(NOT `bfcol_7` IS NULL AS INT64)) OVER ( + PARTITION BY `bfcol_9` + ORDER BY `bfcol_9` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW ) < 3 THEN NULL ELSE COALESCE( - SUM(CAST(`bfcol_9` AS INT64)) OVER ( - PARTITION BY `bfcol_11` - ORDER BY `bfcol_11` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST, `bfcol_3` ASC NULLS LAST + SUM(CAST(`bfcol_7` AS INT64)) OVER ( + PARTITION BY `bfcol_9` + ORDER BY `bfcol_9` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW ), 0 ) - END AS `bfcol_18` + END AS `bfcol_15` FROM `bfcte_2` ), `bfcte_4` AS ( SELECT * FROM `bfcte_3` WHERE - NOT `bfcol_11` IS NULL + NOT `bfcol_9` IS NULL ), `bfcte_5` AS ( SELECT *, CASE - WHEN SUM(CAST(NOT `bfcol_10` IS NULL AS INT64)) OVER ( - PARTITION BY `bfcol_11` - ORDER BY `bfcol_11` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST, `bfcol_3` ASC NULLS LAST + WHEN SUM(CAST(NOT `bfcol_8` IS NULL AS INT64)) OVER ( + PARTITION BY `bfcol_9` + ORDER BY `bfcol_9` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW ) < 3 THEN NULL ELSE COALESCE( - SUM(`bfcol_10`) OVER ( - PARTITION BY `bfcol_11` - ORDER BY `bfcol_11` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST, `bfcol_3` ASC NULLS LAST + SUM(`bfcol_8`) OVER ( + PARTITION BY `bfcol_9` + ORDER BY `bfcol_9` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW ), 0 ) - END AS `bfcol_25` + END AS `bfcol_21` FROM `bfcte_4` ) SELECT - `bfcol_11` AS `bool_col`, - `bfcol_8` AS `rowindex`, - `bfcol_18` AS `bool_col_1`, - `bfcol_25` AS `int64_col` + `bfcol_9` AS `bool_col`, + `bfcol_6` AS `rowindex`, + `bfcol_15` AS `bool_col_1`, + `bfcol_21` AS `int64_col` FROM `bfcte_5` ORDER BY - `bfcol_11` ASC NULLS LAST, - `bfcol_2` ASC NULLS LAST, - `bfcol_3` ASC NULLS LAST \ No newline at end of file + `bfcol_9` ASC NULLS LAST, + `bfcol_2` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_skips_nulls_op/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_w_skips_nulls_op/out.sql index eecd94e0d3..f22ef37b7e 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,30 +1,24 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0`, + `rowindex` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, CASE - WHEN SUM(CAST(NOT `bfcol_0` IS NULL AS INT64)) OVER ( - ORDER BY `bfcol_1` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST - ROWS BETWEEN 2 PRECEDING AND CURRENT ROW - ) < 3 + WHEN SUM(CAST(NOT `bfcol_0` IS NULL AS INT64)) OVER (ORDER BY `bfcol_1` ASC NULLS LAST ROWS BETWEEN 2 PRECEDING AND CURRENT ROW) < 3 THEN NULL ELSE COALESCE( - SUM(`bfcol_0`) OVER ( - ORDER BY `bfcol_1` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST - ROWS BETWEEN 2 PRECEDING AND CURRENT ROW - ), + SUM(`bfcol_0`) OVER (ORDER BY `bfcol_1` ASC NULLS LAST ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), 0 ) - END AS `bfcol_6` + END AS `bfcol_4` FROM `bfcte_0` ) SELECT `bfcol_1` AS `rowindex`, - `bfcol_6` AS `int64_col` + `bfcol_4` AS `int64_col` FROM `bfcte_1` ORDER BY - `bfcol_1` ASC NULLS LAST, - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `bfcol_1` ASC NULLS LAST \ No newline at end of file diff --git a/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_wo_skips_nulls_op/out.sql b/tests/unit/core/compile/sqlglot/snapshots/test_compile_window/test_compile_window_wo_skips_nulls_op/out.sql index 736704cd72..dcf52f2e82 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,27 +1,21 @@ WITH `bfcte_0` AS ( SELECT - * - FROM UNNEST(ARRAY>[STRUCT(CAST(NULL AS INT64), CAST(NULL AS INT64), 0)]) + `int64_col` AS `bfcol_0`, + `rowindex` AS `bfcol_1` + FROM `bigframes-dev`.`sqlglot_test`.`scalar_types` ), `bfcte_1` AS ( SELECT *, CASE - WHEN COUNT(CAST(NOT `bfcol_0` IS NULL AS INT64)) OVER ( - ORDER BY `bfcol_1` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST - ROWS BETWEEN 4 PRECEDING AND CURRENT ROW - ) < 5 + WHEN COUNT(CAST(NOT `bfcol_0` IS NULL AS INT64)) OVER (ORDER BY `bfcol_1` ASC NULLS LAST ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) < 5 THEN NULL - ELSE COUNT(`bfcol_0`) OVER ( - ORDER BY `bfcol_1` ASC NULLS LAST, `bfcol_2` ASC NULLS LAST - ROWS BETWEEN 4 PRECEDING AND CURRENT ROW - ) - END AS `bfcol_6` + ELSE COUNT(`bfcol_0`) OVER (ORDER BY `bfcol_1` ASC NULLS LAST ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) + END AS `bfcol_4` FROM `bfcte_0` ) SELECT `bfcol_1` AS `rowindex`, - `bfcol_6` AS `int64_col` + `bfcol_4` AS `int64_col` FROM `bfcte_1` ORDER BY - `bfcol_1` ASC NULLS LAST, - `bfcol_2` ASC NULLS LAST \ No newline at end of file + `bfcol_1` ASC NULLS LAST \ No newline at end of file