使用geospark在spark上Assert失败

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

我有以下Dataframe:

+--------------+-------------------+---------------------+
|longitude_f   |  latitude_f       |   geom              |
+--------------+-------------------+---------------------+
|7.0737816     |33.82666           |   00 00 00 00 01 0..|
|-7.6198783    |33.5942549         |   00 00 00 00 01 0..|
+--------------+-------------------+---------------------+

longitude_f : double ----
latitude_f  : double ----
geom        : geometry ----

当我执行以下代码时:

Dataset <Row> result_f = sparkSession.sql("select * from data_f where ST_Within(ST_GeomFromText(CONCAT('POINT(',longitude_f,' ',latitude_f,')',4326)),geom)");
 result_f.show();

我得到以下例外:

20/08/01 19:50:36 ERROR Executor: Exception in task 87.0 in stage 40.0 (TID 930)
java.lang.AssertionError: assertion failed
at scala.Predef$.assert(Predef.scala:156)
at org.apache.spark.sql.geosparksql.expressions.ST_PolygonFromEnvelope.eval(Constructors.scala:250)
at org.apache.spark.sql.geosparksql.expressions.ST_Within.eval(Predicates.scala:105)
at org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificPredicate.And_0$(Unknown Source)
at org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificPredicate.eval(Unknown Source)
at org.apache.spark.sql.execution.joins.CartesianProductExec$$anonfun$doExecute$1$$anonfun$2.apply(CartesianProductExec.scala:89)
at org.apache.spark.sql.execution.joins.CartesianProductExec$$anonfun$doExecute$1$$anonfun$2.apply(CartesianProductExec.scala:88)

我需要你的帮助。
谢谢您

carvr3hs

carvr3hs1#

ST_PolygonFromEnvelope 需要4个参数,它们有一个失败的Assert

assert(inputExpressions.length == 4)

为此函数提供4个输入参数并继续。另一方面,我建议从git下载sour并检查这些。同时参考文档,我认为,你没有这样做

相关问题