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

Add MAP_FROM_ARRAYS, STR_TO_MAP for Spark dialect

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.35.0
    • 1.35.0
    • core

    Description

      MAP_FROM_ARRAYS (array1, array2)

      • Returns a map created from an array1 and *array2. Note that the lengths of two arrays should be the same
      // code placeholder
      > SELECT map_from_arrays(array(1.0, 3.0), array('2', '4'));
       {1.0:"2",3.0:"4"} 

       

       

      STR_TO_MAP(string[, stringDelimiter[, keyValueDelimiter]])

      • Returns a map after splitting the string into key/value pairs using delimiters. Default delimiters are ',' for stringDelimiter and ':' for keyValueDelimiter Both pairDelim and keyValueDelim are treated as regular expressions.

      Examples:

      > SELECT str_to_map('a:1,b:2,c:3', ',', ':');
      
      - {"a":"1","b":"2","c":"3"}
      
      > SELECT str_to_map('a');
       {"a":null} 

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jackylau Jacky Lau
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: