ramitg254 commented on code in PR #6259:
URL: https://github.com/apache/hive/pull/6259#discussion_r2695400523
##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/info/desc/DescTableAnalyzer.java:
##########
@@ -149,37 +148,37 @@ private Map<String, String> getPartitionSpec(Hive db,
ASTNode node, TableName ta
if (node.getChild(1).getType() == HiveParser.TOK_PARTSPEC) {
ASTNode partNode = (ASTNode) node.getChild(1);
- Table tab = null;
+ Table table;
try {
- tab = db.getTable(tableName.getNotEmptyDbTable());
+ table = db.getTable(tableName.getNotEmptyDbTable());
} catch (InvalidTableException e) {
throw new
SemanticException(ErrorMsg.INVALID_TABLE.getMsg(tableName.getNotEmptyDbTable()),
e);
} catch (HiveException e) {
throw new SemanticException(e.getMessage(), e);
}
- Map<String, String> partitionSpec = null;
+ Map<String, String> partitionSpec;
try {
- partitionSpec = getPartSpec(partNode);
- validateUnsupportedPartitionClause(tab, partitionSpec != null &&
!partitionSpec.isEmpty());
- partitionSpec = getValidatedPartSpec(tab, partNode, db.getConf(),
false);
+ partitionSpec = getValidatedPartSpec(table, partNode, db.getConf(),
false);
} catch (SemanticException e) {
// get exception in resolving partition it could be DESCRIBE table key
// return null, continue processing for DESCRIBE table key
return null;
}
if (partitionSpec != null) {
- Partition part = null;
+ boolean isPartitionPresent;
try {
- part = db.getPartition(tab, partitionSpec, false);
+ isPartitionPresent = table.isNonNative() ?
+ table.getStorageHandler().isPartitionPresent(table,
partitionSpec) :
Review Comment:
actually I intentionally dropped the original code there as `getPartition`
is called at two places one is in analyzer and other is in operation and this
is check uses two lists via `getPartitions `and `getPartitionKeys` and if I
move this check to `getPartition` then this check will be called two times
But in the current state we are calling it single time only in analyzer
phase and retrieving the partition directly in operation phase which I think is
more efficient
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]