Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB-12351 Remove the pre-scan of IndexPrefixIteratorMode on HBase #5686

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,7 @@ protected Qualifier[][] populateQualifiers() throws StandardException {
Qualifier[][] scanQualifiers = null;
if (scanQualifiersFieldName != null && !skipScanQualifiers) {
try {
if (qualifiersField == null)
qualifiersField = activation.getClass().getField(scanQualifiersFieldName);
qualifiersField = activation.getClass().getField(scanQualifiersFieldName);
scanQualifiers = (Qualifier[][]) qualifiersField.get(activation);
} catch (Exception e) {
throw StandardException.unexpectedUserException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,35 +216,27 @@ public DataSet<ExecRow> getDataSet(DataSetProcessor dsp) throws StandardExceptio
operationContext = dsp.createOperationContext(this);

if (keys == null) {
DataSet<ExecRow> ds = getDriverDataSet(createTableScannerBuilder());
TableScannerIterator tableScannerIterator = (TableScannerIterator) ds.toLocalIterator();
registerCloseable(tableScannerIterator);
// Most of the probing logic is in IndexPrefixIteratorFunction, as created below.
if (isMemPlatform)
if (isMemPlatform) {
DataSet<ExecRow> ds = getDriverDataSet(createTableScannerBuilder());
TableScannerIterator tableScannerIterator = (TableScannerIterator) ds.toLocalIterator();
registerCloseable(tableScannerIterator);
ds = ds.mapPartitions(new IndexPrefixIteratorFunction(operationContext, firstIndexColumnNumber), true);
keys = ds.collect();
closeFirstTableScanner(tableScannerIterator);
}

// Only grab the first row for non-mem platforms.
// Only use a null DVD from the template row for non-mem platforms.
// Use the new custom HBase filter in this case, which needs
// the DataValueDescriptor of the first index column to
// be passed to the constructor.
if (!isMemPlatform) {
ExecRow firstRow = null;
if (tableScannerIterator.hasNext())
firstRow = tableScannerIterator.next();
closeFirstTableScanner(tableScannerIterator);
if (firstRow == null)
return dsp.getEmpty();

else {
int firstMappedIndexColumnNumber = baseColumnMap[firstIndexColumnNumber-1]+1;
ExecRow keyRow = new ValueRow(1);
keyRow.setColumn(1, firstRow.getColumn(firstMappedIndexColumnNumber));
keyRow.setColumn(1, currentTemplate.getColumn(firstMappedIndexColumnNumber));
keys = new ArrayList<>();
keys.add(keyRow);
}
else
keys = ds.collect();

closeFirstTableScanner(tableScannerIterator);

// IndexPrefixIteratorFunction has set scanKeyPrefix.
// Future operations won't want this set, so reset it back to null.
Expand Down Expand Up @@ -326,7 +318,6 @@ public ScanSetBuilder<ExecRow> createTableScannerBuilder() throws StandardExcept
localProcessor(getOperation().getActivation(), this);
scanInformation.skipQualifiers(true);
DataScan dataScan = getNonSIScan();
scanInformation.skipQualifiers(false);

// No need for a large cache since we're
// going after a single row on each read.
Expand Down Expand Up @@ -371,6 +362,7 @@ public DataSet<ExecRow> getDriverDataSet(ScanSetBuilder<ExecRow> scanSetBuilder)
throws StandardException {

DataSet<ExecRow> dataSet = scanSetBuilder.buildDataSet(this);
scanInformation.skipQualifiers(false);
return dataSet;
}

Expand Down