[native] Enable hive.allow-drop-table in NativeQueryRunner#21641
[native] Enable hive.allow-drop-table in NativeQueryRunner#21641majetideepak merged 1 commit intoprestodb:masterfrom
Conversation
mbasmanova
left a comment
There was a problem hiding this comment.
@pdabre12 Are you new to Presto? Please, review contributing guildelines and make sure to create independently buildable commits with nice commit messages that follow the guidelines.
|
@mbasmanova Sorry for the inconvenience, I missed to tag this PR as a draft, it's still in progress. I will clean it up and make sure its according to the community guidelines before its ready for review. |
|
@pdabre12 Sounds good. Would you also create a GitHub issue to describe the problem you are solving and the approach you use to solve it? |
|
@mbasmanova Yes, I will. |
2affa78 to
8248196
Compare
|
@majetideepak Please review. |
majetideepak
left a comment
There was a problem hiding this comment.
The commit must have the [native] prefix.
See PR guidelines here https://github.com/prestodb/presto/tree/master/presto-native-execution#create-pull-request
There was a problem hiding this comment.
@pdabre12 Is there a reason to not use the builder()?
There was a problem hiding this comment.
Why do we need this change?
There was a problem hiding this comment.
The reason I did not use the builder() is because I wanted to make use of the putIfAbsent() method available on HashMap and as far as I know we cannot create an HashMap with a builder().
There was a problem hiding this comment.
This change is needed because under the hood while creating a queryRunner using PrestoSparkNativeQueryRunnerUtils , the native worker properties (hiveProperties above) are added to the properties.
Not adding the putIfAbsent() check there throws an error : duplicate key values for hive.allow-drop-table .
There was a problem hiding this comment.
Can we simply remove .put("hive.allow-drop-table", "true") below to avoid the duplicate key issue?
There was a problem hiding this comment.
No we cannot because the PrestoSparkNativeQueryRunnerUtils uses the PrestoSparkQueryRunner present in presto-spark-base and PrestoSparkQueryRunner is called separately too while testing presto-spark-base operations. Removing these properties from here results in an error while running those tests.
There was a problem hiding this comment.
Then likely getNativeWorkerHiveProperties is not the right place to add this.
Can we add inside at presto-hive/src/test/java/com/facebook/presto/hive/HiveQueryRunner.java:225?
048bac0 to
e72cd9b
Compare
There was a problem hiding this comment.
@pdabre12 : Any reason we have not added the rest of the properties viz. hive.allow-rename-(table)column, hive.allow-add-column, hive.allow-drop-column to NativeQueryRunnerUtils.getNativeWorkerHiveProperties() function above ?
There was a problem hiding this comment.
I guess the need was only for hive.allow-drop-table. But good point. We could add the remaining and remove them from here.
There was a problem hiding this comment.
Yup , the need was only for hive.allow-drop-table.
My plan was to add the other properties once this refactor was accepted.
3f7cdb3 to
f32d5cf
Compare
|
@pdabre12 thanks for iterating on this. My goal is to avoid changes to the non-native code paths since some of the APIs are reused across different contexts. |
047fa06 to
23808e3
Compare
|
@mbasmanova can you take another look? Thanks. |
There was a problem hiding this comment.
Why is this not part of getNativeWorkerHiveProperties ?
Can you update PR description to explain why you are making this change?
There was a problem hiding this comment.
+1. Agree with @mbasmanova. I too feel this should be a part of getNativeWorkerHiveProperties(). Several people look at that function when setting up their catalogs.
There was a problem hiding this comment.
We tried that. getNativeWorkerHiveProperties() is used on the Native Spark side as well and it conflicted due to duplicate config.
The diff would look like 2affa78
You will see that on the Spark side, the corresponding config is set inside the PrestoSparkQueryRunner.
We followed the existing pattern and avoided risky refactoring.
There was a problem hiding this comment.
@mbasmanova I updated the description. Thanks.
There was a problem hiding this comment.
Since these classes are used for both Native and Java paths, we should have native-only, java-only, and common config.
hive.allow-drop-table is a common config.
There was a problem hiding this comment.
If the above classification makes sense, we could refactor the existing config in a separate PR.
There was a problem hiding this comment.
I guess there is also Spark config.
There was a problem hiding this comment.
Do we know why PrestoSparkQueryRunner sets this by default, but Hive query runner doesn't?
CC: @arhimondr
@majetideepak How does this work for native Presto-on-Spark? |
@mbasmanova I see that it also invokes the |
|
The createJavaQueryRunner sets it here |
The |
|
The solution in createJavaQueryRunner looks the best. Let's do the same for native query runner and unify Prestissimo and Presto-on-Spark. |
|
@mbasmanova the solution in this PR is what |
|
@mbasmanova can you approve this change so that we can unblock the CTAS tests? |
|
@majetideepak Deepak, I'm confused because I believe we already have CTAS tests. Is this not the case? What's blocking us from adding more? |
There was a problem hiding this comment.
nit: maybe
ImmutableMap.<String, String>builder()
.putAll(getNativeWorkerHiveProperties(storageFormat))
.put("hive.allow-drop-table", "true")
.build();
and let's add comment to explain that we need hive.allow-drop-table=true because we use "legacy" security.
There was a problem hiding this comment.
@mbasmanova Thanks for the review, added the comment .
The current native tests are set up such that the JavaQueryRunner writes the tables and the NativeQueryRunner reads the tables. |
mbasmanova
left a comment
There was a problem hiding this comment.
Got it. Thanks.
Please, add a comment to explain why you are adding that property and use
ImmutableMap.<String, String>builder()
.putAll(getNativeWorkerHiveProperties(storageFormat))
.put("hive.allow-drop-table", "true")
.build();
|
To add more context, some existing test CTAS APIs drop tables. So we need the queryrunner to be able to drop a table. |
23808e3 to
fea00c0
Compare
fea00c0 to
a94d775
Compare
Allow NativeQueryRunner to drop tables. We need this for writing CTAS tests via the NativeQueryRunner.
Resolves: #21659