[ 
https://issues.apache.org/jira/browse/CALCITE-3350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16933948#comment-16933948
 ] 

Danny Chan edited comment on CALCITE-3350 at 9/20/19 2:16 AM:
--------------------------------------------------------------

Personally i'm curious about why the original `STRING` literal is VARCHAR type, 
should it still be CHAR(n) ?


was (Author: danny0405):
Personally i'm curious about why the original `STRING` literal is `VARCHAR` 
type, should it still be `CHAR(n)` ?

> Keep origin type for RexLiteral when deserialized from json string
> ------------------------------------------------------------------
>
>                 Key: CALCITE-3350
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3350
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Wang Yanlin
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> The json string of sql
> {noformat}
> select ename from emp where job = "abd"
> {noformat}
> is
> {noformat}
> {
>   "rels": [
>     {
>       "id": "0",
>       "relOp": "LogicalTableScan",
>       "table": [
>         "scott",
>         "EMP"
>       ],
>       "inputs": []
>     },
>     {
>       "id": "1",
>       "relOp": "LogicalFilter",
>       "condition": {
>         "op": {
>           "name": "=",
>           "kind": "EQUALS",
>           "syntax": "BINARY"
>         },
>         "operands": [
>           {
>             "input": 2,
>             "name": "$2"
>           },
>           {
>             "literal": "abd",
>             "type": {
>               "type": "VARCHAR",
>               "nullable": false,
>               "precision": 10
>             }
>           }
>         ]
>       }
>     },
>     {
>       "id": "2",
>       "relOp": "LogicalProject",
>       "fields": [
>         "ENAME"
>       ],
>       "exprs": [
>         {
>           "input": 1,
>           "name": "$1"
>         }
>       ]
>     }
>   ]
> }
> {noformat}
> The original type of literal "abd" is
> {noformat}
> VARCHAR(10) NOT NULL
> {noformat}
> When deserialized relnode from this json string, the type of literal "abd" is 
> changed to
> {noformat}
> CHAR(3) NOT NULL
> {noformat}
> Better to keep the same with original type when deserialized from string.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to