You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Piotr Bojko (JIRA)" <ji...@apache.org> on 2018/08/03 14:38:00 UTC

[jira] [Updated] (CALCITE-2446) Lateral joins not work when saved as custom views

     [ https://issues.apache.org/jira/browse/CALCITE-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Piotr Bojko updated CALCITE-2446:
---------------------------------
    Description: 
See https://github.com/ptrbojko/calcite/tree/bug/CALCITE-2446 for reproduction


{quote}Julian Hyde <jh...@apache.org>
Thu, Aug 2, 9:39 PM (18 hours ago)
 to dev

Sounds like an interesting bug in view expansion. Can you log a bug please. If possible create a test case in ServerTest (since I presume that it needs CREATE VIEW followed by a query).



Julian



> On Aug 2, 2018, at 4:50 AM, ptr.bojko@gmail.com wrote:
> 
> Hello,
> 
> I struggling with a strange case. Following query works for me:
> SELECT *
> FROM CORE.FILTERS F
> CROSS JOIN LATERAL TABLE(AUX.TBLFUNCTION('somestring, F.aCOLLUMN)) tblfn
> 
> But when it is placed as a view under a schema EXAMPLES with name
> EXAMPLECOLLATERAL, following query won't work
> SELECT * FROM EXAMPLES.EXAMPLECOLLATERAL
> 
> It produces:
> 
>> org.apache.calcite.runtime.CalciteContextException: At line 3, column 51:
>> Table 'F' not found
>>  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>>  at
>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>>  at
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>>  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>>  at
>> org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463)
>>  at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:783)
>>  at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:768)
>>  at
>> org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:4779)
>>  at
>> org.apache.calcite.sql.validate.DelegatingScope.fullyQualify(DelegatingScope.java:330)
>>  at
>> org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5527)
>>  at
>> org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5490)
>>  at org.apache.calcite.sql.SqlIdentifier.accept(SqlIdentifier.java:334)
>>  at
>> org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1627)
>>  at
>> org.apache.calcite.sql.validate.SqlValidatorImpl.deriveType(SqlValidatorImpl.java:1612)
>>  at
>> org.apache.calcite.sql.SqlOperator.constructArgTypeList(SqlOperator.java:584)
>>  at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:233)
>>  at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:215)
>>  at
>> org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5503)
>>  at
>> org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5490)
>>  at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:138)
>>  at
>> org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1627)
>>  at
>> org.apache.calcite.sql.validate.ProcedureNamespace.validateImpl(ProcedureNamespace.java:53)
>>  at
>> org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)
>>  at
>> org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:965)
>>  at
>> org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:944)
>>  at
>> org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3027)
>>  at
>> org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3012)
>>  at
>> org.apache.calcite.sql.validate.SqlValidatorImpl.validateJoin(SqlValidatorImpl.java:3064)
>>  at
>> org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3021)
>>  at
>> org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3271)
>>  at
>> org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:60)
>>  at
>> org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)
>>  at
>> org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:965)
>>  at
>> org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:944)
>>  at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:225)
>>  at
>> org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:919)
>>  at
>> org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:629)
>>  at
>> org.apache.calcite.prepare.CalcitePrepareImpl.parse_(CalcitePrepareImpl.java:292)
> 
> 
> I am willing to patch this if this is a bug - just need a point to the
> right direction.
> 
> Thanx!
> -- 
> Piotr Bojko
> http://about.me/ptr.bojko
{quote}

  was:to be updated


> Lateral joins not work when saved as custom views
> -------------------------------------------------
>
>                 Key: CALCITE-2446
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2446
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.17.0
>            Reporter: Piotr Bojko
>            Assignee: Julian Hyde
>            Priority: Major
>
> See https://github.com/ptrbojko/calcite/tree/bug/CALCITE-2446 for reproduction
> {quote}Julian Hyde <jh...@apache.org>
> Thu, Aug 2, 9:39 PM (18 hours ago)
>  to dev
> Sounds like an interesting bug in view expansion. Can you log a bug please. If possible create a test case in ServerTest (since I presume that it needs CREATE VIEW followed by a query).
> Julian
> > On Aug 2, 2018, at 4:50 AM, ptr.bojko@gmail.com wrote:
> > 
> > Hello,
> > 
> > I struggling with a strange case. Following query works for me:
> > SELECT *
> > FROM CORE.FILTERS F
> > CROSS JOIN LATERAL TABLE(AUX.TBLFUNCTION('somestring, F.aCOLLUMN)) tblfn
> > 
> > But when it is placed as a view under a schema EXAMPLES with name
> > EXAMPLECOLLATERAL, following query won't work
> > SELECT * FROM EXAMPLES.EXAMPLECOLLATERAL
> > 
> > It produces:
> > 
> >> org.apache.calcite.runtime.CalciteContextException: At line 3, column 51:
> >> Table 'F' not found
> >>  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> >>  at
> >> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> >>  at
> >> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> >>  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
> >>  at
> >> org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463)
> >>  at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:783)
> >>  at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:768)
> >>  at
> >> org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:4779)
> >>  at
> >> org.apache.calcite.sql.validate.DelegatingScope.fullyQualify(DelegatingScope.java:330)
> >>  at
> >> org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5527)
> >>  at
> >> org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5490)
> >>  at org.apache.calcite.sql.SqlIdentifier.accept(SqlIdentifier.java:334)
> >>  at
> >> org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1627)
> >>  at
> >> org.apache.calcite.sql.validate.SqlValidatorImpl.deriveType(SqlValidatorImpl.java:1612)
> >>  at
> >> org.apache.calcite.sql.SqlOperator.constructArgTypeList(SqlOperator.java:584)
> >>  at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:233)
> >>  at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:215)
> >>  at
> >> org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5503)
> >>  at
> >> org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5490)
> >>  at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:138)
> >>  at
> >> org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1627)
> >>  at
> >> org.apache.calcite.sql.validate.ProcedureNamespace.validateImpl(ProcedureNamespace.java:53)
> >>  at
> >> org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)
> >>  at
> >> org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:965)
> >>  at
> >> org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:944)
> >>  at
> >> org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3027)
> >>  at
> >> org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3012)
> >>  at
> >> org.apache.calcite.sql.validate.SqlValidatorImpl.validateJoin(SqlValidatorImpl.java:3064)
> >>  at
> >> org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3021)
> >>  at
> >> org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3271)
> >>  at
> >> org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:60)
> >>  at
> >> org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)
> >>  at
> >> org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:965)
> >>  at
> >> org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:944)
> >>  at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:225)
> >>  at
> >> org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:919)
> >>  at
> >> org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:629)
> >>  at
> >> org.apache.calcite.prepare.CalcitePrepareImpl.parse_(CalcitePrepareImpl.java:292)
> > 
> > 
> > I am willing to patch this if this is a bug - just need a point to the
> > right direction.
> > 
> > Thanx!
> > -- 
> > Piotr Bojko
> > http://about.me/ptr.bojko
> {quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)