Skip to content

Planner: Support "select from model where input in (...)" #279

@ea-rus

Description

@ea-rus

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

  1. 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;
  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;
  1. second field is list of different length
SELECT * FROM model WHERE a IN (100,101) and b IN (1,2,3)

raises an error

  1. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions