Uh oh!
There was an error while loading. Please reload this page.
fix: casting Int64 to Float64 unsuccessfully caused tpch8 to fail - #1601
Conversation
TPCH 8TPCH 14 |
xudong963
commented
Jan 18, 2022
One problem with this modification is that I checked Postgres' behavior, it can process reasonably. postgres=# SELECT * FROM test;
a
---123
(3 rows)
postgres=# SELECT a,
CASE WHEN a=1 THEN 1.2
ELSE 0
END
FROM test;
a | case
---+------1 | 1.22 | 03 | 0
(3 rows)
postgres=# SELECT a,
CASE WHEN a=1 THEN 12
ELSE 5.4
END
FROM test;
a | case
---+------1 | 122 | 5.43 | 5.4
(3 rows) |
houqp
commented
Jan 18, 2022
I agree, better to take both branches into account. |
houqp
left a comment
There was a problem hiding this comment.
Good job unlocking more TPCH queries!
| // start with the else condition, or nulls | ||
| let mut current_value: Option<ArrayRef> = if let Some(e) = &self.else_expr { | ||
| Some(e.evaluate(batch)?.into_array(batch.num_rows())) | ||
| // keep `else_expr`'s data type and return type consistent |
There was a problem hiding this comment.
Eventually it would be great to separate out the coercion logic into the `
/// Create a CASE expressionpubfncase(expr:Option<Arc<dynPhysicalExpr>>,when_thens:&[WhenThen],else_expr:Option<Arc<dynPhysicalExpr>>,) -> Result<Arc<dynPhysicalExpr>>{Ok(Arc::new(CaseExpr::try_new(expr, when_thens, else_expr)?))}function the way it is done with BinaryExpr and binary_cast
But this is better than master so 👍
xudong963
commented
Jan 18, 2022
Next PR I'll do the thing and keep consistent with Postgres. cc @alamb |
alamb
commented
Jan 18, 2022
Filed #1609 to track |
Which issue does this PR close?
Closes#1576#165
Rationale for this change
What changes are included in this PR?
Are there any user-facing changes?