} else if (capabilities != null && capabilities.getType() == ValueType.STRING && capabilities.isDictionaryEncoded()) {
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(); } }
&& capabilities.isDictionaryEncoded()) {
public static DimensionHandler getHandlerFromCapabilities( String dimensionName, ColumnCapabilities capabilities, MultiValueHandling multiValueHandling ) { if (capabilities == null) { return new StringDimensionHandler(dimensionName, multiValueHandling, true); } multiValueHandling = multiValueHandling == null ? MultiValueHandling.ofDefault() : multiValueHandling; if (capabilities.getType() == ValueType.STRING) { if (!capabilities.isDictionaryEncoded()) { throw new IAE("String column must have dictionary encoding."); } return new StringDimensionHandler(dimensionName, multiValueHandling, capabilities.hasBitmapIndexes()); } if (capabilities.getType() == ValueType.LONG) { return new LongDimensionHandler(dimensionName); } if (capabilities.getType() == ValueType.FLOAT) { return new FloatDimensionHandler(dimensionName); } if (capabilities.getType() == ValueType.DOUBLE) { return new DoubleDimensionHandler(dimensionName); } // Return a StringDimensionHandler by default (null columns will be treated as String typed) return new StringDimensionHandler(dimensionName, multiValueHandling, true); }
topNAlgorithm = new DimExtractionTopNAlgorithm(adapter, query); } else if (columnCapabilities != null && !(columnCapabilities.getType() == ValueType.STRING && columnCapabilities.isDictionaryEncoded())) {
@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()); } }
} else if (capabilities != null && capabilities.getType() == ValueType.STRING && capabilities.isDictionaryEncoded()) {
&& capabilities.isDictionaryEncoded()) {
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(); } }
public static DimensionHandler getHandlerFromCapabilities( String dimensionName, ColumnCapabilities capabilities, MultiValueHandling multiValueHandling ) { if (capabilities == null) { return new StringDimensionHandler(dimensionName, multiValueHandling, true); } multiValueHandling = multiValueHandling == null ? MultiValueHandling.ofDefault() : multiValueHandling; if (capabilities.getType() == ValueType.STRING) { if (!capabilities.isDictionaryEncoded()) { throw new IAE("String column must have dictionary encoding."); } return new StringDimensionHandler(dimensionName, multiValueHandling, capabilities.hasBitmapIndexes()); } if (capabilities.getType() == ValueType.LONG) { return new LongDimensionHandler(dimensionName); } if (capabilities.getType() == ValueType.FLOAT) { return new FloatDimensionHandler(dimensionName); } if (capabilities.getType() == ValueType.DOUBLE) { return new DoubleDimensionHandler(dimensionName); } // Return a StringDimensionHandler by default (null columns will be treated as String typed) return new StringDimensionHandler(dimensionName, multiValueHandling, true); }
topNAlgorithm = new DimExtractionTopNAlgorithm(adapter, query); } else if (columnCapabilities != null && !(columnCapabilities.getType() == ValueType.STRING && columnCapabilities.isDictionaryEncoded())) {