private RelMetadataProvider init(HiveConf hiveConf, List<Class<? extends RelNode>> nodeClasses) {
    // Create cost metadata provider
    if (HiveConf.getVar(hiveConf, HiveConf.ConfVars.HIVE_EXECUTION_ENGINE).equals("tez")
        && HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVE_CBO_EXTENDED_COST_MODEL)) {
      // Get max split size for HiveRelMdParallelism
      final Double maxSplitSize = (double) HiveConf.getLongVar(
          hiveConf, HiveConf.ConfVars.MAPRED_MAX_SPLIT_SIZE);

      // Create and return metadata provider
      JaninoRelMetadataProvider metadataProvider = JaninoRelMetadataProvider.of(
          ChainedRelMetadataProvider.of(
              ImmutableList.of(
                  HiveRelMdDistinctRowCount.SOURCE,
                  HiveRelMdCumulativeCost.SOURCE,
                  new HiveRelMdCost(HiveOnTezCostModel.getCostModel(hiveConf)).getMetadataProvider(),
                  HiveRelMdSelectivity.SOURCE,
                  HiveRelMdRowCount.SOURCE,
                  HiveRelMdUniqueKeys.SOURCE,
                  HiveRelMdColumnUniqueness.SOURCE,
                  HiveRelMdExpressionLineage.SOURCE,
                  HiveRelMdSize.SOURCE,
                  HiveRelMdMemory.SOURCE,
                  new HiveRelMdParallelism(maxSplitSize).getMetadataProvider(),
                  HiveRelMdDistribution.SOURCE,
                  HiveRelMdCollation.SOURCE,
                  HiveRelMdPredicates.SOURCE,
                  HiveRelMdTableReferences.SOURCE,
                  HiveRelMdAggregatedColumns.SOURCE,
                  JaninoRelMetadataProvider.DEFAULT)));

      if (nodeClasses != null) {
        // If classes were passed, pre-register them
        metadataProvider.register(nodeClasses);
      }

      return metadataProvider;
    }

    return DEFAULT;
  }
The default metadata provider can be instantiated statically since
it does not need any parameter specified by user (hive conf).
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveDefaultRelMetadataProvider.java