public class ValueBitSetTest {
private static final int FIXED_WIDTH_CHAR_SIZE = 10;
private KeyValueSchema generateSchema(int nFields, int nRepeating, final int nNotNull) {
KeyValueSchemaBuilder builder = new KeyValueSchemaBuilder(nNotNull);
for (int i = 0; i < nFields; i++) {
final int fieldIndex = i;
for (int j = 0; j < nRepeating; j++) {
PDatum datum = new PDatum() {
@Override
public boolean isNullable() {
return fieldIndex <= nNotNull;
}
@Override
public PDataType getDataType() {
return PDataType.values()[fieldIndex % PDataType.values().length];
}
@Override
public Integer getByteSize() {
return !getDataType().isFixedWidth() ? null : getDataType().getByteSize() == null ? FIXED_WIDTH_CHAR_SIZE : getDataType().getByteSize();
}
@Override
public Integer getMaxLength() {
return null;
}
@Override
public Integer getScale() {
return null;
}
@Override
public ColumnModifier getColumnModifier() {
return null;
}
};
builder.addField(datum);
}
}
KeyValueSchema schema = builder.build();
return schema;
}