You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by cloud-fan <gi...@git.apache.org> on 2016/12/02 04:46:58 UTC
[GitHub] spark pull request #13909: [SPARK-16213][SQL] Reduce runtime overhead of a p...
Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/13909#discussion_r90586610
--- Diff: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvalHelper.scala ---
@@ -42,15 +42,48 @@ trait ExpressionEvalHelper extends GeneratorDrivenPropertyChecks {
InternalRow.fromSeq(values.map(CatalystTypeConverters.convertToCatalyst))
}
+ 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 = serializer.deserialize(serializer.serialize(expression))
+ // No codegen version expects GenericArrayData
val catalystValue = CatalystTypeConverters.convertToCatalyst(expected)
--- End diff --
if we use encoder here to convert the value to catalyst format, we don't need to change the `CatalystTypeConverters` right?
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org