spark-test commented on code in PR #60354:
URL: https://github.com/apache/spark/pull/60354#discussion_r4559984911
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/avroSqlFunctions.scala:
##########
@@ -256,6 +311,9 @@ case class ToAvro(child: Expression, jsonFormatSchema:
Expression)
expr.asInstanceOf[Expression]
}
+ // The map builder settings are not user arguments; keep them out of EXPLAIN
output.
+ override protected def stringArgs: Iterator[Any] = super.stringArgs.take(2)
Review Comment:
**Nit (P3):** Together with the same override on `SchemaOfAvro` (line 449)
and `FromAvro`'s `take(3)`, which now also hides the two new settings, this
keeps EXPLAIN output unchanged, as the description says. Nothing would catch a
regression in any of them. `AvroFunctionsSuite` makes no plan-string assertion,
the SQL golden files record only errors for these functions because the SQL
tests do not load Avro, and the Connect explain goldens are rendered after
`ReplaceExpressions`, so they show `CatalystDataToAvro` and
`AvroDataToCatalyst` rather than these wrappers. Reading the code, dropping
this override would make the analyzed plan in `EXPLAIN EXTENDED` print
`to_avro(data#1, {"type": "int"}, EXCEPTION, false)`, and no existing test
would fail. `AvroFunctionsSuite` loads Avro and its analyzed plans still
contain the wrappers, so one `toString` or analyzed-plan assertion per wrapper
there would cover all three.
**Verification:**
- **Behavior:** For from_avro with and without options, to_avro with and
without a schema, and schema_of_avro, the expression's string form or the
analyzed plan printed by EXPLAIN EXTENDED shows only the user arguments. The
assertion fails if the map key policy, the normalization flag or a CHAR/VARCHAR
flag appears.
--
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]