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

JOIN ... USING fails in 3-way join with UnsupportedOperationException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • None

    Description

      Run the query

      ```SQL
      select *
      from "foodmart"."sales_fact_1997" as f
      join "foodmart"."time_by_day" as t using ("time_id")
      join "foodmart"."product" as p using ("product_id")
      join "foodmart"."product_class" as pc using ("product_class_id")
      where t."the_month" = 10
      ```

      and you get the error

      ```
      Caused by: java.lang.UnsupportedOperationException: not applicable to a join type
      at org.eigenbase.reltype.RelCrossType.getField(RelCrossType.java:72)
      at org.eigenbase.sql.validate.SqlValidatorImpl.validateUsingCol(SqlValidatorImpl.java:2954)
      at org.eigenbase.sql.validate.SqlValidatorImpl.validateJoin(SqlValidatorImpl.java:2837)
      ```

      The cause is that after joining f and t, and while validating "... JOIN p USING (product_id)" the result is a type whose fields cannot be sought by name.

      Workaround is to use JOIN ... ON.

      ---------------- Imported from GitHub ----------------
      Url: https://github.com/julianhyde/optiq/issues/74
      Created by: julianhyde
      Labels:
      Created at: Thu Oct 31 01:27:13 CET 2013
      State: closed

      Attachments

        Activity

          People

            Unassigned Unassigned
            github-import GitHub Import
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: