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

Provide alias for whole records in Table API

    XMLWordPrintableJSON

Details

    Description

      In SQL we can provide an alias for whole table to avoid column name collisions between two tables. For example:

      SELECT
        SUM(o.amount * r.rate) 
      FROM 
        Orders AS o, 
        Rates AS r
      WHERE r.currency = o.currency

      However that's not possible in table API. In Table API user have to provide aliases for all of the columns, which can be annoying especially if table consists of tens or even hundred of columns

      For example I would expect some feature like this:

      val result = orders.as('o)
        .join(rates(`o.rowtime).as('r), "o.currency = r.currency")
        .select("SUM(o.amount * r.rate) AS amount")
      

      where rates is a TableFunction.

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            pnowojski Piotr Nowojski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: