@Test public void testLoadSorted() { final JavaTypeFactoryImpl typeFactory = new JavaTypeFactoryImpl(); final RelDataType rowType = typeFactory.createStructType( new RelDataTypeFactory.FieldInfoBuilder() .add("empid", typeFactory.createType(int.class)) .add("deptno", typeFactory.createType(int.class)) .add("name", typeFactory.createType(String.class))); final Enumerable<Object[]> enumerable = Linq4j.asEnumerable( Arrays.asList( new Object[]{100, 10, "Bill"}, new Object[]{200, 20, "Eric"}, new Object[]{150, 10, "Sebastian"}, new Object[]{160, 10, "Theodore"})); final ColumnLoader<Object[]> loader = new ColumnLoader<Object[]>(typeFactory, enumerable, rowType); checkColumn( loader.representationValues.get(0), ArrayTable.RepresentationType.BIT_SLICED_PRIMITIVE_ARRAY, "Column(representation=BitSlicedPrimitiveArray(ordinal=0, bitCount=8, primitive=INT, signed=false), value=[100, 150, 160, 200, 0, 0, 0, 0])"); checkColumn( loader.representationValues.get(1), ArrayTable.RepresentationType.BIT_SLICED_PRIMITIVE_ARRAY, "Column(representation=BitSlicedPrimitiveArray(ordinal=1, bitCount=5, primitive=INT, signed=false), value=[10, 10, 10, 20, 0, 0, 0, 0, 0, 0, 0, 0])"); checkColumn( loader.representationValues.get(2), ArrayTable.RepresentationType.OBJECT_ARRAY, "Column(representation=ObjectArray(ordinal=2), value=[Bill, Sebastian, Theodore, Eric])"); }
checkColumn( loader.representationValues.get(0), ArrayTable.RepresentationType.BIT_SLICED_PRIMITIVE_ARRAY, "Column(representation=BitSlicedPrimitiveArray(ordinal=0, bitCount=5, primitive=INT, signed=false), value=[10, 30, 10, 20, 0, 0, 0, 0, 0, 0, 0, 0])"); checkColumn( loader.representationValues.get(1), ArrayTable.RepresentationType.BIT_SLICED_PRIMITIVE_ARRAY, "Column(representation=BitSlicedPrimitiveArray(ordinal=1, bitCount=8, primitive=INT, signed=false), value=[100, 150, 160, 200, 0, 0, 0, 0])"); checkColumn( loader.representationValues.get(2), ArrayTable.RepresentationType.OBJECT_ARRAY,
new ColumnLoader<Object[]>(typeFactory, enumerable, RelDataTypeImpl.proto(rowType), null); checkColumn( loader.representationValues.get(0), ArrayTable.RepresentationType.BIT_SLICED_PRIMITIVE_ARRAY, "Column(representation=BitSlicedPrimitiveArray(ordinal=0, bitCount=8, primitive=INT, signed=false), value=[100, 150, 160, 200, 0, 0, 0, 0])"); checkColumn( loader.representationValues.get(1), ArrayTable.RepresentationType.BIT_SLICED_PRIMITIVE_ARRAY, "Column(representation=BitSlicedPrimitiveArray(ordinal=1, bitCount=5, primitive=INT, signed=false), value=[10, 10, 10, 20, 0, 0, 0, 0, 0, 0, 0, 0])"); checkColumn( loader.representationValues.get(2), ArrayTable.RepresentationType.OBJECT_ARRAY,
checkColumn( loader.representationValues.get(0), ArrayTable.RepresentationType.BIT_SLICED_PRIMITIVE_ARRAY, "Column(representation=BitSlicedPrimitiveArray(ordinal=0, bitCount=5, primitive=INT, signed=false), value=[10, 30, 10, 20, 0, 0, 0, 0, 0, 0, 0, 0])"); checkColumn( loader.representationValues.get(1), ArrayTable.RepresentationType.BIT_SLICED_PRIMITIVE_ARRAY, "Column(representation=BitSlicedPrimitiveArray(ordinal=1, bitCount=8, primitive=INT, signed=false), value=[100, 150, 160, 200, 0, 0, 0, 0])"); checkColumn( loader.representationValues.get(2), ArrayTable.RepresentationType.OBJECT_ARRAY,