GeezerVison is showing github.com — refactor: switch RowNumber to 0-based indexing in sqlglot compiler (#… · googleapis/google-cloud-python@25fd63b
File treeExpand file treeCollapse file tree Open diff view settings bigframes/core/compile/sqlglot/aggregations tests/unit/core/compile/sqlglot aggregations/snapshots/test_nullary_compiler test_row_number_with_window
snapshots/test_compile_concat test_compile_concat_filter_sorted
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/bigframes/bigframes/core/compile/sqlglot/aggregations/nullary_compiler.py +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 49 | 49 | result: sge.Expression = sge.func("ROW_NUMBER") | 50 | 50 | if window is None: | 51 | 51 | # ROW_NUMBER always needs an OVER clause. | 52 | | - return sge.Window(this=result) | 53 | | - return apply_window_if_present(result, window, include_framing_clauses=False) | | 52 | + return sge.Window(this=result) - 1 | | 53 | + return apply_window_if_present(result, window, include_framing_clauses=False) - 1 |
Collapse file Copy file name to clipboardExpand all lines: packages/bigframes/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number/out.sql +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -19,7 +19,7 @@ WITH `bfcte_0` AS ( | 19 | 19 | ), `bfcte_1` AS ( | 20 | 20 | SELECT | 21 | 21 | *, | 22 | | - ROW_NUMBER() OVER () AS `bfcol_32` | | 22 | + ROW_NUMBER() OVER () - 1 AS `bfcol_32` | 23 | 23 | FROM `bfcte_0` | 24 | 24 | ) | 25 | 25 | SELECT | |
Collapse file Copy file name to clipboardExpand all lines: packages/bigframes/tests/unit/core/compile/sqlglot/aggregations/snapshots/test_nullary_compiler/test_row_number_with_window/out.sql +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -5,7 +5,7 @@ WITH `bfcte_0` AS ( | 5 | 5 | ), `bfcte_1` AS ( | 6 | 6 | SELECT | 7 | 7 | *, | 8 | | - ROW_NUMBER() OVER (ORDER BY `int64_col` ASC NULLS LAST) AS `bfcol_1` | | 8 | + ROW_NUMBER() OVER (ORDER BY `int64_col` ASC NULLS LAST) - 1 AS `bfcol_1` | 9 | 9 | FROM `bfcte_0` | 10 | 10 | ) | 11 | 11 | SELECT | |
Collapse file Copy file name to clipboardExpand all lines: packages/bigframes/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat/out.sql +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -7,7 +7,7 @@ WITH `bfcte_1` AS ( | 7 | 7 | ), `bfcte_3` AS ( | 8 | 8 | SELECT | 9 | 9 | *, | 10 | | - ROW_NUMBER() OVER () AS `bfcol_7` | | 10 | + ROW_NUMBER() OVER () - 1 AS `bfcol_7` | 11 | 11 | FROM `bfcte_1` | 12 | 12 | ), `bfcte_5` AS ( | 13 | 13 | SELECT | @@ -32,7 +32,7 @@ WITH `bfcte_1` AS ( | 32 | 32 | ), `bfcte_2` AS ( | 33 | 33 | SELECT | 34 | 34 | *, | 35 | | - ROW_NUMBER() OVER () AS `bfcol_22` | | 35 | + ROW_NUMBER() OVER () - 1 AS `bfcol_22` | 36 | 36 | FROM `bfcte_0` | 37 | 37 | ), `bfcte_4` AS ( | 38 | 38 | SELECT | |
Collapse file Copy file name to clipboardExpand all lines: packages/bigframes/tests/unit/core/compile/sqlglot/snapshots/test_compile_concat/test_compile_concat_filter_sorted/out.sql +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -6,7 +6,7 @@ WITH `bfcte_2` AS ( | 6 | 6 | ), `bfcte_6` AS ( | 7 | 7 | SELECT | 8 | 8 | *, | 9 | | - ROW_NUMBER() OVER (ORDER BY `int64_col` ASC NULLS LAST) AS `bfcol_4` | | 9 | + ROW_NUMBER() OVER (ORDER BY `int64_col` ASC NULLS LAST) - 1 AS `bfcol_4` | 10 | 10 | FROM `bfcte_2` | 11 | 11 | ), `bfcte_10` AS ( | 12 | 12 | SELECT | @@ -35,7 +35,7 @@ WITH `bfcte_2` AS ( | 35 | 35 | ), `bfcte_8` AS ( | 36 | 36 | SELECT | 37 | 37 | *, | 38 | | - ROW_NUMBER() OVER () AS `bfcol_15` | | 38 | + ROW_NUMBER() OVER () - 1 AS `bfcol_15` | 39 | 39 | FROM `bfcte_4` | 40 | 40 | ), `bfcte_12` AS ( | 41 | 41 | SELECT | @@ -57,7 +57,7 @@ WITH `bfcte_2` AS ( | 57 | 57 | ), `bfcte_5` AS ( | 58 | 58 | SELECT | 59 | 59 | *, | 60 | | - ROW_NUMBER() OVER (ORDER BY `int64_col` ASC NULLS LAST) AS `bfcol_25` | | 60 | + ROW_NUMBER() OVER (ORDER BY `int64_col` ASC NULLS LAST) - 1 AS `bfcol_25` | 61 | 61 | FROM `bfcte_1` | 62 | 62 | ), `bfcte_9` AS ( | 63 | 63 | SELECT | @@ -86,7 +86,7 @@ WITH `bfcte_2` AS ( | 86 | 86 | ), `bfcte_7` AS ( | 87 | 87 | SELECT | 88 | 88 | *, | 89 | | - ROW_NUMBER() OVER () AS `bfcol_36` | | 89 | + ROW_NUMBER() OVER () - 1 AS `bfcol_36` | 90 | 90 | FROM `bfcte_3` | 91 | 91 | ), `bfcte_11` AS ( | 92 | 92 | SELECT | |
|