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

Fix generate_random_uuid bug #2941

Merged
merged 1 commit into from
Feb 25, 2024
Merged

Fix generate_random_uuid bug #2941

merged 1 commit into from
Feb 25, 2024

Conversation

andyfengHKU
Copy link
Contributor

generate_random_uuid is a random function so we need to generate a new random value for each tuple. In such case, we cannot apply factorization technique to reduce duplicate intermediate result.

Our solution is to fall back to tuple at a time evaluation for random function.

Copy link

codecov bot commented Feb 24, 2024

Codecov Report

Attention: Patch coverage is 93.93939% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 93.50%. Comparing base (f2619d5) to head (53e0d25).

Files Patch % Lines
src/include/function/pointer_function_executor.h 50.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2941   +/-   ##
=======================================
  Coverage   93.50%   93.50%           
=======================================
  Files        1121     1121           
  Lines       42859    42881   +22     
=======================================
+ Hits        40075    40096   +21     
- Misses       2784     2785    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@acquamarin acquamarin left a comment

Choose a reason for hiding this comment

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

Can you update the GenRandomUUID operation as well?

struct GenRandomUUID {
    static void operation(common::ku_uuid_t& input, void* dataPtr) {
        input = common::UUID::generateRandomUUID(
            reinterpret_cast<main::ClientContext*>(dataPtr)->getRandomEngine());
    }
};

And executor:

     template<typename RESULT_TYPE, typename OP>
     static void execute(common::ValueVector& result, void* dataPtr) {
+        if (result.state->selVector->isUnfiltered()) {
+            for (auto i = 0u; i < result.state->selVector->selectedSize; i++) {
+                OP::operation(result.getValue<RESULT_TYPE>(i), dataPtr);
+            }
+        } else {
+            for (auto i = 0u; i < result.state->selVector->selectedSize; i++) {
+                auto pos = result.state->selVector->selectedPositions[i];
+                OP::operation(result.getValue<RESULT_TYPE>(pos), dataPtr);
+            }
+        }
     }

@andyfengHKU andyfengHKU merged commit 1ce0728 into master Feb 25, 2024
15 checks passed
@andyfengHKU andyfengHKU deleted the fix-uuid-bug branch February 25, 2024 04: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.

2 participants