Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/22417#discussion_r217619116
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/CodeGeneratorWithInterpretedFallback.scala
 ---
    @@ -59,6 +59,6 @@ abstract class CodeGeneratorWithInterpretedFallback[IN, 
OUT] extends Logging {
         }
       }
     
    -  protected def createCodeGeneratedObject(in: IN): OUT
    +  protected def createCodeGeneratedObject(in: IN, 
subexpressionEliminationEnabled: Boolean): OUT
    --- End diff --
    
    If we are going to get config directly from `SQLConf`, why do we need to 
pass it as a parameter here?
    
    Can we keep this API untouched and let `createCodeGeneratedObject` 
implementation to take care of it?
    
    Like:
    
    ```scala
    object UnsafeProjection
        extends CodeGeneratorWithInterpretedFallback[Seq[Expression], 
UnsafeProjection] {
    
      override protected def createCodeGeneratedObject(in: Seq[Expression]): 
UnsafeProjection = {
        GenerateUnsafeProjection.generate(in, 
SQLConf.get.subexpressionEliminationEnabled)
      }
    
      ...
    }
    ```
    
    I think it is much simpler.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to