我有一個火花DataFrame h3的十六進製id和我試圖獲得多邊形的幾何圖形。
從pyspark。sql從pyspark.sql進口SparkSession。功能導入坳,從pyspark.databricks.sql expr。函數從鑲嵌進口進口* enable_mosaic enable_mosaic(火花,dbutils) #創建一個火花會話火花= SparkSession.builder.appName(“馬賽克”).getOrCreate() #創建一個十六進製的DataFrame IDs df =火花。createDataFrame ([(1,“87422 c2a9ffffff”), (2,“87422 c2a9000000”) (“87422 c2a8ffffff”)], (“id”、“h3hex_id”)) sdf2 = sdf1。withColumn(“幾何”,h3_boundaryaswkt(坳(“h3hex_id”))) sdf2.sample(分數= 0.1),告訴()AnalysisException: [H3_NOT_ENABLED] h3_boundaryaswkt禁用或不受支持的。考慮啟用光子或切換到一個層,支持H3表達式;sdf2 = sdf1。withColumn(“幾何”,grid_boundary(坳(“h3hex_id”), format_name =“WKT”)) sdf2.sample(分數= 0.1),告訴()AnalysisException: [UNRESOLVED_COLUMN。WITH_SUGGESTION]一個列或函數參數與名WKT無法解決。你的意思的嗎?. .
我已經安裝了“databricks-mosaic 0.3.10”集群。
我怎麼解決異常和應用函數DataFrame火花?
https://databrickslabs.github.io/mosaic/api/spatial-indexing.html
https://docs.www.eheci.com/sql/language-manual/functions/h3_boundaryaswkt.html的例子