use of org.apache.drill.common.scanner.persistence.ScanResult in project drill by axbaretto.
the class TestFormatPluginOptionExtractor method test.
@Test
public void test() {
DrillConfig config = DrillConfig.create();
ScanResult scanResult = RunTimeScan.fromPrescan(config);
FormatPluginOptionExtractor e = new FormatPluginOptionExtractor(scanResult);
Collection<FormatPluginOptionsDescriptor> options = e.getOptions();
for (FormatPluginOptionsDescriptor d : options) {
assertEquals(d.pluginConfigClass.getAnnotation(JsonTypeName.class).value(), d.typeName);
switch(d.typeName) {
case "text":
assertEquals(TextFormatConfig.class, d.pluginConfigClass);
assertEquals("(type: String, lineDelimiter: String, fieldDelimiter: String, quote: String, escape: String, comment: String, skipFirstLine: boolean, extractHeader: boolean)", d.presentParams());
break;
case "named":
assertEquals(NamedFormatPluginConfig.class, d.pluginConfigClass);
assertEquals("(type: String, name: String)", d.presentParams());
break;
case "parquet":
assertEquals(d.typeName, "(type: String, autoCorrectCorruptDates: boolean)", d.presentParams());
break;
case "json":
case "sequencefile":
case "pcap":
case "avro":
assertEquals(d.typeName, "(type: String)", d.presentParams());
break;
case "httpd":
assertEquals("(type: String, logFormat: String, timestampFormat: String)", d.presentParams());
break;
default:
fail("add validation for format plugin type " + d.typeName);
}
}
}
use of org.apache.drill.common.scanner.persistence.ScanResult in project drill by axbaretto.
the class CheckStorageConfig method checkPlanParsing.
@Test
public void checkPlanParsing() throws Exception {
DrillConfig config = DrillConfig.create();
ScanResult scan = ClassPathScanner.fromPrescan(config);
LogicalPlan plan = LogicalPlan.parse(new LogicalPlanPersistence(config, scan), DrillFileUtils.getResourceAsString("/storage_engine_plan.json"));
}
use of org.apache.drill.common.scanner.persistence.ScanResult in project drill by axbaretto.
the class CheckStorageConfig method ensureStorageEnginePickup.
@Test
public void ensureStorageEnginePickup() {
DrillConfig config = DrillConfig.create();
ScanResult scan = ClassPathScanner.fromPrescan(config);
Collection<?> engines = scan.getImplementations(StoragePluginConfig.class);
assertEquals(engines.size(), 1);
}
use of org.apache.drill.common.scanner.persistence.ScanResult in project drill by apache.
the class TestFormatPluginOptionExtractor method test.
@Test
public void test() {
DrillConfig config = DrillConfig.create();
ScanResult scanResult = RunTimeScan.fromPrescan(config);
FormatPluginOptionExtractor e = new FormatPluginOptionExtractor(scanResult);
Collection<FormatPluginOptionsDescriptor> options = e.getOptions();
for (FormatPluginOptionsDescriptor d : options) {
assertEquals(d.pluginConfigClass.getAnnotation(JsonTypeName.class).value(), d.typeName);
switch(d.typeName) {
case "text":
assertEquals(TextFormatConfig.class, d.pluginConfigClass);
assertEquals("(type: String, lineDelimiter: String, fieldDelimiter: String, quote: String, escape: String, comment: String, skipFirstLine: boolean, extractHeader: boolean)", d.presentParams());
break;
case "named":
assertEquals(NamedFormatPluginConfig.class, d.pluginConfigClass);
assertEquals("(type: String, name: String)", d.presentParams());
break;
case "parquet":
assertEquals(d.typeName, "(type: String, autoCorrectCorruptDates: boolean, enableStringsSignedMinMax: boolean, " + "blockSize: Integer, pageSize: Integer, useSingleFSBlock: Boolean, writerCompressionType: String, " + "writerLogicalTypeForDecimals: String, writerUsePrimitivesForDecimals: Boolean, " + "writerFormatVersion: String)", d.presentParams());
break;
case "json":
assertEquals(d.typeName, "(type: String)", d.presentParams());
break;
case "sequencefile":
assertEquals(d.typeName, "(type: String)", d.presentParams());
break;
case "avro":
assertEquals(d.typeName, "(type: String)", d.presentParams());
break;
case "pcap":
assertEquals(d.typeName, "(type: String, sessionizeTCPStreams: boolean)", d.presentParams());
break;
case "httpd":
assertEquals("(type: String, logFormat: String, timestampFormat: String)", d.presentParams());
break;
case "logRegex":
assertEquals(d.typeName, "(type: String, regex: String, extension: String, maxErrors: int, schema: List)", d.presentParams());
break;
default:
fail("add validation for format plugin type " + d.typeName);
}
}
}
use of org.apache.drill.common.scanner.persistence.ScanResult in project drill by apache.
the class CheckStorageConfig method checkPlanParsing.
@Test
public void checkPlanParsing() throws Exception {
DrillConfig config = DrillConfig.create();
ScanResult scan = ClassPathScanner.fromPrescan(config);
LogicalPlan plan = LogicalPlan.parse(new LogicalPlanPersistence(config, scan), DrillFileUtils.getResourceAsString("/storage_engine_plan.json"));
}
Aggregations