SQLServerFunctionOption wrongly lists Oracle ROWNUM pseudo-columns as unparenthesized functions
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
Research direction
Start in database/connector/dialect/sqlserver/.../metadata/database/option/SQLServerFunctionOption.java around getUnparenthesizedFunctionNames() and review the TODO on line 31. Check how ColumnSegmentBinder.isUnparenthesizedFunction() consumes this set, then reproduce with SELECT ROWNUM FROM t against a SQL Server table containing a ROWNUM column. Done means the identifier binds to table t rather than being treated as a niladic function.
Written by the indexing model from the issue text.
Description
Bug Report
Which version of ShardingSphere did you use?
master @ a14fa59423c
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
Both (kernel-level SQL binder)
Expected behavior
On SQL Server, a real column named ROWNUM (or ROWNUM_, ROW_NUMBER) is bound as a column so it resolves to its owner table.
Actual behavior
ColumnSegmentBinder.isUnparenthesizedFunction() treats such an identifier as a niladic function and skips column binding, producing wrong bind output.
Reason analyze (If you can)
SQLServerFunctionOption.getUnparenthesizedFunctionNames() (database/connector/dialect/sqlserver/.../metadata/database/option/SQLServerFunctionOption.java line 32) lists ROWNUM, ROWNUM_, ROW_NUMBER. These are Oracle pseudo-columns; SQL Server has no ROWNUM/ROWNUM_, and ROW_NUMBER always requires () + OVER. Only Oracle among the sibling dialects legitimately keeps them. A maintainer TODO on line 31 already flagged their removal. The set is consumed by ColumnSegmentBinder.isUnparenthesizedFunction() (infra/binder/core/.../expression/type/ColumnSegmentBinder.java line 141-143), which skips binding for any identifier in the set.
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
Bind SELECT ROWNUM FROM t against a SQL Server table t having a ROWNUM column; the column is not bound to t.
Example codes for reproduce this issue (such as a github link).
N/A
- Dominant language
- Java
- Stars
- 20.8k
- Forks
- 6.9k
- Avg merge
- 8h 5m
- Merged PRs (30d)
- 316
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/shardingsphere
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
apache/shardingsphere#39872 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/shardingsphere#39861 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/shardingsphere#39859 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
apache/shardingsphere#39857 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
apache/shardingsphere#39852 ·
All issues in apache/shardingsphere
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100