shehabgamin commented on code in PR #15958:
URL: https://github.com/apache/datafusion/pull/15958#discussion_r2080822728


##########
datafusion/sqllogictest/test_files/spark/math/ceil.slt:
##########
@@ -0,0 +1,141 @@
+# 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.
+
+query R
+SELECT ceil(-0.1);
+----
+0
+
+query R
+SELECT ceil(5.4);
+----
+6
+
+query error
+SELECT ceil(3.1411, -3);
+----
+DataFusion error: Error during planning: Failed to coerce arguments to satisfy 
a call to 'ceil' function: coercion from [Float64, Int64] to the signature 
Uniform(1, [Float64, Float32]) failed

Review Comment:
   @irenjj Sail doesn't use the same SQL parser as DataFusion, as it follows 
Spark SQL syntax.
   
   You’ll need to cast values to ensure the tests interpret the correct 
`DataType`.
   
   For example, instead of this:
   
   ```
   SELECT ceil(3.1411, -3);
   ```
   
   Use:
   
   ```
   SELECT ceil(3.1411::decimal(5,4), -3::INT);
   ```
   
   Copy-pasting the exact queries from the files below won't work directly. 
However, if you look closely, you’ll see that each query includes the necessary 
cast for the first argument (the second argument is always an `INT`):
   - 
https://github.com/lakehq/sail/blob/main/python/pysail/tests/spark/function/test_ceil.txt
   - 
https://github.com/lakehq/sail/blob/main/python/pysail/tests/spark/function/test_floor.txt
   
   However, you should expect the same result values from those two files.



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to