dragonfly icon indicating copy to clipboard operation
dragonfly copied to clipboard

Aggregation JSON TAG Field not working

Open canparam opened this issue 1 year ago • 5 comments

Describe the bug i am using json, i am aggregating data but when i groupby TAG field is not working, Number field is still working

To Reproduce Steps to reproduce the behavior: Query records using FT.aggregate junna-idx '*' GROUPBY 1 $.title REDUCE count 0 as count_title See result (nil) value image

Environment (please complete the following information):

  • OS: [ubuntu 20.04]
  • Dragonfly Version: df-v1.22.2

canparam avatar Sep 18 '24 09:09 canparam

Hi @canparam , the bug you found has already been fixed. And the fix will be released in the next version

BagritsevichStepan avatar Sep 25 '24 08:09 BagritsevichStepan

Hi @canparam , the bug you found has already been fixed. And the fix will be released in the next version

Thank @BagritsevichStepan , but after I updated and used Aggregation the service was down

version

redis_version:6.2.11
dragonfly_version:df-v1.23.1
redis_mode:standalone
arch_bits:64
os:Linux 4.4.0-22621-Microsoft x86_64
multiplexing_api:epoll
tcp_port:6380
thread_count:8
uptime_in_seconds:11
uptime_in_days:0```

querry: 

127.0.0.1:6380> ft.AGGREGATE sales-orders-idx '*' GROUPBY 1 @vid reduce count 0 as kk Error: Server closed the connection not connected>

log error

```W20241001 10:41:52.321777   332 main_service.cc:1437]  COMMAND DOCS failed with reason: syntax error
F20241001 10:42:50.749950   333 transaction.cc:653] Unexpected exception Not a double
*** Check failure stack trace: ***
F20241001 10:42:50.749958   339 transaction.cc:653] Unexpected exception Not a double
*** Check failure stack trace: ***
F20241001 10:42:50.749958   339 transaction.cc:653] Unexpected exception Not a doubleF20241001 10:42:50.749961   335 transaction.cc:653] Unexpected exception Not a double
    @     0x7fa6c609d343  (unknown)
*** Check failure stack trace: ***
    @     0x7fa6c609d343  (unknown)
F20241001 10:42:50.749958   339 transaction.cc:653] Unexpected exception Not a doubleF20241001 10:42:50.749961   335 transaction.cc:653] Unexpected exception Not a doubleF20241001 10:42:50.749960   336 transaction.cc:653] Unexpected exception Not a double
    @     0x7fa6c6095b07  (unknown)
*** Check failure stack trace: ***
F20241001 10:42:50.749958   339 transaction.cc:653] Unexpected exception Not a doubleF20241001 10:42:50.749961   335 transaction.cc:653] Unexpected exception Not a doubleF20241001 10:42:50.749960   336 transaction.cc:653] Unexpected exception Not a doubleF20241001 10:42:50.749962   337 transaction.cc:653] Unexpected exception Not a double
    @     0x7fa6c6095b07  (unknown)
    @     0x7fa6c609d343  (unknown)
    @     0x7fa6c609d343  (unknown)
    @     0x7fa6c609748f  (unknown)
*** Check failure stack trace: ***
F20241001 10:42:50.749958   339 transaction.cc:653] Unexpected exception Not a doubleF20241001 10:42:50.749961   335 transaction.cc:653] Unexpected exception Not a doubleF20241001 10:42:50.749960   336 transaction.cc:653] Unexpected exception Not a doubleF20241001 10:42:50.749962   337 transaction.cc:653] Unexpected exception Not a doubleF20241001 10:42:50.750264   338 transaction.cc:653] Unexpected exception Not a double
    @     0x7fa6c609748f  (unknown)
    @     0x7fa6c6095b07  (unknown)
    @     0x7fa6c55e93e6  (unknown)
    @     0x7fa6c6095b07  (unknown)
*** Check failure stack trace: ***
    @     0x7fa6c609d343  (unknown)
    @     0x7fa6c55e93e6  (unknown)
    @     0x7fa6c609748f  (unknown)```



canparam avatar Oct 01 '24 03:10 canparam

Can you please provide a minimal reproducible example or share with us the snapshot?

romange avatar Oct 01 '24 05:10 romange

Can you please provide a minimal reproducible example or share with us the snapshot?

Yes, I found out when I AGGREGATE but any field with data equal to null will error both v1.23.1 and v1.23.0 are buggy

can you create data

127.0.0.1:6379> json.set test:dfly:1 $ '{"name":"John","age":12, "id": null}'
OK
127.0.0.1:6379> json.set test:dfly:2 $ '{"name":"David","age":12, "id": null}'
OK
127.0.0.1:6379> json.set test:dfly:3 $ '{"name":"David","age":12, "id": 1}'
OK
127.0.0.1:6379> FT.CREATE test-dfly ON JSON PREFIX 1 test:dfly: SCHEMA $.name AS name TAG $.age AS age NUMERIC SORTABLE $.id as id NUMERIC
(error) ERR Index already exists
127.0.0.1:6379> ft.dropindex test-dfly
OK
127.0.0.1:6379> FT.CREATE test-dfly ON JSON PREFIX 1 test:dfly: SCHEMA $.name AS name TAG $.age AS age NUMERIC SORTABLE $.id as id NUMERIC
OK
127.0.0.1:6379> ft.aggregate test-dfly "*" GROUPBY 1 @name REDUCE COUNT 0 as num

query image image

error image image

canparam avatar Oct 01 '24 06:10 canparam

Thanks!

romange avatar Oct 01 '24 06:10 romange

Since #4070 merged, crashes no longer occur. However, now we need to add support for nullable fields, as FT.SEARCH and FT.AGGREGATE currently don’t index documents with null values. Another issue #4107 has been created to track the progress.

BagritsevichStepan avatar Nov 10 '24 16:11 BagritsevichStepan

@BagritsevichStepan thanks! regarding nullable values - is it a regression compared to 1.24?

romange avatar Nov 10 '24 16:11 romange

No, in the 1.24 Dragonfly crashed if a field had a null value

BagritsevichStepan avatar Nov 10 '24 16:11 BagritsevichStepan