[
https://issues.apache.org/jira/browse/CALCITE-6068?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Petr Masopust updated CALCITE-6068:
-----------------------------------
Description:
SqlImplementor.java has hardcoded "true" for trimming whitespaces in
Context.toIn method
([https://github.com/apache/calcite/blob/c83ac69111fd9e75af5e3615af29a72284667a4a/core/src/main/java/org/apache/calcite/rel/rel2sql/SqlImplementor.java#L908]).
This makes troubles for our customer who use values like "Value 1 " etc. (don't
ask me why).
E.g.
val filter = relBuilder.`in`(
opportunityId,
relBuilder.literal("value 1 "),
relBuilder.literal("value 2 ")
)
is translated to "id" IN ('value 1', 'value 2') WITHOUT spaces at the end.
I don't know why is such trimming implemented but calcite should not touch user
inputs. Please make this at least configurable because I don't know any
workaround. Obvious one with OR and equalities is optimized to IN and trimmed
too.
Test reproducer is in [https://github.com/pmsgd/calcite5888] repo in AppTest as
testCalcite6068.
was:
SqlImplementor.java has hardcoded "true" for trimming whitespaces in
Context.toIn method
(https://github.com/apache/calcite/blob/c83ac69111fd9e75af5e3615af29a72284667a4a/core/src/main/java/org/apache/calcite/rel/rel2sql/SqlImplementor.java#L908).
This makes troubles for our customer who use values like "Value 1 " etc. (don't
ask me why).
E.g.
val filter = relBuilder.`in`(
opportunityId,
relBuilder.literal("value 1 "),
relBuilder.literal("value 2 ")
)
is translated to "id" IN ('value 1', 'value 2') WITHOUT spaces at the end.
I don't know why is such trimming implemented but calcite should not touch user
inputs. Please make this at least configurable because I don't know any
workaround. Obvious one with OR and equalities is optimized to IN and trimmed
too.
> Whitespaces are removed from filter values
> ------------------------------------------
>
> Key: CALCITE-6068
> URL: https://issues.apache.org/jira/browse/CALCITE-6068
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.35.0
> Reporter: Petr Masopust
> Priority: Major
>
> SqlImplementor.java has hardcoded "true" for trimming whitespaces in
> Context.toIn method
> ([https://github.com/apache/calcite/blob/c83ac69111fd9e75af5e3615af29a72284667a4a/core/src/main/java/org/apache/calcite/rel/rel2sql/SqlImplementor.java#L908]).
>
> This makes troubles for our customer who use values like "Value 1 " etc.
> (don't ask me why).
> E.g.
> val filter = relBuilder.`in`(
> opportunityId,
> relBuilder.literal("value 1 "),
> relBuilder.literal("value 2 ")
> )
> is translated to "id" IN ('value 1', 'value 2') WITHOUT spaces at the end.
>
> I don't know why is such trimming implemented but calcite should not touch
> user inputs. Please make this at least configurable because I don't know any
> workaround. Obvious one with OR and equalities is optimized to IN and trimmed
> too.
> Test reproducer is in [https://github.com/pmsgd/calcite5888] repo in AppTest
> as testCalcite6068.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)