You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] rename does not work with struct field #3279
The rename command returns incorrect results when applied to a struct field.
While the renamed field is correctly added to the search results, additional fields are also added that correspond to each of the fields within the struct, and which contain null values.
Consider the following input data:
name
location
Seattle
{ country: 'United States' }
Vancouver
{ country: 'Canada' }
Query: source=input | rename location as renamed_location
Expected Results:
name
renamed_location
Seattle
{ country: 'United States' }
Vancouver
{ country: 'Canada' }
Actual Results:
name
country
renamed_location
Seattle
null
{ country: 'United States' }
Vancouver
null
{ country: 'Canada' }
How can one reproduce the bug?
See comment below for sample mapping, input data, query, and results.
What is the expected behaviour?
See above. Struct field should be renamed, not additional columns should be created.
What is your host/environment?
Not applicable.
Do you have any screenshots?
Not applicable. See example above and sample mapping, input data, query, and results in comment below.
changed the title [-][BUG] Command `rename` does not work with`struct` field[/-][+][BUG] Command `rename` does not work with `struct` field[/+]on Jan 30, 2025
This is no longer issue in latest Calcite engine enabled PPL query. PPL flatten nested fields per original design because of some historical decisions. We don't know the struct internal field schema. With workaround solutions, accessing struct fields are resolved by this PR: #4719.
Activity
currantw commentedon Jan 30, 2025
EXAMPLE
Mapping:
{ "mappings": { "properties": { "name": { "type": "keyword" }, "location": { "type": "object", "properties": { "state": { "type": "keyword" }, "province": { "type": "keyword" }, "country": { "type": "keyword" }, "coordinates": { "type": "object", "properties": { "latitude": { "type": "double" }, "longitude": { "type": "double" } } } } } } } }Data (Bulk):
{"index":{"_id":"1"}} {"name": "Seattle", "location": { "state": "Washington", "country": "United States", "coordinates": {"latitude": 47.6061, "longitude": -122.3328}}} {"index":{"_id":"2"}} {"name": "Vancouver", "location": { "province": "British Columbia", "country": "Canada", "coordinates": {"latitude": 49.2827, "longitude": -123.1207}}}Query:
Response:
{ "schema": [ { "name": "name", "type": "string" }, { "name": "location.coordinates", "type": "struct" }, { "name": "location.country", "type": "string" }, { "name": "location.province", "type": "string" }, { "name": "location.state", "type": "string" }, { "name": "renamed_location", "type": "struct" } ], "datarows": [ [ "Seattle", null, null, null, null, { "state": "Washington", "country": "United States", "coordinates": { "latitude": 47.6061, "longitude": -122.3328 } } ], [ "Vancouver", null, null, null, null, { "province": "British Columbia", "country": "Canada", "coordinates": { "latitude": 49.2827, "longitude": -123.1207 } } ] ], "total": 2, "size": 2[-][BUG] Command `rename` does not work with`struct` field[/-][+][BUG] Command `rename` does not work with `struct` field[/+][-][BUG] Command `rename` does not work with `struct` field[/-][+][BUG] `rename` does not work with `struct` field[/+]Fix projection/rename alias conflicts (opensearch-project#785, opense…
songkant-aws commentedon Apr 16, 2026
This is no longer issue in latest Calcite engine enabled PPL query. PPL flatten nested fields per original design because of some historical decisions. We don't know the struct internal field schema. With workaround solutions, accessing struct fields are resolved by this PR: #4719.