cj-zhukov commented on PR #395:
URL: https://github.com/apache/datafusion-spark/pull/395#issuecomment-7096619379
@andygrove thanks again for the review, both points were useful. I've pushed
updates for them.
**1. Option errors at execution.** Constant options are now validated in
`return_field_from_args`, so a bad option fails at planning even with no rows.
The runtime check stays for options that are not a constant. New `.slt` records
in `json/to_json.slt`:
- `map('pretty', 'true')` and `map('ignoreNullFields', 'maybe')` over an
empty input now fail (`skipif evaluate`, since without constant folding the
options are not a literal at planning);
- valid options over an empty input return no rows and no error;
- a non-constant options map is rejected when the function runs.
**2. NULL option values.** I rechecked this against PySpark 4.2.0 and added
`.slt` records for each case:
- `map('noSuchOption', CAST(NULL AS STRING))`: Spark returns `{"a":1}`, so a
NULL value alone does not fail (marked `xfail`, because we reject unknown
options);
- `map('ignoreNullFields', CAST(NULL AS STRING))`: Spark fails with `For
input string: "null"`;
- `map('ignoreNullFields', NULL)`: Spark fails at analysis with
`INVALID_OPTIONS.NON_STRING_TYPE`.
So I kept the branch and pointed the code comment at these records.
Could you take another look when you have time?
--
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]