From 0dcb88157409280dc63debee409aabd6a9290b09 Mon Sep 17 00:00:00 2001 From: rui-mo Date: Thu, 21 Nov 2024 15:43:38 +0800 Subject: [PATCH] Align the timezone of decimal partition value with Velox --- .../gluten/backendsapi/velox/VeloxIteratorApi.scala | 9 ++++----- ep/build-velox/src/get_velox.sh | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala b/backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala index 061daaac0fad..e8e4fb87ec5b 100644 --- a/backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala +++ b/backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala @@ -27,7 +27,6 @@ import org.apache.gluten.substrait.rel.{LocalFilesBuilder, LocalFilesNode, Split import org.apache.gluten.substrait.rel.LocalFilesNode.ReadFileFormat import org.apache.gluten.utils._ import org.apache.gluten.vectorized._ - import org.apache.spark.{SparkConf, TaskContext} import org.apache.spark.internal.Logging import org.apache.spark.softaffinity.SoftAffinity @@ -43,9 +42,8 @@ import org.apache.spark.util.{ExecutorManager, SparkDirectoryUtil} import java.lang.{Long => JLong} import java.nio.charset.StandardCharsets -import java.time.ZoneOffset -import java.util.{ArrayList => JArrayList, HashMap => JHashMap, Map => JMap, UUID} - +import java.time.{ZoneId, ZoneOffset} +import java.util.{UUID, ArrayList => JArrayList, HashMap => JHashMap, Map => JMap} import scala.collection.JavaConverters._ class VeloxIteratorApi extends IteratorApi with Logging { @@ -151,8 +149,9 @@ class VeloxIteratorApi extends IteratorApi with Logging { case _: DecimalType => pn.asInstanceOf[Decimal].toJavaBigInteger.toString case _: TimestampType => + // Velox uses 'America/Los_Angeles' timezone by default. TimestampFormatter - .getFractionFormatter(ZoneOffset.UTC) + .getFractionFormatter(ZoneId.of("America/Los_Angeles")) .format(pn.asInstanceOf[java.lang.Long]) case _ => pn.toString } diff --git a/ep/build-velox/src/get_velox.sh b/ep/build-velox/src/get_velox.sh index 53615ddccfbe..8df7ba29f7f5 100755 --- a/ep/build-velox/src/get_velox.sh +++ b/ep/build-velox/src/get_velox.sh @@ -16,8 +16,8 @@ set -exu -VELOX_REPO=https://github.com/oap-project/velox.git -VELOX_BRANCH=2024_11_20 +VELOX_REPO=https://github.com/rui-mo/velox.git +VELOX_BRANCH=test_tz VELOX_HOME="" OS=`uname -s`