st_geomfromtext assertion failed using spark java

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

st_geomfromtext assertion failed using spark java

问题

When I run the following code:

Dataset<Row> df = sparkSession.sql("select -7.07378166 as longitude, 33.826661 as latitude;");
df.withColumn("ST_Geomfromtext ",
    expr("ST_GeomFromText(CONCAT('POINT(',longitude,' ',latitude,')'),4326)"))
    .show(true);

I get the following error:

20/07/22 14:39:56 ERROR Executor: Exception in task 0.0 in stage 1.0 (TID 1)
java.lang.AssertionError: assertion failed
at scala.Predef$.assert(Predef.scala:156)
at org.apache.spark.sql.geosparksql.expressions.ST_GeomFromText.eval(Constructors.scala:148)
at org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificUnsafeProjection.apply(Unknown Source)
at org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificUnsafeProjection.apply(Unknown Source)

I need your help.

Thank you.

英文:

When I rum the following code

Dataset&lt;Row&gt; df = sparkSession.sql(&quot;select -7.07378166 as longitude, 33.826661 as latitude&quot;);
    df.withColumn(&quot;ST_Geomfromtext &quot;,
            expr(&quot;ST_GeomFromText(CONCAT(&#39;POINT(&#39;,longitude,&#39; &#39;,latitude,&#39;)&#39;),4326)&quot;))
            .show(true);

I get the following error :

20/07/22 14:39:56 ERROR Executor: Exception in task 0.0 in stage 1.0 (TID 1)
 java.lang.AssertionError: assertion failed
at scala.Predef$.assert(Predef.scala:156)
at org.apache.spark.sql.geosparksql.expressions.ST_GeomFromText.eval(Constructors.scala:148)
at org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificUnsafeProjection.apply(Unknown 
Source)
at org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificUnsafeProjection.apply(Unknown 
Source)

I need your help

Thank you

答案1

得分: 1

从源代码中,函数ST_GeomFromText只期望一个表达式,但你有两个 - concat(..)4326

查看示例这里

英文:

From the source code the function ST_GeomFromText expects only 1 expression, but you have 2 - concat(..) and 4326

Check examples here

huangapple
  • 本文由 发表于 2020年7月22日 22:47:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/63037021.html
匿名

发表评论

匿名网友

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

确定