Search in sources :

Example 36 with DrillConfig

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();
}
Also used : DrillConfig(org.apache.drill.common.config.DrillConfig) Properties(java.util.Properties) DrillProperties(org.apache.drill.common.config.DrillProperties) BeforeClass(org.junit.BeforeClass)

Example 37 with DrillConfig

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();
}
Also used : DrillConfig(org.apache.drill.common.config.DrillConfig) IntVector(org.apache.drill.exec.vector.IntVector) Properties(java.util.Properties) DrillBuf(io.netty.buffer.DrillBuf) DrillTest(org.apache.drill.test.DrillTest) Test(org.junit.Test)

Example 38 with DrillConfig

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();
}
Also used : DrillConfig(org.apache.drill.common.config.DrillConfig) Properties(java.util.Properties) DrillBuf(io.netty.buffer.DrillBuf) DrillTest(org.apache.drill.test.DrillTest) Test(org.junit.Test)

Example 39 with DrillConfig

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);
}
Also used : BitVector(org.apache.drill.exec.vector.BitVector) DrillConfig(org.apache.drill.common.config.DrillConfig) Properties(java.util.Properties) DrillTest(org.apache.drill.test.DrillTest) Test(org.junit.Test)

Example 40 with DrillConfig

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()));
}
Also used : DrillConfig(org.apache.drill.common.config.DrillConfig) LogicalPlan(org.apache.drill.common.logical.LogicalPlan) LogicalPlanPersistence(org.apache.drill.common.config.LogicalPlanPersistence) Test(org.junit.Test) ExecTest(org.apache.drill.exec.ExecTest)

Aggregations

DrillConfig (org.apache.drill.common.config.DrillConfig)57 Test (org.junit.Test)35 Properties (java.util.Properties)19 DrillProperties (org.apache.drill.common.config.DrillProperties)15 Drillbit (org.apache.drill.exec.server.Drillbit)8 RemoteServiceSet (org.apache.drill.exec.server.RemoteServiceSet)8 BeforeClass (org.junit.BeforeClass)8 ScanResult (org.apache.drill.common.scanner.persistence.ScanResult)7 ExecTest (org.apache.drill.exec.ExecTest)7 LogicalPlanPersistence (org.apache.drill.common.config.LogicalPlanPersistence)6 RpcException (org.apache.drill.exec.rpc.RpcException)6 DrillbitEndpoint (org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint)5 NonTransientRpcException (org.apache.drill.exec.rpc.NonTransientRpcException)5 DrillTest (org.apache.drill.test.DrillTest)5 SchemaPath (org.apache.drill.common.expression.SchemaPath)4 BufferAllocator (org.apache.drill.exec.memory.BufferAllocator)4 DrillBuf (io.netty.buffer.DrillBuf)3 File (java.io.File)3 IOException (java.io.IOException)3 Field (java.lang.reflect.Field)3