Skip to content
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

test: add tpc-h q8 and fix expression parsing #64

Merged
merged 1 commit into from
Feb 13, 2024
Merged

Conversation

skyzh
Copy link
Member

@skyzh skyzh commented Feb 13, 2024

TPC-H Q8 has been broken since cross join support b/c it adds join filter support but some expressions were not handled. This pull request adds tests for TPC-H Q8 and implements between + cast expressions. Note that the type inference is broken and someone should add a Type rel node to df-repr in order to process types correctly.

@AveryQi115
Copy link
Contributor

^ Note that the type inference is broken and someone should add a Type rel node to df-repr in order to process types correctly.
What does this mean?

@skyzh
Copy link
Member Author

skyzh commented Feb 13, 2024

^ Note that the type inference is broken and someone should add a Type rel node to df-repr in order to process types correctly. What does this mean?

  1. Cast needs to be represented as cast(child_expr, target_type). Given that we don't have a Type RelNode, we use Value(default_value) to represent a type.
  2. Decimal has precisions and we did not store them. We hardcode it to be (15, 2) when converting optd representation out to DF representation.
               let expr = CastExpr::from_rel_node(expr.into_rel_node()).unwrap();
                 let child = Self::conv_from_optd_expr(expr.child(), context)?;
                 let data_type = match expr.cast_to() {
                     Value::Bool(_) => DataType::Boolean,
                     Value::Decimal128(_) => DataType::Decimal128(15, 2), /* TODO: AVOID HARD CODE PRECISION */
                     Value::Date32(_) => DataType::Date32,
                     other => unimplemented!("{}", other),
                 };

@AveryQi115
Copy link
Contributor

^ Note that the type inference is broken and someone should add a Type rel node to df-repr in order to process types correctly. What does this mean?

  1. Cast needs to be represented as cast(child_expr, target_type). Given that we don't have a Type RelNode, we use Value(default_value) to represent a type.
  2. Decimal has precisions and we did not store them. We hardcode it to be (15, 2) when converting optd representation out to DF representation.
               let expr = CastExpr::from_rel_node(expr.into_rel_node()).unwrap();
                 let child = Self::conv_from_optd_expr(expr.child(), context)?;
                 let data_type = match expr.cast_to() {
                     Value::Bool(_) => DataType::Boolean,
                     Value::Decimal128(_) => DataType::Decimal128(15, 2), /* TODO: AVOID HARD CODE PRECISION */
                     Value::Date32(_) => DataType::Date32,
                     other => unimplemented!("{}", other),
                 };

Sure, we'll add the support soon.

Copy link
Contributor

@AveryQi115 AveryQi115 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@skyzh skyzh merged commit 2d91160 into main Feb 13, 2024
1 check passed
@skyzh skyzh deleted the skyzh/tpch-test branch February 13, 2024 02:34
@yliang412 yliang412 mentioned this pull request Feb 13, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants