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


##########
plus/src/main/java/org/apache/calcite/adapter/os/FilesTableFunction.java:
##########
@@ -144,6 +145,49 @@ private Enumerable<String> sourceMacOs() {
         return Processes.processLines('\n', args);
       }
 
+      private Enumerable<String> sourceGnuStat() {
+        if (path.contains("'")) {
+          throw new IllegalArgumentException(SINGLE_QUOTE);
+        }
+        // GNU stat format specifiers:
+        // 
https://www.gnu.org/software/coreutils/manual/html_node/stat-invocation.html
+        // format string must have exactly 20 lines per file to match the 
schema
+        final String[] args = {"/bin/sh", "-c", "find '" + path
+              + "' | xargs stat -c '"
+              + "%X\n" // access_time
+              + "%b\n" // block_count
+              + "%Z\n" // change_time
+              + "0\n" // depth: computed later based on path
+              + "%d\n" // device
+              + "filename\n" // filename: computed later from path
+              + "%F\n" // fstype (file system type)
+              + "%G\n" // gname
+              + "%g\n" // gid
+              + "dirname\n" // dir_name: computed later from path
+              + "%i\n\n" // inode (followed by empty line for link)
+              + "%a\n" // perm
+              + "%h\n" // hard
+              + "%n\n" // path
+              + "%s\n" // size
+              + "%Y\n" // mod_time
+              + "%U\n" // user
+              + "%u\n" // uid
+              + "%F'" // type
+        };
+        return Processes.processLines('\n', args);
+      }
+
+      private boolean isGnuStat() {
+        try {
+          // BSD stat doesn't support --version, so we use this to detect GNU 
stat
+          final String[] args = {"stat", "--version"};
+          return Processes.processLines('\n', args)
+              .any(line -> line.contains("GNU coreutils"));
+        } catch (RuntimeException e) {
+          return false;

Review Comment:
   OK,There's really no problem with that,just keep current way~



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