@Disabled("Testing parallelism only")
  @Test
  void testParallelism() throws ParseException {
    int ITERATIONS = 1000000;

    List<Pair<Table, HiveRelOptMaterialization>> testData = new ArrayList<>();
    for (int i = 0; i < 10; ++i) {
      Table table = new Table(new org.apache.hadoop.hive.metastore.api.Table());
      table.setDbName("default");
      table.setTableName("mat" + i);
      table.setViewExpandedText("select col0 from t" + i);
      HiveRelOptMaterialization materialization = createMaterialization(table);
      testData.add(new Pair<>(table, materialization));
    }
    for (int i = 0; i < 10; ++i) {
      Table table = new Table(new org.apache.hadoop.hive.metastore.api.Table());
      table.setDbName("db1");
      table.setTableName("mat" + i);
      table.setViewExpandedText("select col0 from t" + i);
      HiveRelOptMaterialization materialization = createMaterialization(table);
      testData.add(new Pair<>(table, materialization));
    }

    List<Callable<Void>> callableList = new ArrayList<>();
    callableList.add(() -> {
      for (Pair<Table, HiveRelOptMaterialization> entry : testData) {
        materializedViewsCache.refresh(entry.left, entry.left, entry.right);
      }
      return null;
    });
    callableList.add(() -> {
      for (int j = 0; j < ITERATIONS; ++j) {
        for (Pair<Table, HiveRelOptMaterialization> entry : testData) {
          materializedViewsCache.remove(entry.left);
          materializedViewsCache.putIfAbsent(entry.left, entry.right);
        }
      }
      return null;
    });
    for (Pair<Table, HiveRelOptMaterialization> entry : testData) {
      callableList.add(() -> {
        for (int j = 0; j < ITERATIONS; ++j) {
          materializedViewsCache.get(entry.right.getAst());
        }
        return null;
      });
    }
    callableList.add(() -> {
      for (int j = 0; j < ITERATIONS; ++j) {
        List<HiveRelOptMaterialization> materializations = materializedViewsCache.values();
      }
      return null;
    });


    ExecutorService executor = Executors.newFixedThreadPool(12);
    try {
      executor.invokeAll(callableList);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
  }
Functional and parallel execution tests for {@link MaterializedViewsCache}.
Parallel execution test is disabled by default.
ql/src/test/org/apache/hadoop/hive/ql/metadata/TestMaterializedViewsCache.java