Skip to content

Conversation

@github-actions
Copy link
Contributor

Cherry-picked from #46661

…ng (#46661)

### What problem does this PR solve?

Issue Number: close #46619

Root Cause:
```
1. Unnecessary floating-point number conversions in coordinate handling:
   1.1 converting double to string using absl::StrFormat
   1.2 converting string back to double using std::stod
each conversion caused precision loss.

2. Byte order handling issue in WKB parsing:
    2.1 using machine endian before properly reading WKB byte order flag
    2.2 this caused incorrect interpretation of coordinate values
```

Solution:
```
1. Remove unnecessary coordinate value conversions:
    1.1 directly use S2LatLng's degrees() value without string formatting
    1.2 increase output precision in print_s2point to 15 digits

2. Fix WKB byte order handling:
    2.1 read byte order flag first
    2.2 set correct byte order before parsing coordinates
```

Result:
 before:
 ```
 POINT (1.461652102e-231 3.34424828009e-59)
 ```
 after:
 ```
 POINT(117.194767000297 36.46326301008)
 ```
@Thearas
Copy link
Contributor

Thearas commented Jan 21, 2025

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

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@dataroaring dataroaring reopened this Jan 21, 2025
@Thearas
Copy link
Contributor

Thearas commented Jan 21, 2025

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.42% (9570/26277)
Line Coverage: 27.99% (79069/282506)
Region Coverage: 26.63% (40507/152110)
Branch Coverage: 23.38% (20527/87796)
Coverage Report: http://coverage.selectdb-in.cc/coverage/0b11e76372017267fe6056210b521c5434107b6a_0b11e76372017267fe6056210b521c5434107b6a/report/index.html

@felixwluo
Copy link
Contributor

run p0

@felixwluo
Copy link
Contributor

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.42% (9569/26277)
Line Coverage: 27.98% (79058/282506)
Region Coverage: 26.63% (40502/152110)
Branch Coverage: 23.38% (20527/87796)
Coverage Report: http://coverage.selectdb-in.cc/coverage/970fb28d2ae75c781b1afb192750bfd25db16299_970fb28d2ae75c781b1afb192750bfd25db16299/report/index.html

@yiguolei yiguolei merged commit 3b7cc67 into branch-2.1 Jan 24, 2025
20 of 23 checks passed
@github-actions github-actions bot deleted the auto-pick-46661-branch-2.1 branch January 24, 2025 09:34
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.

5 participants