Re: BindableTableScan is losing aliased named

2017-11-18 Thread Enrico Olivelli
I solved my problem just by capturing the original rowtype after sql parser. Thanks Enrico Il ven 17 nov 2017, 22:44 Enrico Olivelli ha scritto: > > > Il ven 17 nov 2017, 22:36 Julian Hyde ha scritto: > >> Translating to RelNode loses some metadata. When

Re: BindableTableScan is losing aliased named

2017-11-17 Thread Enrico Olivelli
Il ven 17 nov 2017, 22:36 Julian Hyde ha scritto: > Translating to RelNode loses some metadata. When preparing a SQL > statement, we use the column names and types given to us by the > validator for use by ResultSetMetaData. > > There's a related interesting case where a column

Re: BindableTableScan is losing aliased named

2017-11-17 Thread Julian Hyde
Translating to RelNode loses some metadata. When preparing a SQL statement, we use the column names and types given to us by the validator for use by ResultSetMetaData. There's a related interesting case where a column appears in ORDER BY but not SELECT. For example, "SELECT x FROM t ORDER BY x,

Re: BindableTableScan is losing aliased named

2017-11-17 Thread Enrico Olivelli
Il ven 17 nov 2017, 19:19 Julian Hyde ha scritto: > > IMHO It would better to keep somethin like an EnumerableProjection which > > renames the fields > > I disagree. If we commit to preserving field names all kinds of > optimization are not possible. > > In Calcite RelNode

Re: BindableTableScan is losing aliased named

2017-11-17 Thread Julian Hyde
> IMHO It would better to keep somethin like an EnumerableProjection which > renames the fields I disagree. If we commit to preserving field names all kinds of optimization are not possible. In Calcite RelNode world, field names are a hint to make debugging easier but are not ultimately

Re: BindableTableScan is losing aliased named

2017-11-17 Thread Enrico Olivelli
your test is working I will try to understand where is the problem in my code b.q. I am looking for a sponsor for this patch, which is a real blocker for me, could you pleas take a look Luis ? https://github.com/apache/calcite/pull/568 Thank you Enrico 2017-11-17 17:45 GMT+01:00 Luis Fernando

Re: BindableTableScan is losing aliased named

2017-11-17 Thread Luis Fernando Kauer
Please insert the following test in ScannableTableTest and run:   /** ProjectableFilterableTable project push down using alias. */   @Test public void testPFPushDownWithAlias() throws Exception {     final StringBuilder buf = new StringBuilder();     final Table table = new

Re: BindableTableScan is losing aliased named

2017-11-17 Thread Enrico Olivelli
In the RowType I have 'k1' and not "thekey" Enrico 2017-11-17 17:20 GMT+01:00 Luis Fernando Kauer : > Did you execute the query? > ProjectRemoveRule removes the Project when it is "trivial". Since the > only used project was pushed to BindableTableScan, the

Re: BindableTableScan is losing aliased named

2017-11-17 Thread Luis Fernando Kauer
Did you execute the query? ProjectRemoveRule removes the Project when it is "trivial".  Since the only used project was pushed to BindableTableScan, the Project would only set the alias, but that can be done in row type. The result is correct because RowType is preserved with the alias.  It