Tejaskriya commented on code in PR #7167:
URL: https://github.com/apache/ozone/pull/7167#discussion_r1751478858
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java:
##########
@@ -570,7 +625,74 @@ public Void call() {
return null;
}
- Map<String, Object> getFilteredObject(Object obj, Class<?> clazz,
Map<String, Object> fieldsSplitMap) {
+ boolean checkFilteredObject(Object obj, Class<?> clazz, Map<String,
Object> fieldsSplitMap)
+ throws IOException {
+ for (Map.Entry<String, Object> field : fieldsSplitMap.entrySet()) {
+ try {
+ Field valueClassField = getRequiredFieldFromAllFields(clazz,
field.getKey());
+ Object valueObject = valueClassField.get(obj);
+ Object fieldValue = field.getValue();
+
+ if (fieldValue == null) {
+ throw new IOException("Malformed filter. Check input");
+ } else if (fieldValue instanceof Filter) {
+ Filter filter = (Filter)fieldValue;
+ // reached the end of fields hierarchy, check if they match the
filter
+ // Currently, only equals operation is supported
+ if (Filter.FilterOperator.EQUALS.equals(filter.getOperator()) &&
+ !String.valueOf(valueObject).equals(filter.getValue())) {
+ return false;
+ } else if
(!Filter.FilterOperator.EQUALS.equals(filter.getOperator())) {
+ throw new IOException("Only EQUALS operator is supported
currently.");
+ }
+ } else {
+ Map<String, Object> subfields = (Map<String, Object>)fieldValue;
+ if (Collection.class.isAssignableFrom(valueObject.getClass())) {
+ if (!checkFilteredObjectCollection((Collection) valueObject,
subfields)) {
Review Comment:
I have made the changes now to ignore that particular filter for the record,
it will continue to check for the other filters
--
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]