Package org.apache.drill.common.config

Examples of org.apache.drill.common.config.DrillConfig


public class Simple {
  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Simple.class);
 
  public static void main(String[] args) throws Exception {
    DrillConfig c = DrillConfig.create();
    LogicalPlan plan = LogicalPlan.parse(c, FileUtils.getResourceAsString("/jdbc_plan.json"));
    System.out.println(plan.toJsonString(c));
  }
View Full Code Here


  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RunSimplePlan.class);
 
 
  @Test
  public void parseSimplePlan() throws Throwable{
    DrillConfig config = DrillConfig.create();
    LogicalPlan plan = LogicalPlan.parse(config, Files.toString(FileUtils.getResourceAsFile("/simple_plan.json"), Charsets.UTF_8));
    IteratorRegistry ir = new IteratorRegistry();
    ReferenceInterpreter i = new ReferenceInterpreter(plan, ir, new BasicEvaluatorFactory(ir), new RSERegistry(config));
    i.setup();
    Collection<RunOutcome> outcomes = i.run();
View Full Code Here

    assertEquals(outcomes.iterator().next().records, 2);
  }
 
  @Test
  public void joinPlan() throws Throwable{
    DrillConfig config = DrillConfig.create();
    LogicalPlan plan = LogicalPlan.parse(config, Files.toString(FileUtils.getResourceAsFile("/simple_join.json"), Charsets.UTF_8));
    IteratorRegistry ir = new IteratorRegistry();
    ReferenceInterpreter i = new ReferenceInterpreter(plan, ir, new BasicEvaluatorFactory(ir), new RSERegistry(config));
    i.setup();
    Collection<RunOutcome> outcomes = i.run();
View Full Code Here

    if(out.outcome != OutcomeType.FAILED && out.exception != null) logger.error("Failure while running {}", out.exception);
  }
 
  @Test
  public void flattenPlan() throws Throwable{
    DrillConfig config = DrillConfig.create();
    LogicalPlan plan = LogicalPlan.parse(config, Files.toString(FileUtils.getResourceAsFile("/simple_plan_flattened.json"), Charsets.UTF_8));
    IteratorRegistry ir = new IteratorRegistry();
    ReferenceInterpreter i = new ReferenceInterpreter(plan, ir, new BasicEvaluatorFactory(ir), new RSERegistry(config));
    i.setup();
    Collection<RunOutcome> outcomes = i.run();
View Full Code Here

    // not sure if we want to keep this as a test and check the results. Now that the internals of the ConstantROP work
    // it might now be worth running the reference intepreter with every build
    @Test
    @Ignore // this plan needs to be updated.
    public void testRefInterp() throws Exception{
            DrillConfig config = DrillConfig.create();
            final String jsonFile = "/constant2.json";
            LogicalPlan plan = LogicalPlan.parse(config, FileUtils.getResourceAsString(jsonFile));
            org.junit.Assert.assertEquals("Constant operator not read in properly or not recognized as a source operator.",
                    plan.getGraph().getLeaves().toString(), "[Constant [memo=null]]");
View Full Code Here

public class RSERegistryTest {

  @Test
  public void testEnginesWithTheSameNameAreEqual() {
    DrillConfig config = DrillConfig.create();
    RSERegistry rses = new RSERegistry(config);
    StorageEngineConfig hconfig = new ConsoleRSE.ConsoleRSEConfig();
    ConsoleRSE engine = (ConsoleRSE) rses.getEngine(hconfig);
    ConsoleRSE engine2 = (ConsoleRSE) rses.getEngine(hconfig);
    assertSame(engine, engine2);
View Full Code Here

   * @param resourcePath path for json plan file
   * @param recordCount expected record count
   * @throws Exception
   */
  public static void assertProduceCount(String resourcePath, int recordCount) throws Exception {
    DrillConfig config = getConfigWithQueue(0);
    Collection<RunOutcome> outcomes = getOutcome(config, resourcePath);
    assertEquals(recordCount, outcomes.iterator().next().records);
  }
View Full Code Here

    i.setup();
    return i.run();
  }
 
  private static DrillConfig getConfigWithQueue(int queueNumber){
    DrillConfig config = DrillConfig.create();
    final BlockingQueue<Object> queue = new ArrayBlockingQueue<Object>(100);
    config.setSinkQueues(queueNumber, queue);
    return config;
  }
View Full Code Here

  }
 
 
 
  public static List<UnbackedRecord> getResultAsUnbackedRecords(String resourcePath) throws Exception{
    DrillConfig config = getConfigWithQueue(0);
    Collection<RunOutcome> outcomes = getOutcome(config, resourcePath);
    if(outcomes.size() != 1) throw new Exception("Only supports logical plans that provide a single outcome.");
    RunOutcome out = outcomes.iterator().next();
    switch(out.outcome){
    case CANCELED:
    case FAILED:
      if(out.exception != null) throw (Exception) out.exception;
      throw new Exception("Failure while running query.");
    }
    Object o;
    Queue<Object> q = config.getQueue(0);
    List<UnbackedRecord> records = Lists.newArrayList();
    while( (o = q.poll()) != null){
      if(o instanceof OutcomeType) continue;
      if( !(o instanceof UnbackedRecord) ) throw new Exception(String.format("This method only works when the QueueRSE is configured to use RECORD encoding.  One of the queue objects was of type %s", o.getClass().getCanonicalName()));
      records.add( (UnbackedRecord) o);
View Full Code Here

   
  }
 
 
  public static void main(String[] args) throws Exception{
    DrillConfig config = DrillConfig.create();
    int arg = 0;
    final BlockingQueue<Object> queue;
    if (arg < args.length && args[arg].equals("--stdout")) {
      ++arg;
      queue = new ArrayBlockingQueue<>(100);
      config.setSinkQueues(0, queue);
    } else {
      queue = null;
    }
    final String jsonFile = args[arg];
    final String planString;
View Full Code Here

TOP

Related Classes of org.apache.drill.common.config.DrillConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.