Skip to content

Commit

Permalink
fixing warnings v15: vector s2
Browse files Browse the repository at this point in the history
  • Loading branch information
vibhatha committed Jan 11, 2024
1 parent c09a3d8 commit 8499caf
Show file tree
Hide file tree
Showing 56 changed files with 134 additions and 105 deletions.
11 changes: 0 additions & 11 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
<checkstyle.failOnViolation>true</checkstyle.failOnViolation>
<errorprone.javac.version>9+181-r4173-1</errorprone.javac.version>
<error_prone_core.version>2.24.0</error_prone_core.version>
<error_prone_annotations.version>2.24.0</error_prone_annotations.version>
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<mockito.core.version>5.5.0</mockito.core.version>
<mockito.inline.version>5.2.0</mockito.inline.version>
Expand Down Expand Up @@ -900,11 +899,6 @@
<artifactId>error_prone_core</artifactId>
<version>2.10.0</version>
</path>
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
<version>2.10.0</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
Expand Down Expand Up @@ -949,11 +943,6 @@
<artifactId>error_prone_core</artifactId>
<version>${error_prone_core.version}</version>
</path>
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
<version>${error_prone_annotations.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
Expand Down
5 changes: 0 additions & 5 deletions java/vector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@
<artifactId>eclipse-collections</artifactId>
<version>11.1.0</version>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
<version>2.23.0</version>
</dependency>
</dependencies>

<pluginRepositories>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public void get(int index, NullableBigIntHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public Long getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
13 changes: 6 additions & 7 deletions java/vector/src/main/java/org/apache/arrow/vector/BitVector.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public MinorType getMinorType() {
@Override
public void setInitialCapacity(int valueCount) {
final int size = getValidityBufferSizeFromCount(valueCount);
if (size * 2 > MAX_ALLOCATION_SIZE) {
if (size * 2L > MAX_ALLOCATION_SIZE) {
throw new OversizedAllocationException("Requested amount of memory is more than max allowed");
}
lastValueCapacity = valueCount;
Expand Down Expand Up @@ -149,15 +149,14 @@ public int getBufferSize() {
* @param length length of the split.
* @param target destination vector
*/
@Override
public void splitAndTransferTo(int startIndex, int length, BaseFixedWidthVector target) {
Preconditions.checkArgument(startIndex >= 0 && length >= 0 && startIndex + length <= valueCount,
"Invalid parameters startIndex: %s, length: %s for valueCount: %s", startIndex, length, valueCount);
compareTypes(target, "splitAndTransferTo");
target.clear();
target.validityBuffer = splitAndTransferBuffer(startIndex, length, target,
validityBuffer, target.validityBuffer);
target.valueBuffer = splitAndTransferBuffer(startIndex, length, target,
valueBuffer, target.valueBuffer);
target.validityBuffer = splitAndTransferBuffer(startIndex, length, validityBuffer, target.validityBuffer);
target.valueBuffer = splitAndTransferBuffer(startIndex, length, valueBuffer, target.valueBuffer);
target.refreshValueCapacity();

target.setValueCount(length);
Expand All @@ -166,7 +165,6 @@ public void splitAndTransferTo(int startIndex, int length, BaseFixedWidthVector
private ArrowBuf splitAndTransferBuffer(
int startIndex,
int length,
BaseFixedWidthVector target,
ArrowBuf sourceBuffer,
ArrowBuf destBuffer) {
int firstByteSource = BitVectorHelper.byteIndex(startIndex);
Expand Down Expand Up @@ -276,11 +274,12 @@ public void get(int index, NullableBitHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public Boolean getObject(int index) {
if (isSet(index) == 0) {
return null;
} else {
return new Boolean(getBit(index) != 0);
return getBit(index) != 0;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public void get(int index, NullableDateDayHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public Integer getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public void get(int index, NullableDateMilliHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public LocalDateTime getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public void get(int index, NullableDecimal256Holder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public BigDecimal getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ public void get(int index, NullableDecimalHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public BigDecimal getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public void get(int index, NullableDurationHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public Duration getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public void get(int index, NullableFloat4Holder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public Float getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public void get(int index, NullableFloat8Holder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public Double getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ private static void writeTimeStampData(TimeStampVector vector, int valueCount) {
}

private static void writeDecimalData(DecimalVector vector, int valueCount) {
final BigDecimal even = new BigDecimal(0.0543278923);
final BigDecimal odd = new BigDecimal(2.0543278923);
final BigDecimal even = new BigDecimal("0.0543278923");
final BigDecimal odd = new BigDecimal("2.0543278923");
for (int i = 0; i < valueCount; i++) {
if (i % 2 == 0) {
vector.setSafe(i, even);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public void get(int index, NullableIntHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public Integer getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public void get(int index, NullableIntervalDayHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public Duration getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down Expand Up @@ -206,23 +207,23 @@ private StringBuilder getAsStringBuilderHelper(int index) {
final int days = valueBuffer.getInt(startIndex);
int millis = valueBuffer.getInt(startIndex + MILLISECOND_OFFSET);

final int hours = millis / (org.apache.arrow.vector.util.DateUtility.hoursToMillis);
millis = millis % (org.apache.arrow.vector.util.DateUtility.hoursToMillis);
final int hours = millis / org.apache.arrow.vector.util.DateUtility.hoursToMillis;
millis = millis % org.apache.arrow.vector.util.DateUtility.hoursToMillis;

final int minutes = millis / (org.apache.arrow.vector.util.DateUtility.minutesToMillis);
millis = millis % (org.apache.arrow.vector.util.DateUtility.minutesToMillis);
final int minutes = millis / org.apache.arrow.vector.util.DateUtility.minutesToMillis;
millis = millis % org.apache.arrow.vector.util.DateUtility.minutesToMillis;

final int seconds = millis / (org.apache.arrow.vector.util.DateUtility.secondsToMillis);
millis = millis % (org.apache.arrow.vector.util.DateUtility.secondsToMillis);
final int seconds = millis / org.apache.arrow.vector.util.DateUtility.secondsToMillis;
millis = millis % org.apache.arrow.vector.util.DateUtility.secondsToMillis;

final String dayString = (Math.abs(days) == 1) ? " day " : " days ";

return (new StringBuilder()
return new StringBuilder()
.append(days).append(dayString)
.append(hours).append(":")
.append(minutes).append(":")
.append(seconds).append(".")
.append(millis));
.append(millis);
}

/*----------------------------------------------------------------*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ public void get(int index, NullableIntervalMonthDayNanoHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public PeriodDuration getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public void get(int index, NullableIntervalYearHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public Period getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down Expand Up @@ -181,11 +182,11 @@ private StringBuilder getAsStringBuilderHelper(int index) {
final String yearString = (Math.abs(years) == 1) ? " year " : " years ";
final String monthString = (Math.abs(months) == 1) ? " month " : " months ";

return (new StringBuilder()
return new StringBuilder()
.append(years)
.append(yearString)
.append(months)
.append(monthString));
.append(monthString);
}

/*----------------------------------------------------------------*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public void read(int index, ReusableBuffer<?> buffer) {
* @param index position of element to get
* @return byte array for non-null element, null otherwise
*/
@Override
public byte[] getObject(int index) {
return get(index);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public byte[] get(int index) {
* @param index position of element to get
* @return Text object for non-null element, null otherwise
*/
@Override
public Text getObject(int index) {
assert index >= 0;
if (NULL_CHECKING_ENABLED && isSet(index) == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public void get(int index, NullableSmallIntHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public Short getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public void get(int index, NullableTimeMicroHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public Long getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public void get(int index, NullableTimeMilliHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public LocalDateTime getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public void get(int index, NullableTimeNanoHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public Long getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public void get(int index, NullableTimeSecHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public Integer getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public void get(int index, NullableTimeStampMicroTZHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public Long getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public void get(int index, NullableTimeStampMicroHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public LocalDateTime getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public void get(int index, NullableTimeStampMilliTZHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public Long getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public void get(int index, NullableTimeStampMilliHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public LocalDateTime getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public void get(int index, NullableTimeStampNanoTZHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public Long getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public void get(int index, NullableTimeStampNanoHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public LocalDateTime getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public void get(int index, NullableTimeStampSecHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public LocalDateTime getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public void get(int index, NullableTinyIntHolder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public Byte getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public void get(int index, NullableUInt1Holder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public Byte getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public void get(int index, NullableUInt2Holder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public Character getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public void get(int index, NullableUInt8Holder holder) {
* @param index position of element
* @return element at given index
*/
@Override
public Long getObject(int index) {
if (isSet(index) == 0) {
return null;
Expand Down
Loading

0 comments on commit 8499caf

Please sign in to comment.