Skip to content

Conversation

@Mryange
Copy link
Contributor

@Mryange Mryange commented Oct 8, 2024

…avior (#38847)
#38847

Proposed changes

There are two issues here. First, the results of casting are inconsistent between FE and BE .

FE
mysql [(none)]>select cast('3.000' as int); 
+----------------------+
| cast('3.000' as INT) |
+----------------------+
|                    3 |
+----------------------+

mysql [(none)]>set debug_skip_fold_constant = true;

BE
mysql [(none)]>select cast('3.000' as int);
+----------------------+
| cast('3.000' as INT) |
+----------------------+
|                 NULL |
+----------------------+

The second issue is that casting on BE converts '3.0' to null. Here, the casting logic for FE and BE has been unified

Proposed changes

Issue Number: close #xxx

…avior (apache#38847)

## Proposed changes

There are two issues here. First, the results of casting are
inconsistent between FE and BE .
```
FE
mysql [(none)]>select cast('3.000' as int); 
+----------------------+
| cast('3.000' as INT) |
+----------------------+
|                    3 |
+----------------------+

mysql [(none)]>set debug_skip_fold_constant = true;

BE
mysql [(none)]>select cast('3.000' as int);
+----------------------+
| cast('3.000' as INT) |
+----------------------+
|                 NULL |
+----------------------+
```
The second issue is that casting on BE converts '3.0' to null. Here, the
casting logic for FE and BE has been unified

<!--Describe your changes.-->
@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@Mryange
Copy link
Contributor Author

Mryange commented Oct 8, 2024

run buildall

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@Mryange
Copy link
Contributor Author

Mryange commented Oct 8, 2024

run beut

@Mryange Mryange force-pushed the branch-2.1-pick-38847 branch from 4c337aa to cb9d8ba Compare October 8, 2024 12:42
@Mryange
Copy link
Contributor Author

Mryange commented Oct 8, 2024

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.10% (9342/25876)
Line Coverage: 27.67% (76740/277346)
Region Coverage: 26.46% (39405/148896)
Branch Coverage: 23.24% (20047/86246)
Coverage Report: http://coverage.selectdb-in.cc/coverage/cb9d8ba9b1398d5ecbe112571a695d838caf791e_cb9d8ba9b1398d5ecbe112571a695d838caf791e/report/index.html

@Mryange
Copy link
Contributor Author

Mryange commented Oct 8, 2024

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.09% (9339/25876)
Line Coverage: 27.65% (76686/277349)
Region Coverage: 26.45% (39384/148901)
Branch Coverage: 23.24% (20044/86250)
Coverage Report: http://coverage.selectdb-in.cc/coverage/cb9d8ba9b1398d5ecbe112571a695d838caf791e_cb9d8ba9b1398d5ecbe112571a695d838caf791e/report/index.html

@Mryange
Copy link
Contributor Author

Mryange commented Oct 8, 2024

run p0

val = val * 10 + digit;
} else {
if ((UNLIKELY(i == first || !is_all_whitespace(s + i, len - i)))) {
if ((UNLIKELY(i == first || (!is_all_whitespace(s + i, len - i) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

之前的代码对于 “3 ” 能转为3
这里好像对 “3.1 ” 就不能转为3了

@yiguolei yiguolei merged commit 6dddd4c into apache:branch-2.1 Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants