Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache spark Spark DataFrame-应用模式显示nullable always true_Apache Spark_Databricks - Fatal编程技术网

Apache spark Spark DataFrame-应用模式显示nullable always true

Apache spark Spark DataFrame-应用模式显示nullable always true,apache-spark,databricks,Apache Spark,Databricks,我正在尝试为我的一个json文件应用模式。无论我是否在模式中为这个特定的字段true或false提供了null,当我在我的文件上应用该模式时,该字段仅为null 模式 val schema = StructType( List( StructField("SMS", StringType, false) ) ) 输出 schema: org.apache.spark.sql.types.StructType = StructType(StructField(S

我正在尝试为我的一个json文件应用模式。无论我是否在模式中为这个特定的字段
true
false
提供了null,当我在我的文件上应用该模式时,该字段仅为
null

模式

val schema = StructType(
    List(
        StructField("SMS", StringType, false)
     )
)
输出

schema: org.apache.spark.sql.types.StructType = StructType(StructField(SMS,StringType,false))
 root
 |-- SMS: string (nullable = true)
在文件上应用架构

val SMSDF=spark.read.schema(schema.json)(“/mnt/aaa/log*”) SMSDF.printSchema()

输出

schema: org.apache.spark.sql.types.StructType = StructType(StructField(SMS,StringType,false))
 root
 |-- SMS: string (nullable = true)
我正在使用Spark 2.4.3、Scala 2.11