Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-2422

Differentiate between null and empty string

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Reopened
    • Major
    • Resolution: Unresolved
    • 4.5.2
    • None
    • None
    • Sending Avatica requests to Phoenix 4.5.2 using Telerik Fiddler or any REST test tool

    Description

      Create a table with a character column (use the JDBC driver or bulk import tool)

      DROP TABLE IF EXISTS SEN.Char_Table;
      CREATE TABLE IF NOT EXISTS SEN.Char_Table(
      	KeyColumn VARCHAR(255) PRIMARY KEY,
      	Column1 CHAR(100));
      

      Upsert an empty string using Avatica wire protocol

      request: {
        "request": "prepareAndExecute",
        "connectionId": "bed590dc-04d0-f1c2-16cd-a20107271BA9",
        "sql": "UPSERT INTO SEN.CHAR_TABLE(KeyColumn, Column1) VALUES('ConversionTestKey', '')",
        "maxRowCount": -1
      }
      

      Query the inserted data

      request: {
        "request": "prepareAndExecute",
        "connectionId": "bed590dc-04d0-f1c2-16cd-a20107271BA9",
        "sql": "SELECT RTRIM(Column1) FROM SEN.CHAR_TABLE WHERE RTRIM(KeyColumn) = 'ConversionTestKey'",
        "maxRowCount": -1
      }
      

      Actual result:

      {
        "response": "Service$ExecuteResponse",
        "results": [
          {
            "response": "resultSet",
            "connectionId": "bed590dc-04d0-f1c2-16cd-a20107271BA9",
            "statementId": 371048010,
            "ownStatement": true,
            "signature": {
              "columns": [
                {
                  "ordinal": 0,
                  "autoIncrement": false,
                  "caseSensitive": false,
                  "searchable": true,
                  "currency": false,
                  "nullable": 1,
                  "signed": false,
                  "displaySize": 255,
                  "label": "RTRIM(COLUMN1)",
                  "columnName": "RTRIM(COLUMN1)",
                  "schemaName": "",
                  "precision": 255,
                  "scale": 0,
                  "tableName": "SEN.CHAR_TABLE",
                  "catalogName": "",
                  "type": {
                    "type": "scalar",
                    "id": 12,
                    "name": "VARCHAR",
                    "rep": "STRING"
                  },
                  "readOnly": true,
                  "writable": false,
                  "definitelyWritable": false,
                  "columnClassName": "java.lang.String"
                }
              ],
              "sql": null,
              "parameters": [
                
              ],
              "cursorFactory": {
                "style": "LIST",
                "clazz": null,
                "fieldNames": null
              }
            },
            "firstFrame": {
              "offset": 0,
              "done": true,
              "rows": [
                [
                  null
                ]
              ]
            },
            "updateCount": -1
          }
        ]
      }
      

      Expected result: results.firstFrame.rows[0] should contain an empty string, not 'null'

      Attachments

        Activity

          People

            Unassigned Unassigned
            kliew Kevin Liew
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: