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 e73cf12f79..b88a870254 100644 --- a/spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala +++ b/spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala @@ -95,6 +95,7 @@ object QueryPlanSerde extends Logging with CometExprShim with CometTypeShim { classOf[Asin] -> CometScalarFunction("asin"), classOf[Atan] -> CometScalarFunction("atan"), classOf[Atan2] -> CometAtan2, + classOf[Cbrt] -> CometScalarFunction("cbrt"), classOf[Ceil] -> CometCeil, classOf[Cos] -> CometScalarFunction("cos"), classOf[Cosh] -> CometScalarFunction("cosh"), diff --git a/spark/src/test/resources/sql-tests/expressions/math/cbrt.sql b/spark/src/test/resources/sql-tests/expressions/math/cbrt.sql new file mode 100644 index 0000000000..2a618fe45b --- /dev/null +++ b/spark/src/test/resources/sql-tests/expressions/math/cbrt.sql @@ -0,0 +1,31 @@ +-- 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. + +-- ConfigMatrix: parquet.enable.dictionary=false,true + +statement +CREATE TABLE test_cbrt(d double) USING parquet + +statement +INSERT INTO test_cbrt VALUES (0.0), (1.0), (-1.0), (8.0), (27.0), (-27.0), (NULL), (cast('NaN' as double)), (cast('Infinity' as double)) + +query tolerance=1e-6 +SELECT cbrt(d) FROM test_cbrt + +-- literal arguments +query tolerance=1e-6 +SELECT cbrt(0.0), cbrt(8.0), cbrt(-27.0), cbrt(NULL)