Skip to content

Commit

Permalink
small improvement to handling multuple versions of list elements
Browse files Browse the repository at this point in the history
  • Loading branch information
mjakubowski84 committed Apr 14, 2021
1 parent 04b61a4 commit 0ef3f24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ lazy val supportedScalaVersions = Seq("2.11.12", "2.12.13", "2.13.5")
lazy val fs2ScalaVersions = Seq("2.12.13", "2.13.5")

ThisBuild / organization := "com.github.mjakubowski84"
ThisBuild / version := "1.9.0-SNAPSHOT"
ThisBuild / isSnapshot := true
ThisBuild / version := "1.8.1"
ThisBuild / isSnapshot := false
ThisBuild / scalaVersion := "2.12.13"
ThisBuild / scalacOptions ++= Seq("-deprecation", "-target:jvm-1.8")
ThisBuild / javacOptions ++= Seq("-source", "1.8", "-target", "1.8", "-unchecked", "-deprecation", "-feature")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ object ListParquetRecord {
private val ListFieldName = "list"
private val ElementFieldName = "element"
private val LegacyElementFieldName = "array"
private val ElementNames = Set(ElementFieldName, LegacyElementFieldName)

/**
* @param elements to init the record with
Expand Down Expand Up @@ -363,8 +364,7 @@ class ListParquetRecord private extends ParquetRecord[Value] with mutable.Seq[Va

override def add(name: String, value: Value): This =
value match {
case repeated: RowParquetRecord if
repeated.length==1 && Set(ElementFieldName, LegacyElementFieldName).contains(repeated.head._1) =>
case repeated: RowParquetRecord if repeated.length == 1 && ElementNames.contains(repeated.head._1) =>
add(repeated.head._2)
case repeated: RowParquetRecord if repeated.isEmpty =>
add(NullValue)
Expand Down

0 comments on commit 0ef3f24

Please sign in to comment.