Copilot commented on code in PR #12967:
URL: https://github.com/apache/gluten/pull/12967#discussion_r4074929874
##########
cpp/velox/tests/VeloxToSubstraitTypeTest.cc:
##########
@@ -62,4 +62,13 @@ TEST_F(VeloxToSubstraitTypeTest, basic) {
testTypeConversion(ROW({}, {}));
}
+TEST_F(VeloxToSubstraitTypeTest, timestampUtc) {
+ google::protobuf::Arena arena;
+ const auto& substraitType = typeConvertor_->toSubstraitType(arena,
TIMESTAMP_UTC());
+
+ ASSERT_TRUE(substraitType.has_precision_timestamp());
+ ASSERT_EQ(substraitType.precision_timestamp().precision(), 6);
+
ASSERT_TRUE(SubstraitParser::parseType(substraitType)->equivalent(*TIMESTAMP_UTC()));
Review Comment:
This test validates precision and type equivalence but doesn’t assert
nullability behavior. Add assertions (and/or an additional test case) to verify
that `toSubstraitType(..., nullable = false)` produces `NULLABILITY_REQUIRED`
(or the project’s equivalent) for `TIMESTAMP_UTC`, to prevent regressions like
hard-coded `NULLABLE`.
##########
cpp/velox/substrait/VeloxToSubstraitType.cc:
##########
@@ -31,6 +31,14 @@ const ::substrait::Type&
VeloxToSubstraitTypeConvertor::toSubstraitType(
substraitType->set_allocated_date(substraitDate);
return *substraitType;
}
+ if (type->equivalent(*velox::TIMESTAMP_UTC())) {
+ auto substraitPrecisionTimestamp =
+
google::protobuf::Arena::CreateMessage<::substrait::Type_PrecisionTimestamp>(&arena);
+ substraitPrecisionTimestamp->set_precision(6);
+
substraitPrecisionTimestamp->set_nullability(::substrait::Type_Nullability_NULLABILITY_NULLABLE);
+
substraitType->set_allocated_precision_timestamp(substraitPrecisionTimestamp);
+ return *substraitType;
+ }
Review Comment:
`toSubstraitType` unconditionally sets `PrecisionTimestamp` nullability to
`NULLABLE` for `TIMESTAMP_UTC`, which can misrepresent non-nullable schemas.
Propagate the method’s nullability input (consistent with other type branches)
so required/not-null columns round-trip correctly.
##########
backends-velox/src-delta40/test/scala/org/apache/spark/sql/delta/GlutenDeltaStatsSuite.scala:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.spark.sql.delta
+
+import org.apache.gluten.execution.HashAggregateExecTransformer
+
+import org.apache.spark.sql.Row
+import org.apache.spark.sql.delta.sources.DeltaSQLConf
+import org.apache.spark.sql.delta.stats.GlutenDeltaJobStatsTracker
+import org.apache.spark.sql.delta.test.DeltaSQLCommandTest
+import org.apache.spark.sql.execution.SparkPlan
+
+import java.util.concurrent.ConcurrentLinkedQueue
+
+import scala.collection.JavaConverters._
Review Comment:
`scala.collection.JavaConverters._` is deprecated on Scala versions that
provide `scala.jdk.CollectionConverters._` (commonly used in Spark 4.x builds).
Consider switching to `scala.jdk.CollectionConverters._` in Spark 4.1+/Delta
4.x test code to avoid deprecation warnings and keep the test sources
forward-compatible.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]