andygrove commented on code in PR #471: URL: https://github.com/apache/datafusion-comet/pull/471#discussion_r1617524600
########## spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala: ########## @@ -1469,5 +1469,38 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper { } } } + test("unary negative integer overflow test") { + val df = Seq(Int.MaxValue, Int.MinValue).toDF("a") + df.write.mode("overwrite").parquet("/tmp/int.parquet") + spark.read.parquet("/tmp/int.parquet").createTempView("t") + + // without ANSI mode + withSQLConf( + SQLConf.ANSI_ENABLED.key -> "false", + CometConf.COMET_ANSI_MODE_ENABLED.key -> "false", + CometConf.COMET_ENABLED.key -> "true", + CometConf.COMET_EXEC_ENABLED.key -> "true") { + checkSparkMaybeThrows(sql("select a, -a from t")) match { + case (None, None) => // no exception + case _ => + fail("No exception should be thrown") + } Review Comment: I think you can just use `checkSparkAnswerAndOperator` here to make sure Comet returns the correct results and does not throw an exception. ```suggestion checkSparkAnswerAndOperator(sql("select a, -a from t")) ``` -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org