Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ class CHIteratorApi extends IteratorApi with Logging with LogLevelUtil {
val partitionColumns = new JArrayList[JMap[String, String]]
val metadataColumns = new JArrayList[JMap[String, String]]
val otherMetadataColumns = new JArrayList[JMap[String, Object]]
val dateFormatter = DateFormatter()
val timestampFormatter = TimestampFormatter.getFractionFormatter(ZoneOffset.UTC)
f.files.foreach {
file =>
paths.add(new URI(file.filePath.toString()).toASCIIString)
Expand All @@ -183,13 +185,11 @@ class CHIteratorApi extends IteratorApi with Logging with LogLevelUtil {
case _: BinaryType =>
new String(pn.asInstanceOf[Array[Byte]], StandardCharsets.UTF_8)
case _: DateType =>
DateFormatter.apply().format(pn.asInstanceOf[Integer])
dateFormatter.format(pn.asInstanceOf[Integer])
case _: DecimalType =>
pn.asInstanceOf[Decimal].toJavaBigInteger.toString
case _: TimestampType =>
TimestampFormatter
.getFractionFormatter(ZoneOffset.UTC)
.format(pn.asInstanceOf[java.lang.Long])
timestampFormatter.format(pn.asInstanceOf[java.lang.Long])
case _ => pn.toString
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ class VeloxIteratorApi extends IteratorApi with Logging {
private def getPartitionColumns(
schema: StructType,
partitionedFiles: Seq[PartitionedFile]): Seq[Map[String, String]] = {
val dateFormatter = DateFormatter()
val timestampFormatter = TimestampFormatter.getFractionFormatter(ZoneOffset.UTC)
partitionedFiles.map {
partitionedFile =>
val partitionColumn = mutable.Map[String, String]()
Expand All @@ -159,13 +161,11 @@ class VeloxIteratorApi extends IteratorApi with Logging {
case _: BinaryType =>
new String(pv.asInstanceOf[Array[Byte]], StandardCharsets.UTF_8)
case _: DateType =>
DateFormatter.apply().format(pv.asInstanceOf[Integer])
dateFormatter.format(pv.asInstanceOf[Integer])
case _: DecimalType =>
pv.asInstanceOf[Decimal].toJavaBigDecimal.unscaledValue().toString
case _: TimestampType =>
TimestampFormatter
.getFractionFormatter(ZoneOffset.UTC)
.format(pv.asInstanceOf[java.lang.Long])
timestampFormatter.format(pv.asInstanceOf[java.lang.Long])
case _ => pv.toString
}
}
Expand Down
Loading