Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-50780][SQL] Use
overrideStdFeatures
instead of `setFeatureMa…
…sk` in `JacksonParser` ### What changes were proposed in this pull request? In apache#49018, the restoration logic for feature flags was fixed using the `setFeatureMask` method. However, the `setFeatureMask` method has been deprecated since Jackson 2.7, so this pr reimplements the relevant logic using `overrideStdFeatures`. ### Why are the changes needed? Clean up the use of deprecated APIs. https://github.com/FasterXML/jackson-core/blob/0d2b0f39200d466f49f1abb06d9027053d41483d/src/main/java/com/fasterxml/jackson/core/JsonParser.java#L999-L1035 ``` /** * Bulk set method for (re)setting states of all standard {link Feature}s * * param mask Bit mask that defines set of features to enable * * return This parser, to allow call chaining * * since 2.3 * deprecated Since 2.7, use {link #overrideStdFeatures(int, int)} instead */ Deprecated public JsonParser setFeatureMask(int mask) { _features = mask; return this; } /** * Bulk set method for (re)setting states of features specified by <code>mask</code>. * Functionally equivalent to *<code> * int oldState = getFeatureMask(); * int newState = (oldState & ~mask) | (values & mask); * setFeatureMask(newState); *</code> * but preferred as this lets caller more efficiently specify actual changes made. * * param values Bit mask of set/clear state for features to change * param mask Bit mask of features to change * * return This parser, to allow call chaining * * since 2.6 */ public JsonParser overrideStdFeatures(int values, int mask) { int newState = (_features & ~mask) | (values & mask); return setFeatureMask(newState); } ``` ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? - Pass GitHub Actions - Specialized tests have already been added in apache#49018: "feature mask should remain unchanged" in `JacksonParserSuite`. ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#49434 from LuciferYang/setFeatureMask. Authored-by: yangjie01 <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
- Loading branch information