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 2019/07/15 15:04:00 UTC

[jira] [Commented] (PARQUET-1488) UserDefinedPredicate throw NPE

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

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

gszadovszky commented on pull request #663: PARQUET-1488: UserDefinedPredicate throw NPE
URL: https://github.com/apache/parquet-mr/pull/663
 
 
   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-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
   
   - [x] My PR adds the following unit tests __OR__ does not need testing for this extremely good reason:
   
     Modified the existing tests TestColumnIndexBuilder.java and TestColumnIndexFiltering.java to cover the scenario
   
   ### 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
   
 
----------------------------------------------------------------
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:
users@infra.apache.org


> UserDefinedPredicate throw NPE
> ------------------------------
>
>                 Key: PARQUET-1488
>                 URL: https://issues.apache.org/jira/browse/PARQUET-1488
>             Project: Parquet
>          Issue Type: Bug
>          Components: parquet-mr
>    Affects Versions: 1.11.0
>            Reporter: Yuming Wang
>            Assignee: Gabor Szadovszky
>            Priority: Major
>              Labels: pull-request-available
>
> It throws {{NullPointerException}} after upgrade parquet to 1.11.0 when using {{UserDefinedPredicate}}.
> The  [UserDefinedPredicate|https://github.com/apache/spark/blob/faf73dcd33d04365c28c2846d3a1f845785f69df/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFilters.scala#L548-L578] is:
> {code:java}
> new UserDefinedPredicate[Binary] with Serializable {                                  
>   private val strToBinary = Binary.fromReusedByteArray(v.getBytes)                    
>   private val size = strToBinary.length                                               
>                                                                                       
>   override def canDrop(statistics: Statistics[Binary]): Boolean = {                   
>     val comparator = PrimitiveComparator.UNSIGNED_LEXICOGRAPHICAL_BINARY_COMPARATOR   
>     val max = statistics.getMax                                                       
>     val min = statistics.getMin                                                       
>     comparator.compare(max.slice(0, math.min(size, max.length)), strToBinary) < 0 ||  
>       comparator.compare(min.slice(0, math.min(size, min.length)), strToBinary) > 0   
>   }                                                                                   
>                                                                                       
>   override def inverseCanDrop(statistics: Statistics[Binary]): Boolean = {            
>     val comparator = PrimitiveComparator.UNSIGNED_LEXICOGRAPHICAL_BINARY_COMPARATOR   
>     val max = statistics.getMax                                                       
>     val min = statistics.getMin                                                       
>     comparator.compare(max.slice(0, math.min(size, max.length)), strToBinary) == 0 && 
>       comparator.compare(min.slice(0, math.min(size, min.length)), strToBinary) == 0  
>   }                                                                                   
>                                                                                       
>   override def keep(value: Binary): Boolean = {                                       
>     UTF8String.fromBytes(value.getBytes).startsWith(                                  
>       UTF8String.fromBytes(strToBinary.getBytes))                                     
>   }                                                                                   
> }                                                                                     
> {code}
> The stack trace is:
> {noformat}
> java.lang.NullPointerException
> 	at org.apache.spark.sql.execution.datasources.parquet.ParquetFilters$$anon$1.keep(ParquetFilters.scala:573)
> 	at org.apache.spark.sql.execution.datasources.parquet.ParquetFilters$$anon$1.keep(ParquetFilters.scala:552)
> 	at org.apache.parquet.internal.filter2.columnindex.ColumnIndexFilter.visit(ColumnIndexFilter.java:152)
> 	at org.apache.parquet.internal.filter2.columnindex.ColumnIndexFilter.visit(ColumnIndexFilter.java:56)
> 	at org.apache.parquet.filter2.predicate.Operators$UserDefined.accept(Operators.java:377)
> 	at org.apache.parquet.internal.filter2.columnindex.ColumnIndexFilter.visit(ColumnIndexFilter.java:181)
> 	at org.apache.parquet.internal.filter2.columnindex.ColumnIndexFilter.visit(ColumnIndexFilter.java:56)
> 	at org.apache.parquet.filter2.predicate.Operators$And.accept(Operators.java:309)
> 	at org.apache.parquet.internal.filter2.columnindex.ColumnIndexFilter$1.visit(ColumnIndexFilter.java:86)
> 	at org.apache.parquet.internal.filter2.columnindex.ColumnIndexFilter$1.visit(ColumnIndexFilter.java:81)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)