private static Iterator buildIteratorFromFolderPath()

in bigquery-antipattern-recognition/src/main/java/com/google/zetasql/toolkit/antipattern/cmd/AntiPatternCommandParser.java [420:435]


  private static Iterator<InputQuery> buildIteratorFromFolderPath(String folderPath) {
    logger.info("Using folder as input source");
    if (GCSHelper.isGCSPath(folderPath)) {
      logger.info("Reading input folder from GCS");
      GCSHelper gcsHelper = new GCSHelper();
      return new InputFolderQueryIterable(gcsHelper.getListOfFilesInGCSPath(folderPath));
    } else {
      logger.info("Reading input folder from local");
      List<String> fileList =
          Stream.of(new File(folderPath).listFiles())
              .filter(file -> file.isFile())
              .map(File::getAbsolutePath)
              .collect(Collectors.toList());
      return new InputFolderQueryIterable(fileList);
    }
  }