You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@parquet.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/02/12 15:34:00 UTC

[jira] [Commented] (PARQUET-2120) parquet-cli dictionary command fails on pages without dictionary encoding

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

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

rshkv opened a new pull request #946:
URL: https://github.com/apache/parquet-mr/pull/946


   Make sure you have checked _all_ steps below.
   
   ### Jira
   
   - [ ] 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-1234: My Parquet PR"
     - https://issues.apache.org/jira/browse/PARQUET-XXX
     - 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
   
   - [ ] My PR adds the following unit tests __OR__ does not need testing for this extremely good reason:
   
   ### Commits
   
   - [ ] 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
   
   - [ ] 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
   


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@parquet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> parquet-cli dictionary command fails on pages without dictionary encoding
> -------------------------------------------------------------------------
>
>                 Key: PARQUET-2120
>                 URL: https://issues.apache.org/jira/browse/PARQUET-2120
>             Project: Parquet
>          Issue Type: Bug
>          Components: parquet-cli
>    Affects Versions: 1.12.2
>            Reporter: Willi Raschkowski
>            Priority: Minor
>
> parquet-cli's {{dictionary}} command fails with an NPE if a page does not have dictionary encoding:
> {code}
> $ parquet dictionary --column col a-b-c.snappy.parquet                
> Unknown error
> java.lang.NullPointerException: Cannot invoke "org.apache.parquet.column.page.DictionaryPage.getEncoding()" because "page" is null
> 	at org.apache.parquet.cli.commands.ShowDictionaryCommand.run(ShowDictionaryCommand.java:78)
> 	at org.apache.parquet.cli.Main.run(Main.java:155)
> 	at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
> 	at org.apache.parquet.cli.Main.main(Main.java:185)
> $ parquet meta a-b-c.snappy.parquet      
> ...
> Row group 0:  count: 1  46.00 B records  start: 4  total: 46 B
> --------------------------------------------------------------------------------
>      type      encodings count     avg size   nulls   min / max
> col  BINARY    S   _     1         46.00 B    0       "a" / "a"
> Row group 1:  count: 200  0.34 B records  start: 50  total: 69 B
> --------------------------------------------------------------------------------
>      type      encodings count     avg size   nulls   min / max
> col  BINARY    S _ R     200       0.34 B     0       "b" / "c"
> {code}
> (Note the missing {{R}} / dictionary encoding on that first page.)
> Someone familiar with Parquet might guess from the NPE that there's no dictionary encoding. But for files that mix pages with and without dictionary encoding (like above), the command will fail before getting to pages that actually have dictionaries.
> The problem is that [this line|https://github.com/apache/parquet-mr/blob/300200eb72b9f16df36d9a68cf762683234aeb08/parquet-cli/src/main/java/org/apache/parquet/cli/commands/ShowDictionaryCommand.java#L76] assumes {{readDictionaryPage}} always returns a page and doesn't handle when it does not, i.e. when it returns {{null}}.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)