parthchandra commented on code in PR #4951: URL: https://github.com/apache/datafusion-comet/pull/4951#discussion_r3641736552
########## 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) Review Comment: Maybe also test for some boundary values `make_time(0,0,0.000000)` and `make_time(23,59,59.999999)` ########## 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 Review Comment: Also maybe add a case with multi column sort - `ORDER BY time_col, id` ########## 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 Review Comment: what about also checking for `ASC NULLS LAST` and `DESC NULLS FIRST` -- 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]
