You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by jc...@apache.org on 2020/03/04 05:26:06 UTC
[orc] branch master updated: ORC-606: Optimize Timestamp parseNanos
calculation
This is an automated email from the ASF dual-hosted git repository.
jcamacho pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/orc.git
The following commit(s) were added to refs/heads/master by this push:
new 72c20e1 ORC-606: Optimize Timestamp parseNanos calculation
72c20e1 is described below
commit 72c20e18c86e525307c18c9b0eaf41fbc49d73eb
Author: Panos Garefalakis <pg...@cloudera.com>
AuthorDate: Mon Mar 2 21:51:16 2020 +0000
ORC-606: Optimize Timestamp parseNanos calculation
Fixes #488
Signed-off-by: Jesus Camacho Rodriguez <jc...@apache.org>
---
.../org/apache/orc/impl/TreeReaderFactory.java | 48 +++++++++++-----------
1 file changed, 23 insertions(+), 25 deletions(-)
diff --git a/java/core/src/java/org/apache/orc/impl/TreeReaderFactory.java b/java/core/src/java/org/apache/orc/impl/TreeReaderFactory.java
index 2e564d6..cac4067 100644
--- a/java/core/src/java/org/apache/orc/impl/TreeReaderFactory.java
+++ b/java/core/src/java/org/apache/orc/impl/TreeReaderFactory.java
@@ -166,6 +166,28 @@ public class TreeReaderFactory {
protected int vectorColumnCount;
protected final Context context;
+ static final long[] powerOfTenTable = {
+ 1L, // 0
+ 10L,
+ 100L,
+ 1_000L,
+ 10_000L,
+ 100_000L,
+ 1_000_000L,
+ 10_000_000L,
+ 100_000_000L, // 8
+ 1_000_000_000L,
+ 10_000_000_000L,
+ 100_000_000_000L,
+ 1_000_000_000_000L,
+ 10_000_000_000_000L,
+ 100_000_000_000_000L,
+ 1_000_000_000_000_000L,
+ 10_000_000_000_000_000L, // 16
+ 100_000_000_000_000_000L,
+ 1_000_000_000_000_000_000L, // 18
+ };
+
TreeReader(int columnId, Context context) throws IOException {
this(columnId, null, context);
}
@@ -1075,9 +1097,7 @@ public class TreeReaderFactory {
int zeros = 7 & (int) serialized;
int result = (int) (serialized >>> 3);
if (zeros != 0) {
- for (int i = 0; i <= zeros; ++i) {
- result *= 10;
- }
+ result *= (int) powerOfTenTable[zeros + 1];
}
return result;
}
@@ -1180,28 +1200,6 @@ public class TreeReaderFactory {
private int[] scratchScaleVector;
private byte[] scratchBytes;
- private static final long[] powerOfTenTable = {
- 1L, // 0
- 10L,
- 100L,
- 1_000L,
- 10_000L,
- 100_000L,
- 1_000_000L,
- 10_000_000L,
- 100_000_000L, // 8
- 1_000_000_000L,
- 10_000_000_000L,
- 100_000_000_000L,
- 1_000_000_000_000L,
- 10_000_000_000_000L,
- 100_000_000_000_000L,
- 1_000_000_000_000_000L,
- 10_000_000_000_000_000L, // 16
- 100_000_000_000_000_000L,
- 1_000_000_000_000_000_000L, // 18
- };
-
DecimalTreeReader(int columnId,
int precision,
int scale,