Re: Flink Table Case Statements appending spaces

2019-02-04 Thread Timo Walther
RTRIM is not the only solution. It is also possible to cast all literals of a CASE WHEN statement to VARCHAR, right? WHEN aggrcat = '0' AND botcode='r4' THEN CAST('monitoring' AS VARCHAR) The common datatype of all branches should then be VARCHAR. Regards, Timo Am 04.02.19 um 11:06 schrie

Re: Flink Table Case Statements appending spaces

2019-02-04 Thread Piotr Nowojski
Hi Ramya, Fabian and Hequn are partially correct. Return type of `CASE WHEN` statement in this case should be CHAR(N), with N being the max of the WHEN branches. However the problem that you are facing is that Flink doesn’t handle CHAR(N) type correctly. There is an open issue for that: https:

Re: Flink Table Case Statements appending spaces

2019-01-29 Thread Hequn Cheng
Hi Ramya, Fabian is right. The behavior in strict SQL standard mode(SQL:2003) returns a CHAR(N) type with blank-padded. Best, Hequn On Wed, Jan 30, 2019 at 1:59 AM Fabian Hueske wrote: > Hi, > > Table API queries are executed with SQL semantics. > In SQL, the strings are padded because the re

Re: Flink Table Case Statements appending spaces

2019-01-29 Thread Fabian Hueske
Hi, Table API queries are executed with SQL semantics. In SQL, the strings are padded because the result data type is not a VARCHAR but a CHAR with as many character as the longest string. You can use the RTRIM function to remove the padding whitespaces. Best, Fabian Am Di., 29. Jan. 2019 um 15

Flink Table Case Statements appending spaces

2019-01-29 Thread Ramya Ramamurthy
Hi, I have encountered a weird issue. When constructing a Table Query with CASE Statements, like below: .append("CASE ") .append("WHEN aggrcat = '0' AND botcode='r4' THEN 'monitoring' ") .append("WHEN aggrcat = '1' AND botcode='r4' THEN 'aggregator' ") .append("WHEN aggrcat = '2' AND botcode='r4'