Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the type check when inserting geography value #5460

Merged
merged 3 commits into from
Mar 30, 2023

Conversation

jievince
Copy link
Contributor

@jievince jievince commented Mar 30, 2023

What type of PR is this?

  • bug
  • feature
  • enhancement

What problem(s) does this PR solve?

Issue(s) number:

Fix #5459

Description:

When inserting, the geography value is converted to a WKB string format. However, it is not possible to differentiate whether a string being inserted into a property of geography type is in fact a WKB string or just an ordinary string.

So I add an argument isWKB to distinguish it:

WriteResult RowWriterV2::write(ssize_t index, folly::StringPiece v, bool isWKB)

How do you solve it?

Special notes for your reviewer, ex. impact of this fix, design document, etc:

Checklist:

Tests:

  • Unit test(positive and negative cases)
  • Function test
  • Performance test
  • N/A

Affects:

  • Documentation affected (Please add the label if documentation needs to be modified.)
  • Incompatibility (If it breaks the compatibility, please describe it and add the label.)
  • If it's needed to cherry-pick (If cherry-pick to some branches is required, please label the destination version(s).)
  • Performance impacted: Consumes more CPU/Memory

Release notes:

Please confirm whether to be reflected in release notes and how to describe:

ex. Fixed the bug .....

@jievince jievince added the ready-for-testing PR: ready for the CI test label Mar 30, 2023
@@ -254,7 +254,7 @@ class RowWriterV2 {
WriteResult write(ssize_t index, uint64_t v);

WriteResult write(ssize_t index, const std::string& v);
WriteResult write(ssize_t index, folly::StringPiece v);
WriteResult write(ssize_t index, folly::StringPiece v, bool isWKB = false);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you could add a new structure like struct WKB {folly::StringPiece}.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I want to reuse the code of write(ssize_t index, folly::StringPiece v)

@xtcyclist xtcyclist merged commit 2cf81d1 into vesoft-inc:master Mar 30, 2023
@jievince jievince deleted the fix-geo-insert-check branch March 30, 2023 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-testing PR: ready for the CI test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

geo type insert illegal data success,but query report error
5 participants