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

FlinkRexUtil create Sarg String array elemet supplement space

    XMLWordPrintableJSON

Details

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

    Description

      As we know, the new version of Calcite introduces the SEARCH rex call to express range conditions. But when i used string array to express range in the StreamSQL, i found that some string in the array had problems with the completion length by using space.

      the following query:

       

      create view tempView as
        select * from sourceTable where action in ('systemnotifyv2', 'session_auth', 'create_session', 'close_single_chat')

      after Sarg operator created, the result is :

       

       

      create view tempView as
       select * from sourceTable where action in ('systemnotifyv2', 'session_auth  ', 'create_session', 'close_single_chat')
      

      I debuged to see why dose the happans. After calling  rexBuilder.makeLiteral in

      FlinkRexUtil#expandSearchOperands, the string 'session_auth' became 'session_auth  '.And i also found that the type and length of the string array were determined by the first string in the array.Just like my example above, the type of the array was Char and the length of the array was 14.the length of 'session_auth' string was 12 so that calcite would supplement  2 space to make it meet the length of 14.

      Now, i All I can think of is adding trim parameter to remove the space。do you have a better way to fix or avoid the problem happens?

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Akihito Liang Junning Liang
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: