Arki-query problems in parsing arrays for proddef values
bchiavarini opened this issue · 4 comments
Hi,
we have experienced some problems in queries that use proddef with array values. Here you can find some data where we are experiencing the problem.
When we extract a json summary on these data we obtain proddef values described in this way:
{"items":{......
"proddef":[
{
"type":"proddef",
"desc":"GRIB(pl=0,10,0,0, pt=3, tod=8)",
"style":"GRIB",
"value":{"pl":"0,10,0,0","pt":3,"tod":8}}
,....]}}
And when we use the obtained proddef values in a new query like:
arki-query --summary-short --json --annotate "proddef:GRIB:pl=0,10,0,0,pt=3,tod=8" proddef_to_test.grib
the result is empty.
Are array values not supported? Is there an alternative way to filter data with these kind of proddef values?
thanks for the help!
Unfortunately, a value that contains commas makes the query syntax ambiguous, and the parser does weird things with it:
$ arki-dump --query 'proddef:GRIB:pl=0,10,0,0,pt=3,tod=8'
proddef:GRIB:10,0,0,pt=3, pl=0, tod=8
You can remove the ambiguity using double quotes as delimiters for the string value:
$ arki-dump --query 'proddef:GRIB:pl="0,10,0,0",pt=3,tod=8'
proddef:GRIB:pl=0,10,0,0, pt=3, tod=8
arki-dump --query
is not well known: it parses a query and reformats it without aliases. It can be useful in some cases to see how arkimet is parsing a query, although indeed something printing out the query in a more structured way would be even more useful.
Does that solve your problem?
I am trying both using
arki-query --summary-short --json --annotate "proddef:GRIB:pl="0,10,0,0",pt=3,tod=8" /arkimet/datasets
or the result of arki-dump --query
:
arki-query --summary-short --json --annotate "proddef:GRIB:pl=0,10,0,0, pt=3, tod=8" /arkimet/datasets
but the result is still empty..
btw i didn't know the arki-dump --query
command, it can be useful indeed
If this is shell syntax:
I am trying both using
arki-query --summary-short --json --annotate "proddef:GRIB:pl="0,10,0,0",pt=3,tod=8" /arkimet/datasets
then you are just closing and reopening the quotes, not quoting them, so the result would be the same as "proddef:GRIB:pl=0,10,0,0,pt=3,tod=8"
sorry, that's true.. i have retried using arki-query --summary-short --json --annotate 'proddef:GRIB:pl="0,10,0,0",pt=3,tod=8' /arkimet/datasets
and it works! I can close the issue
Thank you both for the help!