Hi Julian,
That would be very cool to be listed on the adapters page.  Thanks for
offering.  Providing a SchemaFactory implementation is a great idea.  That
is an area I have not delved into that I'll need to checkout.

Thanks,
Ted

________________________________________
From: Julian Hyde <[email protected]>
Sent: Thursday, February 25, 2016 4:31 PM
To: [email protected]
Subject: Re: Translate "$0" to real name

Ted,

Thanks for chiming in.

And, I’m very excited to see another project using Calcite. Nice work.

May I include SQL-Gremlin in the list of adapters on
http://calcite.apache.org/docs/adapter.html?

Would it make sense to convert SQL-Gremlin into a true adapter (i.e.
provide an implementation of SchemaFactory so that you could include a
Gremlin schema in a Calcite model file alongside other schemas)?


Julian



> On Feb 25, 2016, at 6:02 AM, Ted Wilmes <[email protected]> wrote:
>
> Not sure if this would be of any help, but I worked through a similar
sort of thing in this class:
>
>
https://github.com/twilmes/sql-gremlin/blob/cef926c71645165b4c469ebc05e23df0c3591747/src/main/java/org/twilmes/sql/gremlin/processor/FieldMapVisitor.java
>
>
> I'm using Calcite as part of a project that converts SQL to the Gremlin
graph query language.  Because of how the Gremlin queries are constructed,
I needed to be able to trace the provenance of the columns at each level
back to their original column name.  This particular code is executed
during a depth first traversal of the RelNodes.
>
> --Ted
>
> ________________________________________
> From: Julian Hyde <[email protected]>
> Sent: Wednesday, February 24, 2016 6:44 PM
> To: [email protected]
> Subject: Re: Translate "$0" to real name
>
> Scalar expressions (RexNode) are, by design, separate from relational
expressions (RelNode). Therefore a reference to an input field
(RexInputRef) contains the ordinal and type of the field that it references
but not its name or any other information.
>
> It’s useful that RexNodes are self-contained; they are easier to
canonize, and there are fewer concerns about them being the source of
memory leaks.
>
> If you want to print extra information about a RexNode you need to supply
the list of RelNodes that are the context. When used in a Filter or
Project, that list is just [input]. When used in a Join, that list is
[left, right].
>
> It would be nice if, say, the explain of Filter, Project and Join used
the input field names rather than $n. If you wrote this we could hook it up.
>
> Lastly, note that the names of the fields of RelNodes may not be the
“real names” you are hoping for. We try to preserve the names from SQL, but
there are times when they get lost, especially after applying
transformation rules. All we can really guarantee is that the names are
unique within each input.
>
> Julian
>
>
>> On Feb 23, 2016, at 5:54 PM, Matt Bateman <[email protected]> wrote:
>>
>> Hi All,
>>
>> I'm sure this is something simple I'm missing. When evaluating a where
>> clause the RexInputRef uses the "$index" notation. How do I get from
there
>> to the actual name of the column? The javadoc for RexInputRef talks about
>> this but doesn't indicate how to do the actual translation.
>>
>> Thanks,
>>
>> Matt

Reply via email to