use of org.apache.drill.common.exceptions.UserException in project drill by apache.
the class FragmentExecutor method sendFinalState.
private void sendFinalState() {
final FragmentState outcome = fragmentState.get();
if (outcome == FragmentState.FAILED) {
final FragmentHandle handle = getContext().getHandle();
final UserException uex = UserException.systemError(deferredException.getAndClear()).addIdentity(getContext().getEndpoint()).addContext("Fragment", handle.getMajorFragmentId() + ":" + handle.getMinorFragmentId()).build(logger);
statusReporter.fail(uex);
} else {
statusReporter.stateChanged(outcome);
}
statusReporter.close();
}
use of org.apache.drill.common.exceptions.UserException in project drill by apache.
the class TestReaderLevelProjection method testArrayMismatch.
/**
* Project of a non-array as an array
*/
@Test
public void testArrayMismatch() {
// Simulate SELECT a[0] ...
final ScanLevelProjection scanProj = ScanLevelProjection.build(RowSetTestUtils.projectList("a[0]"), ScanTestUtils.parsers());
// Simulate a data source, with early schema, of (a)
// where a is not an array.
final TupleMetadata tableSchema = new SchemaBuilder().add("a", MinorType.VARCHAR).buildSchema();
final NullColumnBuilder builder = new NullBuilderBuilder().build();
final ResolvedRow rootTuple = new ResolvedRow(builder);
try {
new ExplicitSchemaProjection(scanProj, tableSchema, rootTuple, ScanTestUtils.resolvers());
fail();
} catch (final UserException e) {
// Expected
}
}
use of org.apache.drill.common.exceptions.UserException in project drill by apache.
the class TestReaderLevelProjection method testMapMismatch.
/**
* Project of a non-map as a map
*/
@Test
public void testMapMismatch() {
// Simulate SELECT a.b ...
final ScanLevelProjection scanProj = ScanLevelProjection.build(RowSetTestUtils.projectList("a.b"), ScanTestUtils.parsers());
// Simulate a data source, with early schema, of (a)
// where a is not a map.
final TupleMetadata tableSchema = new SchemaBuilder().add("a", MinorType.VARCHAR).buildSchema();
final NullColumnBuilder builder = new NullBuilderBuilder().build();
final ResolvedRow rootTuple = new ResolvedRow(builder);
try {
new ExplicitSchemaProjection(scanProj, tableSchema, rootTuple, ScanTestUtils.resolvers());
fail();
} catch (final UserException e) {
// Expected
}
}
use of org.apache.drill.common.exceptions.UserException in project drill by apache.
the class TestScanLevelProjection method testProvidedSchemaTypeMismatch.
@Test
public void testProvidedSchemaTypeMismatch() {
TupleMetadata providedSchema = new SchemaBuilder().add("a", MinorType.INT).add("b", MinorType.BIGINT).buildSchema();
final ScanLevelProjection scanProj = ScanLevelProjection.build(RowSetTestUtils.projectAll(), ScanTestUtils.parsers(), providedSchema);
// Make up a reader schema and test the projection set.
// Schema deliberately conflicts with the provided schema.
TupleMetadata readerSchema = new SchemaBuilder().add("a", MinorType.INT).add("b", MinorType.INT).add("c", MinorType.INT).buildSchema();
ProjectionFilter projSet = scanProj.readerProjection();
assertTrue(projSet.isProjected("b"));
try {
projSet.projection(readerSchema.metadata("b"));
fail();
} catch (UserException e) {
// Expected
}
}
use of org.apache.drill.common.exceptions.UserException in project drill by apache.
the class TestScanLevelProjection method testProvidedSchemaModeMismatch.
@Test
public void testProvidedSchemaModeMismatch() {
TupleMetadata providedSchema = new SchemaBuilder().add("a", MinorType.INT).add("b", MinorType.BIGINT).buildSchema();
providedSchema.setProperty(TupleMetadata.IS_STRICT_SCHEMA_PROP, Boolean.TRUE.toString());
final ScanLevelProjection scanProj = ScanLevelProjection.build(RowSetTestUtils.projectAll(), ScanTestUtils.parsers(), providedSchema);
// Make up a reader schema and test the projection set.
// Mode deliberately conflicts with the provided schema
TupleMetadata readerSchema = new SchemaBuilder().add("a", MinorType.INT).addNullable("b", MinorType.INT).add("c", MinorType.INT).buildSchema();
ProjectionFilter projSet = scanProj.readerProjection();
assertTrue(projSet.isProjected("b"));
try {
isProjected(projSet, readerSchema.metadata("b"));
fail();
} catch (UserException e) {
// Expected
}
}
Aggregations