Skip to content

[SQL] Implement MAP_VALUES function#5114

Merged
mihaibudiu merged 1 commit intomainfrom
issue5111
Nov 16, 2025
Merged

[SQL] Implement MAP_VALUES function#5114
mihaibudiu merged 1 commit intomainfrom
issue5111

Conversation

@mihaibudiu
Copy link
Copy Markdown
Contributor

Fixes #5111

Copilot AI review requested due to automatic review settings November 16, 2025 00:15
@mihaibudiu mihaibudiu mentioned this pull request Nov 16, 2025
10 tasks
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements the MAP_VALUES SQL function, which extracts all values from a map and returns them as an array. This complements the existing MAP_KEYS function by providing access to map values.

  • Adds the MAP_VALUES function to the SQL compiler and runtime library
  • Implements corresponding test cases for the new function
  • Updates documentation to include the new function

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Regression1Tests.java Adds Ignore import (unused in this diff)
MapTests.java Renames test method for clarity and adds comprehensive tests for MAP_VALUES function
FunctionDocumentation.java Fixes multiline handling in test pattern parsing
CalciteFunctions.java Registers the MAP_VALUES function with Calcite
ExpressionCompiler.java Adds MAP_VALUES case to expression compilation logic
map.md Documents the new MAP_VALUES function with examples
function-index.md Adds index entry for MAP_VALUES function
map.rs Implements the Rust runtime functions for MAP_VALUES

| <a id="cardinality"></a>`CARDINALITY`(map) | Returns the number of key-value pairs in the map. | `CARDINALITY(MAP['x', 4])` => 1 |
| <a id="map_contains_key"></a>`MAP_CONTAINS_KEY`(map, key) | Returns true when the map has an item with the specified key; `NULL` if any argument is `NULL`. | `MAP_CONTAINS_KEY(MAP['x', 4], 'x')` => `true` |
| <a id="map_keys"></a>`MAP_KEYS`(map) | Returns a sorted ARRAY of the appropriate type with all the keys of the MAP. | `MAP_KEYS(MAP['x', 4, 'y', 5])` => `['x', 'y']` |
| <a id="map_values"></a>`MAP_VALUES`(map) | Returns an ARRAY of the appropriate type with all the values of the MAP. | `MAP_KEYS(MAP['x', 4, 'y', 5])` => `[4, 5]` |
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example incorrectly uses MAP_KEYS instead of MAP_VALUES. It should demonstrate the MAP_VALUES function.

Suggested change
| <a id="map_values"></a>`MAP_VALUES`(map) | Returns an ARRAY of the appropriate type with all the values of the MAP. | `MAP_KEYS(MAP['x', 4, 'y', 5])` => `[4, 5]` |
| <a id="map_values"></a>`MAP_VALUES`(map) | Returns an ARRAY of the appropriate type with all the values of the MAP. | `MAP_VALUES(MAP['x', 4, 'y', 5])` => `[4, 5]` |

Copilot uses AI. Check for mistakes.
Signed-off-by: Mihai Budiu <mbudiu@feldera.com>
@mihaibudiu mihaibudiu added this pull request to the merge queue Nov 16, 2025
Merged via the queue into main with commit b9e4750 Nov 16, 2025
1 check passed
@mihaibudiu mihaibudiu deleted the issue5111 branch November 16, 2025 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SQL] Implement MAP_VALUES function

3 participants