You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sedona.apache.org by "Kimahriman (via GitHub)" <gi...@apache.org> on 2023/03/08 13:07:40 UTC
[GitHub] [sedona] Kimahriman commented on a diff in pull request #792: [SEDONA-231] Redundant Serde Elimination
Kimahriman commented on code in PR #792:
URL: https://github.com/apache/sedona/pull/792#discussion_r1129393214
##########
sql/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/NullSafeExpressions.scala:
##########
@@ -38,42 +38,85 @@ trait FoldableExpression extends Expression {
override def foldable: Boolean = children.forall(_.foldable)
}
-abstract class UnaryGeometryExpression extends Expression with ExpectsInputTypes {
+trait SerdeAware {
+ def evalWithoutSerialization(input: InternalRow): Any
+}
+
+abstract class UnaryGeometryExpression extends Expression with SerdeAware with ExpectsInputTypes {
def inputExpressions: Seq[Expression]
override def nullable: Boolean = true
override def inputTypes: Seq[AbstractDataType] = Seq(GeometryUDT)
override def eval(input: InternalRow): Any = {
- val geometry = inputExpressions.head.toGeometry(input)
+ val result = evalWithoutSerialization(input)
+ serializeResult(result)
+ }
+
+ override def evalWithoutSerialization(input: InternalRow): Any ={
+ val inputExpression = inputExpressions.head
+ val geometry = inputExpression match {
+ case expr: SerdeAware => expr.evalWithoutSerialization(input)
+ case expr: Any => expr.toGeometry(input)
+ }
Review Comment:
Should this check just go inside the `toGeometry` implicit helper so we don't need to duplicate it everywhere?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org