use of com.palantir.atlasdb.keyvalue.dbkvs.impl.FullQuery in project atlasdb by palantir.
the class RangePredicateHelperTest method startCellInclusiveReverseOracle.
@Test
public void startCellInclusiveReverseOracle() {
FullQuery.Builder builder = FullQuery.builder();
RangePredicateHelper.create(true, DBType.ORACLE, builder).startCellInclusive(ROW_NAME, COL_NAME);
FullQuery query = builder.build();
assertThat(query.getQuery(), equalTo(" AND (row_name <= ? AND (row_name < ? OR col_name <= ?))"));
assertThat(query.getArgs(), arrayContaining(ROW_NAME, ROW_NAME, COL_NAME));
}
use of com.palantir.atlasdb.keyvalue.dbkvs.impl.FullQuery in project atlasdb by palantir.
the class RangePredicateHelperTest method startRowInclusiveEmpty.
@Test
public void startRowInclusiveEmpty() {
FullQuery.Builder builder = FullQuery.builder();
RangePredicateHelper.create(false, DBType.ORACLE, builder).startRowInclusive(PtBytes.EMPTY_BYTE_ARRAY);
FullQuery query = builder.build();
assertThat(query.getQuery(), isEmptyString());
assertThat(query.getArgs(), emptyArray());
}
use of com.palantir.atlasdb.keyvalue.dbkvs.impl.FullQuery in project atlasdb by palantir.
the class RangePredicateHelperTest method startCellInclusiveReversePostgres.
@Test
public void startCellInclusiveReversePostgres() {
FullQuery.Builder builder = FullQuery.builder();
RangePredicateHelper.create(true, DBType.POSTGRESQL, builder).startCellInclusive(ROW_NAME, COL_NAME);
FullQuery query = builder.build();
assertThat(query.getQuery(), equalTo(" AND (row_name, col_name) <= (?, ?)"));
assertThat(query.getArgs(), arrayContaining(ROW_NAME, COL_NAME));
}
use of com.palantir.atlasdb.keyvalue.dbkvs.impl.FullQuery in project atlasdb by palantir.
the class RangePredicateHelperTest method startCellTsInclusiveReverseOracle.
@Test
public void startCellTsInclusiveReverseOracle() {
FullQuery.Builder builder = FullQuery.builder();
RangePredicateHelper.create(true, DBType.ORACLE, builder).startCellTsInclusive(ROW_NAME, COL_NAME, TS);
FullQuery query = builder.build();
assertThat(query.getQuery(), equalTo(" AND (row_name <= ? AND (row_name < ? OR col_name < ? OR (col_name = ? AND ts <= ?)))"));
assertThat(query.getArgs(), arrayContaining(ROW_NAME, ROW_NAME, COL_NAME, COL_NAME, TS));
}
use of com.palantir.atlasdb.keyvalue.dbkvs.impl.FullQuery in project atlasdb by palantir.
the class OracleOverflowValueLoader method loadOverflowValues.
@Override
public Map<Long, byte[]> loadOverflowValues(ConnectionSupplier conns, TableReference tableRef, Collection<Long> overflowIds) {
if (overflowIds.isEmpty()) {
return Collections.emptyMap();
} else {
Map<Long, byte[]> ret = Maps.newHashMapWithExpectedSize(overflowIds.size());
for (FullQuery query : getOverflowQueries(conns, tableRef, overflowIds)) {
try (ClosableIterator<AgnosticLightResultRow> overflowIter = select(conns, query)) {
while (overflowIter.hasNext()) {
AgnosticLightResultRow row = overflowIter.next();
// QA-94468 LONG RAW typed columns ("val" in this case) must be retrieved first from the result
// set. See https://docs.oracle.com/cd/B19306_01/java.102/b14355/jstreams.htm#i1007581
byte[] val = row.getBytes("val");
long id = row.getLong("id");
ret.put(id, val);
}
}
}
return ret;
}
}
Aggregations