vinodkc commented on PR #58024:
URL: https://github.com/apache/spark/pull/58024#issuecomment-6587687004
Thanks. All four findings are fixed and the question is answered below.
**The root-number question.** Confirmed by running the queries: `repeat('9',
1001) IS JSON` in all shapes raises with the number-length reason, while the
over-long string and over-deep array return false under OBJECT. Chose the first
option: a `StreamConstraintsException` from the first `nextToken()` is a shape
mismatch for OBJECT/ARRAY . with default constraints only an over-long number
can raise there, so the first value is a number, which can never be an object
or an array. VALUE and SCALAR still raise. Documented in `sql-ref-is-json.md`
and the Javadoc; pinned by suite and golden tests.
**`<reason>` parameter.** Reshaped into sub-conditions like
`COLLECTION_SIZE_LIMIT_EXCEEDED`: `IS_JSON_INPUT_LIMIT_EXCEEDED.{NESTING_DEPTH,
NUMBER_LENGTH, STRING_LENGTH, NAME_LENGTH}` each carry the numeric maximum as a
parameter, plus `UNKNOWN` for an unrecognized Jackson message. The golden file
now records `"errorClass": "IS_JSON_INPUT_LIMIT_EXCEEDED.NESTING_DEPTH"` with
`"maxNestingDepth": "1000"`.
**VARCHAR operand.** The default-config case is labeled a STRING case, and
`json-functions.sql` now runs CHAR and VARCHAR cases under both configs. The
goldens pin both paths: real `varchar(10)`/`char(10)` operands under
`preserveCharVarcharTypeInfo`, and the `cast(cast(... as varchar(10)) as
string)` promotion under standard semantics.
**Javadoc.** Reworded to the reference-page rule: the error is raised only
when checking the input requires going past a limit; a shape mismatch decided
by the first token returns false. Consistent with the behavior chosen above.
**Malformed containers.** Added: truncated (`{`, `[1,`), trailing commas
(`[1,]`, `{"a":1,}`), missing values (`[1,,2]`), missing colon (`{"a"}`),
mismatched closers (`[1}`), in both `JsonExpressionsSuite` (codegen and
interpreted, plus matching-shape variants) and the golden files
--
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]