public SemiAntiJoinIterator(ResultIterator lhsIterator, ResultIterator rhsIterator) { if (type != JoinType.Semi && type != JoinType.Anti) throw new IllegalArgumentException("Type " + type + " is not allowed by " + SemiAntiJoinIterator.class.getName()); this.lhsIterator = lhsIterator; this.rhsIterator = rhsIterator; this.isSemi = type == JoinType.Semi; this.initialized = false; this.lhsTuple = null; this.rhsTuple = null; this.lhsKey = new JoinKey(lhsKeyExpressions); this.rhsKey = new JoinKey(rhsKeyExpressions); }
next = join(lhsTuple, queueIterator.next()); } else { boolean eq = nextLhsTuple != null && lhsKey.equals(nextLhsKey); advance(true); if (eq) { if (lhsKey.equals(rhsKey)) { next = join(lhsTuple, rhsTuple); if (nextLhsTuple != null && lhsKey.equals(nextLhsKey)) { queue.offer(rhsTuple); if (nextRhsTuple == null || !rhsKey.equals(nextRhsKey)) { queueIterator = queue.iterator(); advance(true); throw new SQLExceptionInfo.Builder(SQLExceptionCode.SINGLE_ROW_SUBQUERY_RETURNS_MULTIPLE_ROWS).build().buildException(); } else if (nextRhsTuple == null || !rhsKey.equals(nextRhsKey)) { advance(true); } else if (isSingleValueOnly) { } else if (lhsKey.compareTo(rhsKey) < 0) { if (type == JoinType.Full || type == JoinType.Left) { next = join(lhsTuple, null);
next = join(lhsTuple, queueIterator.next()); } else { boolean eq = nextLhsTuple != null && lhsKey.equals(nextLhsKey); advance(true); if (eq) { if (lhsKey.equals(rhsKey)) { next = join(lhsTuple, rhsTuple); if (nextLhsTuple != null && lhsKey.equals(nextLhsKey)) { queue.offer(rhsTuple); if (nextRhsTuple == null || !rhsKey.equals(nextRhsKey)) { queueIterator = queue.iterator(); advance(true); throw new SQLExceptionInfo.Builder(SQLExceptionCode.SINGLE_ROW_SUBQUERY_RETURNS_MULTIPLE_ROWS).build().buildException(); } else if (nextRhsTuple == null || !rhsKey.equals(nextRhsKey)) { advance(true); } else if (isSingleValueOnly) { } else if (lhsKey.compareTo(rhsKey) < 0) { if (type == JoinType.Full || type == JoinType.Left) { next = join(lhsTuple, null);
next = join(lhsTuple, queueIterator.next()); } else { boolean eq = nextLhsTuple != null && lhsKey.equals(nextLhsKey); advance(true); if (eq) { if (lhsKey.equals(rhsKey)) { next = join(lhsTuple, rhsTuple); if (nextLhsTuple != null && lhsKey.equals(nextLhsKey)) { queue.offer(rhsTuple); if (nextRhsTuple == null || !rhsKey.equals(nextRhsKey)) { queueIterator = queue.iterator(); advance(true); throw new SQLExceptionInfo.Builder(SQLExceptionCode.SINGLE_ROW_SUBQUERY_RETURNS_MULTIPLE_ROWS).build().buildException(); } else if (nextRhsTuple == null || !rhsKey.equals(nextRhsKey)) { advance(true); } else if (isSingleValueOnly) { } else if (lhsKey.compareTo(rhsKey) < 0) { if (type == JoinType.Full || type == JoinType.Left) { next = join(lhsTuple, null);
private void advance(boolean lhs) throws SQLException { if (lhs) { lhsTuple = nextLhsTuple; lhsKey.set(nextLhsKey); if (lhsTuple != null) { nextLhsTuple = lhsIterator.next(); if (nextLhsTuple != null) { nextLhsKey.evaluate(nextLhsTuple); } else { nextLhsKey.clear(); } } } else { rhsTuple = nextRhsTuple; rhsKey.set(nextRhsKey); if (rhsTuple != null) { nextRhsTuple = rhsIterator.next(); if (nextRhsTuple != null) { nextRhsKey.evaluate(nextRhsTuple); } else { nextRhsKey.clear(); } } } }
private void advance(boolean lhs) throws SQLException { if (lhs) { lhsTuple = nextLhsTuple; lhsKey.set(nextLhsKey); if (lhsTuple != null) { nextLhsTuple = lhsIterator.next(); if (nextLhsTuple != null) { nextLhsKey.evaluate(nextLhsTuple); } else { nextLhsKey.clear(); } } } else { rhsTuple = nextRhsTuple; rhsKey.set(nextRhsKey); if (rhsTuple != null) { nextRhsTuple = rhsIterator.next(); if (nextRhsTuple != null) { nextRhsKey.evaluate(nextRhsTuple); } else { nextRhsKey.clear(); } } } }
public BasicJoinIterator(ResultIterator lhsIterator, ResultIterator rhsIterator) { this.lhsIterator = lhsIterator; this.rhsIterator = rhsIterator; this.initialized = false; this.lhsTuple = null; this.rhsTuple = null; this.lhsKey = new JoinKey(lhsKeyExpressions); this.rhsKey = new JoinKey(rhsKeyExpressions); this.nextLhsTuple = null; this.nextRhsTuple = null; this.nextLhsKey = new JoinKey(lhsKeyExpressions); this.nextRhsKey = new JoinKey(rhsKeyExpressions); this.destBitSet = ValueBitSet.newInstance(joinedSchema); this.lhsBitSet = ValueBitSet.newInstance(lhsSchema); this.rhsBitSet = ValueBitSet.newInstance(rhsSchema); lhsBitSet.clear(); int len = lhsBitSet.getEstimatedLength(); this.emptyProjectedValue = new byte[len]; lhsBitSet.toBytes(emptyProjectedValue, 0); this.queue = new MappedByteBufferTupleQueue(thresholdBytes); this.queueIterator = null; }
public BasicJoinIterator(ResultIterator lhsIterator, ResultIterator rhsIterator) { this.lhsIterator = lhsIterator; this.rhsIterator = rhsIterator; this.initialized = false; this.lhsTuple = null; this.rhsTuple = null; this.lhsKey = new JoinKey(lhsKeyExpressions); this.rhsKey = new JoinKey(rhsKeyExpressions); this.nextLhsTuple = null; this.nextRhsTuple = null; this.nextLhsKey = new JoinKey(lhsKeyExpressions); this.nextRhsKey = new JoinKey(rhsKeyExpressions); this.destBitSet = ValueBitSet.newInstance(joinedSchema); this.lhsBitSet = ValueBitSet.newInstance(lhsSchema); this.rhsBitSet = ValueBitSet.newInstance(rhsSchema); lhsBitSet.clear(); int len = lhsBitSet.getEstimatedLength(); this.emptyProjectedValue = new byte[len]; lhsBitSet.toBytes(emptyProjectedValue, 0); this.queue = new MappedByteBufferTupleQueue(thresholdBytes); this.queueIterator = null; }
@Override public boolean equals(Object other) { if (!(other instanceof JoinKey)) return false; return this.compareTo((JoinKey) other) == 0; }
public SemiAntiJoinIterator(ResultIterator lhsIterator, ResultIterator rhsIterator) { if (type != JoinType.Semi && type != JoinType.Anti) throw new IllegalArgumentException("Type " + type + " is not allowed by " + SemiAntiJoinIterator.class.getName()); this.lhsIterator = lhsIterator; this.rhsIterator = rhsIterator; this.isSemi = type == JoinType.Semi; this.initialized = false; this.lhsTuple = null; this.rhsTuple = null; this.lhsKey = new JoinKey(lhsKeyExpressions); this.rhsKey = new JoinKey(rhsKeyExpressions); }
@Override public boolean equals(Object other) { if (!(other instanceof JoinKey)) return false; return this.compareTo((JoinKey) other) == 0; }
private void advance(boolean lhs) throws SQLException { if (lhs) { lhsTuple = nextLhsTuple; lhsKey.set(nextLhsKey); if (lhsTuple != null) { nextLhsTuple = lhsIterator.next(); if (nextLhsTuple != null) { nextLhsKey.evaluate(nextLhsTuple); } else { nextLhsKey.clear(); } } } else { rhsTuple = nextRhsTuple; rhsKey.set(nextRhsKey); if (rhsTuple != null) { nextRhsTuple = rhsIterator.next(); if (nextRhsTuple != null) { nextRhsKey.evaluate(nextRhsTuple); } else { nextRhsKey.clear(); } } } }
public BasicJoinIterator(ResultIterator lhsIterator, ResultIterator rhsIterator) { this.lhsIterator = lhsIterator; this.rhsIterator = rhsIterator; this.initialized = false; this.lhsTuple = null; this.rhsTuple = null; this.lhsKey = new JoinKey(lhsKeyExpressions); this.rhsKey = new JoinKey(rhsKeyExpressions); this.nextLhsTuple = null; this.nextRhsTuple = null; this.nextLhsKey = new JoinKey(lhsKeyExpressions); this.nextRhsKey = new JoinKey(rhsKeyExpressions); this.destBitSet = ValueBitSet.newInstance(joinedSchema); this.lhsBitSet = ValueBitSet.newInstance(lhsSchema); this.rhsBitSet = ValueBitSet.newInstance(rhsSchema); lhsBitSet.clear(); int len = lhsBitSet.getEstimatedLength(); this.emptyProjectedValue = new byte[len]; lhsBitSet.toBytes(emptyProjectedValue, 0); this.queue = new MappedByteBufferTupleQueue(thresholdBytes); this.queueIterator = null; }