if (columnHolder == null || !columnHolder.getCapabilities().isFilterable()) {
public void merge(ColumnCapabilities other) { if (other == null) { return; } if (type == null) { type = other.getType(); } if (!type.equals(other.getType())) { throw new ISE("Cannot merge columns of type[%s] and [%s]", type, other.getType()); } this.dictionaryEncoded |= other.isDictionaryEncoded(); this.runLengthEncoded |= other.isRunLengthEncoded(); this.hasInvertedIndexes |= other.hasBitmapIndexes(); this.hasSpatialIndexes |= other.hasSpatialIndexes(); this.hasMultipleValues |= other.hasMultipleValues(); this.filterable &= other.isFilterable(); } }
@Override public ImmutableBitmap getBitmapIndex(String dimension, String value) { if (isVirtualColumn(dimension)) { // Virtual columns don't have dictionaries or indexes. return null; } final ColumnHolder columnHolder = index.getColumnHolder(dimension); if (columnHolder == null || !columnHolder.getCapabilities().isFilterable()) { if (NullHandling.isNullOrEquivalent(value)) { return bitmapFactory.complement(bitmapFactory.makeEmptyImmutableBitmap(), getNumRows()); } else { return bitmapFactory.makeEmptyImmutableBitmap(); } } if (!columnHolder.getCapabilities().hasBitmapIndexes()) { return null; } final BitmapIndex bitmapIndex = columnHolder.getBitmapIndex(); return bitmapIndex.getBitmap(bitmapIndex.getIndex(value)); }
@Test public void testSerde() throws Exception { String json = mapper.writeValueAsString(new ColumnCapabilitiesImpl() .setDictionaryEncoded(true) .setHasBitmapIndexes(true) .setHasMultipleValues(true) .setHasSpatialIndexes(true) .setType(ValueType.COMPLEX) .setFilterable(true)); Assert.assertFalse(json.contains("filterable")); ColumnCapabilities cc = mapper.readValue(json, ColumnCapabilitiesImpl.class); Assert.assertEquals(ValueType.COMPLEX, cc.getType()); Assert.assertTrue(cc.isDictionaryEncoded()); Assert.assertFalse(cc.isRunLengthEncoded()); Assert.assertTrue(cc.hasSpatialIndexes()); Assert.assertTrue(cc.hasMultipleValues()); Assert.assertTrue(cc.hasBitmapIndexes()); Assert.assertFalse(cc.isFilterable()); }
@Test public void testDeserialization() throws Exception { String json = "{\n" + " \"type\":\"COMPLEX\",\n" + " \"dictionaryEncoded\":true,\n" + " \"runLengthEncoded\":true,\n" + " \"hasSpatialIndexes\":true,\n" + " \"hasMultipleValues\":true,\n" + " \"hasBitmapIndexes\":true,\n" + " \"filterable\":true\n" + "}"; ColumnCapabilities cc = mapper.readValue(json, ColumnCapabilitiesImpl.class); Assert.assertEquals(ValueType.COMPLEX, cc.getType()); Assert.assertTrue(cc.isDictionaryEncoded()); Assert.assertTrue(cc.isRunLengthEncoded()); Assert.assertTrue(cc.hasSpatialIndexes()); Assert.assertTrue(cc.hasMultipleValues()); Assert.assertTrue(cc.hasBitmapIndexes()); Assert.assertFalse(cc.isFilterable()); } }
if (columnHolder == null || !columnHolder.getCapabilities().isFilterable()) {
public void merge(ColumnCapabilities other) { if (other == null) { return; } if (type == null) { type = other.getType(); } if (!type.equals(other.getType())) { throw new ISE("Cannot merge columns of type[%s] and [%s]", type, other.getType()); } this.dictionaryEncoded |= other.isDictionaryEncoded(); this.runLengthEncoded |= other.isRunLengthEncoded(); this.hasInvertedIndexes |= other.hasBitmapIndexes(); this.hasSpatialIndexes |= other.hasSpatialIndexes(); this.hasMultipleValues |= other.hasMultipleValues(); this.filterable &= other.isFilterable(); } }
@Override public ImmutableBitmap getBitmapIndex(String dimension, String value) { if (isVirtualColumn(dimension)) { // Virtual columns don't have dictionaries or indexes. return null; } final ColumnHolder columnHolder = index.getColumnHolder(dimension); if (columnHolder == null || !columnHolder.getCapabilities().isFilterable()) { if (NullHandling.isNullOrEquivalent(value)) { return bitmapFactory.complement(bitmapFactory.makeEmptyImmutableBitmap(), getNumRows()); } else { return bitmapFactory.makeEmptyImmutableBitmap(); } } if (!columnHolder.getCapabilities().hasBitmapIndexes()) { return null; } final BitmapIndex bitmapIndex = columnHolder.getBitmapIndex(); return bitmapIndex.getBitmap(bitmapIndex.getIndex(value)); }