You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by do...@apache.org on 2021/07/29 19:25:56 UTC
[orc] branch main updated: ORC-835: Cache TRUE/FALSE Bytes in
StringGroupFromBooleanTreeReader (#741)
This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git
The following commit(s) were added to refs/heads/main by this push:
new bc53cc3 ORC-835: Cache TRUE/FALSE Bytes in StringGroupFromBooleanTreeReader (#741)
bc53cc3 is described below
commit bc53cc33a3f61ecced87df91450264ea85f4b69d
Author: belugabehr <12...@users.noreply.github.com>
AuthorDate: Thu Jul 29 15:25:48 2021 -0400
ORC-835: Cache TRUE/FALSE Bytes in StringGroupFromBooleanTreeReader (#741)
### What changes were proposed in this pull request?
Cache byte value for TRUE and FALSE strings.
### Why are the changes needed?
Performance.
### How was this patch tested?
No change in functionality. Uses existing unit tests.
---
java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java b/java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java
index bfd51ea..86e90cc 100644
--- a/java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java
+++ b/java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java
@@ -1069,6 +1069,8 @@ public class ConvertTreeReaderFactory extends TreeReaderFactory {
}
public static class StringGroupFromBooleanTreeReader extends StringGroupFromAnyIntegerTreeReader {
+ private static final byte[] TRUE_BYTES = "TRUE".getBytes(StandardCharsets.US_ASCII);
+ private static final byte[] FALSE_BYTES = "FALSE".getBytes(StandardCharsets.US_ASCII);
StringGroupFromBooleanTreeReader(int columnId, TypeDescription fileType,
TypeDescription readerType,
@@ -1078,8 +1080,7 @@ public class ConvertTreeReaderFactory extends TreeReaderFactory {
@Override
public void setConvertVectorElement(int elementNum) {
- byte[] bytes = (longColVector.vector[elementNum] != 0 ? "TRUE" : "FALSE")
- .getBytes(StandardCharsets.UTF_8);
+ byte[] bytes = (longColVector.vector[elementNum] != 0 ? TRUE_BYTES : FALSE_BYTES);
assignStringGroupVectorEntry(bytesColVector, elementNum, readerType, bytes);
}
}