Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-14079 Full data type support in planner
  3. FLINK-9559

The type of a union of CHAR columns of different lengths should be VARCHAR

    XMLWordPrintableJSON

Details

    Description

      Currently, If the case-when expression has two branches which return string literal, redundant white spaces will be appended to the short string literal. For example, for the sql: case 1 when 1 then 'a' when 2 then 'bcd' end, the return value will be 'a ' of CHAR(3) instead of 'a'.

      Although, this follows the behavior in strict SQL standard mode(SQL:2003). We should get the pragmatic return type in a real scenario without blank-padded.

      Happily, this problem has been fixed by CALCITE-2321, we can upgrade calcite to the next release(1.17.0) and override RelDataTypeSystem in flink to configure the return type, i.e., making shouldConvertRaggedUnionTypesToVarying() return true.

      Attachments

        Issue Links

          Activity

            People

              docete Zhenghua Gao
              hequn8128 Hequn Cheng
              Votes:
              0 Vote for this issue
              Watchers:
              3 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 - 10m
                  10m