use of io.druid.segment.data.IndexedInts in project druid by druid-io.
the class StringGroupByColumnSelectorStrategy method checkRowIndexAndAddValueToGroupingKey.
@Override
public boolean checkRowIndexAndAddValueToGroupingKey(int keyBufferPosition, Object rowObj, int rowValIdx, ByteBuffer keyBuffer) {
IndexedInts row = (IndexedInts) rowObj;
int rowSize = row.size();
if (rowValIdx < rowSize) {
keyBuffer.putInt(keyBufferPosition, row.get(rowValIdx));
return true;
} else {
return false;
}
}
use of io.druid.segment.data.IndexedInts in project druid by druid-io.
the class StringGroupByColumnSelectorStrategy method initGroupingKeyColumnValue.
@Override
public void initGroupingKeyColumnValue(int keyBufferPosition, int columnIndex, Object rowObj, ByteBuffer keyBuffer, int[] stack) {
IndexedInts row = (IndexedInts) rowObj;
int rowSize = row.size();
initializeGroupingKeyV2Dimension(row, rowSize, keyBuffer, keyBufferPosition);
stack[columnIndex] = rowSize == 0 ? 0 : 1;
}
use of io.druid.segment.data.IndexedInts in project druid by druid-io.
the class ForwardingFilteredDimensionSelector method getRow.
@Override
public IndexedInts getRow() {
IndexedInts baseRow = selector.getRow();
int baseRowSize = baseRow.size();
int[] result = new int[baseRowSize];
int resultSize = 0;
for (int i = 0; i < baseRowSize; i++) {
int forwardedValue = forwardMapping.get(baseRow.get(i));
if (forwardedValue >= 0) {
result[resultSize++] = forwardedValue;
}
}
return ArrayBasedIndexedInts.of(result, resultSize);
}
use of io.druid.segment.data.IndexedInts in project druid by druid-io.
the class ForwardingFilteredDimensionSelector method makeValueMatcher.
@Override
public ValueMatcher makeValueMatcher(Predicate<String> predicate) {
final BitSet valueIds = DimensionSelectorUtils.makePredicateMatchingSet(this, predicate);
final boolean matchNull = predicate.apply(null);
return new ValueMatcher() {
@Override
public boolean matches() {
final IndexedInts baseRow = selector.getRow();
final int baseRowSize = baseRow.size();
boolean nullRow = true;
for (int i = 0; i < baseRowSize; ++i) {
int forwardedValue = forwardMapping.get(baseRow.get(i));
if (forwardedValue >= 0) {
if (valueIds.get(forwardedValue)) {
return true;
}
nullRow = false;
}
}
// null should match empty rows in multi-value columns
return nullRow && matchNull;
}
};
}
use of io.druid.segment.data.IndexedInts in project druid by druid-io.
the class PredicateFilteredDimensionSelector method makeValueMatcher.
@Override
public ValueMatcher makeValueMatcher(final Predicate<String> matcherPredicate) {
final boolean matchNull = predicate.apply(null);
return new ValueMatcher() {
@Override
public boolean matches() {
final IndexedInts baseRow = selector.getRow();
final int baseRowSize = baseRow.size();
boolean nullRow = true;
for (int i = 0; i < baseRowSize; ++i) {
String rowValue = lookupName(baseRow.get(i));
if (predicate.apply(rowValue)) {
if (matcherPredicate.apply(rowValue)) {
return true;
}
nullRow = false;
}
}
// null should match empty rows in multi-value columns
return nullRow && matchNull;
}
};
}
Aggregations