Package org.apache.tajo.conf

Examples of org.apache.tajo.conf.TajoConf


    for (int i = 0 ; i < sortSpecs.length; i++) {
      col = sortSpecs[i].getSortKey();
      indexKeys[i] = inSchema.getColumnId(col.getQualifiedName());
    }

    BSTIndex bst = new BSTIndex(new TajoConf());
    this.comp = new TupleComparator(keySchema, sortSpecs);
    Path storeTablePath = new Path(context.getWorkDir(), "output");
    LOG.info("Output data directory: " + storeTablePath);
    this.meta = CatalogUtil.newTableMeta(context.getDataChannel() != null ?
        context.getDataChannel().getStoreType() : CatalogProtos.StoreType.RAW);
View Full Code Here


      return state;
    }

    private void initTaskScheduler(SubQuery subQuery) throws IOException {
      TajoConf conf = subQuery.context.getConf();
      subQuery.schedulerContext = new TaskSchedulerContext(subQuery.context,
          subQuery.getMasterPlan().isLeaf(subQuery.getId()), subQuery.getId());
      subQuery.taskScheduler = TaskSchedulerFactory.get(conf, subQuery.schedulerContext, subQuery);
      subQuery.taskScheduler.init(conf);
      LOG.info(subQuery.taskScheduler.getName() + " is chosen for the task scheduling for " + subQuery.getId());
View Full Code Here

     *
     * @param subQuery
     * @return
     */
    public static int calculateShuffleOutputNum(SubQuery subQuery, DataChannel channel) {
      TajoConf conf = subQuery.context.getConf();
      MasterPlan masterPlan = subQuery.getMasterPlan();
      ExecutionBlock parent = masterPlan.getParent(subQuery.getBlock());

      GroupbyNode grpNode = null;
      if (parent != null) {
        grpNode = PlannerUtil.findMostBottomNode(parent.getPlan(), NodeType.GROUP_BY);
      }

      // Is this subquery the first step of join?
      if (parent != null && parent.getScanNodes().length == 2) {
        List<ExecutionBlock> childs = masterPlan.getChilds(parent);

        // for outer
        ExecutionBlock outer = childs.get(0);
        long outerVolume = getInputVolume(subQuery.masterPlan, subQuery.context, outer);

        // for inner
        ExecutionBlock inner = childs.get(1);
        long innerVolume = getInputVolume(subQuery.masterPlan, subQuery.context, inner);
        LOG.info(subQuery.getId() + ", Outer volume: " + Math.ceil((double) outerVolume / 1048576) + "MB, "
            + "Inner volume: " + Math.ceil((double) innerVolume / 1048576) + "MB");

        long bigger = Math.max(outerVolume, innerVolume);

        int mb = (int) Math.ceil((double) bigger / 1048576);
        LOG.info(subQuery.getId() + ", Bigger Table's volume is approximately " + mb + " MB");

        int taskNum = (int) Math.ceil((double) mb /
            conf.getIntVar(ConfVars.DIST_QUERY_JOIN_PARTITION_VOLUME));

        int totalMem = getClusterTotalMemory(subQuery);
        LOG.info(subQuery.getId() + ", Total memory of cluster is " + totalMem + " MB");
        int slots = Math.max(totalMem / conf.getIntVar(ConfVars.TASK_DEFAULT_MEMORY), 1);

        // determine the number of task
        taskNum = Math.min(taskNum, slots);
        LOG.info(subQuery.getId() + ", The determined number of join partitions is " + taskNum);

        // The shuffle output numbers of join may be inconsistent by execution block order.
        // Thus, we need to compare the number with DataChannel output numbers.
        // If the number is right, the number and DataChannel output numbers will be consistent.
        int outerShuffleOutptNum = 0, innerShuffleOutputNum = 0;
        for (DataChannel eachChannel : masterPlan.getOutgoingChannels(outer.getId())) {
          outerShuffleOutptNum = Math.max(outerShuffleOutptNum, eachChannel.getShuffleOutputNum());
        }

        for (DataChannel eachChannel : masterPlan.getOutgoingChannels(inner.getId())) {
          innerShuffleOutputNum = Math.max(innerShuffleOutputNum, eachChannel.getShuffleOutputNum());
        }

        if (outerShuffleOutptNum != innerShuffleOutputNum
            && taskNum != outerShuffleOutptNum
            && taskNum != innerShuffleOutputNum) {
          taskNum = Math.max(outerShuffleOutptNum, innerShuffleOutputNum);
        }

        return taskNum;

        // Is this subquery the first step of group-by?
      } else if (grpNode != null) {

        if (grpNode.getGroupingColumns().length == 0) {
          return 1;
        } else {
          long volume = getInputVolume(subQuery.masterPlan, subQuery.context, subQuery.block);

          int mb = (int) Math.ceil((double) volume / 1048576);
          LOG.info(subQuery.getId() + ", Table's volume is approximately " + mb + " MB");
          // determine the number of task
          int taskNumBySize = (int) Math.ceil((double) mb /
              conf.getIntVar(ConfVars.DIST_QUERY_GROUPBY_PARTITION_VOLUME));

          int totalMem = getClusterTotalMemory(subQuery);

          LOG.info(subQuery.getId() + ", Total memory of cluster is " + totalMem + " MB");
          int slots = Math.max(totalMem / conf.getIntVar(ConfVars.TASK_DEFAULT_MEMORY), 1);
          int taskNum = Math.min(taskNumBySize, slots); //Maximum partitions
          LOG.info(subQuery.getId() + ", The determined number of aggregation partitions is " + taskNum);
          return taskNum;
        }
      } else {
View Full Code Here

  public void init(ServletConfig config) throws ServletException {
    om.getDeserializationConfig().disable(
        DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES);

    try {
      tajoClient = new TajoClient(new TajoConf());

      queryRunnerCleaner = new QueryRunnerCleaner();
      queryRunnerCleaner.start();
    } catch (IOException e) {
      LOG.error(e.getMessage());
View Full Code Here

        //Leaf task of DefaultTaskScheduler should be fragment size
        // EstimatedTaskNum determined number of initial container
        subQuery.schedulerContext.setTaskSize(fragments.size());
        subQuery.schedulerContext.setEstimatedTaskNum(fragments.size());
      } else {
        TajoConf conf = subQuery.context.getConf();
        subQuery.schedulerContext.setTaskSize(conf.getIntVar(ConfVars.TASK_DEFAULT_SIZE) * 1024 * 1024);
        int estimatedTaskNum = (int) Math.ceil((double) table.getStats().getNumBytes() /
            (double) subQuery.schedulerContext.getTaskSize());
        subQuery.schedulerContext.setEstimatedTaskNum(estimatedTaskNum);
      }
    }
View Full Code Here

        : decimalF.format((finishTime - startTime) / 1000) + " sec";
  }

  public static String getTajoMasterHttpAddr(Configuration config) {
    try {
      TajoConf conf = (TajoConf) config;
      String [] masterAddr = conf.getVar(ConfVars.TAJO_MASTER_UMBILICAL_RPC_ADDRESS).split(":");
      return masterAddr[0] + ":" + conf.getVar(ConfVars.TAJO_MASTER_INFO_ADDRESS).split(":")[1];
    } catch (Exception e) {
      e.printStackTrace();
      return e.getMessage();
    }
  }
View Full Code Here

  public FileChunk getFileCunks(Path outDir,
                                      String startKey,
                                      String endKey,
                                      boolean last) throws IOException {
    BSTIndex index = new BSTIndex(new TajoConf());
    BSTIndex.BSTIndexReader idxReader =
        index.getIndexReader(new Path(outDir, "index"));
    idxReader.open();
    Schema keySchema = idxReader.getKeySchema();
    TupleComparator comparator = idxReader.getComparator();
View Full Code Here

  public FileChunk getFileCunks(Path outDir,
                                      String startKey,
                                      String endKey,
                                      boolean last) throws IOException {
    BSTIndex index = new BSTIndex(new TajoConf());
    BSTIndex.BSTIndexReader idxReader =
        index.getIndexReader(new Path(outDir, "index"));
    idxReader.open();
    Schema keySchema = idxReader.getKeySchema();
    TupleComparator comparator = idxReader.getComparator();
View Full Code Here

  }

  public static void main(String[] args) throws Exception {
    LOG.info("QueryMasterRunner started");

    final TajoConf conf = new TajoConf();
    conf.addResource(new Path(TajoConstants.SYSTEM_CONF_FILENAME));

    UserGroupInformation.setConfiguration(conf);

    final QueryId queryId = TajoIdUtils.parseQueryId(args[0]);
    final String queryMasterManagerAddr = args[1];
View Full Code Here

  }

  @Override
  public void init(Configuration conf) {
    Preconditions.checkArgument(conf instanceof TajoConf);
    TajoConf tajoConf = (TajoConf) conf;
    try {
      // Setup RPC server
      InetSocketAddress initIsa =
          new InetSocketAddress("0.0.0.0", port);
      if (initIsa.getAddress() == null) {
        throw new IllegalArgumentException("Failed resolve of " + initIsa);
      }

      int workerNum = tajoConf.getIntVar(TajoConf.ConfVars.QUERY_MASTER_RPC_SERVER_WORKER_THREAD_NUM);
      this.rpcServer = new AsyncRpcServer(QueryMasterProtocol.class, this, initIsa, workerNum);
      this.rpcServer.start();

      this.bindAddr = NetUtils.getConnectAddress(rpcServer.getListenAddress());
      this.addr = bindAddr.getHostName() + ":" + bindAddr.getPort();
View Full Code Here

TOP

Related Classes of org.apache.tajo.conf.TajoConf

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.