[ https://issues.apache.org/jira/browse/CALCITE-2321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16483878#comment-16483878 ]
Hequn Cheng edited comment on CALCITE-2321 at 5/22/18 2:23 PM: --------------------------------------------------------------- Hi [~julianhyde], thanks for your reply. I test Oracle/SqlServer/Mysql and they all return the value without blank-padded. Also, it seems that there is no way to turn blank-padded on. I found some clear descriptions in mysql reference manual: "If all types are character string (CHAR or VARCHAR), the result is VARCHAR with maximum length determined by the longest character length of the operands". Maybe we should make {{shouldRaggedFixedLengthValueUnionBeVariable()}} configurable meanwhile return true by default? As for creating a type system, other system can create their own type system by extending {{RelDataTypeSystemImpl}}, and this may not be a hard work. I tried to set it via dialect, but find it is hard to make use of it in {{SqlTypeFactoryImpl}} during sql to rel conversion. It seems that dialect is used during rel to sql conversion. Thanks, Hequn was (Author: hequn8128): Hi [~julianhyde], thanks for your reply. I test Oracle/SqlServer/Mysql and they all return the value without blank-padded. Also, it seems that there is no way to turn blank-padded on. Maybe we should make {{shouldRaggedFixedLengthValueUnionBeVariable()}} configurable meanwhile return true by default? As for creating a type system, other system can create their own type system by extending {{RelDataTypeSystemImpl}}, and this may not be a hard work. I tried to set it via dialect, but find it is hard to make use of it in {{SqlTypeFactoryImpl}} during sql to rel conversion. It seems that dialect is used during rel to sql conversion. Thanks, Hequn > Support ragged fixed length value union be variable > --------------------------------------------------- > > Key: CALCITE-2321 > URL: https://issues.apache.org/jira/browse/CALCITE-2321 > Project: Calcite > Issue Type: New Feature > Components: core > Reporter: Hequn Cheng > Assignee: Hequn Cheng > Priority: Major > > The {{shouldRaggedFixedLengthValueUnionBeVariable()}} function in > {{SqlTypeFactoryImpl}} always return false now. It is good to make it > configurable since some system may need the function to return true to > provide pragmatic behavior. For example, for the sql: case 1 when 1 then 'a' > when 2 then 'bcd' end, we need the return value to be 'a' instead of 'a ' of > CHAR(3). > I see one option to solve this issue: Add {{boolean > shouldRaggedFixedLengthValueUnionBeVariable()}} in {{RelDataTypeSystem}}, so > external system can override to configure the value. > Any suggestions are welcomed. Thanks a lot. -- This message was sent by Atlassian JIRA (v7.6.3#76005)