@Override
  public Dictionary buildDictionary(VirtualColumnContext context) {
    FieldSpec fieldSpec = context.getFieldSpec();
    switch (fieldSpec.getDataType().getStoredType()) {
      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 BIG_DECIMAL:
        return new ConstantValueBigDecimalDictionary((BigDecimal) fieldSpec.getDefaultNullValue());
      case STRING:
        return new ConstantValueStringDictionary((String) fieldSpec.getDefaultNullValue());
      case BYTES:
        return new ConstantValueBytesDictionary((byte[]) fieldSpec.getDefaultNullValue());
      default:
        throw new IllegalStateException();
    }
  }
@Test
  public void testBuildDictionary() {
    VirtualColumnContext virtualColumnContext = new VirtualColumnContext(SV_INT, 1);
    Dictionary dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext);
    assertEquals(dictionary.getClass(), ConstantValueIntDictionary.class);
    assertEquals(dictionary.getIntValue(0), Integer.MIN_VALUE);

    virtualColumnContext = new VirtualColumnContext(SV_LONG, 1);
    dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext);
    assertEquals(dictionary.getClass(), ConstantValueLongDictionary.class);
    assertEquals(dictionary.getLongValue(0), Long.MIN_VALUE);

    virtualColumnContext = new VirtualColumnContext(SV_FLOAT, 1);
    dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext);
    assertEquals(dictionary.getClass(), ConstantValueFloatDictionary.class);
    assertEquals(dictionary.getFloatValue(0), Float.NEGATIVE_INFINITY);

    virtualColumnContext = new VirtualColumnContext(SV_DOUBLE, 1);
    dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext);
    assertEquals(dictionary.getClass(), ConstantValueDoubleDictionary.class);
    assertEquals(dictionary.getDoubleValue(0), Double.NEGATIVE_INFINITY);

    virtualColumnContext = new VirtualColumnContext(SV_STRING, 1);
    dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext);
    assertEquals(dictionary.getClass(), ConstantValueStringDictionary.class);
    assertEquals(dictionary.getStringValue(0), "null");

    virtualColumnContext = new VirtualColumnContext(SV_BYTES, 1);
    dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext);
    assertEquals(dictionary.getClass(), ConstantValueBytesDictionary.class);
    assertEquals(dictionary.getBytesValue(0), new byte[0]);

    virtualColumnContext = new VirtualColumnContext(MV_INT, 1);
    dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext);
    assertEquals(dictionary.getClass(), ConstantValueIntDictionary.class);
    assertEquals(dictionary.getIntValue(0), Integer.MIN_VALUE);

    virtualColumnContext = new VirtualColumnContext(MV_LONG, 1);
    dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext);
    assertEquals(dictionary.getClass(), ConstantValueLongDictionary.class);
    assertEquals(dictionary.getLongValue(0), Long.MIN_VALUE);

    virtualColumnContext = new VirtualColumnContext(MV_FLOAT, 1);
    dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext);
    assertEquals(dictionary.getClass(), ConstantValueFloatDictionary.class);
    assertEquals(dictionary.getFloatValue(0), Float.NEGATIVE_INFINITY);

    virtualColumnContext = new VirtualColumnContext(MV_DOUBLE, 1);
    dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext);
    assertEquals(dictionary.getClass(), ConstantValueDoubleDictionary.class);
    assertEquals(dictionary.getDoubleValue(0), Double.NEGATIVE_INFINITY);

    virtualColumnContext = new VirtualColumnContext(MV_STRING, 1);
    dictionary = new DefaultNullValueVirtualColumnProvider().buildDictionary(virtualColumnContext);
    assertEquals(dictionary.getClass(), ConstantValueStringDictionary.class);
    assertEquals(dictionary.getStringValue(0), "null");
  }