Github user cloud-fan commented on a diff in the pull request:
    --- Diff: 
    @@ -42,15 +42,48 @@ trait ExpressionEvalHelper extends 
GeneratorDrivenPropertyChecks {
    +  protected def convertToCatalystUnsafe(a: Any): Any = a match {
    +    case arr: Array[Byte] => arr
    +    case arr: Array[Boolean] => UnsafeArrayData.fromPrimitiveArray(arr)
    +    case arr: Array[Short] => UnsafeArrayData.fromPrimitiveArray(arr)
    +    case arr: Array[Int] => UnsafeArrayData.fromPrimitiveArray(arr)
    +    case arr: Array[Long] => UnsafeArrayData.fromPrimitiveArray(arr)
    +    case arr: Array[Float] => UnsafeArrayData.fromPrimitiveArray(arr)
    +    case arr: Array[Double] => UnsafeArrayData.fromPrimitiveArray(arr)
    +    case other => CatalystTypeConverters.convertToCatalyst(other)
    +  }
       protected def checkEvaluation(
           expression: => Expression, expected: Any, inputRow: InternalRow = 
EmptyRow): Unit = {
         val serializer = new JavaSerializer(new SparkConf()).newInstance
         val expr: Expression = 
    +    // No codegen version expects GenericArrayData
         val catalystValue = CatalystTypeConverters.convertToCatalyst(expected)
    +    // Codegen version expects UnsafeArrayData for array expect 
    +    val catalystValueForCodegen = convertToCatalystUnsafe(expected)
    --- End diff --
    > Codegen version expects UnsafeArrayData
    This is wrong, e.g. even the codegen version of `Cast` will produce safe 
format array.
    My proposal is, we improve the checkResult to do type-aware comparison on 
complex types.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to