You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
window frame definition SUM(id) OVER (PARTITION BY first_name ROWS BETWEEN 5 PRECEDING AND 2 FOLLOWING) is incorrectly unparsed as SUM(id) OVER (PARTITION BY first_name ROWS BETWEEN '5' PRECEDING AND '2' FOLLOWING)
long literals 5 and 2 are converted to string literals '5' and '2'
To Reproduce
The following test can be used
#[test]
fn test_aggregation_to_sql() {
sql_round_trip(
GenericDialect {},
r#"SELECT id, first_name,
SUM(id) OVER (PARTITION BY first_name ROWS BETWEEN 5 PRECEDING AND 2 FOLLOWING) AS moving_sum
FROM person
GROUP BY id, first_name;"#,
r#"SELECT person.id, person.first_name, SUM(person.id) OVER (PARTITION BY person.first_name ROWS BETWEEN 5 PRECEDING AND 2 FOLLOWING) AS moving_sum FROM person GROUP BY person.id, person.first_name"#,
);
}
sgrebnov
changed the title
Unparser: numeric values in window frame definition are converted to string literals
Unparser: numeric values in window frame definition are converted into string literals
Oct 17, 2024
Describe the bug
As pointed here: https://github.com/apache/datafusion/pull/12946/files#r1803027063
window frame definition
SUM(id) OVER (PARTITION BY first_name ROWS BETWEEN 5 PRECEDING AND 2 FOLLOWING)
is incorrectly unparsed asSUM(id) OVER (PARTITION BY first_name ROWS BETWEEN '5' PRECEDING AND '2' FOLLOWING)
To Reproduce
The following test can be used
Expected behavior
window frame definition is unparsed correctly
Additional context
https://github.com/apache/datafusion/pull/12946/files#r1803027063
The text was updated successfully, but these errors were encountered: