asolimando commented on code in PR #4672:
URL: https://github.com/apache/calcite/pull/4672#discussion_r2606980660


##########
plus/src/main/java/org/apache/calcite/adapter/os/FilesTableFunction.java:
##########
@@ -207,12 +252,25 @@ private Enumerable<String> sourceMacOs() {
                     current[9] = ""; // dir_name
                   }
 
-                  // Make type values more like those on Linux
-                  final String type = (String) current[19];
-                  current[19] = "/".equals(type) ? "d"
-                      : "".equals(type) || "*".equals(type) ? "f"
-                      : "@".equals(type) ? "l"
-                      : type;
+                  // detect output format: BSD outputs single chars, GNU 
outputs words
+                  final String type = requireNonNull((String) current[19]);
+                  if (type.length() > 1) {
+                    // GNU stat outputs descriptive types like "regular file", 
"directory"
+                    current[19] = type.contains("directory") ? "d"
+                        : type.contains("regular") ? "f"
+                        : type.contains("symbolic") ? "l"
+                        : type.contains("block") ? "b"
+                        : type.contains("character") ? "c"
+                        : type.contains("fifo") ? "p"
+                        : type.contains("socket") ? "s"
+                        : "?";

Review Comment:
   Checkstyle is fine with it, so maybe instead of indentation you are talking 
about the three-way conditional? I tried to follow the style within the file 
itself, but if you feel strongly I can rework 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to