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

Commit 56c2879

Browse files
committed
refactor: fix pull_up_select disorder the columns of readtable nodes
1 parent fee9ffe commit 56c2879

File tree

41 files changed

+81
-82
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+81
-82
lines changed

bigframes/core/rewrite/select_pullup.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,12 @@ def pull_up_source_ids(node: nodes.ReadTableNode) -> nodes.BigFrameNode:
5454
if all(id.sql == source_id for id, source_id in node.scan_list.items):
5555
return node
5656
else:
57-
source_ids = sorted(
58-
set(scan_item.source_id for scan_item in node.scan_list.items)
59-
)
6057
new_scan_list = nodes.ScanList.from_items(
6158
[
62-
nodes.ScanItem(identifiers.ColumnId(source_id), source_id)
63-
for source_id in source_ids
59+
nodes.ScanItem(
60+
identifiers.ColumnId(scan_item.source_id), scan_item.source_id
61+
)
62+
for scan_item in node.scan_list.items
6463
]
6564
)
6665
new_source = dataclasses.replace(node, scan_list=new_scan_list)

tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_corr/out.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
WITH `bfcte_0` AS (
22
SELECT
3-
`float64_col`,
4-
`int64_col`
3+
`int64_col`,
4+
`float64_col`
55
FROM `bigframes-dev`.`sqlglot_test`.`scalar_types`
66
), `bfcte_1` AS (
77
SELECT

tests/unit/core/compile/sqlglot/aggregations/snapshots/test_binary_compiler/test_cov/out.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
WITH `bfcte_0` AS (
22
SELECT
3-
`float64_col`,
4-
`int64_col`
3+
`int64_col`,
4+
`float64_col`
55
FROM `bigframes-dev`.`sqlglot_test`.`scalar_types`
66
), `bfcte_1` AS (
77
SELECT

tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number/out.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ WITH `bfcte_0` AS (
44
`bytes_col`,
55
`date_col`,
66
`datetime_col`,
7-
`duration_col`,
8-
`float64_col`,
97
`geography_col`,
108
`int64_col`,
119
`int64_too`,
1210
`numeric_col`,
11+
`float64_col`,
1312
`rowindex`,
1413
`rowindex_2`,
1514
`string_col`,
1615
`time_col`,
17-
`timestamp_col`
16+
`timestamp_col`,
17+
`duration_col`
1818
FROM `bigframes-dev`.`sqlglot_test`.`scalar_types`
1919
), `bfcte_1` AS (
2020
SELECT

tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_size/out.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ WITH `bfcte_0` AS (
44
`bytes_col`,
55
`date_col`,
66
`datetime_col`,
7-
`duration_col`,
8-
`float64_col`,
97
`geography_col`,
108
`int64_col`,
119
`int64_too`,
1210
`numeric_col`,
11+
`float64_col`,
1312
`rowindex`,
1413
`rowindex_2`,
1514
`string_col`,
1615
`time_col`,
17-
`timestamp_col`
16+
`timestamp_col`,
17+
`duration_col`
1818
FROM `bigframes-dev`.`sqlglot_test`.`scalar_types`
1919
), `bfcte_1` AS (
2020
SELECT

tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_mean/out.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
WITH `bfcte_0` AS (
22
SELECT
33
`bool_col`,
4-
`duration_col`,
5-
`int64_col`
4+
`int64_col`,
5+
`duration_col`
66
FROM `bigframes-dev`.`sqlglot_test`.`scalar_types`
77
), `bfcte_1` AS (
88
SELECT

tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_std/out.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
WITH `bfcte_0` AS (
22
SELECT
33
`bool_col`,
4-
`duration_col`,
5-
`int64_col`
4+
`int64_col`,
5+
`duration_col`
66
FROM `bigframes-dev`.`sqlglot_test`.`scalar_types`
77
), `bfcte_1` AS (
88
SELECT

tests/unit/core/compile/sqlglot/expressions/snapshots/test_array_ops/test_to_array_op/out.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
WITH `bfcte_0` AS (
22
SELECT
33
`bool_col`,
4-
`float64_col`,
54
`int64_col`,
5+
`float64_col`,
66
`string_col`
77
FROM `bigframes-dev`.`sqlglot_test`.`scalar_types`
88
), `bfcte_1` AS (

tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_is_in/out.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
WITH `bfcte_0` AS (
22
SELECT
33
`bool_col`,
4-
`float64_col`,
5-
`int64_col`
4+
`int64_col`,
5+
`float64_col`
66
FROM `bigframes-dev`.`sqlglot_test`.`scalar_types`
77
), `bfcte_1` AS (
88
SELECT

tests/unit/core/compile/sqlglot/expressions/snapshots/test_comparison_ops/test_maximum_op/out.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
WITH `bfcte_0` AS (
22
SELECT
3-
`float64_col`,
4-
`int64_col`
3+
`int64_col`,
4+
`float64_col`
55
FROM `bigframes-dev`.`sqlglot_test`.`scalar_types`
66
), `bfcte_1` AS (
77
SELECT

0 commit comments

Comments
 (0)