Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2446

Lateral joins not work when saved as custom views

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.17.0
    • 1.18.0
    • core
    • None

    Description

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

      Julian Hyde <jhyde@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

      Attachments

        Activity

          People

            julianhyde Julian Hyde
            ptrbojko Piotr Bojko
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: