You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "Nico Kruber (Jira)" <ji...@apache.org> on 2021/03/02 15:53:00 UTC

[jira] [Created] (FLINK-21563) Support using computed columns when defining (new) computed columns

Nico Kruber created FLINK-21563:
-----------------------------------

             Summary: Support using computed columns when defining (new) computed columns
                 Key: FLINK-21563
                 URL: https://issues.apache.org/jira/browse/FLINK-21563
             Project: Flink
          Issue Type: Improvement
          Components: Table SQL / API
    Affects Versions: 1.11.3
            Reporter: Nico Kruber


To avoid code duplications, it would be nice to be able to use computed columns in later computations of new computed columns, e.g.
{code}
CREATE TABLE `flights` (
  `_YEAR` CHAR(4),
  `_MONTH` CHAR(2),
  `_DAY` CHAR(2),
  `_SCHEDULED_DEPARTURE` CHAR(4),
  `SCHEDULED_DEPARTURE` AS TO_TIMESTAMP(`_YEAR` || '-' || `_MONTH` || '-' || `_DAY` || ' ' || SUBSTRING(`_SCHEDULED_DEPARTURE` FROM 0 FOR 2) || ':' || SUBSTRING(`_SCHEDULED_DEPARTURE` FROM 3) || ':00'),
  `_DEPARTURE_TIME` CHAR(4),
  `DEPARTURE_DELAY` SMALLINT,
  `DEPARTURE_TIME` AS SCHEDULED_DEPARTURE + DEPARTURE_DELAY
)...
{code}

Otherwise, a user would have to repeat these calculations over and over again which is not that maintainable.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)