andygrove commented on code in PR #7723: URL: https://github.com/apache/datafusion-comet/pull/7723#discussion_r4745900907
########## docs/source/user-guide/latest/compatibility/index.md: ########## @@ -171,6 +171,51 @@ already-ordered `TakeOrderedAndProject` inputs are tracked in An error on a row absent from the final result is not always a mismatch: Spark can also need to evaluate that row, for example to sort the input or process an `OFFSET` prefix. +## ANSI division errors skipped by filters and projections + +With `spark.sql.ansi.enabled=true`, Comet can return rows where Spark raises +`DIVIDE_BY_ZERO`. The examples below use Spark's default code generation settings +and a Parquet table `t` with these two rows in the same row group. + +| x | y | p | q | +| --- | ---- | ----- | ----- | +| 1 | 1 | true | true | +| 0 | NULL | false | false | + +```sql +SELECT x FROM t WHERE y IS NOT NULL AND abs(10 DIV x) > 0 +``` + +`CometFilter` skips the row with `y = NULL` and returns `1`. Spark's whole-stage filter +checks a column for NULL when a predicate first needs it. The comparison needs only +`x`, so Spark divides by zero before checking `y`. With `spark.sql.codegen.wholeStage=false`, +Spark checks `y` first. Lowering `spark.sql.codegen.hugeMethodLimit` only forces this +switch if a compiled method exceeds the limit. + +With `spark.comet.parquet.rowFilterPushdown.enabled=true`, the Comet Parquet scan can Review Comment: I ran example 1 over the two-row table with `spark.comet.parquet.rowFilterPushdown.enabled=true`, and Comet still raised `DIVIDE_BY_ZERO` from the filter with `Error evaluating filter predicate`. So the claim that the zero divisor never reaches the filter does not hold for this table. Could you check which cases pushdown really removes, and either state that narrowly or drop the paragraph? ########## docs/source/user-guide/latest/compatibility/index.md: ########## @@ -171,6 +171,51 @@ already-ordered `TakeOrderedAndProject` inputs are tracked in An error on a row absent from the final result is not always a mismatch: Spark can also need to evaluate that row, for example to sort the input or process an `OFFSET` prefix. +## ANSI division errors skipped by filters and projections + +With `spark.sql.ansi.enabled=true`, Comet can return rows where Spark raises Review Comment: The heading and opening sentence are about division, but the same two shapes return rows in Comet where Spark raises for any expression that fails under ANSI. For example, `WHERE y IS NOT NULL AND CAST(s AS INT) > 0` with `s = 'bad'` on the `y` NULL row raises `CAST_INVALID_INPUT` in Spark and returns rows in Comet. Could the intro say that division is the example and the behavior applies to other ANSI errors too? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
