Imbruced commented on a change in pull request #528:
URL: https://github.com/apache/incubator-sedona/pull/528#discussion_r637163575
##########
File path:
sql/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/Functions.scala
##########
@@ -1122,4 +1123,48 @@ case class ST_FlipCoordinates(inputExpressions:
Seq[Expression])
override def dataType: DataType = GeometryUDT
override def children: Seq[Expression] = inputExpressions
+}
+
+
+case class ST_SubDivide(inputExpressions: Seq[Expression])
+ extends Expression with CodegenFallback {
+ override def nullable: Boolean = true
+
+ override def eval(input: InternalRow): Any = {
+ inputExpressions.validateLength(2)
+ val geometryRaw = inputExpressions.head
+ val maxVerticesRaw = inputExpressions(1)
+ geometryRaw.toGeometry(input) match {
+ case geom: Geometry => ArrayData.toArrayData(
+ GeometrySubDivider.subDivide(geom,
maxVerticesRaw.toInt(input)).map(_.toGenericArrayData)
+ )
+ case null => null
+ }
+
+ }
+
+ override def dataType: DataType = ArrayType(GeometryUDT)
+
+ override def children: Seq[Expression] = inputExpressions
+}
+
+case class ST_SubDivideExplode(children: Seq[Expression]) extends Generator {
Review comment:
But as far i remember lateral view works with spark 2.4 and above
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]