panbingkun commented on PR #48385: URL: https://github.com/apache/spark/pull/48385#issuecomment-2421030520
- I overlooked `another scenario` in the `PR description`, when an error occurs, the `function name prompted` may not match the `actual function name`, eg: <img width="1395" alt="image" src="https://github.com/user-attachments/assets/9cd7ace2-2406-4951-a658-32c9f4be6b4a"> ```sql spark-sql (default)> select random("1"); [DATATYPE_MISMATCH.UNEXPECTED_INPUT_TYPE] Cannot resolve "rand(1)" due to data type mismatch: The first parameter requires the ("INT" or "BIGINT") type, however "1" has the type "STRING". SQLSTATE: 42K09; line 1 pos 7; 'Project [unresolvedalias(random(1))] +- OneRowRelation ``` - Because in our spark implementation, multiple `function’s names` often correspond to the `same` implementation. eg: https://github.com/apache/spark/blob/78308da2e1e3fd297e16d335a49b3571647e6493/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala#L404-L405 https://github.com/apache/spark/blob/78308da2e1e3fd297e16d335a49b3571647e6493/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala#L433-L434 https://github.com/apache/spark/blob/78308da2e1e3fd297e16d335a49b3571647e6493/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala#L384-L385 - If logic similar to `getTagValue(FunctionRegistry.FUNC_ALIAS).getOrElse("...")` is not used in the implementation, the above problems may occur (the `actual functions used` are `inconsistent` with `the schema` or `error prompts`). - Of course, if we decide to `revert` it, I am also okay. -- 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]
