Re: An exception after rewriting a casting expression to a scalar subquery

2019-03-07 Thread Muhammad Gelbana
https://issues.apache.org/jira/browse/CALCITE-2901 Thanks, Gelbana On Thu, Mar 7, 2019 at 11:33 AM Stamatis Zampetakis wrote: > Sorry, I meant to write instead of > > final RelDataType type = > typeFactory.createTypeWithNullability(fieldList.get(0).getType(), true); > > in my previous email. >

Re: An exception after rewriting a casting expression to a scalar subquery

2019-03-07 Thread Stamatis Zampetakis
Sorry, I meant to write instead of final RelDataType type = typeFactory.createTypeWithNullability(fieldList.get(0).getType(), true); in my previous email. I think it would make sense to change the hardcoded value but I didn't try to see if there are test failures after the change neither I know

Re: An exception after rewriting a casting expression to a scalar subquery

2019-03-07 Thread Muhammad Gelbana
Actually the types is derived this way final RelDataType type = typeFactory.createTypeWithNullability(fieldList.get(0).getType(), *true*); Reference: https://github.com/apache/calcite/blob/d10aeb7f7e50dc7028ce102a5f590d0c50c49fa8/core/src/main/java/org/apache/calcite/rex/RexSubQuery.java#L99 If

Re: An exception after rewriting a casting expression to a scalar subquery

2019-03-06 Thread Stamatis Zampetakis
Hi Gelbana, I am not sure why the scalar type is always nullable at this part of the code but I would expect that the type is obtained as follows: final RelDataType type = typeFactory.copyType(fieldList.get(0).getType()); // which copies also the nullability of the type instead of final RelData

An exception after rewriting a casting expression to a scalar subquery

2019-03-05 Thread Muhammad Gelbana
'm trying to rewrite the below query to be SELECT (SELECT PRONAME FROM PG_PROC WHERE OID = col1) FROM (VALUES ('array_in', 'array_out')) as tbl(col1, col2) When I try to test my code using this query SELECT col1::regproc FROM (VALUES ('array_in', 'array_out')) as tbl(col1, col2) The casting expre