You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Tejaskriya (via GitHub)" <gi...@apache.org> on 2024/07/22 06:10:01 UTC

[PR] HDDS-11190. Add --fields option to ldb scan command [ozone]

Tejaskriya opened a new pull request, #6976:
URL: https://github.com/apache/ozone/pull/6976

   ## What changes were proposed in this pull request?
   RocksDB stores data in key-value pairs. The value itself may have some kind of key-value structure. Currently, `ozone debug ldb scan` command shows the full value for each record being displayed. This could be very verbose and include information that is not needed for the use case.
   Having a --fields option which filters the fields being displayed for each record will help to get concise output.
   
   For example, if a value has many fields like [name, location->[address, DN, IP], version, lastUpdateTime] , using the option "--fields=name,location.address,version" will display only (name, address in location and version) in the output.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-11190
   
   ## How was this patch tested?
   
   Tested manually in docker cluster:
   ```
   sh-4.2$ ozone debug ldb --db=/data/metadata/om.db scan --cf=fileTable --fields=volumeName,bucketName,keyName,keyLocationVersions.locationVersionMap         
   { "/-9223372036854775040/-9223372036854774528/-9223372036854771967/k1": {
     "bucketName" : "bb1",
     "volumeName" : "vol1",
     "keyName" : "k1",
     "keyLocationVersions.locationVersionMap" : [ {
       "locationVersionMap" : {
         "0" : [ {
           "blockID" : {
             "containerBlockID" : {
               "containerID" : 1,
               "localID" : 113750153625600003
             },
             "blockCommitSequenceId" : 10
           },
           "length" : 3,
           "offset" : 0,
           "createVersion" : 0,
           "partNumber" : 0
         } ]
       }
     } ]
   }
   , "/-9223372036854775040/-9223372036854774528/-9223372036854774528/k1": {
     "bucketName" : "bb1",
     "volumeName" : "vol1",
     "keyName" : "k1",
     "keyLocationVersions.locationVersionMap" : [ {
       "locationVersionMap" : {
         "0" : [ {
           "blockID" : {
             "containerBlockID" : {
               "containerID" : 1,
               "localID" : 113750153625600001
             },
             "blockCommitSequenceId" : 2
           },
           "length" : 3,
           "offset" : 0,
           "createVersion" : 0,
           "partNumber" : 0
         } ]
       }
     } ]
   }
   ```
   


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-11190. Add --fields option to ldb scan command [ozone]

Posted by "sumitagrawl (via GitHub)" <gi...@apache.org>.
sumitagrawl commented on code in PR #6976:
URL: https://github.com/apache/ozone/pull/6976#discussion_r1714677386


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ValueSchema.java:
##########
@@ -101,7 +101,7 @@ public Void call() throws Exception {
     return null;
   }
 
-  private boolean getValueFields(String dbPath, Map<String, Object> valueSchema) {
+  public boolean getValueFields(String dbPath, Map<String, Object> valueSchema, int d, String table) {

Review Comment:
   we can make this method static, as used as utility by other class



##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ValueSchema.java:
##########
@@ -148,7 +148,7 @@ private Object getFieldsStructure(Class<?> clazz, int currentDepth) {
     }
   }
 
-  private List<Field> getAllFields(Class clazz) {
+  public List<Field> getAllFields(Class clazz) {

Review Comment:
   we can make this method as static.



##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java:
##########
@@ -515,16 +572,79 @@ public Void call() {
 
           Object o = dbColumnFamilyDefinition.getValueCodec()
               .fromPersistedFormat(byteArrayKeyValue.getValue());
-          sb.append(WRITER.writeValueAsString(o));
+
+          if (valueFields != null) {
+            Map<String, Object> filteredValue = new HashMap<>();
+            for (String field : valueFields.split(",")) {

Review Comment:
   re-construct field outside loop



##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java:
##########
@@ -515,16 +572,79 @@ public Void call() {
 
           Object o = dbColumnFamilyDefinition.getValueCodec()
               .fromPersistedFormat(byteArrayKeyValue.getValue());
-          sb.append(WRITER.writeValueAsString(o));
+
+          if (valueFields != null) {
+            Map<String, Object> filteredValue = new HashMap<>();
+            for (String field : valueFields.split(",")) {
+              String[] subfields = field.split("\\.");
+              try {
+                Field valueClassField = getRequiredFieldFromAllFields(dbColumnFamilyDefinition.getValueType(),
+                    subfields[0]);
+                Object valueObject = valueClassField.get(o);
+                if (subfields.length == 1) {
+                  filteredValue.put(field, valueObject);
+                } else {
+                  Class<?> typeOfClassField;
+                  try {
+                    if (Collection.class.isAssignableFrom(valueClassField.getType())) {
+                      typeOfClassField = (Class<?>)
+                          ((ParameterizedType) valueClassField.getGenericType()).getActualTypeArguments()[0];
+                    } else {
+                      typeOfClassField = valueClassField.getType();
+                    }
+                  } catch (ClassCastException ex) {
+                    typeOfClassField = valueClassField.getType();
+                  }
+
+                  Field classSubField = getRequiredFieldFromAllFields(typeOfClassField, subfields[1]);
+
+                  if (Collection.class.isAssignableFrom(valueObject.getClass())) {
+                    List<Map<String, Object>> subfieldObjectsList = new ArrayList<>();
+                    for (Object ob : (List) valueObject) {
+                      Map<String, Object> subfieldValueMap = new HashMap<>();
+                      subfieldValueMap.put(subfields[1], classSubField.get(ob));
+                      subfieldObjectsList.add(subfieldValueMap);
+                    }
+                    filteredValue.put(field, subfieldObjectsList);
+                  } else {
+                    filteredValue.put(field, classSubField.get(valueObject));
+                  }
+                }
+              } catch (NoSuchFieldException ex) {
+                err().println("ERROR: no such field: " + valueFields);
+              }
+            }
+            sb.append(WRITER.writeValueAsString(filteredValue));
+
+          } else {
+            sb.append(WRITER.writeValueAsString(o));
+          }
+
           results.add(sb.toString());
         }
         logWriter.log(results, sequenceId);
-      } catch (Exception e) {
+      } catch (IOException | IllegalAccessException e) {
         exception = true;
         LOG.error("Exception parse Object", e);
       }
       return null;
     }
+
+    Field getRequiredFieldFromAllFields(Class clazz, String fieldName) throws NoSuchFieldException {
+      List<Field> classFieldList = new ValueSchema().getAllFields(clazz);

Review Comment:
   can avoid creating ValueSchema object my making method static, in all places



##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java:
##########
@@ -405,6 +419,47 @@ private boolean printTable(List<ColumnFamilyHandle> columnFamilyHandleList,
       IOUtils.closeQuietly(iterator, readOptions, slice);
     }
   }
+  boolean checkValidValueFields(String dbPath, String valueFields,
+                                DBColumnFamilyDefinition<?, ?> columnFamilyDefinition) {

Review Comment:
   validation may not be required, will give all matching data.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-11190. Add --fields option to ldb scan command [ozone]

Posted by "Tejaskriya (via GitHub)" <gi...@apache.org>.
Tejaskriya commented on PR #6976:
URL: https://github.com/apache/ozone/pull/6976#issuecomment-2288178721

   I have run some benchmarking on a large scm.db which had a huge number of records in the deletedBlocks table. Due to the constraint jq has to have only string as keys, I had to use sed to wrap the key (which is an integer) with quotes and then pass the output to jq. 
   The logic of this PR performed way better than jq. The script used: https://gist.github.com/Tejaskriya/5168efd19e7cdb08fdfc6804100b71e7
   Performace graph:
   ![image](https://github.com/user-attachments/assets/24a7399e-14ea-4a3e-8885-57eec49f8336)
   
   


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-11190. Add --fields option to ldb scan command [ozone]

Posted by "Tejaskriya (via GitHub)" <gi...@apache.org>.
Tejaskriya commented on PR #6976:
URL: https://github.com/apache/ozone/pull/6976#issuecomment-2298095003

   @sumitagrawl thank you for the review! I have made the methods in ValueSchema as static, performed the splitting of fields outside the loop and removed the validation.
   Additionally, as discussed offline, I have implemented the filtering in a recursive way so that we can have multiple levels of filtering. As of now, no limit has been set. Could you please review the updated patch?


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-11190. Add --fields option to ldb scan command [ozone]

Posted by "sumitagrawl (via GitHub)" <gi...@apache.org>.
sumitagrawl commented on code in PR #6976:
URL: https://github.com/apache/ozone/pull/6976#discussion_r1724874326


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java:
##########
@@ -515,16 +533,84 @@ public Void call() {
 
           Object o = dbColumnFamilyDefinition.getValueCodec()
               .fromPersistedFormat(byteArrayKeyValue.getValue());
-          sb.append(WRITER.writeValueAsString(o));
+
+          if (valueFields != null) {
+            Map<String, Object> filteredValue = new HashMap<>();
+            for (List<String> subfields : fieldsSplit) {
+              try {
+                filteredValue.putAll(getFilteredObject(o, subfields, dbColumnFamilyDefinition.getValueType()));
+              } catch (NoSuchFieldException ex) {
+                err().println("ERROR: no such field: " + subfields);
+              } catch (IllegalAccessException e) {
+                err().println("ERROR: Cannot get field from object: " + subfields);
+              }
+            }
+            sb.append(WRITER.writeValueAsString(filteredValue));
+          } else {
+            sb.append(WRITER.writeValueAsString(o));
+          }
+
           results.add(sb.toString());
         }
         logWriter.log(results, sequenceId);
-      } catch (Exception e) {
+      } catch (IOException e) {
         exception = true;
         LOG.error("Exception parse Object", e);
       }
       return null;
     }
+
+    Map<String, Object> getFilteredObject(Object o, List<String> subfields, Class<?> fieldClass)
+        throws NoSuchFieldException, IllegalAccessException {
+      Field valueClassField = getRequiredFieldFromAllFields(fieldClass, subfields.get(0));
+      Object valueObject = valueClassField.get(o);
+      int length = subfields.size();
+      Map<String, Object> valueMap = new HashMap<>();
+      if (length == 1) {
+        valueMap.put(subfields.get(0), valueObject);
+      } else {
+        Class<?> typeOfClassField;
+        try {
+          if (Collection.class.isAssignableFrom(valueClassField.getType())) {
+            typeOfClassField = (Class<?>)
+                ((ParameterizedType) valueClassField.getGenericType()).getActualTypeArguments()[0];
+          } else {
+            typeOfClassField = valueClassField.getType();
+          }
+        } catch (ClassCastException ex) {
+          typeOfClassField = valueClassField.getType();
+        }
+
+        if (Collection.class.isAssignableFrom(valueObject.getClass())) {

Review Comment:
   Do any usecase of supporting Map or Set? do below logic will work for same?



##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java:
##########
@@ -515,16 +533,84 @@ public Void call() {
 
           Object o = dbColumnFamilyDefinition.getValueCodec()
               .fromPersistedFormat(byteArrayKeyValue.getValue());
-          sb.append(WRITER.writeValueAsString(o));
+
+          if (valueFields != null) {
+            Map<String, Object> filteredValue = new HashMap<>();
+            for (List<String> subfields : fieldsSplit) {
+              try {
+                filteredValue.putAll(getFilteredObject(o, subfields, dbColumnFamilyDefinition.getValueType()));
+              } catch (NoSuchFieldException ex) {
+                err().println("ERROR: no such field: " + subfields);
+              } catch (IllegalAccessException e) {
+                err().println("ERROR: Cannot get field from object: " + subfields);
+              }
+            }
+            sb.append(WRITER.writeValueAsString(filteredValue));
+          } else {
+            sb.append(WRITER.writeValueAsString(o));
+          }
+
           results.add(sb.toString());
         }
         logWriter.log(results, sequenceId);
-      } catch (Exception e) {
+      } catch (IOException e) {
         exception = true;
         LOG.error("Exception parse Object", e);
       }
       return null;
     }
+
+    Map<String, Object> getFilteredObject(Object o, List<String> subfields, Class<?> fieldClass)
+        throws NoSuchFieldException, IllegalAccessException {
+      Field valueClassField = getRequiredFieldFromAllFields(fieldClass, subfields.get(0));
+      Object valueObject = valueClassField.get(o);
+      int length = subfields.size();
+      Map<String, Object> valueMap = new HashMap<>();
+      if (length == 1) {
+        valueMap.put(subfields.get(0), valueObject);
+      } else {
+        Class<?> typeOfClassField;
+        try {
+          if (Collection.class.isAssignableFrom(valueClassField.getType())) {
+            typeOfClassField = (Class<?>)
+                ((ParameterizedType) valueClassField.getGenericType()).getActualTypeArguments()[0];
+          } else {
+            typeOfClassField = valueClassField.getType();
+          }
+        } catch (ClassCastException ex) {
+          typeOfClassField = valueClassField.getType();
+        }
+
+        if (Collection.class.isAssignableFrom(valueObject.getClass())) {
+          List<Object> subfieldObjectsList = new ArrayList<>();
+          for (Object ob : (List) valueObject) {

Review Comment:
   (List) valueObject ==> (Collection) valueObject



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-11190. Add --fields option to ldb scan command [ozone]

Posted by "sumitagrawl (via GitHub)" <gi...@apache.org>.
sumitagrawl merged PR #6976:
URL: https://github.com/apache/ozone/pull/6976


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-11190. Add --fields option to ldb scan command [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on PR #6976:
URL: https://github.com/apache/ozone/pull/6976#issuecomment-2254576284

   Thanks @Tejaskriya for working on this.  Have you considered using `jq` for filtering output?


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-11190. Add --fields option to ldb scan command [ozone]

Posted by "errose28 (via GitHub)" <gi...@apache.org>.
errose28 commented on PR #6976:
URL: https://github.com/apache/ozone/pull/6976#issuecomment-2261435551

   I also suggested using `jq`.
   
   > but for larger dbs it will be reading the data twice. With adding an option to our code, we will be reading the data only once and filtering it simultaneously.
   
   I don't think this how it would work. This seems to describe jq as blocking until the whole DB is read, and only then beginning  filtering on all the objects before giving the final output. jq actually works on streams. Our ldb process would read and print lines to stdout. After a line is printed, our process moves on to read and print more of the DB while jq is filtering the lines that were just printed at the same time.
   
   If there is a speedup it would probably be because we are reducing the amount of data that gets converted to json and printed. However, this benefit might be negated because this filter is implemented with [Java reflection](https://github.com/apache/ozone/blob/9b29eae46ad19ba648765f22c30a1c294f403243/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ValueSchema.java#L159) and jq filtering is [in C](https://github.com/jqlang/jq).
   
   Can we get benchmarks of various filtering queries using jq vs this method? Ideally on larger DBs with at least thousands of keys. Based on these results we can decide whether this option is something we should support.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-11190. Add --fields option to ldb scan command [ozone]

Posted by "Tejaskriya (via GitHub)" <gi...@apache.org>.
Tejaskriya commented on PR #6976:
URL: https://github.com/apache/ozone/pull/6976#issuecomment-2254967304

   @adoroszlai are you suggesting to not have a filter option and have the user use jq commands to do the filtering?
   In that case, using jq was considered, but for larger dbs it will be reading the data twice. With adding an option to our code, we will be reading the data only once and filtering it simultaneously.
   


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-11190. Add --fields option to ldb scan command [ozone]

Posted by "Tejaskriya (via GitHub)" <gi...@apache.org>.
Tejaskriya commented on code in PR #6976:
URL: https://github.com/apache/ozone/pull/6976#discussion_r1724943395


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java:
##########
@@ -515,16 +533,84 @@ public Void call() {
 
           Object o = dbColumnFamilyDefinition.getValueCodec()
               .fromPersistedFormat(byteArrayKeyValue.getValue());
-          sb.append(WRITER.writeValueAsString(o));
+
+          if (valueFields != null) {
+            Map<String, Object> filteredValue = new HashMap<>();
+            for (List<String> subfields : fieldsSplit) {
+              try {
+                filteredValue.putAll(getFilteredObject(o, subfields, dbColumnFamilyDefinition.getValueType()));
+              } catch (NoSuchFieldException ex) {
+                err().println("ERROR: no such field: " + subfields);
+              } catch (IllegalAccessException e) {
+                err().println("ERROR: Cannot get field from object: " + subfields);
+              }
+            }
+            sb.append(WRITER.writeValueAsString(filteredValue));
+          } else {
+            sb.append(WRITER.writeValueAsString(o));
+          }
+
           results.add(sb.toString());
         }
         logWriter.log(results, sequenceId);
-      } catch (Exception e) {
+      } catch (IOException e) {
         exception = true;
         LOG.error("Exception parse Object", e);
       }
       return null;
     }
+
+    Map<String, Object> getFilteredObject(Object o, List<String> subfields, Class<?> fieldClass)
+        throws NoSuchFieldException, IllegalAccessException {
+      Field valueClassField = getRequiredFieldFromAllFields(fieldClass, subfields.get(0));
+      Object valueObject = valueClassField.get(o);
+      int length = subfields.size();
+      Map<String, Object> valueMap = new HashMap<>();
+      if (length == 1) {
+        valueMap.put(subfields.get(0), valueObject);
+      } else {
+        Class<?> typeOfClassField;
+        try {
+          if (Collection.class.isAssignableFrom(valueClassField.getType())) {
+            typeOfClassField = (Class<?>)
+                ((ParameterizedType) valueClassField.getGenericType()).getActualTypeArguments()[0];
+          } else {
+            typeOfClassField = valueClassField.getType();
+          }
+        } catch (ClassCastException ex) {
+          typeOfClassField = valueClassField.getType();
+        }
+
+        if (Collection.class.isAssignableFrom(valueObject.getClass())) {

Review Comment:
   It will work for set, But not for Map



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-11190. Add --fields option to ldb scan command [ozone]

Posted by "Tejaskriya (via GitHub)" <gi...@apache.org>.
Tejaskriya commented on code in PR #6976:
URL: https://github.com/apache/ozone/pull/6976#discussion_r1728473225


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java:
##########
@@ -515,16 +533,84 @@ public Void call() {
 
           Object o = dbColumnFamilyDefinition.getValueCodec()
               .fromPersistedFormat(byteArrayKeyValue.getValue());
-          sb.append(WRITER.writeValueAsString(o));
+
+          if (valueFields != null) {
+            Map<String, Object> filteredValue = new HashMap<>();
+            for (List<String> subfields : fieldsSplit) {
+              try {
+                filteredValue.putAll(getFilteredObject(o, subfields, dbColumnFamilyDefinition.getValueType()));
+              } catch (NoSuchFieldException ex) {
+                err().println("ERROR: no such field: " + subfields);
+              } catch (IllegalAccessException e) {
+                err().println("ERROR: Cannot get field from object: " + subfields);
+              }
+            }
+            sb.append(WRITER.writeValueAsString(filteredValue));
+          } else {
+            sb.append(WRITER.writeValueAsString(o));
+          }
+
           results.add(sb.toString());
         }
         logWriter.log(results, sequenceId);
-      } catch (Exception e) {
+      } catch (IOException e) {
         exception = true;
         LOG.error("Exception parse Object", e);
       }
       return null;
     }
+
+    Map<String, Object> getFilteredObject(Object o, List<String> subfields, Class<?> fieldClass)
+        throws NoSuchFieldException, IllegalAccessException {
+      Field valueClassField = getRequiredFieldFromAllFields(fieldClass, subfields.get(0));
+      Object valueObject = valueClassField.get(o);
+      int length = subfields.size();
+      Map<String, Object> valueMap = new HashMap<>();
+      if (length == 1) {
+        valueMap.put(subfields.get(0), valueObject);
+      } else {
+        Class<?> typeOfClassField;
+        try {
+          if (Collection.class.isAssignableFrom(valueClassField.getType())) {
+            typeOfClassField = (Class<?>)
+                ((ParameterizedType) valueClassField.getGenericType()).getActualTypeArguments()[0];
+          } else {
+            typeOfClassField = valueClassField.getType();
+          }
+        } catch (ClassCastException ex) {
+          typeOfClassField = valueClassField.getType();
+        }
+
+        if (Collection.class.isAssignableFrom(valueObject.getClass())) {

Review Comment:
   I have added handling for map values now, Could you please review it?



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org