-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor!: proof_of_sql_parser::intermediate_ast::OrderBy
with sqlparser::ast::OrderByExpr
in the proof-of-sql crate
#450
base: main
Are you sure you want to change the base?
Conversation
…parser::ast::OrderByExpr` in the proof-of-sql crate
fb9aa62
to
d7d1606
Compare
fn owned_column_to_expr<S: Scalar>(col: &OwnedColumn<S>) -> Expr { | ||
match col { | ||
OwnedColumn::Boolean(_) => Expr::Identifier("BooleanColumn".into()), | ||
OwnedColumn::TinyInt(_) => Expr::Identifier("TinyIntColumn".into()), | ||
OwnedColumn::SmallInt(_) => Expr::Identifier("SmallIntColumn".into()), | ||
OwnedColumn::Int(_) => Expr::Identifier("IntColumn".into()), | ||
OwnedColumn::BigInt(_) => Expr::Identifier("BigIntColumn".into()), | ||
OwnedColumn::VarChar(_) => Expr::Identifier("VarCharColumn".into()), | ||
OwnedColumn::Int128(_) => Expr::Identifier("Int128Column".into()), | ||
OwnedColumn::Decimal75(_, _, _) => Expr::Identifier("DecimalColumn".into()), | ||
OwnedColumn::Scalar(_) => Expr::Identifier("ScalarColumn".into()), | ||
OwnedColumn::TimestampTZ(_, _, _) => Expr::Identifier("TimestampColumn".into()), | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm this leads to duplicates, right?
@@ -0,0 +1 @@ | |||
* text=auto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not commit this please unless you have a very good reason
https://stackoverflow.com/questions/21472971/what-is-the-purpose-of-text-auto-in-gitattributes-file
( | ||
col.clone(), | ||
OrderByExpr { | ||
expr: owned_column_to_expr(col), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK we can't do this since expressions are not by default identifiers.
)) | ||
|order_by| -> PostprocessingResult<(OwnedColumn<S>, OrderByExpr)> { | ||
let identifier = match &order_by.expr { | ||
Expr::Identifier(ident) => ident.clone(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can order by expressions such as c0 + c1, not identifiers.
Please be sure to look over the pull request guidelines here: https://github.com/spaceandtimelabs/sxt-proof-of-sql/blob/main/CONTRIBUTING.md#submit-pr.
Please go through the following checklist
!
is used if and only if at least one breaking change has been introduced.source scripts/run_ci_checks.sh
.Rationale for this change
This PR addresses the need to replace the
proof_of_sql_parser::OrderBy
with thesqlparser::ast::OrderByExpr
in theproof-of-sql
crate as part of a larger transition toward integrating thesqlparser
.This change is a subtask of issue #235, with the main goal of streamlining the repository by switching to the
sqlparser
crate and gradually replacing intermediary constructs likeproof_of_sql_parser::intermediate_ast
withsqlparser::ast
.What changes are included in this PR?
proof_of_sql_parser::OrderBy
have been replaced withsqlparser::ast::OrderByExpr
OrderBy
has been updated to maintain the original functionality, ensuring no changes to the logic or behavior.Are these changes tested?
Yes
Part of #235