Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-23899 Built-in SQL Function Improvement
  3. SPARK-23937

High-order function: map_filter(map<K, V>, function<K, V, boolean>) → MAP<K,V>

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.3.0
    • 3.0.0
    • SQL
    • None

    Description

      Constructs a map from those entries of map for which function returns true:

      SELECT map_filter(MAP(ARRAY[], ARRAY[]), (k, v) -> true); -- {}
      SELECT map_filter(MAP(ARRAY[10, 20, 30], ARRAY['a', NULL, 'c']), (k, v) -> v IS NOT NULL); -- {10 -> a, 30 -> c}
      SELECT map_filter(MAP(ARRAY['k1', 'k2', 'k3'], ARRAY[20, 3, 15]), (k, v) -> v > 10); -- {k1 -> 20, k3 -> 15}
      
      

      Attachments

        Activity

          People

            mgaido Marco Gaido
            smilegator Xiao Li
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: