datafusion-comet icon indicating copy to clipboard operation
datafusion-comet copied to clipboard

abs returns incorrect value in some cases

Open andygrove opened this issue 1 year ago • 4 comments

Describe the bug

SQL

SELECT c28, abs(c28) AS x FROM test1 ORDER BY c28;

Spark Plan

AdaptiveSparkPlan isFinalPlan=true
+- == Final Plan ==
   *(2) Sort [c28#228L ASC NULLS FIRST], true, 0
   +- AQEShuffleRead coalesced
      +- ShuffleQueryStage 0
         +- Exchange rangepartitioning(c28#228L ASC NULLS FIRST, 200), ENSURE_REQUIREMENTS, [plan_id=24514]
            +- *(1) Project [c28#228L, abs(c28#228L) AS x#25310L]
               +- *(1) ColumnarToRow
                  +- FileScan parquet [c28#228L] Batched: true, DataFilters: [], Format: Parquet, Location: InMemoryFileIndex(1 paths)[file:/home/andy/git/apache/datafusion-comet/fuzz-testing/test1.parquet], PartitionFilters: [], PushedFilters: [], ReadSchema: struct<c28:bigint>
+- == Initial Plan ==
   Sort [c28#228L ASC NULLS FIRST], true, 0
   +- Exchange rangepartitioning(c28#228L ASC NULLS FIRST, 200), ENSURE_REQUIREMENTS, [plan_id=24500]
      +- Project [c28#228L, abs(c28#228L) AS x#25310L]
         +- FileScan parquet [c28#228L] Batched: true, DataFilters: [], Format: Parquet, Location: InMemoryFileIndex(1 paths)[file:/home/andy/git/apache/datafusion-comet/fuzz-testing/test1.parquet], PartitionFilters: [], PushedFilters: [], ReadSchema: struct<c28:bigint>

Comet Plan

AdaptiveSparkPlan isFinalPlan=true
+- == Final Plan ==
   *(2) Sort [c28#228L ASC NULLS FIRST], true, 0
   +- AQEShuffleRead coalesced
      +- ShuffleQueryStage 0
         +- Exchange rangepartitioning(c28#228L ASC NULLS FIRST, 200), ENSURE_REQUIREMENTS, [plan_id=24579]
            +- *(1) ColumnarToRow
               +- CometProject [c28#228L, x#25316L], [c28#228L, abs(c28#228L) AS x#25316L]
                  +- CometScan parquet [c28#228L] Batched: true, DataFilters: [], Format: CometParquet, Location: InMemoryFileIndex(1 paths)[file:/home/andy/git/apache/datafusion-comet/fuzz-testing/test1.parquet], PartitionFilters: [], PushedFilters: [], ReadSchema: struct<c28:bigint>
+- == Initial Plan ==
   Sort [c28#228L ASC NULLS FIRST], true, 0
   +- Exchange rangepartitioning(c28#228L ASC NULLS FIRST, 200), ENSURE_REQUIREMENTS, [plan_id=24559]
      +- CometProject [c28#228L, x#25316L], [c28#228L, abs(c28#228L) AS x#25316L]
         +- CometScan parquet [c28#228L] Batched: true, DataFilters: [], Format: CometParquet, Location: InMemoryFileIndex(1 paths)[file:/home/andy/git/apache/datafusion-comet/fuzz-testing/test1.parquet], PartitionFilters: [], PushedFilters: [], ReadSchema: struct<c28:bigint>

First difference at row 11: Spark: -8779944534083813778,8779944534083813778 Comet: -8779944534083813778,-8779944534083813778

Steps to reproduce

No response

Expected behavior

No response

Additional context

No response

andygrove avatar Jul 15 '24 15:07 andygrove

This is likely a duplicate of https://github.com/apache/datafusion-comet/issues/642

andygrove avatar Jul 15 '24 15:07 andygrove

working on it.

vaibhawvipul avatar Jul 20 '24 14:07 vaibhawvipul

I am able to reproduce the issue.

vaibhawvipul avatar Jul 24 '24 07:07 vaibhawvipul

Native abs is disabled for now

kazuyukitanimura avatar Sep 24 '24 21:09 kazuyukitanimura

Closing this bug because we disabled the feature. Filed https://github.com/apache/datafusion-comet/issues/1890 to re-implement.

andygrove avatar Jun 16 '25 19:06 andygrove

👀

coderfender avatar Sep 20 '25 02:09 coderfender