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 2022/01/31 03:49:02 UTC
[orc] branch branch-1.7 updated: ORC-1107: Fix NPE at benchmark data schema loading (#1033)
This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch branch-1.7
in repository https://gitbox.apache.org/repos/asf/orc.git
The following commit(s) were added to refs/heads/branch-1.7 by this push:
new 42030ac ORC-1107: Fix NPE at benchmark data schema loading (#1033)
42030ac is described below
commit 42030aca7e3f3a976bad9d85f6bbabae4cceef9e
Author: William Hyun <wi...@apache.org>
AuthorDate: Sun Jan 30 19:47:48 2022 -0800
ORC-1107: Fix NPE at benchmark data schema loading (#1033)
### What changes were proposed in this pull request?
This PR aims to fix a NPE at benchmark data schema loading.
### Why are the changes needed?
**BEFORE**
```
$ java -jar core/target/orc-benchmarks-core-*-uber.jar scan data -d taxy -c zstd
Exception in thread "main" java.lang.NullPointerException
at org.apache.orc.bench.core.Utilities.loadSchema(Utilities.java:37)
at org.apache.orc.bench.core.convert.ScanVariants.run(ScanVariants.java:78)
at org.apache.orc.bench.core.Driver.main(Driver.java:64)
```
**AFTER**
```
$ java -jar core/target/orc-benchmarks-core-*-uber.jar scan data -d taxy -c zstd
Exception in thread "main" java.lang.IllegalArgumentException: Schema Not Found: taxy.schema
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
at org.apache.orc.bench.core.Utilities.loadSchema(Utilities.java:37)
at org.apache.orc.bench.core.convert.ScanVariants.run(ScanVariants.java:78)
at org.apache.orc.bench.core.Driver.main(Driver.java:64)
```
### How was this patch tested?
Manually.
(cherry picked from commit e8b858f41e3730d9034212d9f38942912047c908)
Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
java/bench/core/src/java/org/apache/orc/bench/core/Utilities.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/java/bench/core/src/java/org/apache/orc/bench/core/Utilities.java b/java/bench/core/src/java/org/apache/orc/bench/core/Utilities.java
index 92ae0d4..1d25746 100644
--- a/java/bench/core/src/java/org/apache/orc/bench/core/Utilities.java
+++ b/java/bench/core/src/java/org/apache/orc/bench/core/Utilities.java
@@ -18,6 +18,7 @@
package org.apache.orc.bench.core;
+import com.google.common.base.Preconditions;
import org.apache.commons.cli.CommandLine;
import org.apache.hadoop.fs.Path;
import org.apache.orc.TypeDescription;
@@ -33,6 +34,7 @@ public class Utilities {
public static TypeDescription loadSchema(String name) throws IOException {
InputStream in = Utilities.class.getClassLoader().getResourceAsStream(name);
+ Preconditions.checkArgument(in != null, "Schema not found: " + name);
byte[] buffer= new byte[1 * 1024];
int len = in.read(buffer);
StringBuilder string = new StringBuilder();