Skip to content

Commit

Permalink
limitoffsetstep contents int/fload instead of AST constant
Browse files Browse the repository at this point in the history
  • Loading branch information
ea-rus committed Nov 30, 2023
1 parent 144ba37 commit c4c54de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion mindsdb_sql/planner/query_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,9 @@ def plan_timeseries_predictor(self, query, table, predictor_namespace, predictor
raise PlanningException(
f'Can\'t provide ORDER BY to time series predictor, it will be taken from predictor settings. Found: {query.order_by}')

saved_limit = query.limit
saved_limit = None
if query.limit is not None:
saved_limit = query.limit.value

if query.group_by or query.having or query.offset:
raise PlanningException(f'Unsupported query to timeseries predictor: {str(query)}')
Expand Down
4 changes: 2 additions & 2 deletions tests/test_planner/test_ts_predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def test_join_predictor_timeseries_query_with_limit(self):
left=Identifier('result_1'),
join_type=JoinType.LEFT_JOIN)
),
LimitOffsetStep(dataframe=Result(3), limit=query.limit),
LimitOffsetStep(dataframe=Result(3), limit=query.limit.value),
ProjectStep(dataframe=Result(4), columns=[Star()]),
],
)
Expand Down Expand Up @@ -1308,7 +1308,7 @@ def test_several_groups(self):
),
LimitOffsetStep(step_num=4,
dataframe=Result(3),
limit=Constant(4)),
limit=4),
ProjectStep(dataframe=Result(4),
columns=[Identifier(parts=['tb', 'saledate'], alias=Identifier('date')),
Identifier(parts=['tb', 'MA'], alias=Identifier('forecast'))])
Expand Down

0 comments on commit c4c54de

Please sign in to comment.