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

Stamatis Zampetakis commented on CALCITE-4996:
----------------------------------------------

At some point we had to deal with a similar problem but couldn't recall the 
details. After some thought it came back to me but our solution was far from 
ideal as we basically wrote our own {{RelJsonReader}}. By doing this we could 
use a custom {{RelInput}} inside {{readRel}} method. Like that we didn't have 
to have rely on some specific {{RelOptSchema}} to reconstruct {{RelNodes}} but 
we were creating the types from the content of the JSON string.

Long story short we could get back a complete {{RelNode}} tree which looked 
like the original but kinda fake cause there wasn't any real validation against 
a schema. 

I now understand better what's the goal of this PR thanks for the feedback 
[~mkou] and [~julianhyde]. Since Julian is following this closely I completely 
trust his judgement but if I can help with anything let me know.

> [RelJson] create a new public toRex method which can override makeInputRef
> --------------------------------------------------------------------------
>
>                 Key: CALCITE-4996
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4996
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Marieke Gueye
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> In the case of our project, the environment that generates a JSON from a 
> RexNode and the environment that reads it are different. We need to 
> "translate" the inputs into their aliases in the new cluster. 
> This method will permit to give more freedom to the JSON RexNode parser if 
> needed. 
> {code}
> /**
>    * Transforms a RexNode tree defined in a map (from a JSON) into a RexNode
>    * Applying a special method to inputs instead of transforming them into 
> inputRef
>    * @param cluster The optimization environment
>    * @param apply is a InputTranslator lambda that transforms the map 
> representing input
>    *               references into a RexNode
>    * @param o the map derived from a RexNode transformed into a JSON
>    * @return the transformed RexNode
>    */
> {code}
> Make sure that {{RexNode toRex(RelInput relInput, @PolyNull Object o)}} is 
> still working + adding tests 



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

Reply via email to