Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-3062

Apply LIMIT 1 optimization for DISTINCT in UNION situations

    Details

    • Type: Feature Request
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 8.1
    • Fix Version/s: 8.9
    • Component/s: Query Engine
    • Labels:
      None

      Description

      The translator does not support select expressions. Query:
      SELECT DISTINCT DATAMART_NAME AS c_9, 'constant' AS c_10 FROM (SELECT datamart_name FROM
      (
      SELECT 'DATACOM Datamart' AS DATAMART_NAME FROM SECURITY_DM_DATACOM_DEV_R140_CA31_CMGRD1.VIEWOBJACCESS
      UNION ALL
      SELECT 'DB2 D91A Datamart' AS DATAMART_NAME FROM SECURITY_DM_DB2_D91APTIB_CMGRD1.VIEWOBJACCESS
      ) AS t
      ) a

      Final part of plan:
      OPTIMIZATION COMPLETE:
      PROCESSOR PLAN:
      SortNode(0) output=[datamart_name AS c_9, '_constant_' AS c_10] [DUP_REMOVE]
      ProjectNode(1) output=[datamart_name AS c_9, '_constant_' AS c_10] [datamart_name AS c_9, '_constant_' AS c_10]
      UnionAllNode(2) output=[datamart_name]
      AccessNode(3) output=['DATACOM Datamart' AS DATAMART_NAME] SELECT 'DATACOM Datamart' FROM SECURITY_DM_DATACOM_DEV_R140_CA31_CMGRD1.VIEWOBJACCESS AS g_0
      AccessNode(4) output=['DB2 D91A Datamart' AS DATAMART_NAME] SELECT 'DB2 D91A Datamart' FROM SECURITY_DM_DB2_D91APTIB_CMGRD1.VIEWOBJACCESS AS g_0

      Expected LIMIT 1 in the access nodes. Comment from Steven: "More than likely we are not checking across a union for this optimization."

      See https://community.jboss.org/message/883460 for more details and complete plan

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                shawkins Steven Hawkins
                Reporter:
                markaddleman Mark Addleman
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: