mrutunjay-kinagi commented on PR #58977: URL: https://github.com/apache/spark/pull/58977#issuecomment-6817504235
@cloud-fan Thanks for the review. All seven findings are addressed in 37c57383504, and the description is updated. | Finding | Change | |---|---| | P1: `from_csv` / `from_json` pick the field with the task's setting | `JsonToStructs` and `CsvToStructs` take a defaulted `corruptRecordExactMatch` argument, captured at analysis like `charVarcharStandardSemantics`, and pass it to their evaluators. The `ExprUtils` helpers take an explicit `exactMatch` argument: the readers pass the session's value at setup, the evaluators pass the captured value, and the `OptimizeCsvJsonExprs` guards pass the value captured on the expression they inspect. The CSV pruning arm's pattern is updated for the new arity. | | P1: no legacy flag | Added the internal `spark.sql.legacy.columnNameOfCorruptRecord.exactMatch` (default `false`, `SESSION` binding). It is folded into the same value as `spark.sql.caseSensitive` through `SQLConf.columnNameOfCorruptRecordExactMatch`, so the readers, both functions and the pruning guards honour it together, including through `Dataset.rdd`. The 4.4 migration entry names it and now describes the CSV column shift and the inferred-schema case. | | P2: pruning `from_json` can change a field's role | The `GetStructField` and `named_struct` arms prune only when every kept field has the same corrupt record role in the pruned schema as in the full one, judged with the captured value. | | P3: `isCorruptRecordField` scans the schema | Replaced with the fast path you described. `ExprUtilsSuite` checks it against the full candidate rule for every field position. | | P3: options built twice | Each setup point keeps its first options object and builds a second one only when the resolved name differs. | | P3: XML test cannot tell data from corrupt record | The record now carries `<_CORRUPT_RECORD>c</_CORRUPT_RECORD>` and all three paths expect `"c"` back. | | P3: no TODO on the `from_xml` path | Added at the check in `XmlExpressionEvalUtils`, and `verifyColumnNameOfCorruptRecord`'s doc now says it matches exactly and serves the XML paths. | Tests added for the two blocking items, for both `spark.sql.caseSensitive=true` and the legacy flag: `from_csv` and `from_json` over a non-local input return the same rows through `Dataset.rdd` as through `collect()`, a pruned extraction of the case-variant field returns its data, and a plan analyzed under one setting and collected under the other follows the setting at analysis. The readers have flag on/off cases for file reads on v1 and v2 and for the `Dataset[String]` readers, plus the inferred-schema case from your comment. Two things worth flagging: - The new constructor argument is printed with the expression, so 19 `sql-tests` golden files and 4 Connect explain results are regenerated. Every change is the one added argument. - I gave the flag `SESSION` binding rather than `PERSISTED`, following the `ConfigBindingPolicy` guidance that a rollback flag should not be frozen into a view. The captured value on the expression still fixes the behaviour of an already analyzed plan. Please say if you would rather it were `PERSISTED`. I did not add a dotless i test, since you marked it optional. -- 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]
