Evan Galpin
08/04/2021, 2:35 PMfriends
array (arbitrary example) at the same level as group
. I noted that the docs say this about the unnesting example (emphasis mine):
For instance, the example in the beginning will transform into two rows with this configuration example.Are these then distinct rows in the table, or some kind of special nested rows associated with a top-level row? And if there were another nested/complex field, would that result in a combinatorial explosion in terms of number of rows? A related question: how does this approach work with conjunctions? In the example given where the topics are
paddling
and hiking
, can a query be written to answer the question “which meetup events had talks about both paddling and hiking?”
[1] https://docs.pinot.apache.org/basics/data-import/complex-type#handle-the-complex-type-with-ingestion-configurationsKishore G
Evan Galpin
08/04/2021, 3:56 PMKishore G
Kishore G
Evan Galpin
08/04/2021, 3:57 PMKishore G
Kishore G
Kishore G
Evan Galpin
08/04/2021, 4:03 PMKishore G
Kishore G
Kishore G
Kishore G
Kishore G
Evan Galpin
08/04/2021, 4:47 PM{
"name": "adam",
"age": 30,
"country": "us",
"addresses":
[
{
"number" : 112,
"street" : "main st",
"country" : "us"
},
{
"number" : 2,
"street" : "second st",
"country" : "us"
},
{
"number" : 3,
"street" : "third st",
"country" : "ca"
}
]
}
How would one write a query to select rows that had an address on main st
but only if that address was in ca
? Would the below query return the adam
row?
SELECT ... FROM mytable WHERE JSON_MATCH(person, '"$.addresses[*].country"=''ca'' AND "$.addresses[*].street"=''main st'' ')
Especially thinking of the fields like multi-value fields, I would guess that it would return the adam
row:
{
"name": "adam",
"age": 30,
"country": "us",
"addresses.number": [
112,
2,
3
],
"addresses.street": [
"main st",
"second st",
"third st"
],
"addresses.country": [
"ca",
"us"
]
}
[1] https://docs.pinot.apache.org/basics/indexing/json-indexKishore G
Kishore G
Jackie
08/04/2021, 4:57 PMadam
because main st
and ca
are not from the same elementEvan Galpin
08/04/2021, 4:59 PM*
(asterisk) does maintain the context? That’s both surprising and great to learn!Jackie
08/04/2021, 5:02 PMJSON_MATCH
clause. Basically in a single JSON_MATCH
, the context is maintainedEvan Galpin
08/04/2021, 5:03 PMEvan Galpin
08/04/2021, 5:09 PMKishore G
Evan Galpin
08/04/2021, 5:48 PM