Skip to content

Commit

Permalink
[format][orc] remove all isRepeating
Browse files Browse the repository at this point in the history
  • Loading branch information
ranxianglei.rxl committed Oct 15, 2024
1 parent 2920fc9 commit 8a89649
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected int rowMapper(int r) {

@Override
public boolean isNullAt(int i) {
return !vector.noNulls && vector.isNull[vector.isRepeating ? 0 : i];
return !vector.noNulls && vector.isNull[rowMapper(i)];
}

public static org.apache.paimon.data.columnar.ColumnVector createPaimonVector(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ public OrcBytesColumnVector(BytesColumnVector vector, VectorizedRowBatch orcBatc

@Override
public Bytes getBytes(int i) {
int rowId = vector.isRepeating ? 0 : i;
int selectedRowId = rowMapper(rowId);
int rowId = rowMapper(i);
byte[][] data = vector.vector;
int[] start = vector.start;
int[] length = vector.length;
return new Bytes(data[selectedRowId], start[selectedRowId], length[selectedRowId]);
return new Bytes(data[rowId], start[rowId], length[rowId]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ public OrcDecimalColumnVector(DecimalColumnVector vector, VectorizedRowBatch orc
@Override
public Decimal getDecimal(int i, int precision, int scale) {
i = rowMapper(i);
BigDecimal data =
vector.vector[vector.isRepeating ? 0 : i].getHiveDecimal().bigDecimalValue();
BigDecimal data = vector.vector[i].getHiveDecimal().bigDecimalValue();
return Decimal.fromBigDecimal(data, precision, scale);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public OrcDoubleColumnVector(DoubleColumnVector vector, VectorizedRowBatch orcBa
@Override
public double getDouble(int i) {
i = rowMapper(i);
return vector.vector[vector.isRepeating ? 0 : i];
return vector.vector[i];
}

@Override
public float getFloat(int i) {
i = rowMapper(i);
return (float) vector.vector[vector.isRepeating ? 0 : i];
return (float) vector.vector[i];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ public class OrcLegacyTimestampColumnVector extends AbstractOrcColumnVector
@Override
public Timestamp getTimestamp(int i, int precision) {
i = rowMapper(i);
int index = hiveVector.isRepeating ? 0 : i;
java.sql.Timestamp timestamp = toTimestamp(hiveVector.vector[index]);
java.sql.Timestamp timestamp = toTimestamp(hiveVector.vector[i]);
return Timestamp.fromSQLTimestamp(timestamp);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,30 @@ public OrcLongColumnVector(LongColumnVector vector, VectorizedRowBatch orcBatch)
@Override
public long getLong(int i) {
i = rowMapper(i);
return vector.vector[vector.isRepeating ? 0 : i];
return vector.vector[i];
}

@Override
public boolean getBoolean(int i) {
i = rowMapper(i);
return vector.vector[vector.isRepeating ? 0 : i] == 1;
return vector.vector[i] == 1;
}

@Override
public byte getByte(int i) {
i = rowMapper(i);
return (byte) vector.vector[vector.isRepeating ? 0 : i];
return (byte) vector.vector[i];
}

@Override
public int getInt(int i) {
i = rowMapper(i);
return (int) vector.vector[vector.isRepeating ? 0 : i];
return (int) vector.vector[i];
}

@Override
public short getShort(int i) {
i = rowMapper(i);
return (short) vector.vector[vector.isRepeating ? 0 : i];
return (short) vector.vector[i];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public OrcTimestampColumnVector(ColumnVector vector, VectorizedRowBatch orcBatch
@Override
public Timestamp getTimestamp(int i, int precision) {
i = rowMapper(i);
int index = vector.isRepeating ? 0 : i;
return DateTimeUtils.toInternal(vector.time[index], vector.nanos[index] % 1_000_000);
return DateTimeUtils.toInternal(vector.time[i], vector.nanos[i] % 1_000_000);
}
}

0 comments on commit 8a89649

Please sign in to comment.