Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVRO-4068: Java Code Cleanup #3192

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

belugabehr
Copy link
Contributor

What is the purpose of the change

  • This pull request many legacy artifact , fixing AVRO-4068

Verifying this change

This change is a trivial rework / code cleanup without any test coverage.

@github-actions github-actions bot added the Java Pull Requests for Java binding label Sep 30, 2024
@@ -192,7 +192,7 @@ public BigDecimal fromBytes(final ByteBuffer value, final Schema schema, final L
BigInteger bg = null;
ByteBuffer buffer = decoder.readBytes(null);
byte[] array = buffer.array();
if (array != null && array.length > 0) {
if (array.length > 0) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cannot be null

@@ -206,7 +206,7 @@ public int size() {
this.reserved = reserved;
for (Entry<String, ?> a : propMap.entrySet()) {
Object v = a.getValue();
JsonNode json = null;
JsonNode json;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This always gets overwritten

@@ -71,11 +70,9 @@ public class Protocol extends JsonProperties {
public static final long VERSION = 1;

// Support properties for both Protocol and Message objects
private static final Set<String> MESSAGE_RESERVED = Collections
.unmodifiableSet(new HashSet<>(Arrays.asList("doc", "response", "request", "errors", "one-way")));
private static final Set<String> MESSAGE_RESERVED = Set.of("doc", "response", "request", "errors", "one-way");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use new Set.of(xxx)

@@ -27,7 +27,6 @@ private DataFileConstants() {

public static final byte VERSION = 1;
public static final byte[] MAGIC = new byte[] { (byte) 'O', (byte) 'b', (byte) 'j', VERSION };
public static final long FOOTER_BLOCK = -1;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never used

Comment on lines -369 to -384
byte[] getData() {
return data;
}

long getNumEntries() {
return numEntries;
}

int getBlockSize() {
return blockSize;
}

boolean isFlushOnWrite() {
return flushOnWrite;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never used

@@ -26,15 +26,14 @@
import org.apache.avro.util.NonCopyingByteArrayOutputStream;
import org.apache.commons.compress.compressors.xz.XZCompressorInputStream;
import org.apache.commons.compress.compressors.xz.XZCompressorOutputStream;
import org.apache.commons.compress.utils.IOUtils;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecated

@@ -72,7 +71,7 @@ public ByteBuffer decompress(ByteBuffer data) throws IOException {
InputStream bytesIn = new ByteArrayInputStream(data.array(), computeOffset(data), data.remaining());

try (InputStream ios = new XZCompressorInputStream(bytesIn)) {
IOUtils.copy(ios, baos);
ios.transferTo(baos);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new JDK9+ syntax

Comment on lines -45 to -49
@Override
public boolean markSupported() {
return false;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same implementation as parent/super class

@belugabehr belugabehr force-pushed the belugabehr/AVRO-4068 branch from 83f23c8 to 39e70ac Compare October 1, 2024 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java Pull Requests for Java binding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant