You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/07/03 12:35:40 UTC

[GitHub] [incubator-druid] clintropolis opened a new pull request #8019: multi-value string expression transformation fix

clintropolis opened a new pull request #8019: multi-value string expression transformation fix
URL: https://github.com/apache/incubator-druid/pull/8019
 
 
   ### Description
   
   This PR fixes an issue with the automatic translation of expressions for multi-value string column inputs, where if an identifier was duplicated, the expression would not transform correctly.
   
   This has been resolved by modifying expression parsing to uniquely identify all _non lambda bound_ `IdentifierExpr`, at parsing transformation time in `ExprListenerImpl`. `LambdaExpr` identifiers are marked on entering a lambda expression, and all non-lambda identifiers are given a unique identifier to accompany the identifier to use to get the value from the `Expr.ObjectBinding`.
   
   `Expr.BindingDetails` has been reworked to accommodate this change, as well as simplified. Further refactoring took place in `Parser` to handle the transformation required to create `LambdaExpr` binding `IdentifierExpr` to ensure the correct transformation.
   
   Example:
   before patch:
   ```
   concat(x, '-lol-', x)
   ``` 
   
   where `x` is a multi-value string dimension would result in a transformation to something like 
   
   ```
   map((x) -> concat(x, '-lol-', x), x)
   ```
    
   after patch:
   this will correctly map to something like 
   ```
   cartesian_map((x, x_0) -> concat(x, '-lol-', x_0), x, x_0)
   ```
   
   <hr>
   
   This PR has:
   - [ ] been self-reviewed.
   - [x] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
   - [x] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader. 
   - [x] added unit tests or modified existing tests to cover new code paths.
   

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org