apache / apache/shardingsphere

Support federated query mysql bit_length function

Open
#31,898 0 comments 0 reactions 0 assignees View on GitHub
feature: SQL federation type: enhancement
Dominant language
Java
Stars
20.8k
Forks
6.9k
Avg merge
11h 35m
Merged PRs (30d)
326

Description

# Background

Hi Community,

Federated queries help users perform cross-database join queries, subqueries, and aggregate queries. Currently, we plan to enhance MySQL functions in the federated query environment to support more SQL execution scenarios in federated query contexts.

For more details, please refer to: [Apache ShardingSphere Documentation on SQL Federation](https://shardingsphere.apache.org/document/current/cn/features/sql-federation/).

Ref: https://dev.mysql.com/doc/refman/8.4/en/string-functions.html#function_bit-length

# Task

- [ ] `select bit_length('\n\t\r\b\0\_\%\\');`

Run log:
```
expected:
+----------------------------------+
| bit_length('\n\t\r\b\0\_\%\\') |
+==================================+
| 80 |
+----------------------------------+

actual:
SQL federation does not support SQL 'select bit_length('\\n\\t\\r\\b\\0\\_\\%\\\\');\n'.\nMore details: At line 0, column 0: No match found for function signature bit_length()
```

- [ ] TODO Test cases for nested function calls

Contributor guide

Open the contributing guide

Research direction

Use the provided SELECT bit_length('\n\t\r\b\0\_\%\\') as the reproduction case and start by tracing MySQL function support in SQL federation. Add support for the bit_length query, then add the requested nested-function test cases and verify the result is 80 rather than an unsupported-function error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, mysql, sql
Domain
databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.