Examples of FileFragment


Examples of org.apache.tajo.storage.fragment.FileFragment

    path = CommonTestingUtil.getTestDir();
  }

  @Test
  public final void testGetAndSetFields() {
    FileFragment fragment1 = new FileFragment("table1_1", new Path(path, "table0"), 0, 500);

    assertEquals("table1_1", fragment1.getTableName());
    assertEquals(new Path(path, "table0"), fragment1.getPath());
    assertTrue(0 == fragment1.getStartKey());
    assertTrue(500 == fragment1.getEndKey());
  }
View Full Code Here

Examples of org.apache.tajo.storage.fragment.FileFragment

    assertTrue(500 == fragment1.getEndKey());
  }

  @Test
  public final void testGetProtoAndRestore() {
    FileFragment fragment = new FileFragment("table1_1", new Path(path, "table0"), 0, 500);

    FileFragment fragment1 = FragmentConvertor.convert(FileFragment.class, fragment.getProto());
    assertEquals("table1_1", fragment1.getTableName());
    assertEquals(new Path(path, "table0"), fragment1.getPath());
    assertTrue(0 == fragment1.getStartKey());
    assertTrue(500 == fragment1.getEndKey());
  }
View Full Code Here

Examples of org.apache.tajo.storage.fragment.FileFragment

  @Test
  public final void testCompareTo() {
    final int num = 10;
    FileFragment[] tablets = new FileFragment[num];
    for (int i = num - 1; i >= 0; i--) {
      tablets[i] = new FileFragment("tablet1_"+i, new Path(path, "tablet0"), i * 500, (i+1) * 500);
    }
   
    Arrays.sort(tablets);

    for(int i = 0; i < num; i++) {
View Full Code Here

Examples of org.apache.tajo.storage.fragment.FileFragment

  @Test
  public final void testCompareTo2() {
    final int num = 1860;
    FileFragment[] tablets = new FileFragment[num];
    for (int i = num - 1; i >= 0; i--) {
      tablets[i] = new FileFragment("tablet1_"+i, new Path(path, "tablet0"), (long)i * 6553500, (long)(i+1) * 6553500);
    }

    SortedSet sortedSet = Sets.newTreeSet();
    for (FileFragment frag : tablets) {
      sortedSet.add(frag);
View Full Code Here

Examples of org.apache.tajo.storage.fragment.FileFragment

                          final CatalogProtos.FragmentProto[] fragments) throws PhysicalPlanningException {
    this(context, sm, plan);

    mergedInputPaths = TUtil.newList();
    for (CatalogProtos.FragmentProto proto : fragments) {
      FileFragment fragment = FragmentConvertor.convert(FileFragment.class, proto);
      mergedInputPaths.add(fragment.getPath());
    }
  }
View Full Code Here

Examples of org.apache.tajo.storage.fragment.FileFragment

        childBlocks[0] = masterPlan.getChild(execBlock.getId(), 0);
        childBlocks[1] = masterPlan.getChild(execBlock.getId(), 1);

        tablePath = storageManager.getTablePath(scans[i].getTableName());
        stats[i] = masterContext.getSubQuery(childBlocks[i].getId()).getResultStats().getNumBytes();
        fragments[i] = new FileFragment(scans[i].getCanonicalName(), tablePath, 0, 0, new String[]{UNKNOWN_HOST});
      } else {
        tablePath = tableDesc.getPath();
        try {
          stats[i] = GlobalPlanner.computeDescendentVolume(scans[i]);
        } catch (PlanningException e) {
          throw new IOException(e);
        }

        // if table has no data, storageManager will return empty FileFragment.
        // So, we need to handle FileFragment by its size.
        // If we don't check its size, it can cause IndexOutOfBoundsException.
        List<FileFragment> fileFragments = storageManager.getSplits(scans[i].getCanonicalName(), tableDesc.getMeta(), tableDesc.getSchema(), tablePath);
        if (fileFragments.size() > 0) {
          fragments[i] = fileFragments.get(0);
        } else {
          fragments[i] = new FileFragment(scans[i].getCanonicalName(), tablePath, 0, 0, new String[]{UNKNOWN_HOST});
        }
      }
    }

    // If one of inner join tables has no input data,
View Full Code Here

Examples of org.apache.tajo.storage.fragment.FileFragment

    LOG.info("Try to divide " + mergedRange + " into " + determinedTaskNum +
        " sub ranges (total units: " + determinedTaskNum + ")");
    TupleRange [] ranges = partitioner.partition(determinedTaskNum);

    FileFragment dummyFragment = new FileFragment(scan.getTableName(), tablePath, 0, 0, new String[]{UNKNOWN_HOST});
    SubQuery.scheduleFragment(subQuery, dummyFragment);

    List<String> basicFetchURIs = new ArrayList<String>();
    List<ExecutionBlock> childBlocks = masterPlan.getChilds(subQuery.getId());
    for (ExecutionBlock childBlock : childBlocks) {
View Full Code Here

Examples of org.apache.tajo.storage.fragment.FileFragment

    ScanNode scan = execBlock.getScanNodes()[0];
    Path tablePath;
    tablePath = subQuery.getContext().getStorageManager().getTablePath(scan.getTableName());

    FileFragment frag = new FileFragment(scan.getCanonicalName(), tablePath, 0, 0, new String[]{UNKNOWN_HOST});
    List<FileFragment> fragments = new ArrayList<FileFragment>();
    fragments.add(frag);
    SubQuery.scheduleFragments(subQuery, fragments);

    Map<String, List<IntermediateEntry>> hashedByHost;
View Full Code Here

Examples of org.apache.tajo.storage.fragment.FileFragment

    c.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, "file:///");
    FileSystem fs = FileSystem.get(c);
    Path tablePath = new Path(file.getAbsolutePath());

    List<FileFragment> listTablets = new ArrayList<FileFragment>();
    FileFragment tablet;

    FileStatus[] fileLists = fs.listStatus(tablePath);
    for (FileStatus f : fileLists) {
      if (f.getLen() == 0) {
        continue;
      }
      tablet = new FileFragment(name, f.getPath(), 0l, f.getLen());
      listTablets.add(tablet);
    }

    FileFragment[] tablets = new FileFragment[listTablets.size()];
    listTablets.toArray(tablets);
View Full Code Here

Examples of org.apache.tajo.storage.fragment.FileFragment

    FileStatus file = fs.getFileStatus(dataPath);
    TableProto proto = (TableProto) FileUtil.loadProto(
        cluster.getDefaultFileSystem(), metaPath, TableProto.getDefaultInstance());
    meta = new TableMeta(proto);
    FileFragment fragment = new FileFragment("test.tbl", dataPath, 0, file.getLen());

    int tupleCnt = 0;
    start = System.currentTimeMillis();
    Scanner scanner = StorageManagerFactory.getStorageManager(conf).getScanner(meta, schema, fragment);
    scanner.init();
    while ((tuple=scanner.next()) != null) {
      tupleCnt++;
    }
    scanner.close();

    assertEquals(tupleNum, tupleCnt);

    tupleCnt = 0;
    long fileStart = 0;
    long fileLen = file.getLen()/13;

    for (int i = 0; i < 13; i++) {
      fragment = new FileFragment("test.tbl", dataPath, fileStart, fileLen);
      scanner = new RowFile.RowFileScanner(conf, schema, meta, fragment);
      scanner.init();
      while ((tuple=scanner.next()) != null) {
        if (!idSet.remove(tuple.get(0).asInt4())) {
          System.out.println("duplicated! " + tuple.get(0).asInt4());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.