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

Blink planner can not extract correct unique key for UpsertStreamTableSink

Agile BoardRank to TopRank to BottomAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      I reproduce an Elasticsearch6UpsertTableSink issue which user reported in mail list[1] that Blink planner can not extract correct unique key for following query, but legacy planner works well. 

      // user code
      INSERT INTO ES6_ZHANGLE_OUTPUT  
       SELECT aggId, pageId, ts_min as ts,  
             count(case when eventId = 'exposure' then 1 else null end) as expoCnt,  
             count(case when eventId = 'click' then 1 else null end) as clkCnt  
       FROM  (    
           SELECT        
             'ZL_001' as aggId,
              pageId,        
              eventId,        
              recvTime,        
              ts2Date(recvTime) as ts_min    
           from kafka_zl_etrack_event_stream    
           where eventId in ('exposure', 'click')  
       ) as t1  
       group by aggId, pageId, ts_min
      

      I  found that blink planner can not extract correct unique key in `FlinkRelMetadataQuery.getUniqueKeys(relNode)`, legacy planner works well in  `org.apache.flink.table.plan.util.UpdatingPlanChecker.getUniqueKeyFields(...) `. A simple ETL job to reproduce this issue can refers[2]

       

      [1]http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Flink-1-10-es-sink-exception-td32773.html

      [2]https://github.com/leonardBang/flink-sql-etl/blob/master/etl-job/src/main/java/kafka2es/Kafka2UpsertEs.java

       

       

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            godfreyhe godfrey he
            leonard Leonard Xu
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0h
              0h
              Logged:
              Time Spent - 40m
              40m

              Slack

                Issue deployment