diff --git a/spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala b/spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala index 5eee0c5cad..38e770d7d0 100644 --- a/spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala +++ b/spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala @@ -1109,6 +1109,8 @@ object QueryPlanSerde extends Logging with CometExprShim with CometTypeShim { _: DoubleType | _: DecimalType | _: DateType | _: TimestampType | _: TimestampNTZType | _: BooleanType | _: BinaryType | _: StringType => true + case dt if isTimeType(dt) => + true case _ => false } diff --git a/spark/src/test/resources/sql-tests/expressions/datetime/make_time_sort.sql b/spark/src/test/resources/sql-tests/expressions/datetime/make_time_sort.sql new file mode 100644 index 0000000000..f1a9badfb8 --- /dev/null +++ b/spark/src/test/resources/sql-tests/expressions/datetime/make_time_sort.sql @@ -0,0 +1,47 @@ +-- 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. + +-- MinSparkVersion: 4.1 +-- Config: spark.sql.timeType.enabled=true + +statement +CREATE TABLE test_make_time_sort(id int, hours int, minutes int, secs decimal(16,6)) USING parquet + +statement +INSERT INTO test_make_time_sort VALUES + (1, 12, 30, 45.123456), + (2, 0, 0, 0.000000), + (3, 23, 59, 59.999999), + (4, 1, 2, 3.500000), + (5, 0, 0, 0.000001), + (6, NULL, NULL, NULL) + +query +SELECT id, t +FROM ( + SELECT id, make_time(hours, minutes, secs) AS t + FROM test_make_time_sort +) +SORT BY t ASC NULLS FIRST + +query +SELECT id, t +FROM ( + SELECT id, make_time(hours, minutes, secs) AS t + FROM test_make_time_sort +) +SORT BY t DESC NULLS LAST