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


##########
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:
   CI has passed, I think it is also fine,can ignore this comment.



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