Evan Galpin
01/06/2022, 5:56 PMJSON_MATCH
? Ex. Modifying example query from json-index docs[1]:
{
"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"
}
]
}
SELECT ...
FROM mytable
WHERE JSON_MATCH(person, '"$.addresses[*].number">2')
I would expect that this adam
doc/row would match. But I’m not sure if range queries are supported. Thanks!
https://docs.pinot.apache.org/basics/indexing/json-index#chained-key-lookupRichard Startin
01/06/2022, 6:08 PMRichard Startin
01/06/2022, 6:08 PMEvan Galpin
01/06/2022, 6:26 PMSELECT ...
FROM mytable
WHERE JSON_MATCH(person, '"$.addresses[*].number">2 AND "$.addresses[*].country"=''us''')
this would not match. Using the approach of extracting the address numbers would remove the possibility of using the context for conjunctions.
Do you happen to know if there have been attempts to implement effectively defining a schema for a json column, allowing definition of different data types/indexes within the JSON? Any idea off-hand if that’s completely infeasible, reasonable with effort, etc?Kishore G
Kishore G
JSON_MATCH(person, '"$.addresses[*].country"=''us''') AND JSON_EXTRACT_SCALAR(""$.addresses[*].number") > 2
Kishore G
Kishore G
Evan Galpin
01/06/2022, 7:17 PMthe planner is optimized to only evaluate the json country = “us”Could you elaborate on this a bit? My initial impression was that your recommendation might still have the limitation where JSON context is not maintained, but your input about the planner made me wonder. Keen to learn, thanks!
Kishore G
Kishore G
Evan Galpin
01/06/2022, 7:21 PMRichard Startin
01/06/2022, 7:21 PMKishore G
Evan Galpin
01/06/2022, 7:24 PMKishore G
Kishore G
Kishore G
Evan Galpin
01/06/2022, 7:26 PMEvan Galpin
01/06/2022, 7:30 PMMAP
and STRUCT
data types. Where can I learn more about these data types and their usage?Evan Galpin
01/06/2022, 7:32 PM