srowen commented on a change in pull request #24800: [SPARK-27947][SQL]
ParsedStatement subclass toString may throw ClassCastException
URL: https://github.com/apache/spark/pull/24800#discussion_r291583210
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/sql/ParsedStatement.scala
##########
@@ -36,8 +38,11 @@ import
org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
private[sql] abstract class ParsedStatement extends LogicalPlan {
// Redact properties and options when parsed nodes are used by generic
methods like toString
override def productIterator: Iterator[Any] = super.productIterator.map {
- case mapArg: Map[_, _] =>
conf.redactOptions(mapArg.asInstanceOf[Map[String, String]])
- case other => other
+ case mapArg: Map[_, _] =>
+ // May match any Map type, e.g. Map[String, Int], due to type erasure
+ Try(conf.redactOptions(mapArg.asInstanceOf[Map[String,
String]])).getOrElse(mapArg)
Review comment:
Another solution: let `redactOptions` take a map of any key and value type.
Only evaluate and update keys/values that are actually strings. This would
maybe make it more flexible and handle, say, a `Map[SomeEnum,String]` later.
----------------------------------------------------------------
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]