Skip to content
This repository has been archived by the owner on Dec 20, 2018. It is now read-only.

why all fields are nullable #288

Open
yuryn opened this issue Jul 27, 2018 · 1 comment
Open

why all fields are nullable #288

yuryn opened this issue Jul 27, 2018 · 1 comment

Comments

@yuryn
Copy link

yuryn commented Jul 27, 2018

When I read simple avro file with all fileds non-nullable, resulted dataframe schema has all fields nullable.

avro file schema:

{
  "type" : "record",
  "name" : "RobotDetection",
  "namespace" : "cz.search.robotdetection",
  "fields" : [ {
    "name" : "sessionId",
    "type" : "string"
  }, {
    "name" : "robotDetectionResult",
    "type" : "int"
  } ]
}

dataframe schema:

val a = spark.read.format("com.databricks.spark.avro").load("avrofile.avro")
a.schema
res1: org.apache.spark.sql.types.StructType = StructType(StructField(sessionId,StringType,true), StructField(robotDetectionResult,IntegerType,true))
@gengliangwang
Copy link
Contributor

gengliangwang commented Aug 2, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants