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


   Co-Authored-By: Huaxin Gao 
[[email protected]](mailto:[email protected])
   Co-Authored-By: Xinli Shang [[email protected]](mailto:[email protected])
   
   ### 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-2006
     - 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).
    
   #### Changes in this PR:
   Parquet relies on the column name. In a lot of usages e.g. schema 
resolution, this would be a problem. Iceberg uses ID and stored Id/name 
mappings.
   
   This PR is to add column ID resolution support. The changes are:
   
   1. add column ID in ColumnDescriptor.
   
   2. in FilterAPI, add the choice of constructing a filter using column ID 
instead of column path
   for example, originally we only allow
   ```
   IntColumn intColumn = intColumn("a.b.c"); 
   FilterPredicate predicate = eq(intColumn, 7);
   ```
   Now we can have
   ```
   IntColumn intColumn = intColumn(new Type.ID(1)); 
   FilterPredicate predicate = eq(intColumn, 7);
   ```
   
   3. The schema of the filter is checked in 
`SchemaCompatibilityValidator.validateColumn`. In validateColumn method, check 
the ColumnPath of the predicate column, if it's null, it means the predicate is 
constructed by id. Then loop through the ColumnDescriptors in the schema, find 
the one that has the same id as the predicate column, get the corresponding 
columnPath in ColumnDescriptor, and update the null ColumnPath. So now the 
predicate has the right ColumnPath, and all the filtering will be done using 
ColumnPath as usual.
   
   4. added a new property `COLUMN_ID_RESOLUTION`. The default value of this 
property is false. On the write path, if this property sets to true, the the 
column ids in the entire schema have to be unique. 
   
   5. on read path, if the column ids are unique, then id resolution will be 
used. 
   
   ### 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to