use of org.apache.drill.shaded.guava.com.google.common.collect.ImmutableMap in project drill by apache.
the class TestDirectoryExplorerUDFs method testDirectoryUDFsWithAndWithoutMetadataCache.
// DRILL-4720
@Test
public void testDirectoryUDFsWithAndWithoutMetadataCache() throws Exception {
// prepare test table with partitions
Path tableRelPath = Paths.get("table_with_partitions");
File tableDir = dirTestWatcher.makeRootSubDir(tableRelPath);
File dataFile = dirTestWatcher.getRootDir().toPath().resolve(Paths.get("parquet", "alltypes_required.parquet")).toFile();
createPartitions(tableDir.toPath(), dataFile, 2);
Map<String, String> configurations = ImmutableMap.<String, String>builder().put("mindir", "part_1").put("imindir", "part_1").put("maxdir", "part_2").put("imaxdir", "part_2").build();
String query = "select dir0 from dfs.`%s` where dir0 = %s('dfs', '%s') limit 1";
// run tests without metadata cache
for (Map.Entry<String, String> entry : configurations.entrySet()) {
testBuilder().sqlQuery(query, tableRelPath, entry.getKey(), tableRelPath).unOrdered().baselineColumns("dir0").baselineValues(entry.getValue()).go();
}
// generate metadata
test("refresh table metadata dfs.`%s`", tableRelPath);
// run tests with metadata cache
for (Map.Entry<String, String> entry : configurations.entrySet()) {
testBuilder().sqlQuery(query, tableRelPath, entry.getKey(), tableRelPath).unOrdered().baselineColumns("dir0").baselineValues(entry.getValue()).go();
}
}
Aggregations