wecharyu commented on code in PR #5141:
URL: https://github.com/apache/hive/pull/5141#discussion_r1546303260
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java:
##########
@@ -1525,30 +1527,33 @@ public void visit(LeafNode node) throws MetaException {
if (isOpEquals || Operator.isNotEqualOperator(node.operator)) {
Map<String, String> partKeyToVal = new HashMap<>();
partKeyToVal.put(partCol.getName(), node.value.toString());
- String escapedNameFragment = Warehouse.makePartName(partKeyToVal,
false);
+ String escapedNameFragmentPart = Warehouse.makePartName(partKeyToVal,
false);
if (colType == FilterType.Date) {
// Some engines like Pig will record both date and time values, in
which case we need
// match PART_NAME by like clause.
- escapedNameFragment += "%";
+ escapedNameFragmentPart += "%";
}
+ StringBuilder sbFilter = new StringBuilder();
+ for (int i = 0; i < partitionKeys.size(); i++) {
+ FieldSchema col = partitionKeys.get(i);
+ if (i > 0) {
+ sbFilter.append(Path.SEPARATOR);
+ }
+ if (partCol.getName().equals(col.getName())) {
+ sbFilter.append(escapedNameFragmentPart);
+ } else {
+
sbFilter.append(FileUtils.escapePathName(col.getName().toLowerCase(), "_%"));
+ sbFilter.append('=');
+ sbFilter.append(FileUtils.escapePathName(null, "_%"));
Review Comment:
Since we do not need escape '_%' here, we can coalesce these two lines into:
```java
sbFilter.append('=_%');
```
--
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]