uros-db commented on code in PR #46503:
URL: https://github.com/apache/spark/pull/46503#discussion_r1597935735


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/inputFileBlock.scala:
##########
@@ -39,7 +40,7 @@ case class InputFileName() extends LeafExpression with 
Nondeterministic {
 
   override def nullable: Boolean = false
 
-  override def dataType: DataType = StringType
+  override def dataType: DataType = SQLConf.get.defaultStringType

Review Comment:
   ### Example 2 (query analysis fail in CollationTypeCasts)
   
   User wants to check whether input file name (which is a string) begins with 
result from another function call -let's call it `foo()` for the sake of this 
example
   ```
   SELECT startsWith(input_file_name(), foo());
   ```
   
   - suppose the user has set the session level default collation, let's say 
"UNICODE"
   - `input_file_name` expression which doesn't yet support collations, returns 
type StringType("UTF8_BINARY")
   - `foo` expression which **does** support collations, returns type 
StringType("UNICODE")
   - `startsWith` expression takes (StringTypeAnyCollation, 
StringTypeAnyCollation)
   
   so in this example query, `startsWith` expression would fail due to a 
mismatch between parameter input types (2 different implicit collations, where 
neither has priority over the other)



-- 
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]

Reply via email to