我正在使用geospark 1.3.1,在这里我试图找到包含在一个圆中的所有地理点,给定一个以米为单位的圆心和半径。要做到这一点,我不想把中心从度转换到米,创建一个圆(使用 ST_Buffer
)然后在应用 ST_Contains
与所有地理点连接。请参见下面的sql:
WITH point_data AS (
SELECT
ST_Point(CAST(c.lon as Decimal(24,20)), CAST(c.lat as Decimal(24,20))) as geo_point
FROM point_data_view as c
)
SELECT * FROM point_data as pd
WHERE ST_Contains(ST_Transform(ST_Buffer(ST_Transform(ST_Point(<LON>, <LAT>), 'epsg:4326', 'epsg:3857'), 1000.0), 'epsg:3857', 'epsg:4326'), pd.geo_point) = true
然而,当我按照指南geospark添加依赖到pom文件并创建一个uberjar提交(使用 spark2-submit
)我得到以下错误(仅当使用 ST_Transform
(功能)
java.lang.NoSuchMethodError: org.hsqldb.DatabaseURL.parseURL(Ljava/lang/String;ZZ)Lorg/hsqldb/persist/HsqlProperties;
at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source)
at org.hsqldb.jdbc.JDBCDataSource.getConnection(Unknown Source)
at org.hsqldb.jdbc.JDBCDataSource.getConnection(Unknown Source)
at org.geotools.referencing.factory.epsg.DirectEpsgFactory.getConnection(DirectEpsgFactory.java:3302)
at org.geotools.referencing.factory.epsg.ThreadedEpsgFactory.createBackingStore(ThreadedEpsgFactory.java:436)
at org.geotools.referencing.factory.DeferredAuthorityFactory.getBackingStore(DeferredAuthorityFactory.java:133)
at org.geotools.referencing.factory.BufferedAuthorityFactory.isAvailable(BufferedAuthorityFactory.java:235)
at org.geotools.referencing.factory.DeferredAuthorityFactory.isAvailable(DeferredAuthorityFactory.java:119)
at org.geotools.factory.FactoryRegistry.isAvailable(FactoryRegistry.java:667)
at org.geotools.factory.FactoryRegistry.isAcceptable(FactoryRegistry.java:501)
at org.geotools.factory.FactoryRegistry.getServiceImplementation(FactoryRegistry.java:437)
at org.geotools.factory.FactoryRegistry.getServiceProvider(FactoryRegistry.java:365)
at org.geotools.factory.FactoryCreator.getServiceProvider(FactoryCreator.java:145)
at org.geotools.referencing.ReferencingFactoryFinder.getAuthorityFactory(ReferencingFactoryFinder.java:220)
at org.geotools.referencing.ReferencingFactoryFinder.getCRSAuthorityFactory(ReferencingFactoryFinder.java:440)
at org.geotools.referencing.factory.epsg.LongitudeFirstFactory.createBackingStore(LongitudeFirstFactory.java:192)
at org.geotools.referencing.factory.DeferredAuthorityFactory.getBackingStore(DeferredAuthorityFactory.java:133)
at org.geotools.referencing.factory.BufferedAuthorityFactory.isAvailable(BufferedAuthorityFactory.java:235)
at org.geotools.referencing.factory.DeferredAuthorityFactory.isAvailable(DeferredAuthorityFactory.java:119)
at org.geotools.factory.FactoryRegistry.isAvailable(FactoryRegistry.java:667)
at org.geotools.factory.FactoryRegistry.isAcceptable(FactoryRegistry.java:501)
at org.geotools.factory.FactoryRegistry$1.filter(FactoryRegistry.java:192)
at javax.imageio.spi.FilterIterator.advance(ServiceRegistry.java:834)
at javax.imageio.spi.FilterIterator.<init>(ServiceRegistry.java:828)
at javax.imageio.spi.ServiceRegistry.getServiceProviders(ServiceRegistry.java:519)
at org.geotools.factory.FactoryRegistry.getServiceProviders(FactoryRegistry.java:197)
at org.geotools.referencing.ReferencingFactoryFinder.getFactories(ReferencingFactoryFinder.java:180)
at org.geotools.referencing.ReferencingFactoryFinder.getCRSAuthorityFactories(ReferencingFactoryFinder.java:455)
at org.geotools.referencing.DefaultAuthorityFactory.getBackingFactory(DefaultAuthorityFactory.java:89)
at org.geotools.referencing.DefaultAuthorityFactory.<init>(DefaultAuthorityFactory.java:69)
at org.geotools.referencing.CRS.getAuthorityFactory(CRS.java:263)
at org.geotools.referencing.CRS.decode(CRS.java:525)
at org.geotools.referencing.CRS.decode(CRS.java:453)
at org.apache.spark.sql.geosparksql.expressions.ST_Transform.eval(Functions.scala:237)
我曾尝试在我的构建中对“org.hsqldb”进行着色和重新定位,但这并没有改变任何事情,而且没有将geospark jar包含在uber jar中,而是将它们作为构建的一部分进行加载 spark2-submit
我也有同样的错误。我真的找不到解决这个问题的方法,只有使用 ST_Transform
方法?
看起来myspark平台有一个旧版本的 org.hsqldb
比地球公园给你的还要多!
我的底纹如下:
<properties>
<geoSparkVersion>1.3.1</geoSparkVersion>
<sparkVersion>2.3.0</sparkVersion>
<clouderaPackage>cloudera2</clouderaPackage>
<scalaVersion>2.11.0</scalaVersion>
<scalaBinaryVersion>2.11</scalaBinaryVersion>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_${scalaBinaryVersion}</artifactId>
<version>${sparkVersion}.${clouderaPackage}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_${scalaBinaryVersion}</artifactId>
<version>${sparkVersion}.${clouderaPackage}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.datasyslab</groupId>
<artifactId>geospark</artifactId>
<version>${geoSparkVersion}</version>
</dependency>
<dependency>
<groupId>org.datasyslab</groupId>
<artifactId>geospark-sql_2.3</artifactId>
<version>${geoSparkVersion}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<finalName>${artifactId}-${version}-${jarNameWithDependencies}</finalName>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<relocations>
<relocation>
<pattern>org.hsqldb</pattern>
<shadedPattern>shaded.org.hsqldb</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
1条答案
按热度按时间hwamh0ep1#
看起来像是经典的依赖关系问题,可能是您的ubber jar容器org.hsqldb库的不同版本,您应该尝试从您的依赖关系中排除org.hsqldb.*或对其进行着色处理。我猜你用maven shaded插件做uber jar?如果您这样做了,您可以在这里查看如何排除依赖项:https://maven.apache.org/plugins/maven-shade-plugin/examples/includes-excludes.html