geomesa spark不能使用自定义函数

wa7juj8i  于 2021-05-27  发布在  Spark
关注(0)|答案(1)|浏览(573)

我想在java中使用geomesa udf函数,但我似乎不能使用任何函数,我有这些与geomesa相关的导入:

import org.locationtech.jts.geom.*;
import org.apache.spark.sql.types.*;
import org.locationtech.geomesa.spark.jts.*;

但我不能使用其中的任何自定义函数:

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>

它根本不认识圣·莫克点,我能怎么办?

aij0ehis

aij0ehis1#

为了将地理空间udf和UDT添加到spark会话中,需要调用两个路径之一。对于jts支持,可以按照以下步骤操作:https://www.geomesa.org/documentation/stable/user/spark/sparksql_functions.html (基本上,在spark会话中用JTS呼叫)。
或者,使用sparksql从geomesa数据源创建Dataframe也应该注册udt和udf(https://www.geomesa.org/documentation/stable/user/spark/sparksql.html#usage)
支持的地理空间功能的完整列表如下:https://www.geomesa.org/documentation/stable/user/spark/sparksql_functions.html
作为编辑,sparksqlapi、dataframeapi和pysparkapi都需要geomesa中单独的绑定。如果我错了,那么无法在其他API中使用spark sql函数文档中的函数就是一个错误,应该在geomesa jira中填写:https://geomesa.atlassian.net.

相关问题