mindsdb_sql
mindsdb_sql copied to clipboard
Planner: Support "select from model where input in (...)"
Support multiple model calls in selecting from predictor with using IN statement.
This select
SELECT * FROM model
WHERE a IN (100,101)
Should call model twice, with two inputs and return two records in output. Equivalent calls:
SELECT * FROM model WHERE a = 100;
SELECT * FROM model WHERE a = 101;
Edge cases
- second field is constant
SELECT * FROM model WHERE a IN (100,101) and b = 1
is converted to:
SELECT * FROM model WHERE a = 100 and b = 1;
SELECT * FROM model WHERE a = 101 and b = 1;
- second field is list of equal length
SELECT * FROM model WHERE a IN (100,101) and b IN (1,2)
is converted to:
SELECT * FROM model WHERE a = 100 and b = 1;
SELECT * FROM model WHERE a = 101 and b = 2;
- second field is list of different length
SELECT * FROM model WHERE a IN (100,101) and b IN (1,2,3)
raises an error
- first field is subselect
SELECT * FROM model WHERE a IN (select a from table1)
Raise not supported ? To be able to handle this case this logic should be implemented in mindsdb.