Package org.apache.tajo.storage

Examples of org.apache.tajo.storage.Scanner


  }

  @Override
  public Scanner getScanner(TableMeta meta, Fragment fragment,
                            Schema target) throws IOException {
    Scanner scanner;

    Class<? extends Scanner> scannerClass;

    String handlerName = meta.getStoreType().name().toLowerCase();
    String handlerNameKey = handlerName + "_v2";

    scannerClass = SCANNER_HANDLER_CACHE.get(handlerNameKey);
    if (scannerClass == null) {
      scannerClass = conf.getClass(
          String.format("tajo.storage.scanner-handler.v2.%s.class",
              meta.getStoreType().name().toLowerCase()), null,
          Scanner.class);
      SCANNER_HANDLER_CACHE.put(handlerNameKey, scannerClass);
    }

    if (scannerClass == null) {
      throw new IOException("Unknown Storage Type: " + meta.getStoreType());
    }

    scanner = newScannerInstance(scannerClass, conf, meta, fragment);
    if (scanner.isProjectable()) {
      scanner.setTarget(target.toArray());
    }

    if(scanner instanceof FileScannerV2) {
      ((FileScannerV2)scanner).setStorageManagerContext(context);
    }
View Full Code Here


      scanner.init();
    }
  }

  private void openCacheScanner() throws IOException {
    Scanner cacheScanner = TupleCache.getInstance().openCacheScanner(cacheKey, plan.getPhysicalSchema());
    if (cacheScanner != null) {
      scanner = cacheScanner;
      cacheRead = true;
    }
  }
View Full Code Here

      final Path outputPath = getChunkPathForWrite(level + 1, nextRunId);
      info(LOG, mergeFanout + " files are being merged to an output file " + outputPath.getName());
      long mergeStartTime = System.currentTimeMillis();
      final RawFileAppender output = new RawFileAppender(context.getConf(), inSchema, meta, outputPath);
      output.init();
      final Scanner merger = createKWayMerger(inputFiles, startIdx, mergeFanout);
      merger.init();
      Tuple mergeTuple;
      while((mergeTuple = merger.next()) != null) {
        output.addTuple(mergeTuple);
      }
      merger.close();
      output.close();
      long mergeEndTime = System.currentTimeMillis();
      info(LOG, outputPath.getName() + " is written to a disk. ("
          + FileUtil.humanReadableByteCount(output.getOffset(), false)
          + " bytes, " + (mergeEndTime - mergeStartTime) + " msec)");
View Full Code Here

    assertFalse(tupleCache.lockBroadcastScan(cacheKey));

    tupleCache.addBroadcastCache(cacheKey, tupleData);
    assertTrue(tupleCache.isBroadcastCacheReady(cacheKey));

    Scanner scanner = tupleCache.openCacheScanner(cacheKey, null);
    assertNotNull(scanner);

    int count = 0;

    while (true) {
      Tuple tuple = scanner.next();
      if (tuple == null) {
        break;
      }

      assertEquals(tupleData.get(count), tuple);
View Full Code Here

    return scannerClass;
  }

  @Override
  public Scanner getScanner(TableMeta meta, Schema schema, Fragment fragment, Schema target) throws IOException {
    Scanner scanner;

    Class<? extends Scanner> scannerClass = getScannerClass(meta.getStoreType());
    if (scannerClass == null) {
      throw new IOException("Unknown Storage Type: " + meta.getStoreType());
    }

    scanner = newScannerInstance(scannerClass, conf, schema, meta, fragment);
    if (scanner.isProjectable()) {
      scanner.setTarget(target.toArray());
    }

    if(scanner instanceof FileScannerV2) {
      ((FileScannerV2)scanner).setStorageManagerContext(context);
    }
View Full Code Here

TOP

Related Classes of org.apache.tajo.storage.Scanner

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.