Comments (4)
fixed at e0fd6c0
Now filter select * from idx where j.color in ( 'blue' )
should work the exactly as select *, j.color in ( 'blue' ) as cnd from ifx where cnd=1
Prior to the fix filter IN ( string list )
by json attribute assumes that json.field
as always a single string now it should work properly with the multiple kinds of json.field
from manticoresearch.
but there's no case for json field with array of strings
Right. What was done in 88e7179 changes the behaviour for non-arrays. Moreover the behaviour for arrays and scalars is different even when going the ... as cond
way:
mysql> drop table if exists t; CREATE TABLE t (j json); INSERT INTO t(j) values ('{"a": [1,2]}'),('{"a": 1}'); SELECT * FROM t WHERE j.a IN (1); select *, ANY(x=1 FOR x IN j.a) cond from t;
--------------
drop table if exists t
--------------
Query OK, 0 rows affected (0.02 sec)
--------------
CREATE TABLE t (j json)
--------------
Query OK, 0 rows affected (0.03 sec)
--------------
INSERT INTO t(j) values ('{"a": [1,2]}'),('{"a": 1}')
--------------
Query OK, 2 rows affected (0.00 sec)
--------------
SELECT * FROM t WHERE j.a IN (1)
--------------
+---------------------+---------+
| id | j |
+---------------------+---------+
| 1515687300166582363 | {"a":1} |
+---------------------+---------+
1 row in set (0.00 sec)
--- 1 out of 1 results in 0ms ---
--------------
select *, ANY(x=1 FOR x IN j.a) cond from t
--------------
+---------------------+-------------+------+
| id | j | cond |
+---------------------+-------------+------+
| 1515687300166582362 | {"a":[1,2]} | 1 |
| 1515687300166582363 | {"a":1} | 0 |
+---------------------+-------------+------+
2 rows in set (0.00 sec)
--- 2 out of 2 results in 0ms ---
So I'm not sure it's a bug since WHERE j.a IN (...)
is a little ambiguous while using FOR
makes it more clear. WHERE ANY/ALL(j.a) IN (...)
would make it more clear too, so perhaps this is the syntax which makes sense in the context of this task and comparison with arrays.
from manticoresearch.
OK, thank you.
This behavior seemed like a bug because
- Example table of original issue contains JSON column with array attribute
- Query with
WHERE json.array IN (...)
does not return an error
Query with WHERE ANY/ALL(json.array) IN (...)
sounds great, because virtual conditional column cannot be included in HTTP search request
from manticoresearch.
related to #778
from manticoresearch.
Related Issues (20)
- Thai chars are in the wrong charsets HOT 5
- Treating document IDs as numbers in /search responses HOT 4
- Daemon crashes on _search request from Kibana HOT 1
- Fix json escaping for mysqldump HOT 2
- Make it possible to heal from dupes in a disk chunk HOT 3
- Search by JSON keys works incorrectly HOT 1
- Possible issue with Buddy on Windows HOT 6
- buddy can not work at Windows if listen is 127.0.0.1 HOT 5
- WARNING: wordlist size mismatch (size=18, checkpoints=0) HOT 3
- Crash if I use an SQL with a reserved word HOT 4
- Escape is not working for HTTP and SQL HOT 4
- IDF calculation issue
- Extended quote and double quote functionality
- Show correct data types in /cli_json HOT 2
- Escaping in wordforms and exceptions
- Problem with using > HOT 1
- Error: GPG check FAILED when installing in platform linux/arm64 image almalinux:9 HOT 7
- Non exist chunk crash
- Can't import table with wordforms HOT 8
- plain index needs autodetection of date formats for timestamp fields
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from manticoresearch.