cloud-fan commented on code in PR #52784:
URL: https://github.com/apache/spark/pull/52784#discussion_r2476211138


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/st/stExpressions.scala:
##########
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.catalyst.expressions
+
+import org.apache.spark.sql.catalyst.expressions.objects._
+import org.apache.spark.sql.catalyst.trees._
+import org.apache.spark.sql.catalyst.util.{Geography, Geometry, STUtils}
+import org.apache.spark.sql.types._
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// This file defines expressions for geospatial operations.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+// Useful constants for ST expressions.
+private[sql] object ExpressionDefaults {
+  val DEFAULT_GEOGRAPHY_SRID: Int = Geography.DEFAULT_SRID
+  val DEFAULT_GEOMETRY_SRID: Int = Geometry.DEFAULT_SRID
+}
+
+/** ST writer expressions. */
+
+/**
+ * Returns the input GEOGRAPHY or GEOMETRY value in WKB format.
+ * See 
https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry#Well-known_binary
+ * for more details on the WKB format.
+ */
+@ExpressionDescription(
+  usage = "_FUNC_(geo) - Returns the geospatial value (value of type GEOGRAPHY 
or GEOMETRY) "
+    + "in WKB format.",
+  arguments = """
+    Arguments:
+      * geo - A geospatial value, either a GEOGRAPHY or a GEOMETRY.
+  """,
+  examples = """
+    Examples:
+      > SELECT 
hex(_FUNC_(st_geogfromwkb(X'0101000000000000000000F03F0000000000000040')));
+       0101000000000000000000F03F0000000000000040
+      > SELECT 
hex(_FUNC_(st_geomfromwkb(X'0101000000000000000000F03F0000000000000040')));
+       0101000000000000000000F03F0000000000000040
+  """,
+  since = "4.1.0",
+  group = "st_funcs"
+)
+case class ST_AsBinary(geo: Expression)
+    extends RuntimeReplaceable
+    with ImplicitCastInputTypes
+    with UnaryLike[Expression] {
+
+  override def inputTypes: Seq[AbstractDataType] = Seq(
+      TypeCollection(GeographyType, GeometryType)
+    )

Review Comment:
   ```suggestion
       TypeCollection(GeographyType, GeometryType)
     )
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to