MCPcopy Index your code
hub / github.com/tobymao/sqlglot / test_window_functions

Method test_window_functions

tests/test_diff.py:200–221  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

198 self._validate_delta_only(diff_delta_only(expr_src, expr_tgt), [])
199
200 def test_window_functions(self):
201 expr_src = parse_one("SELECT ROW_NUMBER() OVER (PARTITION BY a ORDER BY b)")
202 expr_tgt = parse_one("SELECT RANK() OVER (PARTITION BY a ORDER BY b)")
203
204 self._validate_delta_only(diff_delta_only(expr_src, expr_src), [])
205
206 self._validate_delta_only(
207 diff_delta_only(expr_src, expr_tgt),
208 [
209 Remove(expression=parse_one("ROW_NUMBER()")),
210 Insert(expression=parse_one("RANK()")),
211 Update(source=expr_src.selects[0], target=expr_tgt.selects[0]),
212 ],
213 )
214
215 expr_src = parse_one("SELECT MAX(x) OVER (ORDER BY y) FROM z", "oracle")
216 expr_tgt = parse_one("SELECT MAX(x) KEEP (DENSE_RANK LAST ORDER BY y) FROM z", "oracle")
217
218 self._validate_delta_only(
219 diff_delta_only(expr_src, expr_tgt),
220 [Update(source=expr_src.selects[0], target=expr_tgt.selects[0])],
221 )
222
223 def test_pre_matchings(self):
224 expr_src = parse_one("SELECT 1")

Callers

nothing calls this directly

Calls 6

_validate_delta_onlyMethod · 0.95
parse_oneFunction · 0.90
RemoveClass · 0.90
InsertClass · 0.90
UpdateClass · 0.90
diff_delta_onlyFunction · 0.85

Tested by

no test coverage detected