cloud-fan commented on a change in pull request #23010: [SPARK-26012][SQL]Null
and '' values should not cause dynamic partition failure of string types
URL: https://github.com/apache/spark/pull/23010#discussion_r273507782
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -260,6 +261,75 @@ class FindDataSourceTable(sparkSession: SparkSession)
extends Rule[LogicalPlan]
}
}
+/** A function that converts the empty string to null for partition values. */
+case class Empty2Null(child: Expression) extends UnaryExpression with
String2StringExpression {
+ override def convert(v: UTF8String): UTF8String = if (v.numBytes() == 0)
null else v
+ override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
+ nullSafeCodeGen(ctx, ev, c => {
+ val setIsNull = if (nullable) s"${ev.isNull} = true" else ""
Review comment:
this is not needed, if nullable is always true.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]