Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter to model in data join model #327

Merged
merged 4 commits into from
Nov 30, 2023
Merged

Filter to model in data join model #327

merged 4 commits into from
Nov 30, 2023

Conversation

ea-rus
Copy link
Contributor

@ea-rus ea-rus commented Nov 16, 2023

If table join model query, if condition is related to model:

  • it converts to transfers to data for model input
  • also this condition excludes from whereStep (replaced to 0=0)

Here days_on_market=1 will be input to model:

SELECT location
FROM example_db.demo_data.home_rentals as t 
JOIN mindsdb.home_rentals_model as m
where m.days_on_market= 1

Support subselects

SELECT location
FROM example_db.demo_data.home_rentals as t 
JOIN mindsdb.home_rentals_model as m
where m.days_on_market= (select days_on_market from example_db.demo_data.home_rentals where id=1)

Fix LimitOffsetStep

…so these conditions excludes from whereStep (replaced to 0=0)
Copy link

github-actions bot commented Nov 16, 2023

Coverage

Coverage Report
FileStmtsMissCoverMissing
mindsdb_sql
   __about__.py10100%1–10
   __init__.py24196%21
mindsdb_sql/parser
   lexer.py166199%244
   logger.py19479%14, 17, 23, 26
   parser.py4562195%92, 121–128, 182, 199, 317, 346–347, 367, 378, 491, 526, 557, 567, 581, 657
   utils.py46491%73–79
mindsdb_sql/parser/ast
   base.py36489%13, 28, 31, 51
   create.py601673%7–8, 49–54, 73–85
   drop.py52296%10, 13
   insert.py62592%32, 35–37, 42
   show.py48198%18
   update.py53591%40–42, 75–76
mindsdb_sql/parser/ast/select
   case.py26292%19, 22
   constant.py42198%21
   data.py11282%15, 19
   identifier.py64789%43, 80–85
   operation.py113695%27–30, 56, 65, 166
   parameter.py11191%10
   select.py97397%148–153
   star.py12283%8–9
mindsdb_sql/parser/dialects/mindsdb
   create_file.py19195%14
   create_predictor.py88199%54
   knowledge_base.py38197%71
   parser.py9082797%118, 123, 253, 277, 287, 349, 351, 443, 455, 587, 604, 628–629, 755, 805, 854, 871, 1003, 1013, 1051–1052, 1077, 1088, 1228, 1232, 1286, 1689
mindsdb_sql/parser/dialects/mysql
   lexer.py23674%16, 18, 20, 32, 34, 36
   parser.py6111697%116, 118, 210, 222, 341, 358, 486, 496, 534–535, 555, 566, 695, 751, 895, 1041
   show_index.py171135%10–12, 15–23, 26–27
mindsdb_sql/planner
   query_plan.py22864%13–21, 30
   query_planner.py7315093%47–48, 71–72, 81, 158, 371, 428, 505, 509, 517, 580–588, 638, 722, 761, 770, 803, 808, 840, 853, 855, 884, 888, 918–935, 953–954, 999, 1006, 1029–1030, 1066, 1141, 1168, 1194, 1259, 1306, 1331–1333
   query_prepare.py2846179%76, 78, 86–116, 227, 249, 272, 315, 336, 360, 389–443, 446–452, 483, 496–498, 507, 526
   step_result.py14286%7, 12
   steps.py169398%14, 19, 27
   ts_utils.py50296%58, 60
   utils.py2423187%60, 83–86, 124, 142, 154, 166, 169, 181, 211, 224, 239, 245, 250, 257, 259, 264, 269–272, 277, 282, 288, 294, 308, 338–339, 350–351
mindsdb_sql/render
   sqlalchemy_render.py3665286%38, 72, 74, 86, 91, 163–164, 177–178, 202, 232, 234, 263, 275, 281, 332, 396, 444, 459, 469–470, 494–505, 524, 547–571, 582–583, 588–589, 600–603, 623–626
TOTAL601937094% 

Tests Skipped Failures Errors Time
679 1 💤 0 ❌ 0 🔥 16.721s ⏱️

@ea-rus ea-rus marked this pull request as ready for review November 30, 2023 15:53
@ea-rus ea-rus merged commit c1876c3 into staging Nov 30, 2023
10 checks passed
@ea-rus ea-rus mentioned this pull request Nov 30, 2023
@ea-rus ea-rus deleted the model-filter branch October 31, 2024 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant