[
https://issues.apache.org/jira/browse/CALCITE-5774?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17732085#comment-17732085
]
Benchao Li commented on CALCITE-5774:
-------------------------------------
I'm not sure that this should be a right behavior. For example, for query
{code:sql}
select case
when a = 0 then 'foobar'
when a = 1 then 'bar'
when a = 2 then another_varchar_col
else 'baz'
end
from T{code}
the inferred type should be {{varchar}}, then we'll pad nothing to literals.
Then why should we add paddings when the inferred type is {{char(6)}}?
> withCaseClausesOnNewLines(true) creates invalid string literal
> --------------------------------------------------------------
>
> Key: CALCITE-5774
> URL: https://issues.apache.org/jira/browse/CALCITE-5774
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.34.0
> Reporter: Guillaume Massé
> Priority: Major
>
> It tries incorrectly to align ending quotes:
>
> input:
>
> {code:java}
> select f(case when a = 0 then 'foobar' when a = 1 then 'bar' else 'baz'
> end){code}
>
>
> output:
> {code:java}
> select f(case
> when a = 0 then 'foobar'
> when a = 1 then 'bar '
> else 'baz'
> end){code}
>
> expected:
> {code:java}
> select f(case
> when a = 0 then 'foobar'
> when a = 1 then 'bar'
> else 'baz'
> end){code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)