Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-22196

FlinkRelMdUniqueKeys#getTableUniqueKeys should filter out the column indices which the does not exist in current row schema

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.12.2
    • 1.13.0
    • Table SQL / Planner
    • None

    Description

      Well since we have supported project push-down, some primary-key in original schema may not exist no longer more, so the non-existed column shall be filtered out.

       

      Current code:

      val columns = relOptTable.getRowType.getFieldNames
      val columnIndices = schema.getPrimaryKey.get().getColumns map { c =>
        columns.indexOf(c)
      }
      

      May be supposed to correct to:

      val columns = relOptTable.getRowType.getFieldNames
      val columnIndices = schema
        .getPrimaryKey
        .get()
        .getColumns
        .map(columns.indexOf)
        .filterNot(_ == -1) // filter out the non-exist column
      

       

      Attachments

        Issue Links

          Activity

            People

              neighborhood Lsw_aka_laplace
              neighborhood Lsw_aka_laplace
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: