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

Two-level column name cannot be resolved in ORDER BY

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.11.0
    • Fix Version/s: 1.12.0
    • Component/s: core
    • Labels:

      Description

      For example, select f1.c1 from struct.t order by f0.c1

        Activity

        Hide
        maryannxue Maryann Xue added a comment -

        Could you please take a look at https://github.com/apache/calcite/pull/391, Julian Hyde?

        Show
        maryannxue Maryann Xue added a comment - Could you please take a look at https://github.com/apache/calcite/pull/391 , Julian Hyde ?
        Hide
        julianhyde Julian Hyde added a comment -

        Looks good, but why did you remove the @Override keyword?

        Show
        julianhyde Julian Hyde added a comment - Looks good, but why did you remove the @Override keyword?
        Hide
        maryannxue Maryann Xue added a comment -

        Because I removed findQualifyingTables from its super class DelegatingScope and thus findQualifyingTables is now a utility method in ListScope only. DelegatingScope#fullyQualify now calls findQualifyingTableNames for both simple qualifiers and compound qualifiers.

        Show
        maryannxue Maryann Xue added a comment - Because I removed findQualifyingTables from its super class DelegatingScope and thus findQualifyingTables is now a utility method in ListScope only. DelegatingScope#fullyQualify now calls findQualifyingTableNames for both simple qualifiers and compound qualifiers.
        Hide
        julianhyde Julian Hyde added a comment - - edited

        Ah great. Could you go further and make findQualifyingTables final and package-protected?

        +1 to commit

        Show
        julianhyde Julian Hyde added a comment - - edited Ah great. Could you go further and make findQualifyingTables final and package-protected? +1 to commit
        Hide
        maryannxue Maryann Xue added a comment -

        Just found out that MatchRecognizeScope as a sub-class of ListScope overrides the findQualifyingTables method. findQualifyingTables is called by ListScope#findQualifyingTableName and ListScope#findQualifyingTableNames. So can I go ahead and change MatchRecognizeScope#findQualifyingTables to from public to protected?

        Show
        maryannxue Maryann Xue added a comment - Just found out that MatchRecognizeScope as a sub-class of ListScope overrides the findQualifyingTables method. findQualifyingTables is called by ListScope#findQualifyingTableName and ListScope#findQualifyingTableNames . So can I go ahead and change MatchRecognizeScope#findQualifyingTables to from public to protected?
        Hide
        julianhyde Julian Hyde added a comment -

        Could MatchRecognizeScope override findQualifyingTableNames instead?

        Show
        julianhyde Julian Hyde added a comment - Could MatchRecognizeScope override findQualifyingTableNames instead?
        Hide
        maryannxue Maryann Xue added a comment -

        Think what we could do is to remove findQualifyingTables from ListScope, then move the logic into findQualifyingTableNames and let findQualifyingTableName call findQualifyingTableNames, since findQualifyingTableName is basically to restrict the number of entries returned and is marked as "deprecated" anyway.

        Show
        maryannxue Maryann Xue added a comment - Think what we could do is to remove findQualifyingTables from ListScope , then move the logic into findQualifyingTableNames and let findQualifyingTableName call findQualifyingTableNames , since findQualifyingTableName is basically to restrict the number of entries returned and is marked as "deprecated" anyway.
        Hide
        maryannxue Maryann Xue added a comment -

        Can I go further to remove findQualifyingTableName since it is not called anywhere else other than by the same method in sub-classes?

        Show
        maryannxue Maryann Xue added a comment - Can I go further to remove findQualifyingTableName since it is not called anywhere else other than by the same method in sub-classes?
        Hide
        julianhyde Julian Hyde added a comment -

        No. It's a public method in a public API. We can't remove it until the next major revision. That's why it's marked "Deprecated to be removed before 2.0".

        Show
        julianhyde Julian Hyde added a comment - No. It's a public method in a public API. We can't remove it until the next major revision. That's why it's marked "Deprecated to be removed before 2.0".
        Hide
        maryannxue Maryann Xue added a comment -

        Could you please take a look at my latest commit on that PR, Julian Hyde? It simply removed findQualifyingTables and put the essential logic into findQualifyingTableNames.

        Show
        maryannxue Maryann Xue added a comment - Could you please take a look at my latest commit on that PR, Julian Hyde ? It simply removed findQualifyingTables and put the essential logic into findQualifyingTableNames .
        Show
        maryannxue Maryann Xue added a comment - Fixed in https://git1-us-west.apache.org/repos/asf?p=calcite.git;a=commit;h=55d7c6d .
        Hide
        julianhyde Julian Hyde added a comment -

        Resolved in release 1.12.0 (2017-03-24).

        Show
        julianhyde Julian Hyde added a comment - Resolved in release 1.12.0 (2017-03-24).

          People

          • Assignee:
            maryannxue Maryann Xue
            Reporter:
            maryannxue Maryann Xue
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development