[英]CreateDataFrame with F#
I'm trying to create a simple Spark DataFrame with F# as it is used in Spark.Net test我正在尝试使用 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)
eventually, this code fails (as exactly the same code using .NET collections)最终,此代码失败(与使用 .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], )
The above runs well for me以上对我来说运行良好
+-----+---+----------+
|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.jar dotnet bin/Debug/netcoreapp3.1/yourLibrary.dll $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.