Skip to content

Commit

Permalink
fixing the compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
stheppi committed Apr 27, 2017
1 parent c3c83b4 commit 9a102a5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,22 @@ case class StructFieldsExtractorBytes(includeAllFields: Boolean, fieldsAliasMap:
.map { value =>
Option(field.schema().name()).collect {
case Decimal.LOGICAL_NAME =>
value match {
case java.math.BigDecimal => value.fromBigDecimal()
case arr: Array[Byte] => Decimal.toLogical(field.schema, arr).fromBigDecimal()
value.asInstanceOf[Any] match {
case _:java.math.BigDecimal => value.fromBigDecimal()
case arr: Array[Byte] => Decimal.toLogical(field.schema, arr).asInstanceOf[Any].fromBigDecimal()
case _ => throw new IllegalArgumentException(s"${field.name()} is not handled for value:$value")
}
case Time.LOGICAL_NAME =>
value.asInstanceOf[Any] match {
case i: Int => StructFieldsExtractorBytes.TimeFormat.format(Time.toLogical(field.schema, i)).fromString()
case d@java.util.Date => StructFieldsExtractorBytes.TimeFormat.format(d).fromString()
case i: Int => StructFieldsExtractorBytes.TimeFormat.format(Time.toLogical(field.schema, i)).asInstanceOf[Any].fromString()
case d:java.util.Date => StructFieldsExtractorBytes.TimeFormat.format(d).asInstanceOf[Any].fromString()
case _ => throw new IllegalArgumentException(s"${field.name()} is not handled for value:$value")
}

case Timestamp.LOGICAL_NAME =>
value.asInstanceOf[Any] match {
case d@java.util.Date => StructFieldsExtractorBytes.DateFormat.format(d).fromString()
case l: Long => StructFieldsExtractorBytes.DateFormat.format(Timestamp.toLogical(field.schema, l)).fromString()
case d:java.util.Date => StructFieldsExtractorBytes.DateFormat.format(d).asInstanceOf[Any].fromString()
case l: Long => StructFieldsExtractorBytes.DateFormat.format(Timestamp.toLogical(field.schema, l)).asInstanceOf[Any].fromString()
case _ => throw new IllegalArgumentException(s"${field.name()} is not handled for value:$value")
}
}.getOrElse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,21 @@ case class StructFieldsExtractor(includeAllFields: Boolean,

schema.name() match {
case Decimal.LOGICAL_NAME =>
value match {
case java.math.BigDecimal => value
value.asInstanceOf[Any] match {
case _:java.math.BigDecimal => value
case arr: Array[Byte] => Decimal.toLogical(schema, arr)
case _ => throw new IllegalArgumentException(s"${field.name()} is not handled for value:$value")
}
case Time.LOGICAL_NAME =>
value.asInstanceOf[Any] match {
case i: Int => StructFieldsExtractor.TimeFormat.format(Time.toLogical(schema, i))
case d@java.util.Date => StructFieldsExtractor.TimeFormat.format(d)
case d:java.util.Date => StructFieldsExtractor.TimeFormat.format(d)
case _ => throw new IllegalArgumentException(s"${field.name()} is not handled for value:$value")
}

case Timestamp.LOGICAL_NAME =>
value.asInstanceOf[Any] match {
case d@java.util.Date => StructFieldsExtractor.DateFormat.format(d)
case d:java.util.Date => StructFieldsExtractor.DateFormat.format(d)
case l: Long => StructFieldsExtractor.DateFormat.format(Timestamp.toLogical(schema, l))
case _ => throw new IllegalArgumentException(s"${field.name()} is not handled for value:$value")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,21 @@ object TagsExtractor extends StrictLogging {
Option(struct.get(field)).map { value =>
schema.name() match {
case Decimal.LOGICAL_NAME =>
value match {
case java.math.BigDecimal => value
value.asInstanceOf[Any] match {
case _:java.math.BigDecimal => value
case arr: Array[Byte] => Decimal.toLogical(schema, arr)
case _ => throw new IllegalArgumentException(s"${field.name()} is not handled for value:$value")
}
case Time.LOGICAL_NAME =>
value.asInstanceOf[Any] match {
case i: Int => StructFieldsExtractor.TimeFormat.format(Time.toLogical(schema, i))
case d@java.util.Date => StructFieldsExtractor.TimeFormat.format(d)
case d:java.util.Date => StructFieldsExtractor.TimeFormat.format(d)
case _ => throw new IllegalArgumentException(s"${field.name()} is not handled for value:$value")
}

case Timestamp.LOGICAL_NAME =>
value.asInstanceOf[Any] match {
case d@java.util.Date => StructFieldsExtractor.DateFormat.format(d)
case d:java.util.Date => StructFieldsExtractor.DateFormat.format(d)
case l: Long => StructFieldsExtractor.DateFormat.format(Timestamp.toLogical(schema, l))
case _ => throw new IllegalArgumentException(s"${field.name()} is not handled for value:$value")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ case class StructFieldsExtractor(targetTable: String,
//handle specific schema
schema.name() match {
case Decimal.LOGICAL_NAME =>
value match {
case java.math.BigDecimal => value
value.asInstanceOf[Any] match {
case _:java.math.BigDecimal => value
case arr: Array[Byte] => Decimal.toLogical(schema, arr)
case _ => throw new IllegalArgumentException(s"${field.name()} is not handled for value:$value")
}
case Time.LOGICAL_NAME =>
value.asInstanceOf[Any] match {
case i: Int => StructFieldsExtractor.TimeFormat.format(Time.toLogical(schema, i))
case d@java.util.Date => StructFieldsExtractor.TimeFormat.format(d)
case d:java.util.Date => StructFieldsExtractor.TimeFormat.format(d)
case _ => throw new IllegalArgumentException(s"${field.name()} is not handled for value:$value")
}

case Timestamp.LOGICAL_NAME =>
value.asInstanceOf[Any] match {
case d@java.util.Date => StructFieldsExtractor.DateFormat.format(d)
case d:java.util.Date => StructFieldsExtractor.DateFormat.format(d)
case l: Long => StructFieldsExtractor.DateFormat.format(Timestamp.toLogical(schema, l))
case _ => throw new IllegalArgumentException(s"${field.name()} is not handled for value:$value")
}
Expand Down

0 comments on commit 9a102a5

Please sign in to comment.