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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: extend int128 to numeric interface #381

Closed
wants to merge 1 commit into from

Conversation

jiaqizho
Copy link
Contributor

fix #ISSUE_Number


Change logs

CBDB not allow building pg numeric from other formats. Numeric objects can only be constructed from string, which means that the caller needs to convert its own data into a specific format string, then convert the string into numeric. This is a very inefficient method.

Current change provider a new method int128_to_numeric which used to build a numeric from int128. Also, current method allow build special numeric or build numeric with scale.

Why are the changes needed?

Allow caller build numeric from int128

Does this PR introduce any user-facing change?

nope

How was this patch tested?

ci

Contributor's Checklist

Here are some reminders and checklists before/when submitting your pull request, please check them:

  • Make sure your Pull Request has a clear title and commit message. You can take git-commit template as a reference.
  • Sign the Contributor License Agreement as prompted for your first-time contribution(One-time setup).
  • Learn the coding contribution guide, including our code conventions, workflow and more.
  • List your communication in the GitHub Issues or Discussions (if has or needed).
  • Document changes.
  • Add tests for the change
  • Pass make installcheck
  • Pass make -C src/test installcheck-cbdb-parallel
  • Feel free to request cloudberrydb/dev team for review and approval when your PR is ready馃コ

@@ -4423,6 +4424,41 @@ int64_to_numeric(int64 val)
return res;
}

#ifdef HAVE_INT128
Numeric
int128_to_numeric(int128 val, int scale, bool neg,
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to change in numeric.c?

@jiaqizho
Copy link
Contributor Author

after #392 , no need current change any more.

@jiaqizho jiaqizho closed this Mar 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.

None yet

2 participants