Repository navigation
Closed
Labels
bugSomething isn't working
Description
What is the bug?
The nested function separates values of an array into additional rows which duplicates some values and gives misleading results
How can one reproduce the bug?
Steps to reproduce the behavior:
- Load this dataset to your server:
{"index":{"_id":"1"}}
{"message":{"info":"a","author":"e","dayOfWeek":1},"comment":{"data":"ab","likes":3},"myNum":1,"someField":"b"}
{"index":{"_id":"2"}}
{"message":{"info":"b","author":"f","dayOfWeek":2},"comment":{"data":"aa","likes":2},"myNum":2,"someField":"a"}
{"index":{"_id":"3"}}
{"message":{"info":"c","author":"g","dayOfWeek":1},"comment":{"data":"aa","likes":3},"myNum":3,"someField":"a"}
{"index":{"_id":"4"}}
{"message":[{"info":"d","author":"h","dayOfWeek":4},{"info":"e","author":"i","dayOfWeek":5}],"comment":{"data":"ab","likes":1},"myNum":4,"someField":"b"}
{"index":{"_id":"5"}}
{"message": [{"info":"zz","author":"zz","dayOfWeek":6}],"comment":{"data":["aa","bb"],"likes":10},"myNum":[3,4],"someField":"a"}
- Query
{
"fetch_size": 20,
"query": "SELECT nested(message.info), nested(comment.data) FROM nested_simple;"
}
- See the results:
"total": 6,
"datarows": [
[
"a",
"ab"
],
[
"b",
"aa"
],
[
"c",
"aa"
],
[
"d",
"ab"
],
[
"e",
"ab"
],
[
"zz",
[
"aa",
"bb"
]
]
],
"size": 6,
"status": 200
- Note that "ab" is duplicated and is in an additional row. Also, note that the size of the results is 6 while the dataset only has 5 rows.
What is the expected behavior?
When calling the nested function with data having array of objects we should expect the resulting number of rows to be the same number as the dataset. For example, the dataset above should always have 5 rows in the result when the user queries SELECT nested(message.info), nested(comment.data) from nested_simple;
Expected output:
"datarows": [
[
"a",
"ab"
],
[
"b",
"aa"
],
[
"c",
"aa"
],
[
[
"d",
"e"
],
"ab"
],
[
[
"zz"
],
[
"aa",
"bb"
]
]
],
"total": 5,
"size": 5,
"status": 200
What is your host/environment?
- SQL plugin: 2.4
Metadata
Metadata
Assignees
Labels
bugSomething isn't working

Activity
GumpacG commentedon Feb 16, 2023
Closing this issue because it is actually expected behaviour to follow PartiQL behaviour.
PartiQL data:
PartiQL query and result: