src/main/java/org/apache/hadoop/hdfs/server/namenode/analytics/sql/SqlParser.java
public String describeInJson(String describe) {
    Gson gson = new Gson();
    Type type = new TypeToken<Map<String, List<String>>>() {}.getType();
    if (describe.toUpperCase().contains("DESCRIBE")) {
      boolean filesCheck = describe.toUpperCase().contains("FILES");
      boolean dirsCheck = describe.toUpperCase().contains("DIRS");
      if (filesCheck) {
        Map<String, List<String>> filesDescription =
            new LinkedHashMap<String, List<String>>() {
              {
                put(
                    "WHERE_CONDITIONS",
                    Constants.FILTER_FILE.stream().map(Enum::name).collect(Collectors.toList()));
                put(
                    "GROUP_BYS",
                    Constants.TYPE_FILE.stream().map(Enum::name).collect(Collectors.toList()));
                put(
                    "SUM_FIELDS",
                    Constants.SUM_FILE.stream().map(Enum::name).collect(Collectors.toList()));
                put(
                    "MIN_MAX_AVG_FIELDS",
                    Constants.FIND_FILE.stream().map(Enum::name).collect(Collectors.toList()));
              }
            };
        return gson.toJson(filesDescription, type);
      }
      if (dirsCheck) {
        Map<String, List<String>> dirsDescription =
            new LinkedHashMap<String, List<String>>() {
              {
                put(
                    "WHERE_CONDITIONS",
                    Constants.FILTER_DIR.stream().map(Enum::name).collect(Collectors.toList()));
                put(
                    "GROUP_BYS",
                    Constants.TYPE_DIR.stream().map(Enum::name).collect(Collectors.toList()));
                put(
                    "SUM_FIELDS",
                    Constants.SUM_DIR.stream().map(Enum::name).collect(Collectors.toList()));
                put(
                    "MIN_MAX_AVG_FIELDS",
                    Constants.FIND_DIR.stream().map(Enum::name).collect(Collectors.toList()));
              }
            };
        return gson.toJson(dirsDescription, type);
      }
    }
    throw new IllegalArgumentException();
  }
/**
   * Describes either the files or directories options available.
   *
   * @param describe The entity to describe. Either files or dirs.
   * @return The JSON string dictating the options available.
   */
Describes either the files or directories options available.
@param describe The entity to describe. Either files or dirs.
@return The JSON string dictating the options available.
Describes either the files or directories options available . @param describe The entity to describe . Either files or dirs . @return The JSON string dictating the options available .
public String describeInJson(String describe) {
    Gson gson = new Gson();
    Type type = new TypeToken<Map<String, List<String>>>() {}.getType();
    if (describe.toUpperCase().contains("DESCRIBE")) {
      boolean filesCheck = describe.toUpperCase().contains("FILES");
      boolean dirsCheck = describe.toUpperCase().contains("DIRS");
      if (filesCheck) {
        Map<String, List<String>> filesDescription =
            new LinkedHashMap<String, List<String>>() {
              {
                put(
                    "WHERE_CONDITIONS",
                    Constants.FILTER_FILE.stream().map(Enum::name).collect(Collectors.toList()));
                put(
                    "GROUP_BYS",
                    Constants.TYPE_FILE.stream().map(Enum::name).collect(Collectors.toList()));
                put(
                    "SUM_FIELDS",
                    Constants.SUM_FILE.stream().map(Enum::name).collect(Collectors.toList()));
                put(
                    "MIN_MAX_AVG_FIELDS",
                    Constants.FIND_FILE.stream().map(Enum::name).collect(Collectors.toList()));
              }
            };
        return gson.toJson(filesDescription, type);
      }
      if (dirsCheck) {
        Map<String, List<String>> dirsDescription =
            new LinkedHashMap<String, List<String>>() {
              {
                put(
                    "WHERE_CONDITIONS",
                    Constants.FILTER_DIR.stream().map(Enum::name).collect(Collectors.toList()));
                put(
                    "GROUP_BYS",
                    Constants.TYPE_DIR.stream().map(Enum::name).collect(Collectors.toList()));
                put(
                    "SUM_FIELDS",
                    Constants.SUM_DIR.stream().map(Enum::name).collect(Collectors.toList()));
                put(
                    "MIN_MAX_AVG_FIELDS",
                    Constants.FIND_DIR.stream().map(Enum::name).collect(Collectors.toList()));
              }
            };
        return gson.toJson(dirsDescription, type);
      }
    }
    throw new IllegalArgumentException();
  }
public String describeInJson ( String describe ) { Gson gson = new Gson ( ) ; Type type = new TypeToken < Map < String , List < String > > > ( ) { } . getType ( ) ; if ( describe . toUpperCase ( ) . contains ( "DESCRIBE" ) ) { boolean filesCheck = describe . toUpperCase ( ) . contains ( "FILES" ) ; boolean dirsCheck = describe . toUpperCase ( ) . contains ( "DIRS" ) ; if ( filesCheck ) { Map < String , List < String > > filesDescription = new LinkedHashMap < String , List < String > > ( ) { { put ( "WHERE_CONDITIONS" , Constants . FILTER_FILE . stream ( ) . map ( Enum :: name ) . collect ( Collectors . toList ( ) ) ) ; put ( "GROUP_BYS" , Constants . TYPE_FILE . stream ( ) . map ( Enum :: name ) . collect ( Collectors . toList ( ) ) ) ; put ( "SUM_FIELDS" , Constants . SUM_FILE . stream ( ) . map ( Enum :: name ) . collect ( Collectors . toList ( ) ) ) ; put ( "MIN_MAX_AVG_FIELDS" , Constants . FIND_FILE . stream ( ) . map ( Enum :: name ) . collect ( Collectors . toList ( ) ) ) ; } } ; return gson . toJson ( filesDescription , type ) ; } if ( dirsCheck ) { Map < String , List < String > > dirsDescription = new LinkedHashMap < String , List < String > > ( ) { { put ( "WHERE_CONDITIONS" , Constants . FILTER_DIR . stream ( ) . map ( Enum :: name ) . collect ( Collectors . toList ( ) ) ) ; put ( "GROUP_BYS" , Constants . TYPE_DIR . stream ( ) . map ( Enum :: name ) . collect ( Collectors . toList ( ) ) ) ; put ( "SUM_FIELDS" , Constants . SUM_DIR . stream ( ) . map ( Enum :: name ) . collect ( Collectors . toList ( ) ) ) ; put ( "MIN_MAX_AVG_FIELDS" , Constants . FIND_DIR . stream ( ) . map ( Enum :: name ) . collect ( Collectors . toList ( ) ) ) ; } } ; return gson . toJson ( dirsDescription , type ) ; } } throw new IllegalArgumentException ( ) ; }
Describes either the files or directories options available.
Describes either the files or directories options available .