martin-g commented on code in PR #19908: URL: https://github.com/apache/datafusion/pull/19908#discussion_r2711668589
########## datafusion/sqllogictest/test_files/spark/math/random.slt: ########## @@ -15,23 +15,146 @@ # specific language governing permissions and limitations # under the License. -# This file was originally created by a porting script from: -# https://github.com/lakehq/sail/tree/43b6ed8221de5c4c4adbedbb267ae1351158b43c/crates/sail-spark-connect/tests/gold_data/function -# This file is part of the implementation of the datafusion-spark function library. -# For more information, please see: -# https://github.com/apache/datafusion/issues/15914 - -## Original Query: SELECT random(); -## PySpark 3.5.5 Result: {'rand()': 0.7460731389309176, 'typeof(rand())': 'double'} -#query -#SELECT random(); - -## Original Query: SELECT random(0); -## PySpark 3.5.5 Result: {'rand(0)': 0.7604953758285915, 'typeof(rand(0))': 'double', 'typeof(0)': 'int'} -#query -#SELECT random(0::int); - -## Original Query: SELECT random(null); -## PySpark 3.5.5 Result: {'rand(NULL)': 0.7604953758285915, 'typeof(rand(NULL))': 'double', 'typeof(NULL)': 'void'} -#query -#SELECT random(NULL::void); +query R +SELECT random(42::integer); +---- +0.81430514512291 + +query R +SELECT random(0::integer); +---- +0.324575268031407 + Review Comment: ```suggestion query B SELECT random() > 0; ---- true ``` to test random() without a seed Update: Actually `random()` is used below, so it is tested. I guess it works due to the simplification but it would fail to read the seed when executed directly, i.e. without simplification. -- 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]
