apache / apache/shardingsphere

SQL-rewrite-test phone number createInputParameter error

Open
#31,001 1 comment 0 reactions 0 assignees View on GitHub
in: test type: bug
Dominant language
Java
Stars
20.8k
Forks
6.9k
Avg merge
11h 35m
Merged PRs (30d)
326

Description

## Bug Report

**For English only**, other languages will not accept.

Before report a bug, make sure you have:

- Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
- Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).

Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot reproduce it on current information, we will **close it**.

Please answer these questions before submitting your issue. Thanks!

### Which version of ShardingSphere did you use?

master

### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

ALL

### Expected behavior
SQL rewrite test ,insert phone number shoud regarded as a String;

### Actual behavior
SQL rewrite test ,insert phone number now regarded as a number;

### Reason analyze (If you can)

I am working for issue 30227 insert SQL.

- I want to insert data, a virtual phone number '15755557777';
- This data is encrypted by likeAlgorithm to '04844448888';
- When insert use mode 'with_columns_for_parameters',data '04844448888' is passed as an argument to method `SQLRewriteEngineTestParametersBuilder.createInputParameter`.
- In modthod,'04844448888' is treated as a number.
![image](https://github.com/apache/shardingsphere/assets/34822229/161519fe-fb53-4873-b437-59710a36ac1c)

- Because it is too long and begin with '0','04844448888'is regarded as a base-8 number.
- But it incloud number 8,exception throw from this: `java.lang.NumberFormatException: For input string: "4844448888" under radix 8`
-
![image](https://github.com/apache/shardingsphere/assets/34822229/c70265a7-a827-4651-9414-ee23c94d0443)

- I change this data to '13211112222',encrypt to '04100001111'
![image](https://github.com/apache/shardingsphere/assets/34822229/a3981b36-550d-4a7c-9d7b-f5676d7ae468)
image

### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

### Example codes for reproduce this issue (such as a github link).

-https://github.com/zzyReal666/shardingsphere.git
-branch : issue-30227

Contributor guide

Open the contributing guide

Research direction

Start with SQLRewriteEngineTestParametersBuilder.createInputParameter and the SQL rewrite test on the issue-30227 branch. Reproduce the phone-number input beginning with 0, then verify that the rewritten value is treated as a String and no NumberFormatException occurs.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.