public static CollectionTupleSource createNullTupleSource() { return new CollectionTupleSource(new ArrayList<List<Object>>(0).iterator()); }
public static CollectionTupleSource createUpdateCountTupleSource(int count) { return new CollectionTupleSource(Arrays.asList(Arrays.asList(count)).iterator()); }
public static CollectionTupleSource createNullTupleSource() { return new CollectionTupleSource(new ArrayList<List<Object>>(0).iterator()); }
public static CollectionTupleSource createUpdateCountTupleSource(int count) { return new CollectionTupleSource(Arrays.asList(Arrays.asList(count)).iterator()); }
public static CollectionTupleSource createUpdateCountTupleSource(int count) { return new CollectionTupleSource(Arrays.asList(Arrays.asList(count)).iterator()); }
public static CollectionTupleSource createNullTupleSource() { return new CollectionTupleSource(new ArrayList<List<Object>>(0).iterator()); }
@Override public TupleSource call() throws Exception { return new CollectionTupleSource(Arrays.asList(Arrays.asList(1), Arrays.asList(2)).iterator()); } }, new CommandContext());
values.add(eval.evaluate(expr, null)); ts = new CollectionTupleSource(Arrays.asList(values).iterator());
values.add(eval.evaluate(expr, null)); ts = new CollectionTupleSource(Arrays.asList(values).iterator());
values.add(eval.evaluate(expr, null)); ts = new CollectionTupleSource(Arrays.asList(values).iterator());
TupleBrowser createTupleBrowser(NullOrder nullOrder, boolean readOnly) throws TeiidComponentException { boolean direction = OrderBy.ASC; if (ordering != null) { LogManager.logDetail(LogConstants.CTX_DQP, "Using index for ordering"); //$NON-NLS-1$ direction = ordering; } if (valueTs != null) { LogManager.logDetail(LogConstants.CTX_DQP, "Using index value set"); //$NON-NLS-1$ return new TupleBrowser(this.table.getTree(), valueTs, direction, readOnly); } if (!valueSet.isEmpty()) { LogManager.logDetail(LogConstants.CTX_DQP, "Using index value set"); //$NON-NLS-1$ sortValueSet(direction, nullOrder); CollectionTupleSource cts = new CollectionTupleSource(valueSet.iterator()); return new TupleBrowser(this.table.getTree(), cts, direction, readOnly); } if (lower != null || upper != null) { LogManager.logDetail(LogConstants.CTX_DQP, "Using index for range query", lower, upper); //$NON-NLS-1$ } return new TupleBrowser(this.table.getTree(), lower, upper, direction, readOnly); }
TupleBrowser createTupleBrowser(NullOrder nullOrder, boolean readOnly) throws TeiidComponentException { boolean direction = OrderBy.ASC; if (ordering != null) { LogManager.logDetail(LogConstants.CTX_DQP, "Using index for ordering"); //$NON-NLS-1$ direction = ordering; } if (valueTs != null) { LogManager.logDetail(LogConstants.CTX_DQP, "Using index value set"); //$NON-NLS-1$ return new TupleBrowser(this.table.getTree(), valueTs, direction, readOnly); } if (!valueSet.isEmpty()) { LogManager.logDetail(LogConstants.CTX_DQP, "Using index value set"); //$NON-NLS-1$ sortValueSet(direction, nullOrder); CollectionTupleSource cts = new CollectionTupleSource(valueSet.iterator()); return new TupleBrowser(this.table.getTree(), cts, direction, readOnly); } if (lower != null || upper != null) { LogManager.logDetail(LogConstants.CTX_DQP, "Using index for range query", lower, upper); //$NON-NLS-1$ } return new TupleBrowser(this.table.getTree(), lower, upper, direction, readOnly); }
TupleBrowser createTupleBrowser(NullOrder nullOrder, boolean readOnly) throws TeiidComponentException { boolean direction = OrderBy.ASC; if (ordering != null) { LogManager.logDetail(LogConstants.CTX_DQP, "Using index for ordering"); //$NON-NLS-1$ direction = ordering; } if (valueTs != null) { LogManager.logDetail(LogConstants.CTX_DQP, "Using index value set"); //$NON-NLS-1$ return new TupleBrowser(this.table.getTree(), valueTs, direction, readOnly); } if (!valueSet.isEmpty()) { LogManager.logDetail(LogConstants.CTX_DQP, "Using index value set"); //$NON-NLS-1$ sortValueSet(direction, nullOrder); CollectionTupleSource cts = new CollectionTupleSource(valueSet.iterator()); return new TupleBrowser(this.table.getTree(), cts, direction, readOnly); } if (lower != null || upper != null) { LogManager.logDetail(LogConstants.CTX_DQP, "Using index for range query", lower, upper); //$NON-NLS-1$ } return new TupleBrowser(this.table.getTree(), lower, upper, direction, readOnly); }
if (condition == null) { long count = this.getRowCount(); return new CollectionTupleSource(Arrays.asList(Collections.nCopies(projectedCols.size(), (int)Math.min(Integer.MAX_VALUE, count))).iterator());
@Test public void testTupleBrowserRemove() throws Exception { BufferManagerImpl bm = BufferManagerFactory.getTestBufferManager(1, 1); ElementSymbol e1 = new ElementSymbol("x"); e1.setType(Integer.class); ElementSymbol e2 = new ElementSymbol("x"); e2.setType(Integer.class); List<ElementSymbol> elements = Arrays.asList(e1, e2); STree map = bm.createSTree(elements, "1", 2); map.insert(Arrays.asList(1, 1), InsertMode.NEW, -1); TupleBrowser tb = new TupleBrowser(map, new CollectionTupleSource(Collections.singletonList(Arrays.asList(1)).iterator()), true, false); assertNotNull(tb.nextTuple()); tb.removed(); assertEquals(Integer.valueOf(0), tb.getValueCount()); }
return new CollectionTupleSource(Arrays.asList(Collections.nCopies(projectedCols.size(), count)).iterator()); } else if (updatable) { tb = bm.createTupleBuffer(projectedCols, sessionID, TupleSourceType.PROCESSOR);
return new CollectionTupleSource(Arrays.asList(Collections.nCopies(projectedCols.size(), count)).iterator()); } else if (updatable) { tb = bm.createTupleBuffer(projectedCols, sessionID, TupleSourceType.PROCESSOR);
return new CollectionTupleSource(Arrays.asList(Collections.nCopies(projectedCols.size(), count)).iterator()); } else if (updatable) { tb = bm.createTupleBuffer(projectedCols, sessionID, TupleSourceType.PROCESSOR);
@Test public void testSearch() throws TeiidComponentException, TeiidProcessingException { //due to buffering changes we need to hold this in memory directly rather than serialize it out as that will lead to GC overhead errors BufferManagerImpl bm = BufferManagerFactory.getTestBufferManager(Integer.MAX_VALUE, 1); ElementSymbol e1 = new ElementSymbol("x"); e1.setType(Integer.class); ElementSymbol e2 = new ElementSymbol("x"); e2.setType(Integer.class); List elements = Arrays.asList(e1, e2); STree map = bm.createSTree(elements, "1", 2); int size = 1<<16; for (int i = 0; i < size; i++) { assertNull(map.insert(Arrays.asList(i, i), InsertMode.NEW, -1)); assertEquals(i + 1, map.getRowCount()); } map.compact(); for (int i = 0; i < size; i++) { TupleBrowser tb = new TupleBrowser(map, new CollectionTupleSource(Collections.singletonList(Arrays.asList(i)).iterator()), true); assertNotNull(tb.nextTuple()); assertNull(tb.nextTuple()); } }
@Test public void testSearchWithRepeated() throws TeiidComponentException, TeiidProcessingException { //due to buffering changes we need to hold this in memory directly rather than serialize it out as that will lead to GC overhead errors BufferManagerImpl bm = BufferManagerFactory.getTestBufferManager(Integer.MAX_VALUE, 1); ElementSymbol e1 = new ElementSymbol("x"); e1.setType(Integer.class); ElementSymbol e2 = new ElementSymbol("x"); e2.setType(Integer.class); List<ElementSymbol> elements = Arrays.asList(e1, e2); STree map = bm.createSTree(elements, "1", 2); int size = 1<<16; for (int i = 0; i < size; i++) { assertNull(map.insert(Arrays.asList(i, i*2), InsertMode.NEW, -1)); assertNull(map.insert(Arrays.asList(i, i*2+1), InsertMode.NEW, -1)); assertEquals((i + 1) * 2, map.getRowCount()); } map.compact(); for (int i = 0; i < size; i++) { TupleBrowser tb = new TupleBrowser(map, new CollectionTupleSource(Collections.singletonList(Arrays.asList(i)).iterator()), true); for (int j = 0; j < 2; j++) { assertNotNull(tb.nextTuple()); } assertNull(tb.nextTuple()); } }