4paradigm / 4paradigm/OpenMLDB

Support SQL syntax of limit with parameter

Open
#3,179 1 comment 0 reactions 1 assignee Claimed by @aceforeverd View on GitHub
execute-engine
Dominant language
C++
Stars
1.7k
Forks
331
Avg merge
12d 12h
Merged PRs (30d)
1

Description

Now we are using Python SDK and get this error.

```
[SQL: SELECT employees.name, employees.age
FROM employees
LIMIT ?]
[parameters: (1,)]
```

```
SQLQuery:W0331 15:00:52.237329 1441265280 sql_compiler.cc:329] Fail create sql plan: Un-support LIMIT with expression type LimitOffset
(At /Users/tobe/code/4pd/OpenMLDB/hybridse/src/planv2/planner_v2.cc:40)
(At /Users/tobe/code/4pd/OpenMLDB/hybridse/src/planv2/ast_node_converter.cc:1811)
(At /Users/tobe/code/4pd/OpenMLDB/hybridse/src/planv2/ast_node_converter.cc:536)
(At /Users/tobe/code/4pd/OpenMLDB/hybridse/src/planv2/ast_node_converter.cc:1243)
(At /Users/tobe/code/4pd/OpenMLDB/hybridse/src/planv2/ast_node_converter.cc:1215)
(Caused by) Un-support LIMIT with expression type LimitOffset
W0331 15:00:52.237375 1441265280 sql_cluster_router.cc:1053] Status: [1002] fail to explain SELECT employees.name, employees.age
FROM employees
LIMIT ?--Un-support LIMIT with expression type LimitOffset
```

Contributor guide

Open the contributing guide

Research direction

The error originates in hybridse/src/planv2/ast_node_converter.cc and sql_compiler.cc, indicating unsupported LIMIT with parameter expression. Start by examining the SQL parser and planner code to understand how LIMIT clauses are currently handled. Look for where LimitOffset expressions are processed and extend support for parameterized limits. Testing involves running SQL queries with parameterized LIMIT through the Python SDK to verify the fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sql
Domain
backend, databases, machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.