Skip to content

Commit

Permalink
[hotfix] Change 'toLowerCase' to 'allowUpperCase' (#4271)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzelin authored Sep 27, 2024
1 parent f394501 commit ce56759
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ public class ArrowBundleRecords implements BundleRecords {

private final VectorSchemaRoot vectorSchemaRoot;
private final RowType rowType;
private final boolean onlyLowerCase;
private final boolean allowUpperCase;

public ArrowBundleRecords(
VectorSchemaRoot vectorSchemaRoot, RowType rowType, boolean onlyLowerCase) {
VectorSchemaRoot vectorSchemaRoot, RowType rowType, boolean allowUpperCase) {
this.vectorSchemaRoot = vectorSchemaRoot;
this.rowType = rowType;
this.onlyLowerCase = onlyLowerCase;
this.allowUpperCase = allowUpperCase;
}

public VectorSchemaRoot getVectorSchemaRoot() {
Expand All @@ -52,7 +52,7 @@ public long rowCount() {

@Override
public Iterator<InternalRow> iterator() {
ArrowBatchReader arrowBatchReader = new ArrowBatchReader(rowType, onlyLowerCase);
ArrowBatchReader arrowBatchReader = new ArrowBatchReader(rowType, allowUpperCase);
return arrowBatchReader.readBatch(vectorSchemaRoot).iterator();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public class ArrowBatchReader {
private final VectorizedColumnBatch batch;
private final Arrow2PaimonVectorConverter[] convertors;
private final RowType projectedRowType;
private final boolean toLowerCase;
private final boolean allowUpperCase;

public ArrowBatchReader(RowType rowType, boolean toLowerCase) {
public ArrowBatchReader(RowType rowType, boolean allowUpperCase) {
this.internalRowSerializer = new InternalRowSerializer(rowType);
ColumnVector[] columnVectors = new ColumnVector[rowType.getFieldCount()];
this.convertors = new Arrow2PaimonVectorConverter[rowType.getFieldCount()];
Expand All @@ -53,7 +53,7 @@ public ArrowBatchReader(RowType rowType, boolean toLowerCase) {
for (int i = 0; i < columnVectors.length; i++) {
this.convertors[i] = Arrow2PaimonVectorConverter.construct(rowType.getTypeAt(i));
}
this.toLowerCase = toLowerCase;
this.allowUpperCase = allowUpperCase;
}

public Iterable<InternalRow> readBatch(VectorSchemaRoot vsr) {
Expand All @@ -64,7 +64,7 @@ public Iterable<InternalRow> readBatch(VectorSchemaRoot vsr) {
try {
String fieldName = dataFields.get(i).name();
Field field =
arrowSchema.findField(toLowerCase ? fieldName.toLowerCase() : fieldName);
arrowSchema.findField(allowUpperCase ? fieldName : fieldName.toLowerCase());
int idx = arrowSchema.getFields().indexOf(field);
mapping[i] = idx;
} catch (IllegalArgumentException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public class ArrowFormatWriterTest {

@Test
public void testWrite() {
try (ArrowFormatWriter writer = new ArrowFormatWriter(PRIMITIVE_TYPE, 4096, false)) {
try (ArrowFormatWriter writer = new ArrowFormatWriter(PRIMITIVE_TYPE, 4096, true)) {
List<InternalRow> list = new ArrayList<>();
List<InternalRow.FieldGetter> fieldGetters = new ArrayList<>();

Expand Down Expand Up @@ -118,7 +118,7 @@ public void testWrite() {

@Test
public void testReadWithSchemaMessUp() {
try (ArrowFormatWriter writer = new ArrowFormatWriter(PRIMITIVE_TYPE, 4096, false)) {
try (ArrowFormatWriter writer = new ArrowFormatWriter(PRIMITIVE_TYPE, 4096, true)) {
List<InternalRow> list = new ArrayList<>();
List<InternalRow.FieldGetter> fieldGetters = new ArrayList<>();

Expand Down Expand Up @@ -160,7 +160,7 @@ public void testReadWithSchemaMessUp() {

@Test
public void testArrowBundleRecords() {
try (ArrowFormatWriter writer = new ArrowFormatWriter(PRIMITIVE_TYPE, 4096, false)) {
try (ArrowFormatWriter writer = new ArrowFormatWriter(PRIMITIVE_TYPE, 4096, true)) {
List<InternalRow> list = new ArrayList<>();
List<InternalRow.FieldGetter> fieldGetters = new ArrayList<>();

Expand Down Expand Up @@ -192,7 +192,7 @@ public void testArrowBundleRecords() {

@Test
public void testCWriter() {
try (ArrowFormatCWriter writer = new ArrowFormatCWriter(PRIMITIVE_TYPE, 4096, false)) {
try (ArrowFormatCWriter writer = new ArrowFormatCWriter(PRIMITIVE_TYPE, 4096, true)) {
List<InternalRow> list = new ArrayList<>();
List<InternalRow.FieldGetter> fieldGetters = new ArrayList<>();

Expand Down

0 comments on commit ce56759

Please sign in to comment.