-
Notifications
You must be signed in to change notification settings - Fork 4.8k
HIVE-29066: PARTITION_NAME_WHITELIST_PATTERN is not honouring session level configuration #5943
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
Open
Aggarwal-Raghav
wants to merge
1
commit into
apache:master
Choose a base branch
from
Aggarwal-Raghav:HIVE-29066
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
set hive.strict.checks.bucketing=false; | ||
|
||
set hive.mapred.mode=nonstrict; | ||
SET hive.metastore.partition.name.whitelist.pattern=[^9]*; | ||
set hive.exec.failure.hooks=org.apache.hadoop.hive.ql.hooks.VerifyTableDirectoryIsEmptyHook; | ||
|
||
set hive.exec.dynamic.partition=true; | ||
|
@@ -17,4 +16,5 @@ load data local inpath '../../data/files/bmj/000000_0' INTO TABLE source_table p | |
-- If the directory is not empty the hook will throw an error, instead the error should come from the metastore | ||
-- This shows that no dynamic partitions were created and left behind or had directories created | ||
|
||
SET metaconf:metastore.partition.name.whitelist.pattern=[^9]*; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason for moving this line below is, the metaconf will be resetted after any meta-operation i.e create etc. My assumption is, metconf should always be a line before the config is consumed in the query. the question can be tracked here. |
||
insert overwrite table dest_table partition (ds, hr) select key, hr, ds, value from source_table where ds='2008-04-08' and value='val_129' order by value asc; |
9 changes: 9 additions & 0 deletions
9
ql/src/test/queries/clientnegative/session_partition_with_whitelist.q
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
set metaconf:metastore.partition.name.whitelist.pattern; | ||
|
||
create table t1 (id int) partitioned by (pcol string); | ||
alter table t1 add partition (pCol='2025-06-09'); | ||
|
||
set metaconf:metastore.partition.name.whitelist.pattern=[^9]*; | ||
alter table t1 add partition (pCol='2025-06-19'); | ||
show partitions t1; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
ql/src/test/results/clientnegative/session_partition_with_whitelist.q.out
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
metaconf:metastore.partition.name.whitelist.pattern= | ||
PREHOOK: query: create table t1 (id int) partitioned by (pcol string) | ||
PREHOOK: type: CREATETABLE | ||
PREHOOK: Output: database:default | ||
PREHOOK: Output: default@t1 | ||
POSTHOOK: query: create table t1 (id int) partitioned by (pcol string) | ||
POSTHOOK: type: CREATETABLE | ||
POSTHOOK: Output: database:default | ||
POSTHOOK: Output: default@t1 | ||
PREHOOK: query: alter table t1 add partition (pCol='2025-06-09') | ||
PREHOOK: type: ALTERTABLE_ADDPARTS | ||
PREHOOK: Output: default@t1 | ||
POSTHOOK: query: alter table t1 add partition (pCol='2025-06-09') | ||
POSTHOOK: type: ALTERTABLE_ADDPARTS | ||
POSTHOOK: Output: default@t1 | ||
POSTHOOK: Output: default@t1@pcol=2025-06-09 | ||
PREHOOK: query: alter table t1 add partition (pCol='2025-06-19') | ||
PREHOOK: type: ALTERTABLE_ADDPARTS | ||
PREHOOK: Output: default@t1 | ||
FAILED: Execution Error, return code 40000 from org.apache.hadoop.hive.ql.ddl.DDLTask. MetaException(message:Partition value '2025-06-19' contains a character not matched by whitelist pattern '[^9]*'. Configure with metastore.partition.name.whitelist.pattern) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is enough for fixing dynamic partition. Reasoning:
hivename: hive.metastore.partition.name.whitelist.pattern
varname: metastore.partition.name.whitelist.pattern
As users do
set metaconf:metastore.partition.name.whitelist.pattern=[^9]*
, then varname is used not the hivename. I believe it was never working earlier also for session level.NOTE: This also means that in hive-site.xml as well this is now going to be picked instead of hivename.
This shouldn't be an issue because:
MetastoreConf#getVar()
which check for hivename as failsafe. That's why q file are not required to change.