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

Create table ddl support comment after computed column

    XMLWordPrintableJSON

Details

    Description

      For now, we can define computed column in create table ddl, but we can not add comment after it just like regular table column, So we should support it,  it's grammar as follows:

      col_name AS expr  [COMMENT 'string']
      

      My idea is, we can introduce  class

       SqlTableComputedColumn

      to wrap name, expression and comment,  And just get the element from it will be ok.

      As for parserImpls.ftl, it can be like as follows:

      identifier = SimpleIdentifier()
      <AS>
      expr = Expression(ExprContext.ACCEPT_NON_QUERY)
      [ <COMMENT> <QUOTED_STRING> {
          String p = SqlParserUtil.parseString(token.image);
          comment = SqlLiteral.createCharString(p, getPos());
      }]
      {
          SqlTableComputedColumn tableComputedColumn =
              new SqlTableComputedColumn(identifier, expr, comment, getPos());
          context.columnList.add(tableComputedColumn);
      }

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            hailong wang hailong wang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: