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-31234][SQL][2.4] ResetCommand should not affect static SQL Configuration #28262

Closed

Conversation

gatorsmile
Copy link
Member

@gatorsmile gatorsmile commented Apr 19, 2020

What changes were proposed in this pull request?

This PR is to backport the fix of #28003, add a migration guide, update the PR description and add an end-to-end test case.

Before this PR, the SQL RESET command will reset the values of static SQL configuration to the default and remove the cached values of Spark Context Configurations in the current session. This PR fixes the bugs. After this PR, the RESET command follows its definition and only updates the runtime SQL configuration values to the default.

Why are the changes needed?

When we introduced the feature of Static SQL Configuration, we did not update the implementation of SQL RESET command.

The static SQL configuration should not be changed by any command at runtime. However, the RESET command resets the values to the default. We should fix them.

Does this PR introduce any user-facing change?

Before Spark 2.4.6, the RESET command resets both the runtime and static SQL configuration values to the default. It also removes the cached values of Spark Context Configurations in the current session, although these configuration values are for displaying/querying only.

How was this patch tested?

Added an end-to-end test and a unit test

@gatorsmile
Copy link
Member Author

@dongjoon-hyun
Copy link
Member

cc @holdenk since she is the release manager of 2.4.6 and the target version of this issue became 2.4.6 today.

assert(session.sessionState.conf.getConf(GLOBAL_TEMP_DATABASE) === "globalTempDB-SPARK-31234")
session.sql("RESET")
assert(session.sessionState.conf.getConfString("spark.app.name") === "test-app-SPARK-31234")
assert(session.sessionState.conf.getConf(GLOBAL_TEMP_DATABASE) === "globalTempDB-SPARK-31234")
Copy link
Member Author

Choose a reason for hiding this comment

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

GLOBAL_TEMP_DATABASE is a typical example. The value is being used at the runtime. See the code

val db = sparkSession.sessionState.conf.getConf(StaticSQLConf.GLOBAL_TEMP_DATABASE)

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 Jenkins). Thanks, @gatorsmile .

@SparkQA
Copy link

SparkQA commented Apr 19, 2020

Test build #121483 has finished for PR 28262 at commit 96dc679.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun
Copy link
Member

Merged to branch-2.4.

dongjoon-hyun pushed a commit that referenced this pull request Apr 19, 2020
…figuration

### What changes were proposed in this pull request?
This PR is to backport the fix of #28003, add a migration guide, update the PR description and add an end-to-end test case.

Before this PR, the SQL `RESET` command will reset the values of static SQL configuration to the default and remove the cached values of Spark Context Configurations in the current session. This PR fixes the bugs. After this PR, the `RESET` command follows its definition and only updates the runtime SQL configuration values to the default.

### Why are the changes needed?
When we introduced the feature of Static SQL Configuration, we did not update the implementation of  SQL `RESET` command.

The static SQL configuration should not be changed by any command at runtime. However, the `RESET` command resets the values to the default. We should fix them.

### Does this PR introduce any user-facing change?
Before Spark 2.4.6, the `RESET` command resets both the runtime and static SQL configuration values to the default. It also removes the cached values of Spark Context Configurations in the current session, although these configuration values are for displaying/querying only.

### How was this patch tested?
Added an end-to-end test and a unit test

Closes #28262 from gatorsmile/spark-31234followup2.4.

Authored-by: gatorsmile <gatorsmile@gmail.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
@maropu
Copy link
Member

maropu commented Apr 20, 2020

Looks fine, thanks, @gatorsmile !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants