我想在GeoMesa中使用Java函数,但我似乎不能使用任何函数,我有以下与GeoMesa相关的导入:
import org.locationtech.jts.geom.*;
import org.apache.spark.sql.types.*;
import org.locationtech.geomesa.spark.jts.*;但我不能使用其中的任何UDF函数:
dataset.withColumn("column", st_makePoint(...));我有以下Maven依赖项:
<dependency>
<dependency>
<groupId>org.locationtech.geomesa</groupId>
<artifactId>geomesa-spark-jts_2.11</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>org.locationtech.geomesa</groupId>
<artifactId>geomesa-spark-sql_2.11</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>org.locationtech.geomesa</groupId>
<artifactId>geomesa-spark-core_2.11</artifactId>
<version>2.4.1</version>
</dependency>它根本无法识别st_makePoint,我能做些什么呢?
发布于 2020-07-29 20:22:22
为了将地理空间UDF和UDF添加到Spark会话,需要调用两条路径中的一条。对于JTS支持,可以遵循以下步骤:https://www.geomesa.org/documentation/stable/user/spark/sparksql_functions.html (基本上是在Spark会话上调用.withJTS )。
或者,使用Spark SQL从GeoMesa数据源创建数据帧也应该注册UDT和UDF。(https://www.geomesa.org/documentation/stable/user/spark/sparksql.html#usage)
此处提供了受支持的地理空间函数的完整列表:https://www.geomesa.org/documentation/stable/user/spark/sparksql_functions.html
作为编辑,Spark SQL API、DataFrame API和PySpark API都需要在GeoMesa中进行单独的绑定。如果我错了,那么不能在其他API中使用Spark SQL函数文档中的函数就是一个错误,应该在GeoMesa JIRA中进行填充:https://geomesa.atlassian.net。
https://stackoverflow.com/questions/63149077
复制相似问题