Package com.alibaba.wasp.plan.action

Examples of com.alibaba.wasp.plan.action.ScanAction


    String entityTableName = "test";
    byte[] startKey = "000".getBytes();
    byte[] endKey = "111".getBytes();
    int limit = 100;
    int batch = 20;
    ScanAction action = new ScanAction(readerMode, indexTableName, entityTableName,
        startKey, endKey);
    action.addEntityColumn("test", "f", "c", DataType.STRING, Bytes.toBytes(""));
    action.addEntityColumn("test", "f", "c", DataType.STRING, Bytes.toBytes(""));
    action.setBatch(batch);
    action.setLimit(limit);
    ScanActionProto proto = ProtobufUtil.convertScanAction(action);
    action = (ScanAction) ProtobufUtil.convertScanAction(proto);
    Assert.assertTrue(readerMode == action.getReaderMode());
    Assert.assertTrue(indexTableName.equals(action.getIndexTableName()));
    Assert.assertTrue(entityTableName.equals(action.getEntityTableName()));
    Assert.assertTrue(Bytes.toString(action.getStartKey()).equals("000"));
    Assert.assertTrue(Bytes.toString(action.getEndKey()).equals("111"));
    Assert.assertTrue(action.getBatch() == batch);
    Assert.assertTrue(action.getLimit() == limit);
    Assert.assertTrue(action.getColumns().get(0).getFamilyName().equals("f")
        && action.getColumns().get(0).getColumnName().equals("c")
        && Bytes.toString(action.getColumns().get(0).getValue()).equals(""));
    Assert.assertTrue(action.getColumns().get(1).getFamilyName().equals("f")
        && action.getColumns().get(1).getColumnName().equals("c")
        && Bytes.toString(action.getColumns().get(1).getValue()).equals(""));
  }
View Full Code Here


    List<String> conditionFields = queryInfo.getAllConditionFieldName();
    // check if table has this columns
    metaEventOperation.checkAndGetFields(table, conditionFields);

    List<ColumnStruct> conditionColumns = buildAllConditionColumns(table, queryInfo);
    ScanAction scanAction = new ScanAction(table.getTableName());
    scanAction.setNotIndexConditionColumns(conditionColumns);

    DQLPlan qp = new AggregateQueryPlan(scanAction, table);
    qp.setQueryInfo(queryInfo);
    LOG.debug("QueryPlan " + qp);
    context.setPlan(qp);
View Full Code Here

      List<ColumnStruct> selectStoringColumns = columnActionPair.getSecond();
      List<ColumnStruct> conditionNotInIndex = isJustUseIndex ? Collections.<ColumnStruct>emptyList()
          : buildColumnsNotInIndex(table, index, queryInfo);

      // instance scan action.
      action = new ScanAction(context.getReadModel(),
          StorageTableNameBuilder.buildIndexTableName(index),
          table.getTableName(), startKeyAndEndKey.getFirst(),
          startKeyAndEndKey.getSecond(), selectEntityColumns);
      ((ScanAction) action).setStoringColumns(selectStoringColumns);
      ((ScanAction) action).setLimit(limit);
View Full Code Here

        throws ServiceException {
      try {
        queryResultProtos.clear();
        nameDataTypePairs.clear();
        ClientProtos.ScanResponse response = null;
        ScanAction action = plan.getAction();
        do {
          response = server.scan(null, action, scannerId == -1 ? false : true,
              scannerId, false, true, tableDesc);
          scannerId = response.getScannerId();
          resultList.addAll(response.getResultList());
View Full Code Here

    @Override
    public Pair<List<ClientProtos.QueryResultProto>, List<ClientProtos.StringDataTypePair>> execute()
        throws ServiceException {
      queryResultProtos.clear();
      nameDataTypePairs.clear();
      ScanAction action = plan.getAction();
      List<ColumnStruct> columnStructs = action.getNotIndexConditionColumns();
      AggregateInfo info = plan.getQueryInfo().getAggregateInfo();
      Scan scan = new Scan();

      scan.addColumn(Bytes.toBytes(info.getField().getFamily()),
          Bytes.toBytes(info.getField().getName()));
View Full Code Here

    @Override
    public Pair<List<ClientProtos.QueryResultProto>, List<ClientProtos.StringDataTypePair>> execute()
        throws ServiceException {
      try {
        queryResultProtos.clear();
        ScanAction action = plan.getScanAction();
        EntityGroupLocation entityGroupLocation = action
            .getEntityGroupLocation();
        EntityGroupInfo entityGroupInfo = entityGroupLocation
            .getEntityGroupInfo();
        serverName = new ServerName(entityGroupLocation.getHostname(),
            entityGroupLocation.getPort(), ServerName.NON_STARTCODE);
View Full Code Here

                  throw e;
                }
              }
            }
          } else {
            ScanAction scanAction = localQueryPlan.getScanAction();
            executeScanAction(eg, scanAction, testFTable[i]);
          }
        } else {
          GlobalQueryPlan globalQueryPlan = (GlobalQueryPlan) plan;
          ScanAction scanAction = globalQueryPlan.getAction();
          executeScanAction(eg, scanAction, testFTable[i]);
        }
      } catch (ZooKeeperConnectionException e) {
        e.printStackTrace();
        success = false;
View Full Code Here

TOP

Related Classes of com.alibaba.wasp.plan.action.ScanAction

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.