Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-6941

Array/Map value constructor is unparsed incorrectly in ClickHouse

    XMLWordPrintableJSON

Details

    Description

      Array/Map value constructor is unparsed incorrectly in ClickHouse,

      currently select map('a','b') —> select MAP['a', 'b']   select array(1,2,3) —> select ARRAY[1,2,3]

      that would cause to error as follow:

      1. array[1,2,3] should to be array(1,2,3) and map['k1','v1','k2','v2'] should be map('k1','v1','k2','v2')

      select array[1,2];
      Code: 62. DB::Exception: Syntax error: failed at position 294 (end of query) (line 16, col 18): ;

      select map['k1','v1','k2','v2'];
      Code: 62. DB::Exception: Syntax error: failed at position 330 (end of query) (line 17, col 32): ;

       

      2. case sensitive with map/array:
      select map('a', 'b');
      > {'a':'b'} ----- result is ok

      select MAP('a', 'b');
      Code: 46. DB::Exception: Received from localhost:9000. DB::Exception: Function with name `MAP` does not exist. In scope SELECT MAP('a', 'b').
       Maybe you meant: ['map','max']. (UNKNOWN_FUNCTION)
       
      select array(1,2);
      > [1,2] ----- result is ok

      select ARRAY(1,2);
      Code: 46. DB::Exception: Received from localhost:9000. DB::Exception: Function with name `ARRAY` does not exist. In scope SELECT ARRAY(1, 2). 
      Maybe you meant: ['array']. (UNKNOWN_FUNCTION)

      above results can refer to doc:
      https://clickhouse.com/docs/sql-reference/data-types/array 
      https://clickhouse.com/docs/sql-reference/data-types/map

      Attachments

        Issue Links

          Activity

            People

              xuzifu666 Yu Xu
              xuzifu666 Yu Xu
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: