Assertion failed on spark using GeoSpark

huangapple go评论74阅读模式
英文:

Assertion failed on spark using GeoSpark

问题

I have the following 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 ----

When I execute the following code:

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();

I get the following exception:

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)

I need your help. Thank you.

英文:

I have the following 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 ----

When I execute the following code :

Dataset &lt;Row&gt; result_f = sparkSession.sql(&quot;select * from data_f where ST_Within(ST_GeomFromText(CONCAT(&#39;POINT(&#39;,longitude_f,&#39; &#39;,latitude_f,&#39;)&#39;,4326)),geom)&quot;);
 result_f.show();

I get the following exception :

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)

I need your help .

Thank you

答案1

得分: 1

ST_PolygonFromEnvelope需要4个参数,并且它们有一个断言(assertion)正在失败
assert(inputExpressions.length == 4)
提供4个输入参数给这个函数并继续。
另外,我建议从Git下载源代码并检查这些。
还请参考文档,我认为你没有这样做。

英文:

ST_PolygonFromEnvelope takes 4 args and they have assertion which is failing

assert(inputExpressions.length == 4)

provide 4 input arguments to this function and proceed.
On a side note, i would suggest download the source from git and check these.
Also refer the documentation, I think, you are not doing that

huangapple
  • 本文由 发表于 2020年8月2日 03:53:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/63209468.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定