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(); } }
@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()); } }
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(); } }