luocooong commented on a change in pull request #2190:
URL: https://github.com/apache/drill/pull/2190#discussion_r598220863



##########
File path: 
contrib/format-hdf5/src/main/java/org/apache/drill/exec/store/hdf5/HDF5BatchReader.java
##########
@@ -448,26 +462,33 @@ private void projectMetadataRow(RowSetLoader rowWriter) {
     }
     for (Node node : group) {
       HDF5DrillMetadata metadataRow = new HDF5DrillMetadata();
-      metadataRow.setPath(node.getPath());
-      metadataRow.setDataType(node.getType().name());
-
-      switch (node.getType()) {
-        case DATASET:
-          attribs = getAttributes(node.getPath());
-          metadataRow.setAttributes(attribs);
-          metadata.add(metadataRow);
-          break;
-        case GROUP:
-          attribs = getAttributes(node.getPath());
-          metadataRow.setAttributes(attribs);
-          metadata.add(metadataRow);
-          if (!node.isLink()) {
-            // Links don't have metadata
-            getFileMetadata((Group) node, metadata);
-          }
-          break;
-        default:
-          logger.warn("Unknown data type: {}", node.getType());
+
+      if (node.isLink()) {
+        SoftLink link = (SoftLink) node;
+        metadataRow.setPath(link.getTargetPath());
+        metadataRow.setLink(true);
+      } else {
+        metadataRow.setPath(node.getPath());
+        metadataRow.setDataType(node.getType().name());
+        metadataRow.setLink(false);
+        switch (node.getType()) {
+          case DATASET:
+            attribs = getAttributes(node.getPath());
+            metadataRow.setAttributes(attribs);
+            metadata.add(metadataRow);
+            break;
+          case GROUP:
+            attribs = getAttributes(node.getPath());
+            metadataRow.setAttributes(attribs);
+            metadata.add(metadataRow);
+            if (!node.isLink()) {

Review comment:
       It seems that there is an unnecessary "if" logic here. Because of the 
`node.isLink()` is `false` for ever (Go to the line 466).




-- 
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.

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


Reply via email to