Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/6519#discussion_r35735102
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
---
@@ -214,6 +214,8 @@ class CodeGenContext {
case dt: DataType if isPrimitiveType(dt) => s"($c1 > $c2 ? 1 : $c1 <
$c2 ? -1 : 0)"
case BinaryType =>
s"org.apache.spark.sql.catalyst.util.TypeUtils.compareBinary($c1, $c2)"
case NullType => "0"
+ case s: StructType if
s.fields.forall(_.dataType.isInstanceOf[AtomicType]) =>
--- End diff --
@rxin after checking `CreateStructUnsafe`, I still feel confused.
Basically, `genComp` will generate a one line java code that will be
evaluated in `if()`. Even in `CreateStructUnsafe`, its usage of
`GenerateUnsafeProjection.createCode` generates a block of java code to run to
set up the value of `GeneratedExpressionCode.primitive`.
So in `genComp`, for `StructType`, we still need to generate one line java
code. I don't see how we can use the approach of
`GenerateUnsafeProjection.createCode` to do this for `genComp`.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]