HIVE-29413: Avoid code duplication by updating getPartCols method for iceberg tables#6413
HIVE-29413: Avoid code duplication by updating getPartCols method for iceberg tables#6413ramitg254 wants to merge 20 commits into
Conversation
|
@ramitg254 please take a look: 9e7535c. I would suggest following similar approach |
|
but here we are creating separate method getEffectivePartCols() and leaving getPartCols() as it is, which as per our discussion on that closed pr we shouldn't do that, and only go ahead with updating getPartCols() |
Where did I say that? The ask was to keep the original method unchanged. same here |
|
oh I got confused due to this comment: #6337 (comment) in which getSupportedPartCols() was just separate method similar to getEffectivePartCols() |
|
I am fine with that earlier approach as well but recently I saw this one: https://issues.apache.org/jira/browse/HIVE-29525 so I thought we should have unified getPartCols() and getCols() which gives similar results as native hive tables as first step towards solving this after that those plan logics can be taken care of later on when that ticket will be addressed. please share your thoughts on this idea |
| private static int calculatePartPrefix(Table tbl, Set<String> partSpecKeys) { | ||
| int partPrefixToDrop = 0; | ||
| for (FieldSchema fs : tbl.getPartCols()) { | ||
| for (FieldSchema fs : tbl.getEffectivePartCols()) { |
There was a problem hiding this comment.
any tests covering this for iceberg?
There was a problem hiding this comment.
I am not aware about that did this because of :#6413 (comment)
| } else { | ||
| // partition spec is not specified but column schema can have partitions specified | ||
| for(FieldSchema f : targetTable.getPartCols()) { | ||
| for(FieldSchema f : targetTable.getEffectivePartCols()) { |
There was a problem hiding this comment.
do we really need this? tests?
| List<String> cols = new ArrayList<String>(); | ||
| if (qbp.getAnalyzeRewrite() != null) { | ||
| List<FieldSchema> partitionCols = tab.getPartCols(); | ||
| List<FieldSchema> partitionCols = tab.getEffectivePartCols(); |
There was a problem hiding this comment.
we don't even enter here, see if above - !tab.hasNonNativePartitionSupport()
| } | ||
| } else { | ||
| partColSchema.addAll(tbl.getPartCols()); | ||
| partColSchema.addAll(tbl.getEffectivePartCols()); |
|
so many |
|
@deniskuzZ I was updating getPartCols() with getEffectivePartCols() to moste places as we should eventually move to this generic common method. |
@ramitg254 i like the idea of having a single
Since you've already identified them, why not apply the |
|
I was planning to but updating getCols() will alone cause test failures for all q files whichever has describe command for iceberg tables and also query plans will itself get affected as stats logic current take this getCols() into account and there are around 90+ occurences of it in code so it will lead to breakage as well so I thought it will be better if we take care of it as a separate change |
I guess that was the main intent — to integrate Iceberg partition handling into the existing code with minimal workarounds/code duplication. Maybe I’m missing something, but, unfortunately, I don’t see much value in the current state of PR, sorry. Let’s see what Krisztian thinks about it. |
# Conflicts: # ql/src/java/org/apache/hadoop/hive/ql/parse/ColumnStatsAutoGatherContext.java
# Conflicts: # ql/src/java/org/apache/hadoop/hive/ql/metadata/Table.java
|



What changes were proposed in this pull request?
added getEffectivePartCols() in most places possible to avoid code duplication.
Why are the changes needed?
getPartCols() does not have support for iceberg tables.
Does this PR introduce any user-facing change?
No
How was this patch tested?
ci tests and local build