MaxGekk opened a new pull request #27777: [SPARK-31025][SQL] Support foldable CSV strings by `schema_of_csv` URL: https://github.com/apache/spark/pull/27777 ### What changes were proposed in this pull request? In the PR, I propose to change checking of the input parameter in the `SchemaOfCsv` expression, and allow foldable `child` expression. ### Why are the changes needed? To improve user experience with Spark SQL. Currently, only string literals are acceptable as CSV examples by `schema_of_csv`: ```sql spark-sql> select schema_of_csv(concat_ws(',', 0.1, 1)); Error in query: cannot resolve 'schema_of_csv(concat_ws(',', CAST(0.1BD AS STRING), CAST(1 AS STRING)))' due to data type mismatch: The input csv should be a string literal and not null; however, got concat_ws(',', CAST(0.1BD AS STRING), CAST(1 AS STRING)).; line 1 pos 7; 'Project [unresolvedalias(schema_of_csv(concat_ws(,, cast(0.1 as string), cast(1 as string))), None)] +- OneRowRelation ``` ### Does this PR introduce any user-facing change? Yes, after change the `schema_of_csv` accept foldable expressions, for example: ```sql ``` ### How was this patch tested? - By existing test suites `CsvFunctionsSuite` and `CsvExpressionsSuite`. - Added new test to `CsvFunctionsSuite` to check foldable input.
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org