[ 
https://issues.apache.org/jira/browse/PARQUET-1596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16863157#comment-16863157
 ] 

ASF GitHub Bot commented on PARQUET-1596:
-----------------------------------------

Fokko commented on pull request #648: PARQUET-1596: PARQUET-1375 broke 
parquet-cli's to-avro command
URL: https://github.com/apache/parquet-mr/pull/648
 
 
   Make sure you have checked _all_ steps below.
   
   ### Jira
   
   - [x] My PR addresses the following [Parquet 
Jira](https://issues.apache.org/jira/browse/PARQUET/) issues and references 
them in the PR title. For example, "PARQUET-1596: My Parquet PR"
     - https://issues.apache.org/jira/browse/PARQUET-1596
     - In case you are adding a dependency, check if the license complies with 
the [ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html#category-x).
   
   ### Tests
   
   - [x] My PR adds the following unit tests __OR__ does not need testing for 
this extremely good reason:
   
   ### Commits
   
   - [x] My commits all reference Jira issues in their subject lines. In 
addition, my commits follow the guidelines from "[How to write a good git 
commit message](http://chris.beams.io/posts/git-commit/)":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   
   ### Documentation
   
   - x] In case of new functionality, my PR adds documentation that describes 
how to use it.
     - All the public functions and the classes in the PR contain Javadoc that 
explain what it does
   
   The NPE:
   
   ```
   cat 
/Users/fokkodriesprong/Desktop/parquet-mr/parquet-cli/target/surefire-reports/org.apache.parquet.cli.commands.ToAvroCommandTest.txt
   
-------------------------------------------------------------------------------
   Test set: org.apache.parquet.cli.commands.ToAvroCommandTest
   
-------------------------------------------------------------------------------
   Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.154 sec 
<<< FAILURE!
   testToAvroCommandFromJson(org.apache.parquet.cli.commands.ToAvroCommandTest) 
 Time elapsed: 0.052 sec  <<< ERROR!
   java.lang.NullPointerException
        at org.apache.hadoop.fs.FileSystem.getDefaultUri(FileSystem.java:180)
        at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:361)
        at org.apache.hadoop.fs.FileSystem.getLocal(FileSystem.java:344)
        at org.apache.parquet.cli.BaseCommand.defaultFS(BaseCommand.java:81)
        at 
org.apache.parquet.cli.BaseCommand.qualifiedPath(BaseCommand.java:164)
        at org.apache.parquet.cli.BaseCommand.openSeekable(BaseCommand.java:215)
        at 
org.apache.parquet.cli.BaseCommand.getAvroSchema(BaseCommand.java:375)
        at 
org.apache.parquet.cli.commands.ToAvroCommand.run(ToAvroCommand.java:93)
        at 
org.apache.parquet.cli.commands.ToAvroCommandTest.testToAvroCommandFromJson(ToAvroCommandTest.java:72)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
        at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
        at org.junit.rules.RunRules.evaluate(RunRules.java:20)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at 
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
        at 
org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
        at 
org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
        at 
org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
        at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
   ```
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> PARQUET-1375 broke parquet-cli's to-avro command
> ------------------------------------------------
>
>                 Key: PARQUET-1596
>                 URL: https://issues.apache.org/jira/browse/PARQUET-1596
>             Project: Parquet
>          Issue Type: Bug
>          Components: parquet-cli
>            Reporter: Kengo Seki
>            Assignee: Fokko Driesprong
>            Priority: Major
>              Labels: pull-request-available
>
> Given the following JSON file:
> {code}
> $ cat /tmp/sample.json 
> { "id": 1, "name": "Alice" }
> { "id": 2, "name": "Bob" }
> { "id": 3, "name": "Carol" }
> { "id": 4, "name": "Dave" }
> {code}
> using {{to-avro}} on the master branch for converting this into avro fails 
> with NPE:
> {code}
> $ git branch -v
> * master 47398be7 PARQUET-1375: Upgrade to Jackson 2.9.9 (#616)
> $ mvn clean install -DskipTests
> (snip)
> [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ parquet-cli 
> ---
> [INFO] Installing 
> /home/sekikn/repo/parquet-mr/parquet-cli/target/parquet-cli-1.12.0-SNAPSHOT.jar
>  to 
> /home/sekikn/.m2/repository/org/apache/parquet/parquet-cli/1.12.0-SNAPSHOT/parquet-cli-1.12.0-SNAPSHOT.jar
> [INFO] Installing /home/sekikn/repo/parquet-mr/parquet-cli/pom.xml to 
> /home/sekikn/.m2/repository/org/apache/parquet/parquet-cli/1.12.0-SNAPSHOT/parquet-cli-1.12.0-SNAPSHOT.pom
> [INFO] Installing 
> /home/sekikn/repo/parquet-mr/parquet-cli/target/parquet-cli-1.12.0-SNAPSHOT-tests.jar
>  to 
> /home/sekikn/.m2/repository/org/apache/parquet/parquet-cli/1.12.0-SNAPSHOT/parquet-cli-1.12.0-SNAPSHOT-tests.jar
> [INFO] Installing 
> /home/sekikn/repo/parquet-mr/parquet-cli/target/parquet-cli-1.12.0-SNAPSHOT-runtime.jar
>  to 
> /home/sekikn/.m2/repository/org/apache/parquet/parquet-cli/1.12.0-SNAPSHOT/parquet-cli-1.12.0-SNAPSHOT-runtime.jar
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time:  14.769 s
> [INFO] Finished at: 2019-06-12T23:52:57+09:00
> [INFO] 
> ------------------------------------------------------------------------
> $ mvn dependency:copy-dependencies
> (snip)
> $ java -cp 'target/*:target/dependency/*' org.apache.parquet.cli.Main to-avro 
> /tmp/sample.json -o /tmp/sample.avro
> Unknown error
> java.lang.RuntimeException: Failed on record 0
>       at 
> org.apache.parquet.cli.commands.ToAvroCommand.run(ToAvroCommand.java:120)
>       at org.apache.parquet.cli.Main.run(Main.java:147)
>       at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
>       at org.apache.parquet.cli.Main.main(Main.java:177)
> Caused by: java.lang.NullPointerException
>       at org.apache.avro.file.DataFileWriter.create(DataFileWriter.java:153)
>       at org.apache.avro.file.DataFileWriter.create(DataFileWriter.java:145)
>       at 
> org.apache.parquet.cli.commands.ToAvroCommand.run(ToAvroCommand.java:112)
>       ... 3 more
> $ echo $?
> 1
> {code}
> But with its previous revision, it succeeds:
> {code}
> $ git checkout HEAD^
> HEAD is now at 9d6fb45e PARQUET-1576 Bump Apache Avro to 1.9.0 (#638)
> $ mvn clean install -DskipTests
> (snip)
> [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ parquet-cli 
> ---
> [INFO] Installing 
> /home/sekikn/repo/parquet-mr/parquet-cli/target/parquet-cli-1.12.0-SNAPSHOT.jar
>  to 
> /home/sekikn/.m2/repository/org/apache/parquet/parquet-cli/1.12.0-SNAPSHOT/parquet-cli-1.12.0-SNAPSHOT.jar
> [INFO] Installing /home/sekikn/repo/parquet-mr/parquet-cli/pom.xml to 
> /home/sekikn/.m2/repository/org/apache/parquet/parquet-cli/1.12.0-SNAPSHOT/parquet-cli-1.12.0-SNAPSHOT.pom
> [INFO] Installing 
> /home/sekikn/repo/parquet-mr/parquet-cli/target/parquet-cli-1.12.0-SNAPSHOT-tests.jar
>  to 
> /home/sekikn/.m2/repository/org/apache/parquet/parquet-cli/1.12.0-SNAPSHOT/parquet-cli-1.12.0-SNAPSHOT-tests.jar
> [INFO] Installing 
> /home/sekikn/repo/parquet-mr/parquet-cli/target/parquet-cli-1.12.0-SNAPSHOT-runtime.jar
>  to 
> /home/sekikn/.m2/repository/org/apache/parquet/parquet-cli/1.12.0-SNAPSHOT/parquet-cli-1.12.0-SNAPSHOT-runtime.jar
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time:  15.822 s
> [INFO] Finished at: 2019-06-12T23:57:04+09:00
> [INFO] 
> ------------------------------------------------------------------------
> $ mvn dependency:copy-dependencies
> (snip)
> $ java -cp 'target/*:target/dependency/*' org.apache.parquet.cli.Main to-avro 
> /tmp/sample.json -o /tmp/sample.avro
> $ echo $?
> 0
> $ java -cp 'target/*:target/dependency/*' org.apache.parquet.cli.Main head 
> /tmp/sample.avro
> {"id": 1, "name": "Alice"}
> {"id": 2, "name": "Bob"}
> {"id": 3, "name": "Carol"}
> {"id": 4, "name": "Dave"}
> {code}
> Reverting the following code
> {code:title=AvroJson.java}
>    public static Iterator<JsonNode> parser(final InputStream stream) {
>      try(JsonParser parser = FACTORY.createParser(stream)) {
> {code}
> to
> {code}
>    public static Iterator<JsonNode> parser(final InputStream stream) {
>      try {
>       JsonParser parser = FACTORY.createParser(stream);
> {code}
> seems to work.
> cc [~Fokko] :)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to