srielau commented on code in PR #58541:
URL: https://github.com/apache/spark/pull/58541#discussion_r3951523950


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/command/AnalyzeColumnCommand.scala:
##########
@@ -142,7 +142,6 @@ case class AnalyzeColumnCommand(
     case DoubleType | FloatType => true
     case BooleanType => true
     case _: DatetimeType => true
-    case _: CharType | _: VarcharType => false
     case BinaryType | _: StringType => true

Review Comment:
   Fixed. `FilterEstimation`, `ValueInterval`, and `EstimationUtils` now match 
`_: StringType` so CHAR/VARCHAR use the same CBO fallbacks as STRING (no 
`MatchError` after `ANALYZE`). Added `FilterEstimationSuite` coverage for 
equality/`IN`/range and a `StatisticsCollectionSuite` regression that plans 
those predicates with CBO after collecting column stats.



##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala:
##########
@@ -213,7 +213,8 @@ object JdbcUtils extends Logging with SQLConfHelper {
     case java.sql.Types.BIT => BooleanType // @see JdbcDialect for quirks
     case java.sql.Types.BLOB => BinaryType
     case java.sql.Types.BOOLEAN => BooleanType
-    case java.sql.Types.CHAR if conf.charVarcharAsString => StringType
+    case java.sql.Types.CHAR
+        if conf.charVarcharAsString && !conf.charVarcharStandardSemantics => 
StringType

Review Comment:
   Fixed in d3a9c7fed9b: JDBC `getCatalystType` now uses 
`!conf.charVarcharFirstClassTypes`, so preserve-type-info with 
`charVarcharAsString=true` still yields CHAR/VARCHAR. The JDBC schema-inference 
test covers both `CHAR_VARCHAR_STANDARD_SEMANTICS` and 
`PRESERVE_CHAR_VARCHAR_TYPE_INFO`.



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