@Test public void testBuildMetadata() { VirtualColumnContext virtualColumnContext = new VirtualColumnContext(svStringFieldSpec, 1); Assert.assertEquals( new ColumnMetadata.Builder().setVirtual(true).setColumnName("svStringColumn").setFieldType(FieldType.DIMENSION) .setDataType(DataType.STRING).setTotalDocs(1).setSingleValue(true).setDefaultNullValueString("null") .setCardinality(1).setHasDictionary(true).setHasInvertedIndex(true).setIsSorted(true).build(), new DefaultNullValueVirtualColumnProvider().buildMetadata(virtualColumnContext)); virtualColumnContext = new VirtualColumnContext(svIntFieldSpec, 1); Assert.assertEquals( new ColumnMetadata.Builder().setVirtual(true).setColumnName("svIntColumn").setFieldType(FieldType.DIMENSION) .setDataType(DataType.INT).setTotalDocs(1).setSingleValue(true).setDefaultNullValueString("-2147483648") .setCardinality(1).setHasDictionary(true).setHasInvertedIndex(true).setIsSorted(true).build(), new DefaultNullValueVirtualColumnProvider().buildMetadata(virtualColumnContext)); virtualColumnContext = new VirtualColumnContext(svLongFieldSpec, 1); Assert.assertEquals( new ColumnMetadata.Builder().setVirtual(true).setColumnName("svLongColumn").setFieldType(FieldType.DIMENSION) .setDataType(DataType.LONG).setTotalDocs(1).setSingleValue(true) .setDefaultNullValueString("-9223372036854775808").setCardinality(1).setHasDictionary(true) .setHasInvertedIndex(true).setIsSorted(true).build(), new DefaultNullValueVirtualColumnProvider().buildMetadata(virtualColumnContext)); virtualColumnContext = new VirtualColumnContext(svDoubleFieldSpec, 1); Assert.assertEquals( new ColumnMetadata.Builder().setVirtual(true).setColumnName("svDoubleColumn").setFieldType(FieldType.DIMENSION) .setDataType(DataType.DOUBLE).setTotalDocs(1).setSingleValue(true).setDefaultNullValueString("-Infinity") .setCardinality(1).setHasDictionary(true).setHasInvertedIndex(true).setIsSorted(true).build(), new DefaultNullValueVirtualColumnProvider().buildMetadata(virtualColumnContext)); virtualColumnContext = new VirtualColumnContext(svFloatFieldSpec, 1); Assert.assertEquals( new ColumnMetadata.Builder().setVirtual(true).setColumnName("svFloatColumn").setFieldType(FieldType.DIMENSION) .setDataType(DataType.FLOAT).setTotalDocs(1).setSingleValue(true).setDefaultNullValueString("-Infinity") .setCardinality(1).setHasDictionary(true).setHasInvertedIndex(true).setIsSorted(true).build(), new DefaultNullValueVirtualColumnProvider().buildMetadata(virtualColumnContext)); virtualColumnContext = new VirtualColumnContext(mvStringFieldSpec, 1); Assert.assertEquals( new ColumnMetadata.Builder().setVirtual(true).setColumnName("mvStringColumn").setFieldType(FieldType.DIMENSION) .setDataType(DataType.STRING).setTotalDocs(1).setSingleValue(false).setDefaultNullValueString("null") .setCardinality(1).setHasDictionary(true).setHasInvertedIndex(true).setIsSorted(false).build(), new DefaultNullValueVirtualColumnProvider().buildMetadata(virtualColumnContext)); virtualColumnContext = new VirtualColumnContext(mvIntFieldSpec, 1); Assert.assertEquals( new ColumnMetadata.Builder().setVirtual(true).setColumnName("mvIntColumn").setFieldType(FieldType.DIMENSION) .setDataType(DataType.INT).setTotalDocs(1).setSingleValue(false).setDefaultNullValueString("-2147483648") .setCardinality(1).setHasDictionary(true).setHasInvertedIndex(true).setIsSorted(false).build(), new DefaultNullValueVirtualColumnProvider().buildMetadata(virtualColumnContext)); virtualColumnContext = new VirtualColumnContext(mvLongFieldSpec, 1); Assert.assertEquals( new ColumnMetadata.Builder().setVirtual(true).setColumnName("mvLongColumn").setFieldType(FieldType.DIMENSION) .setDataType(DataType.LONG).setTotalDocs(1).setSingleValue(false) .setDefaultNullValueString("-9223372036854775808").setCardinality(1).setHasDictionary(true) .setHasInvertedIndex(true).setIsSorted(false).build(), new DefaultNullValueVirtualColumnProvider().buildMetadata(virtualColumnContext)); virtualColumnContext = new VirtualColumnContext(mvDoubleFieldSpec, 1); Assert.assertEquals( new ColumnMetadata.Builder().setVirtual(true).setColumnName("mvDoubleColumn").setFieldType(FieldType.DIMENSION) .setDataType(DataType.DOUBLE).setTotalDocs(1).setSingleValue(false).setDefaultNullValueString("-Infinity") .setCardinality(1).setHasDictionary(true).setHasInvertedIndex(true).setIsSorted(false).build(), new DefaultNullValueVirtualColumnProvider().buildMetadata(virtualColumnContext)); virtualColumnContext = new VirtualColumnContext(mvFloatFieldSpec, 1); Assert.assertEquals( new ColumnMetadata.Builder().setVirtual(true).setColumnName("mvFloatColumn").setFieldType(FieldType.DIMENSION) .setDataType(DataType.FLOAT).setTotalDocs(1).setSingleValue(false).setDefaultNullValueString("-Infinity") .setCardinality(1).setHasDictionary(true).setHasInvertedIndex(true).setIsSorted(false).build(), new DefaultNullValueVirtualColumnProvider().buildMetadata(virtualColumnContext)); }
@Override public ColumnMetadata buildMetadata(VirtualColumnContext context) { return getColumnMetadataBuilder(context).setCardinality(1).setHasDictionary(true).setHasInvertedIndex(true) .setIsSorted(context.getFieldSpec().isSingleValueField()).build(); }
DefaultNullValueVirtualColumnProvider extends BaseVirtualColumnProvider { @Override public ColumnMetadata buildMetadata(VirtualColumnContext context) { return getColumnMetadataBuilder(context).setCardinality(1).setHasDictionary(true).setHasInvertedIndex(true) .setIsSorted(context.getFieldSpec().isSingleValueField()).build(); } }
DefaultNullValueVirtualColumnProvider extends BaseVirtualColumnProvider { @Override public ColumnMetadata buildMetadata(VirtualColumnContext context) { return getColumnMetadataBuilder(context).setCardinality(1).setHasDictionary(true).setHasInvertedIndex(true) .setIsSorted(context.getFieldSpec().isSingleValueField()).build(); }  }
DefaultNullValueVirtualColumnProvider extends BaseVirtualColumnProvider { @Override public ColumnMetadata buildMetadata(VirtualColumnContext context) { return getColumnMetadataBuilder(context).setCardinality(1).setHasDictionary(true).setHasInvertedIndex(true) .setIsSorted(context.getFieldSpec().isSingleValueField()).build(); }  @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 ColumnMetadata buildMetadata(VirtualColumnContext context) { return getColumnMetadataBuilder(context).setCardinality(1).setHasDictionary(true).setHasInvertedIndex(true) .setIsSorted(context.getFieldSpec().isSingleValueField()).build(); }  @Override ForwardIndexReader<?> buildForwardIndex(VirtualColumnContext context); @Override Dictionary buildDictionary(VirtualColumnContext context); @Override InvertedIndexReader<?> buildInvertedIndex(VirtualColumnContext context); @Override ColumnMetadata buildMetadata(VirtualColumnContext context);  }