@Override
  public TempTableCursor tempTableCursor(
      ExecutionContext executionContext,
      ISchematicCursor cursor,
      List<IOrderBy> orderBys,
      boolean sortedDuplicates,
      long requestID)
      throws TddlException {
    try {

      IRepository bdbRepo =
          ExecutorContext.getContext()
              .getRepositoryHolder()
              .getOrCreateRepository(
                  Group.GroupType.BDB_JE.name(),
                  Collections.EMPTY_MAP,
                  executionContext.getExtraCmds());
      return new TempTableCursor(
          bdbRepo, cursor, orderBys, sortedDuplicates, requestID, executionContext);

    } catch (Exception e) {
      closeParentCursor(cursor);
      throw new TddlException(e);
    }
  }
  @Override
  public ITempTableSortCursor tempTableSortCursor(
      ExecutionContext executionContext,
      ISchematicCursor cursor,
      List<IOrderBy> orderBys,
      boolean sortedDuplicates,
      long requestID)
      throws TddlException {
    try {
      if (GeneralUtil.getExtraCmdBoolean(
          executionContext.getExtraCmds(), ConnectionProperties.ALLOW_TEMPORARY_TABLE, false)) {

        IRepository bdbRepo =
            ExecutorContext.getContext()
                .getRepositoryHolder()
                .getOrCreateRepository(
                    Group.GroupType.BDB_JE.name(),
                    Collections.EMPTY_MAP,
                    executionContext.getExtraCmds());
        return new TempTableSortCursor(
            this, bdbRepo, cursor, orderBys, sortedDuplicates, requestID, executionContext);
      }

      throw new IllegalStateException("not allow to use temporary table . allow first");

    } catch (Exception e) {
      closeParentCursor(cursor);
      throw new TddlException(e);
    }
  }
Esempio n. 3
0
  @Test
  public void initTestRuleSchemaManager() throws TddlException {
    ExecutorContext executorContext = new ExecutorContext();
    ExecutorContext.setContext(executorContext);
    TopologyHandler topology =
        new TopologyHandler("andor_show", null, "test_matrix_without_group_config.xml");
    executorContext.setTopologyHandler(topology);

    topology.init();
    TddlRule rule = new TddlRule();
    rule.setAppName("andor_show");
    rule.init();

    OptimizerRule optimizerRule = new OptimizerRule(rule);
    RuleSchemaManager s = new RuleSchemaManager(optimizerRule, topology.getMatrix());
    s.init();
    Assert.assertTrue(s.getTable("BMW_USERS") != null);
  }
Esempio n. 4
0
  @Test
  public void initTestStaticSchemaManagerWithSchemaFile() throws TddlException {
    ExecutorContext executorContext = new ExecutorContext();
    ExecutorContext.setContext(executorContext);
    StaticSchemaManager s = new StaticSchemaManager("test_schema.xml", "andor_show", null);
    s.init();

    Assert.assertTrue(s.getTable("BMW_USERS") != null);
    Assert.assertEquals(9, s.getAllTables().size());
  }
  @Override
  public TempTableCursor tempTableCursor(
      ExecutionContext executionContext,
      IQueryTree plan,
      List<IOrderBy> orderBys,
      boolean sortedDuplicates,
      long requestID)
      throws TddlException {

    IRepository bdbRepo =
        ExecutorContext.getContext()
            .getRepositoryHolder()
            .getOrCreateRepository(
                Group.GroupType.BDB_JE.name(),
                Collections.EMPTY_MAP,
                executionContext.getExtraCmds());
    return new TempTableCursor(bdbRepo, plan, sortedDuplicates, requestID, executionContext);
  }