@Test public void testBuildDictionary() { VirtualColumnContext virtualColumnContext = new VirtualColumnContext(svStringFieldSpec, 1); Dictionary dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext); Assert.assertEquals(ConstantValueStringDictionary.class, dictionary.getClass()); Assert.assertEquals("null", dictionary.getStringValue(0)); virtualColumnContext = new VirtualColumnContext(svIntFieldSpec, 1); dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext); Assert.assertEquals(ConstantValueIntDictionary.class, dictionary.getClass()); Assert.assertEquals(Integer.MIN_VALUE, dictionary.getIntValue(0)); virtualColumnContext = new VirtualColumnContext(svLongFieldSpec, 1); dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext); Assert.assertEquals(ConstantValueLongDictionary.class, dictionary.getClass()); Assert.assertEquals(Long.MIN_VALUE, dictionary.getLongValue(0)); virtualColumnContext = new VirtualColumnContext(svDoubleFieldSpec, 1); dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext); Assert.assertEquals(ConstantValueDoubleDictionary.class, dictionary.getClass()); Assert.assertEquals(Double.NEGATIVE_INFINITY, dictionary.getDoubleValue(0)); virtualColumnContext = new VirtualColumnContext(svFloatFieldSpec, 1); dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext); Assert.assertEquals(ConstantValueFloatDictionary.class, dictionary.getClass()); Assert.assertEquals(Float.NEGATIVE_INFINITY, dictionary.getFloatValue(0)); virtualColumnContext = new VirtualColumnContext(mvStringFieldSpec, 1); dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext); Assert.assertEquals(ConstantValueStringDictionary.class, dictionary.getClass()); Assert.assertEquals("null", dictionary.getStringValue(0)); virtualColumnContext = new VirtualColumnContext(mvIntFieldSpec, 1); dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext); Assert.assertEquals(ConstantValueIntDictionary.class, dictionary.getClass()); Assert.assertEquals(Integer.MIN_VALUE, dictionary.getIntValue(0)); virtualColumnContext = new VirtualColumnContext(mvLongFieldSpec, 1); dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext); Assert.assertEquals(ConstantValueLongDictionary.class, dictionary.getClass()); Assert.assertEquals(Long.MIN_VALUE, dictionary.getLongValue(0)); virtualColumnContext = new VirtualColumnContext(mvDoubleFieldSpec, 1); dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext); Assert.assertEquals(ConstantValueDoubleDictionary.class, dictionary.getClass()); Assert.assertEquals(Double.NEGATIVE_INFINITY, dictionary.getDoubleValue(0)); virtualColumnContext = new VirtualColumnContext(mvFloatFieldSpec, 1); dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext); Assert.assertEquals(ConstantValueFloatDictionary.class, dictionary.getClass()); Assert.assertEquals(Float.NEGATIVE_INFINITY, dictionary.getFloatValue(0)); }
@Override public Dictionary buildDictionary(VirtualColumnContext context) { FieldSpec fieldSpec = context.getFieldSpec(); switch (fieldSpec.getDataType()) { case INT: return new ConstantValueIntDictionary((int) fieldSpec.getDefaultNullValue()); case LONG: return new ConstantValueLongDictionary((long) fieldSpec.getDefaultNullValue()); case FLOAT: return new ConstantValueFloatDictionary((float) fieldSpec.getDefaultNullValue()); case DOUBLE: return new ConstantValueDoubleDictionary((double) fieldSpec.getDefaultNullValue()); case STRING: return new ConstantValueStringDictionary((String) fieldSpec.getDefaultNullValue()); case BYTES: return new ConstantValueBytesDictionary((byte[]) fieldSpec.getDefaultNullValue()); default: throw new IllegalStateException(); } }
DefaultNullValueVirtualColumnProvider extends BaseVirtualColumnProvider { @Override public Dictionary buildDictionary(VirtualColumnContext context) { FieldSpec fieldSpec = context.getFieldSpec(); switch (fieldSpec.getDataType()) { case INT: return new ConstantValueIntDictionary((int) fieldSpec.getDefaultNullValue()); case LONG: return new ConstantValueLongDictionary((long) fieldSpec.getDefaultNullValue()); case FLOAT: return new ConstantValueFloatDictionary((float) fieldSpec.getDefaultNullValue()); case DOUBLE: return new ConstantValueDoubleDictionary((double) fieldSpec.getDefaultNullValue()); case STRING: return new ConstantValueStringDictionary((String) fieldSpec.getDefaultNullValue()); case BYTES: return new ConstantValueBytesDictionary((byte[]) fieldSpec.getDefaultNullValue()); default: throw new IllegalStateException(); } } }
DefaultNullValueVirtualColumnProvider extends BaseVirtualColumnProvider { @Override public Dictionary buildDictionary(VirtualColumnContext context) { FieldSpec fieldSpec = context.getFieldSpec(); switch (fieldSpec.getDataType()) { case INT: return new ConstantValueIntDictionary((int) fieldSpec.getDefaultNullValue()); case LONG: return new ConstantValueLongDictionary((long) fieldSpec.getDefaultNullValue()); case FLOAT: return new ConstantValueFloatDictionary((float) fieldSpec.getDefaultNullValue()); case DOUBLE: return new ConstantValueDoubleDictionary((double) fieldSpec.getDefaultNullValue()); case STRING: return new ConstantValueStringDictionary((String) fieldSpec.getDefaultNullValue()); case BYTES: return new ConstantValueBytesDictionary((byte[]) fieldSpec.getDefaultNullValue()); default: throw new IllegalStateException(); } }  }
DefaultNullValueVirtualColumnProvider extends BaseVirtualColumnProvider { @Override public Dictionary buildDictionary(VirtualColumnContext context) { FieldSpec fieldSpec = context.getFieldSpec(); switch (fieldSpec.getDataType()) { case INT: return new ConstantValueIntDictionary((int) fieldSpec.getDefaultNullValue()); case LONG: return new ConstantValueLongDictionary((long) fieldSpec.getDefaultNullValue()); case FLOAT: return new ConstantValueFloatDictionary((float) fieldSpec.getDefaultNullValue()); case DOUBLE: return new ConstantValueDoubleDictionary((double) fieldSpec.getDefaultNullValue()); case STRING: return new ConstantValueStringDictionary((String) fieldSpec.getDefaultNullValue()); case BYTES: return new ConstantValueBytesDictionary((byte[]) fieldSpec.getDefaultNullValue()); default: throw new IllegalStateException(); } }  @Override ForwardIndexReader<?> buildForwardIndex(VirtualColumnContext context); @Override Dictionary buildDictionary(VirtualColumnContext context); @Override InvertedIndexReader<?> buildInvertedIndex(VirtualColumnContext context); @Override ColumnMetadata buildMetadata(VirtualColumnContext context); }
DefaultNullValueVirtualColumnProvider extends BaseVirtualColumnProvider { @Override public Dictionary buildDictionary(VirtualColumnContext context) { FieldSpec fieldSpec = context.getFieldSpec(); switch (fieldSpec.getDataType()) { case INT: return new ConstantValueIntDictionary((int) fieldSpec.getDefaultNullValue()); case LONG: return new ConstantValueLongDictionary((long) fieldSpec.getDefaultNullValue()); case FLOAT: return new ConstantValueFloatDictionary((float) fieldSpec.getDefaultNullValue()); case DOUBLE: return new ConstantValueDoubleDictionary((double) fieldSpec.getDefaultNullValue()); case STRING: return new ConstantValueStringDictionary((String) fieldSpec.getDefaultNullValue()); case BYTES: return new ConstantValueBytesDictionary((byte[]) fieldSpec.getDefaultNullValue()); default: throw new IllegalStateException(); } }  @Override ForwardIndexReader<?> buildForwardIndex(VirtualColumnContext context); @Override Dictionary buildDictionary(VirtualColumnContext context); @Override InvertedIndexReader<?> buildInvertedIndex(VirtualColumnContext context); @Override ColumnMetadata buildMetadata(VirtualColumnContext context);  }