Skip to content

Commit

Permalink
ARROW-6709: [JAVA] Jdbc adapter currentIndex should increment when va…
Browse files Browse the repository at this point in the history
…lue is null
  • Loading branch information
tianchen92 committed Sep 26, 2019
1 parent 35b6d07 commit b1e9d5a
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ public BigIntConsumer(BigIntVector vector, int index) {
public void consume(ResultSet resultSet) throws SQLException {
long value = resultSet.getLong(columnIndexInResultSet);
if (!resultSet.wasNull()) {
vector.setSafe(currentIndex++, value);
vector.setSafe(currentIndex, value);
}
currentIndex++;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ public BitConsumer(BitVector vector, int index) {
public void consume(ResultSet resultSet) throws SQLException {
boolean value = resultSet.getBoolean(columnIndexInResultSet);
if (!resultSet.wasNull()) {
vector.setSafe(currentIndex++, value ? 1 : 0);
vector.setSafe(currentIndex, value ? 1 : 0);
}
currentIndex++;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ public void consume(ResultSet resultSet) throws SQLException {
Date date = calendar == null ? resultSet.getDate(columnIndexInResultSet) :
resultSet.getDate(columnIndexInResultSet, calendar);
if (!resultSet.wasNull()) {
vector.setSafe(currentIndex++, date.getTime());
vector.setSafe(currentIndex, date.getTime());
}
currentIndex++;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ public DecimalConsumer(DecimalVector vector, int index) {
public void consume(ResultSet resultSet) throws SQLException {
BigDecimal value = resultSet.getBigDecimal(columnIndexInResultSet);
if (!resultSet.wasNull()) {
vector.setSafe(currentIndex++, value);
vector.setSafe(currentIndex, value);
}
currentIndex++;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ public DoubleConsumer(Float8Vector vector, int index) {
public void consume(ResultSet resultSet) throws SQLException {
double value = resultSet.getDouble(columnIndexInResultSet);
if (!resultSet.wasNull()) {
vector.setSafe(currentIndex++, value);
vector.setSafe(currentIndex, value);
}
currentIndex++;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ public FloatConsumer(Float4Vector vector, int index) {
public void consume(ResultSet resultSet) throws SQLException {
float value = resultSet.getFloat(columnIndexInResultSet);
if (!resultSet.wasNull()) {
vector.setSafe(currentIndex++, value);
vector.setSafe(currentIndex, value);
}
currentIndex++;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ public IntConsumer(IntVector vector, int index) {
public void consume(ResultSet resultSet) throws SQLException {
int value = resultSet.getInt(columnIndexInResultSet);
if (!resultSet.wasNull()) {
vector.setSafe(currentIndex++, value);
vector.setSafe(currentIndex, value);
}
currentIndex++;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ public SmallIntConsumer(SmallIntVector vector, int index) {
public void consume(ResultSet resultSet) throws SQLException {
short value = resultSet.getShort(columnIndexInResultSet);
if (!resultSet.wasNull()) {
vector.setSafe(currentIndex++, value);
vector.setSafe(currentIndex, value);
}
currentIndex++;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ public void consume(ResultSet resultSet) throws SQLException {
Time time = calendar == null ? resultSet.getTime(columnIndexInResultSet) :
resultSet.getTime(columnIndexInResultSet, calendar);
if (!resultSet.wasNull()) {
vector.setSafe(currentIndex++, (int) time.getTime());
vector.setSafe(currentIndex, (int) time.getTime());
}
currentIndex++;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ public void consume(ResultSet resultSet) throws SQLException {
Timestamp timestamp = calendar == null ? resultSet.getTimestamp(columnIndexInResultSet) :
resultSet.getTimestamp(columnIndexInResultSet, calendar);
if (!resultSet.wasNull()) {
vector.setSafe(currentIndex++, timestamp.getTime());
vector.setSafe(currentIndex, timestamp.getTime());
}
currentIndex++;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ public TinyIntConsumer(TinyIntVector vector, int index) {
public void consume(ResultSet resultSet) throws SQLException {
byte value = resultSet.getByte(columnIndexInResultSet);
if (!resultSet.wasNull()) {
vector.setSafe(currentIndex++, value);
vector.setSafe(currentIndex, value);
}
currentIndex++;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ public void consume(ResultSet resultSet) throws SQLException {
if (!resultSet.wasNull()) {
byte[] bytes = value.getBytes(StandardCharsets.UTF_8);

vector.setSafe(currentIndex++, bytes);
vector.setSafe(currentIndex, bytes);
}
currentIndex++;
}

@Override
Expand Down

0 comments on commit b1e9d5a

Please sign in to comment.