diff options
Diffstat (limited to 'exec/java-exec/src/test/java/org/apache/drill/PlanTestBase.java')
-rw-r--r-- | exec/java-exec/src/test/java/org/apache/drill/PlanTestBase.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/exec/java-exec/src/test/java/org/apache/drill/PlanTestBase.java b/exec/java-exec/src/test/java/org/apache/drill/PlanTestBase.java index 247d7842e..da257c02c 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/PlanTestBase.java +++ b/exec/java-exec/src/test/java/org/apache/drill/PlanTestBase.java @@ -20,15 +20,20 @@ package org.apache.drill; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; import java.util.List; import java.util.Stack; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.commons.io.FileUtils; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.exec.record.RecordBatchLoader; import org.apache.drill.exec.record.VectorWrapper; import org.apache.drill.exec.rpc.user.QueryDataBatch; +import org.apache.drill.exec.store.parquet.metadata.Metadata; import org.apache.drill.exec.vector.NullableVarCharVector; import org.apache.drill.exec.vector.ValueVector; import org.apache.calcite.sql.SqlExplain.Depth; @@ -317,6 +322,26 @@ public class PlanTestBase extends BaseTestQuery { testPhysical(plan); } + /** + * Helper method for checking the metadata file existence + * + * @param table table name or table path + */ + public static void checkForMetadataFile(String table) { + final String tmpDir; + + try { + tmpDir = dirTestWatcher.getRootDir().getCanonicalPath(); + } catch (IOException e) { + throw new RuntimeException(e); + } + + File metaFile = table.startsWith(tmpDir) ? FileUtils.getFile(table, Metadata.METADATA_FILENAME) + : FileUtils.getFile(tmpDir, table, Metadata.METADATA_FILENAME); + assertTrue(String.format("There is no metadata cache file for the %s table", table), + Files.exists(metaFile.toPath())); + } + /* * This will get the plan (either logical or physical) in Optiq RelNode * format, based on SqlExplainLevel and Depth. |