You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Wang Yanlin (Jira)" <ji...@apache.org> on 2019/09/16 12:39:00 UTC

[jira] [Created] (CALCITE-3350) Keep origin type for RexLiteral when deserialized from json string

Wang Yanlin created CALCITE-3350:
------------------------------------

             Summary: 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: Improvement
            Reporter: Wang Yanlin


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.2#803003)