mindsdb_sql icon indicating copy to clipboard operation
mindsdb_sql copied to clipboard

[Planner] Skip groups selecting step if groups are specified explicitly

Open StpMax opened this issue 1 year ago • 0 comments

Let assume there are TS model created:

CREATE MODEL 
  mindsdb.house_sales_model
FROM example_db
  (SELECT * FROM demo_data.house_sales)
PREDICT ma
ORDER BY saledate
GROUP BY type
WINDOW 8
HORIZON 4; 

If do JOIN query like this:

 SELECT m.saledate as date, m.ma as forecast
  FROM mindsdb.house_sales_model as m 
  JOIN example_db.demo_data.house_sales as t
  WHERE t.saledate > LATEST AND t.type = 'house';

then fist step will be FetchDataframeStep with query

SELECT DISTINCT t.type AS type FROM demo_data.house_sales AS t WHERE t.type = 'house'

The step is redundant, because initially query already contains filter by type. Will be good to skip this step.

StpMax avatar Nov 09 '23 15:11 StpMax