Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 2080da9

Browse files
update snapshot test
1 parent 50f5c09 commit 2080da9

File tree

2 files changed

+22
-25
lines changed

2 files changed

+22
-25
lines changed

tests/unit/core/compile/sqlglot/snapshots/test_compile_random_sample/test_compile_random_sample/out.sql

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
WITH `bfcte_0` AS (
22
SELECT
3-
*,
4-
RAND() AS `bfcol_16`
5-
FROM UNNEST(ARRAY<STRUCT<`bfcol_0` BOOLEAN, `bfcol_1` BYTES, `bfcol_2` DATE, `bfcol_3` DATETIME, `bfcol_4` GEOGRAPHY, `bfcol_5` INT64, `bfcol_6` INT64, `bfcol_7` NUMERIC, `bfcol_8` FLOAT64, `bfcol_9` INT64, `bfcol_10` INT64, `bfcol_11` STRING, `bfcol_12` TIME, `bfcol_13` TIMESTAMP, `bfcol_14` INT64, `bfcol_15` INT64>>[STRUCT(
3+
*
4+
FROM UNNEST(ARRAY<STRUCT<`bfcol_0` BOOLEAN, `bfcol_1` BYTES, `bfcol_2` DATE, `bfcol_3` DATETIME, `bfcol_4` GEOGRAPHY, `bfcol_5` INT64, `bfcol_6` INT64, `bfcol_7` NUMERIC, `bfcol_8` FLOAT64, `bfcol_9` INT64, `bfcol_10` INT64, `bfcol_11` STRING, `bfcol_12` TIME, `bfcol_13` TIMESTAMP, `bfcol_14` INT64>>[STRUCT(
65
TRUE,
76
CAST(b'Hello, World!' AS BYTES),
87
CAST('2021-07-21' AS DATE),
@@ -17,8 +16,7 @@ WITH `bfcte_0` AS (
1716
'Hello, World!',
1817
CAST('11:41:43.076160' AS TIME),
1918
CAST('2021-07-21T17:43:43.945289+00:00' AS TIMESTAMP),
20-
4,
21-
0
19+
4
2220
), STRUCT(
2321
FALSE,
2422
CAST(b'\xe3\x81\x93\xe3\x82\x93\xe3\x81\xab\xe3\x81\xa1\xe3\x81\xaf' AS BYTES),
@@ -34,8 +32,7 @@ WITH `bfcte_0` AS (
3432
'こんにちは',
3533
CAST('11:14:34.701606' AS TIME),
3634
CAST('2021-07-21T17:43:43.945289+00:00' AS TIMESTAMP),
37-
-1000000,
38-
1
35+
-1000000
3936
), STRUCT(
4037
TRUE,
4138
CAST(b'\xc2\xa1Hola Mundo!' AS BYTES),
@@ -51,8 +48,7 @@ WITH `bfcte_0` AS (
5148
' ¡Hola Mundo! ',
5249
CAST('23:59:59.999999' AS TIME),
5350
CAST('2023-03-01T10:55:13.250125+00:00' AS TIMESTAMP),
54-
0,
55-
2
51+
0
5652
), STRUCT(
5753
CAST(NULL AS BOOLEAN),
5854
CAST(NULL AS BYTES),
@@ -68,8 +64,7 @@ WITH `bfcte_0` AS (
6864
CAST(NULL AS STRING),
6965
CAST(NULL AS TIME),
7066
CAST(NULL AS TIMESTAMP),
71-
CAST(NULL AS INT64),
72-
3
67+
CAST(NULL AS INT64)
7368
), STRUCT(
7469
FALSE,
7570
CAST(b'\xe3\x81\x93\xe3\x82\x93\xe3\x81\xab\xe3\x81\xa1\xe3\x81\xaf' AS BYTES),
@@ -85,8 +80,7 @@ WITH `bfcte_0` AS (
8580
'Hello, World!',
8681
CAST(NULL AS TIME),
8782
CAST(NULL AS TIMESTAMP),
88-
31540000000000,
89-
4
83+
31540000000000
9084
), STRUCT(
9185
FALSE,
9286
CAST(b'G\xc3\xbcten Tag' AS BYTES),
@@ -102,8 +96,7 @@ WITH `bfcte_0` AS (
10296
'Güten Tag!',
10397
CAST('15:16:17.181921' AS TIME),
10498
CAST('1980-03-14T15:16:17.181921+00:00' AS TIMESTAMP),
105-
4,
106-
5
99+
4
107100
), STRUCT(
108101
TRUE,
109102
CAST(b'Hello\tBigFrames!\x07' AS BYTES),
@@ -119,8 +112,7 @@ WITH `bfcte_0` AS (
119112
'capitalize, This ',
120113
CAST('01:02:03.456789' AS TIME),
121114
CAST('2023-05-23T11:42:55.000001+00:00' AS TIMESTAMP),
122-
CAST(NULL AS INT64),
123-
6
115+
CAST(NULL AS INT64)
124116
), STRUCT(
125117
TRUE,
126118
CAST(NULL AS BYTES),
@@ -136,8 +128,7 @@ WITH `bfcte_0` AS (
136128
' سلام',
137129
CAST('12:00:00.000001' AS TIME),
138130
CAST('2038-01-19T03:14:17.999999+00:00' AS TIMESTAMP),
139-
4,
140-
7
131+
4
141132
), STRUCT(
142133
FALSE,
143134
CAST(NULL AS BYTES),
@@ -153,15 +144,19 @@ WITH `bfcte_0` AS (
153144
'T',
154145
CAST(NULL AS TIME),
155146
CAST(NULL AS TIMESTAMP),
156-
432000000000,
157-
8
147+
432000000000
158148
)])
159149
), `bfcte_1` AS (
160150
SELECT
161-
*
151+
*,
152+
GENERATE_UUID() AS `bfcol_15`
162153
FROM `bfcte_0`
154+
), `bfcte_2` AS (
155+
SELECT
156+
*
157+
FROM `bfcte_1`
163158
WHERE
164-
`bfcol_16` < 0.1
159+
`bfcol_15` < 0.1
165160
)
166161
SELECT
167162
`bfcol_0` AS `bool_col`,
@@ -179,6 +174,6 @@ SELECT
179174
`bfcol_12` AS `time_col`,
180175
`bfcol_13` AS `timestamp_col`,
181176
`bfcol_14` AS `duration_col`
182-
FROM `bfcte_1`
177+
FROM `bfcte_2`
183178
ORDER BY
184179
`bfcol_15` ASC NULLS LAST

tests/unit/core/compile/sqlglot/test_compile_random_sample.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ def test_compile_random_sample(
3030
Because BigFrames doesn't expose a public API for creating a random sample
3131
operation, this test constructs the node directly and then compiles it to SQL.
3232
"""
33-
node = nodes.RandomSampleNode(scalar_types_array_value.node, fraction=0.1)
33+
node = nodes.RandomSampleNode(
34+
scalar_types_array_value.node, fraction=0.1, shuffle=True
35+
)
3436
sql = compile.sqlglot.compile_sql(compile.CompileRequest(node, sort_rows=True)).sql
3537
snapshot.assert_match(sql, "out.sql")

0 commit comments

Comments
 (0)