[英]CreateDataFrame with F#
我正在嘗試使用 F# 創建一個簡單的 Spark DataFrame,因為它在Spark.Net 測試中使用
let schema =
StructType (
[|
StructField("Name", new StringType())
StructField("Age", new IntegerType())
StructField("Date", new DateType())
|] )
let rows: obj[][] =
[|
[| "Alice"; 20; new Date(2020, 1, 1) |]
|]
session.CreateDataFrame(rows |> Array.map GenericRow, schema).Show(10, 0, false)
最終,此代碼失敗(與使用 .NET 集合的代碼完全相同)
JVM method execution failed: Nonstatic method 'createDataFrame' failed for class '7' when called with 2 arguments ([Index=1, Type=GenericRow[], Value=Microsoft.Spark.Sql.GenericRow[]], [Index=2, Type=JvmObjectReference, Value=8], )
以上對我來說運行良好
+-----+---+----------+
|Name |Age|Date |
+-----+---+----------+
|Alice|20 |2020-01-01|
+-----+---+----------+
$SPARK_HOME/bin/spark-submit --class org.apache.spark.deploy.dotnet.DotnetRunner --master local bin/Debug/netcoreapp3.1/microsoft-spark-2.4.x-0.11.0.Z68995FCBF432492D15484D04A9D2AC4D04A9D2AC4調試/netcoreapp3.1/yourLibrary.dll
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.