Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/6519#discussion_r35950642
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
---
@@ -216,6 +226,21 @@ 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.supportOrdering(s) =>
+ val ordering = s.fields.map(_.dataType).zipWithIndex.map {
+ case(dt, index) => new SortOrder(BoundReference(index, dt,
nullable = true), Ascending)
+ }
+ val comparisons = GenerateOrdering.genComparisons(ordering, this)
+ val funcCode: String =
+ s"""
+ public int compareStruct(InternalRow a, InternalRow b) {
--- End diff --
wouldn't this fail on nested struct?
---
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]