Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-47523][SQL] Replace deprecated JsonParser#getCurrentName with JsonParser#currentName #45668

Closed
wants to merge 1 commit into from

Conversation

LuciferYang
Copy link
Contributor

@LuciferYang LuciferYang commented Mar 22, 2024

What changes were proposed in this pull request?

This pr replaces the use of JsonParser#getCurrentName with JsonParser#currentName in Spark code, as JsonParser#getCurrentName has been deprecated since jackson 2.17.

https://github.com/FasterXML/jackson-core/blob/8fba680579885bf9cdae72e93f16de557056d6e3/src/main/java/com/fasterxml/jackson/core/JsonParser.java#L1521-L1551

    /**
     * Deprecated alias of {@link #currentName()}.
     *
     * @return Name of the current field in the parsing context
     *
     * @throws IOException for low-level read issues, or
     *   {@link JsonParseException} for decoding problems
     *
     * @deprecated Since 2.17 use {@link #currentName} instead.
     */
    @Deprecated
    public abstract String getCurrentName() throws IOException;

    /**
     * Method that can be called to get the name associated with
     * the current token: for {@link JsonToken#FIELD_NAME}s it will
     * be the same as what {@link #getText} returns;
     * for field values it will be preceding field name;
     * and for others (array values, root-level values) null.
     *
     * @return Name of the current field in the parsing context
     *
     * @throws IOException for low-level read issues, or
     *   {@link JsonParseException} for decoding problems
     *
     * @since 2.10
     */
    public String currentName() throws IOException {
        // !!! TODO: switch direction in 2.18 or later
        return getCurrentName();
    }

Why are the changes needed?

Clean up deprecated API usage.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Pass GitHub Actions

Was this patch authored or co-authored using generative AI tooling?

No

@github-actions github-actions bot added the SQL label Mar 22, 2024
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM (Pending CIs).

Copy link
Member

@yaooqinn yaooqinn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM.

Thank you. @LuciferYang

@dongjoon-hyun
Copy link
Member

Merged to master for Apache Spark 4.0.0.
Thank you, @LuciferYang and @yaooqinn .

sweisdb pushed a commit to sweisdb/spark that referenced this pull request Apr 1, 2024
…h `JsonParser#currentName`

### What changes were proposed in this pull request?
This pr replaces the use of `JsonParser#getCurrentName` with `JsonParser#currentName` in Spark code, as `JsonParser#getCurrentName` has been deprecated since jackson 2.17.

https://github.com/FasterXML/jackson-core/blob/8fba680579885bf9cdae72e93f16de557056d6e3/src/main/java/com/fasterxml/jackson/core/JsonParser.java#L1521-L1551

```java
    /**
     * Deprecated alias of {link #currentName()}.
     *
     * return Name of the current field in the parsing context
     *
     * throws IOException for low-level read issues, or
     *   {link JsonParseException} for decoding problems
     *
     * deprecated Since 2.17 use {link #currentName} instead.
     */
    Deprecated
    public abstract String getCurrentName() throws IOException;

    /**
     * Method that can be called to get the name associated with
     * the current token: for {link JsonToken#FIELD_NAME}s it will
     * be the same as what {link #getText} returns;
     * for field values it will be preceding field name;
     * and for others (array values, root-level values) null.
     *
     * return Name of the current field in the parsing context
     *
     * throws IOException for low-level read issues, or
     *   {link JsonParseException} for decoding problems
     *
     * since 2.10
     */
    public String currentName() throws IOException {
        // !!! TODO: switch direction in 2.18 or later
        return getCurrentName();
    }
```

### Why are the changes needed?
Clean up deprecated API usage.

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
Pass GitHub Actions

### Was this patch authored or co-authored using generative AI tooling?
No

Closes apache#45668 from LuciferYang/SPARK-47523.

Authored-by: yangjie01 <yangjie01@baidu.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants