我正在使用geospark 1.3.1,试图找到包含在多边形中的所有地理点。我使用sql命令:
val result = spark.sql(
|SELECT *
|FROM spatial_trace, streetCrossDf
|WHERE ST_Within (streetCrossDf.geometry, spatial_trace.geometry)
""".stripMargin)
result.show()
查询工作正常,但在尝试显示结果时失败。好像是图书馆的输出问题。我在齐柏林飞艇笔记本上做这个。有人能告诉我我做错了什么吗。?我得到以下错误:
org.apache.spark.sparkexception:由于阶段失败而中止作业:阶段10.0中的任务0失败了4次,最近的失败:阶段10.0中丢失了任务0.3(tid 15,10.42.22.236,执行器3):java.lang.classcastexception:org.apache.spark.unsafe.types.utf8string不能在org.apache.spark.sql.geosparksql.strategy.join.traitjoinqueryexec$$anonfun$tospatialrdd$1.apply(traitjoinqueryexec)上转换为org.apache.spark.sql.catalyst.util.arraydata。scala:164)在org.apache.spark.sql.geosparksql.strategy.join.traitjoinqueryexec$$anonfun$tospatialrdd$1.apply(traitjoinqueryexec。scala:163)在scala.collection.iterator$$anon$11.next(iterator。scala:410)在scala.collection.iterator$class.foreach(iterator。scala:891)在scala.collection.abstractiterator.foreach(迭代器。scala:1334)在scala.collection.traversableonce$class.foldleft(traversableonce。scala:157)在scala.collection.abstractiterator.foldleft(迭代器。scala:1334)在scala.collection.traversableonce$class.aggregate(traversableonce。scala:214)在scala.collection.abstractiterator.aggregate(iterator。scala:1334)在org.apache.spark.rdd.rdd$$anonfun$聚合$1$$anonfun$22.apply(rdd。scala:1122)在org.apache.spark.rdd.rdd$$anonfun$aggregate$1$$anonfun$22.apply(rdd。scala:1122)在org.apache.spark.sparkcontext$$anonfun$36.apply(sparkcontext。scala:2157)在org.apache.spark.sparkcontext$$anonfun$36.apply(sparkcontext。scala:2157)在org.apache.spark.scheduler.resulttask.runtask(resulttask。scala:90)在org.apache.spark.scheduler.task.run(task。scala:121)在org.apache.spark.executor.executor$taskrunner$$anonfun$10.apply(executor。scala:402)在org.apache.spark.util.utils$.trywithsafefinally(utils。scala:1360)在org.apache.spark.executor.executor$taskrunner.run(executor。scala:408)位于java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor。java:1149)在java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor。java:624)在java.lang.thread.run(线程。java:748)
1条答案
按热度按时间u4vypkhs1#
我知道我有点晚了,但这是由开发人员在这里解决。需要使用构造函数转换几何图形
修复示例: