andygrove commented on issue #2692:
URL: 
https://github.com/apache/datafusion-comet/issues/2692#issuecomment-3503268748

   Notes to future self for when I have time to work on this.
   
   We currently have many variations of `checkSparkAnswer`:
   
   ```scala
     protected def checkSparkAnswer(query: String): (SparkPlan, SparkPlan) = {
     protected def checkSparkAnswer(df: => DataFrame): (SparkPlan, SparkPlan) = 
{
     protected def checkSparkAnswerWithTolerance(
     protected def checkSparkAnswerWithTolerance(
     protected def checkSparkAnswerAndOperator(
     protected def checkSparkAnswerAndOperator(
     protected def checkSparkAnswerAndOperator(
     protected def checkSparkAnswerAndOperatorWithTol(
     protected def checkSparkAnswerAndOperatorWithTol(
     protected def checkSparkAnswerAndFallbackReason(
     protected def checkSparkAnswerAndFallbackReason(
     protected def checkSparkAnswerAndFallbackReasons(
     protected def checkSparkAnswerMaybeThrows(
   ```
   
   I would like to explore an approach that provides a highly customizable 
version of the method.
   
   Some possible approaches:
   
   ## Builder pattern for a spec to pass to the test
   
   ```scala
   checkSparkAnswerAndOperator(CheckSparkAnswer.builder()
     .withTolerance(0.000001)
     .allowOperators(classOf[ProjectExec], classOf[HashAggregateExec])
     .build())
   ```
   
   ## Use closure for custom checks
   
   ```
   checkSparkAnswer(df, test => test.assertRowCount(42).withTolerance(0.000001))
   
   checkSparkAnswer(df, test => test.inspectResults((sparkDF, cometDF) => { .. 
custom logic here .. })
   ```
   


-- 
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]

Reply via email to