use of org.apache.drill.common.config.DrillConfig in project drill by apache.
the class TestInboundImpersonation method setup.
@BeforeClass
public static void setup() throws Exception {
startMiniDfsCluster(TestInboundImpersonation.class.getSimpleName());
final DrillConfig newConfig = new DrillConfig(DrillConfig.create(cloneDefaultTestConfigProperties()).withValue(ExecConstants.USER_AUTHENTICATION_ENABLED, ConfigValueFactory.fromAnyRef(true)).withValue(ExecConstants.USER_AUTHENTICATOR_IMPL, ConfigValueFactory.fromAnyRef(UserAuthenticatorTestImpl.TYPE)).withValue(ExecConstants.IMPERSONATION_ENABLED, ConfigValueFactory.fromAnyRef(true)), false);
final Properties connectionProps = new Properties();
connectionProps.setProperty(DrillProperties.USER, "anonymous");
connectionProps.setProperty(DrillProperties.PASSWORD, "anything works!");
updateTestCluster(1, newConfig, connectionProps);
addMiniDfsBasedStorage(createTestWorkspaces());
createTestData();
}
use of org.apache.drill.common.config.DrillConfig in project drill by apache.
the class TestAllocators method ensureDrillBufReadIndexIsZero.
/**
* Contract for DrillBuf[] returned from getBuffers() is that buffers are returned in a reader appropriate state
* (i.e., readIndex = 0)
*
* Before this patch, the following scenario breaks this contract:
* As data being read from DrillBuf, readIndex will be pushed forward. And, later on,
* when DrillBuf[] are read from the ValueVector, readIndex will point at the location of the most recent reading
*
* This unit test is added to ensure that the readIndex points at zero under this scenario
*/
// DRILL-3854
@Test
public void ensureDrillBufReadIndexIsZero() throws Exception {
final int length = 10;
final Properties props = new Properties() {
{
put(RootAllocatorFactory.TOP_LEVEL_MAX_ALLOC, "1000000");
}
};
final DrillConfig config = DrillConfig.create(props);
final BufferAllocator allc = RootAllocatorFactory.newRoot(config);
final TypeProtos.MajorType.Builder builder = TypeProtos.MajorType.newBuilder();
builder.setMinorType(TypeProtos.MinorType.INT);
builder.setMode(TypeProtos.DataMode.REQUIRED);
final IntVector iv = new IntVector(MaterializedField.create("Field", builder.build()), allc);
iv.allocateNew();
// Write data to DrillBuf
for (int i = 0; i < length; ++i) {
iv.getBuffer().writeInt(i);
}
// Read data to DrillBuf
for (int i = 0; i < length; ++i) {
assertEquals(i, iv.getBuffer().readInt());
}
for (DrillBuf drillBuf : iv.getBuffers(false)) {
assertEquals(0, drillBuf.readInt());
}
final List<DrillBuf> toBeClean = Lists.newArrayList();
for (DrillBuf drillBuf : iv.getBuffers(true)) {
assertEquals(0, drillBuf.readInt());
toBeClean.add(drillBuf);
}
for (DrillBuf drillBuf : toBeClean) {
drillBuf.release();
}
allc.close();
}
use of org.apache.drill.common.config.DrillConfig in project drill by apache.
the class TestAllocators method testTransfer.
@Test
public void testTransfer() throws Exception {
final Properties props = new Properties() {
{
put(RootAllocatorFactory.TOP_LEVEL_MAX_ALLOC, "1049600");
}
};
final DrillConfig config = DrillConfig.create(props);
BufferAllocator a = RootAllocatorFactory.newRoot(config);
BufferAllocator a1 = a.newChildAllocator("a1", 0, Integer.MAX_VALUE);
BufferAllocator a2 = a.newChildAllocator("a2", 0, Integer.MAX_VALUE);
DrillBuf buf1 = a1.buffer(1_000_000);
DrillBuf buf2 = a2.buffer(1_000);
DrillBuf buf3 = buf1.transferOwnership(a2).buffer;
buf1.release();
buf2.release();
buf3.release();
a1.close();
a2.close();
a.close();
}
use of org.apache.drill.common.config.DrillConfig in project drill by apache.
the class TestAllocators method testClearBitVector.
@Test
public void testClearBitVector() {
final Properties props = new Properties() {
{
put(RootAllocatorFactory.TOP_LEVEL_MAX_ALLOC, "1000000");
}
};
final DrillConfig config = DrillConfig.create(props);
final BufferAllocator allc = RootAllocatorFactory.newRoot(config);
final TypeProtos.MajorType.Builder builder = TypeProtos.MajorType.newBuilder();
builder.setMinorType(TypeProtos.MinorType.BIT);
builder.setMode(TypeProtos.DataMode.REQUIRED);
final BitVector bv = new BitVector(MaterializedField.create("Field", builder.build()), allc);
bv.getMutator().setValueCount(1);
assertEquals(bv.getAccessor().getValueCount(), 1);
bv.clear();
assertEquals(bv.getAccessor().getValueCount(), 0);
}
use of org.apache.drill.common.config.DrillConfig in project drill by apache.
the class BasicOptimizerTest method parseSimplePlan.
@Test
public void parseSimplePlan() throws Exception {
DrillConfig c = DrillConfig.create();
LogicalPlanPersistence lpp = PhysicalPlanReaderTestFactory.defaultLogicalPlanPersistence(c);
LogicalPlan plan = LogicalPlan.parse(lpp, FileUtils.getResourceAsString("/scan_screen_logical.json"));
String unparse = plan.unparse(lpp);
// System.out.println(unparse);
//System.out.println( new BasicOptimizer(DrillConfig.create()).convert(plan).unparse(c.getMapper().writer()));
}
Aggregations