OrderByRelBuilder addRelDistribution(ASTNode distributeByAST) throws SemanticException {
      if (distributeByAST != null) {
        Builder<Integer> keys = ImmutableList.builder();
        for (int i = 0; i < distributeByAST.getChildCount(); ++i) {
          ASTNode keyAST = (ASTNode) distributeByAST.getChild(i);
          int fieldIndex = genSortByKey(keyAST);
          if (fieldIndex >= 0) {
            keys.add(fieldIndex);
          }
        }
        ImmutableList<Integer> keyList = keys.build();
        if (!keyList.isEmpty()) {
          hiveRelDistribution = new HiveRelDistribution(RelDistribution.Type.HASH_DISTRIBUTED, keyList);
          return this;
        }
      }
      // In case of SORT BY we do not need Distribution
      // but the instance RelDistributions.ANY can not be used here because
      // org.apache.calcite.rel.core.Exchange has
      // assert distribution != RelDistributions.ANY;
      hiveRelDistribution = new HiveRelDistribution(RelDistribution.Type.ANY, RelDistributions.ANY.getKeys());
      return this;
    }
This method can be called at startup time to pre-register all the
additional Hive classes (compared to Calcite core classes) that may
be visited during the planning phase in the metadata providers
and the field trimmer.
ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java