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

Commit

Permalink
supporting fields with NULL types as sql NullType
Browse files Browse the repository at this point in the history
  • Loading branch information
wabu committed May 9, 2017
1 parent c19f01a commit ddb0dfe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ object SchemaConverters {
case LONG => SchemaType(LongType, nullable = false)
case FIXED => SchemaType(BinaryType, nullable = false)
case ENUM => SchemaType(StringType, nullable = false)
case NULL => SchemaType(NullType, nullable = false)

case RECORD =>
val fields = avroSchema.getFields.asScala.map { f =>
Expand Down
5 changes: 2 additions & 3 deletions src/test/scala/com/databricks/spark/avro/AvroSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ class AvroSuite extends FunSuite with BeforeAndAfterAll {
dataFileWriter.flush()
dataFileWriter.close()

intercept[IncompatibleSchemaException] {
spark.read.avro(s"$dir.avro")
}
val df = spark.read.avro(s"$dir.avro")
assert(df.count() == 1)
}
}

Expand Down

0 comments on commit ddb0dfe

Please sign in to comment.