Skip to content

NodePartitioningManager code cleanup#10293

Merged
findepi merged 7 commits intotrinodb:masterfrom
findepi:findepi/maybe-cc
Dec 16, 2021
Merged

NodePartitioningManager code cleanup#10293
findepi merged 7 commits intotrinodb:masterfrom
findepi:findepi/maybe-cc

Conversation

@findepi
Copy link
Copy Markdown
Member

@findepi findepi commented Dec 14, 2021

No description provided.

It's already checked earlier in the method
Apparently most methods in the class call it `partitioningHandle`, so
let's be it.
Replace `Optional.get` with `Optional.orElseThrow` to avoid a warning.
Extract variable to maintain readability.
`ConnectorTransactionHandle` should be present.
ConnectorNodePartitioningProvider partitioningProvider = getPartitioningProvider(catalogName);
BucketFunction bucketFunction = partitioningProvider.getBucketFunction(
partitioningHandle.getTransactionHandle().orElse(null),
partitioningHandle.getTransactionHandle().orElseThrow(() -> new IllegalArgumentException("No transactionHandle for partitioning handle: " + partitioningHandle)),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why is transaction handle optional then? What is the case when it is not set? Worth a comment or more descriptive exception message?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think the empty transaction handle is for SystemPartitioningHandle (internal use)

@findepi findepi merged commit 8f1b333 into trinodb:master Dec 16, 2021
@findepi findepi deleted the findepi/maybe-cc branch December 16, 2021 08:55
@github-actions github-actions bot added this to the 367 milestone Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants