Package org.apache.tajo.engine.utils

Examples of org.apache.tajo.engine.utils.TupleCache


    ExecutionBlockId ebId = QueryIdFactory.newExecutionBlockId(
        QueryIdFactory.newQueryId(System.currentTimeMillis(), 0));

    TupleCacheKey cacheKey = new TupleCacheKey(ebId.toString(), "TestTable");
    TupleCache tupleCache = TupleCache.getInstance();

    assertFalse(tupleCache.isBroadcastCacheReady(cacheKey));
    assertTrue(tupleCache.lockBroadcastScan(cacheKey));
    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);
      count++;
    }

    assertEquals(tupleData.size(), count);

    tupleCache.removeBroadcastCache(ebId);
    assertFalse(tupleCache.isBroadcastCacheReady(cacheKey));
    assertTrue(tupleCache.lockBroadcastScan(cacheKey));

    tupleCache.removeBroadcastCache(ebId);
  }
View Full Code Here

TOP

Related Classes of org.apache.tajo.engine.utils.TupleCache

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.