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

[Draft] Persistence Component: Separating out Partitioning from Unitemporal Snapshot milestoning #3317

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

rengam32
Copy link
Contributor

What type of PR is this?

Improvement

What does this PR do / why is it needed ?

Introducing new interfaces for Partitioning and abstracting it out from Unitemporal Snapshot milestoning.

Which issue(s) this PR fixes:

None

Other notes for reviewers:

Does this PR introduce a user-facing change?

No

@rengam32 rengam32 requested a review from a team as a code owner December 22, 2024 13:35
Copy link

github-actions bot commented Dec 22, 2024

Test Results

0 files  0 suites   0s ⏱️
0 tests 0 ✔️ 0 💤 0

Results for commit c0bc489.

♻️ This comment has been updated with latest results.

@rengam32 rengam32 changed the title Persistence Component: Separating out Partitioning from Unitemporal Snapshot milestoning [Draft] Persistence Component: Separating out Partitioning from Unitemporal Snapshot milestoning Dec 23, 2024

List<Condition> whereClauseForPartition = new ArrayList<>((Arrays.asList(openRecordCondition, notExistsWhereClause)));
if (!(partitioning.isPresent() && partitioning.get().deleteStrategy() == DeleteStrategy.DELETE_ALL))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

refactor to interfaces instead of enum?

Comment on lines +116 to +121
if (unitemporalSnapshot.digestField().isPresent())
{
return Optional.of(unitemporalSnapshot
.digestField().get());
}
return Optional.empty();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (unitemporalSnapshot.digestField().isPresent())
{
return Optional.of(unitemporalSnapshot
.digestField().get());
}
return Optional.empty();
return unitemporalSnapshot.digestField();

Copy link
Contributor

Choose a reason for hiding this comment

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

fixed this in my branch

Comment on lines +127 to +132
if (unitemporalDelta.digestField().isPresent())
{
return Optional.of(unitemporalDelta
.digestField().get());
}
return Optional.empty();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (unitemporalDelta.digestField().isPresent())
{
return Optional.of(unitemporalDelta
.digestField().get());
}
return Optional.empty();
return unitemporalDelta.digestField();

Copy link
Contributor

Choose a reason for hiding this comment

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

fixed this in my branch

Comment on lines +138 to +143
if (bitemporalSnapshot.digestField().isPresent())
{
return Optional.of(bitemporalSnapshot
.digestField().get());
}
return Optional.empty();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (bitemporalSnapshot.digestField().isPresent())
{
return Optional.of(bitemporalSnapshot
.digestField().get());
}
return Optional.empty();
return bitemporalSnapshot.digestField();

Copy link
Contributor

Choose a reason for hiding this comment

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

fixed this in my branch

Comment on lines +149 to +154
if (bitemporalDelta.digestField().isPresent())
{
return Optional.of(bitemporalDelta
.digestField().get());
}
return Optional.empty();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (bitemporalDelta.digestField().isPresent())
{
return Optional.of(bitemporalDelta
.digestField().get());
}
return Optional.empty();
return bitemporalDelta.digestField();

Copy link
Contributor

Choose a reason for hiding this comment

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

fixed this in my branch

Comment on lines +29 to +33
@Value.Default
default boolean failOnDuplicatePrimaryKeys()
{
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason for adding this? failOnDuplicatePrimaryKeys is a concept under NoVersioning, which seems independent of partitioning

Copy link
Contributor

Choose a reason for hiding this comment

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

removed this in my branch

Comment on lines +94 to +97
if (digestField.isPresent())
{
remainingCols = Arrays.asList(digestField.get());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

we need to have an else block to actually return the remaining columns (i.e. data columns)

Copy link
Contributor

Choose a reason for hiding this comment

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

fixed this in my branch

.condition(And.of(whereClauseForNotInSink))
.addFields(FieldValue.builder().datasetRef(mainDataset().datasetReference()).fieldName(ingestMode().digestField()).build())
.build()));
FieldValue.builder().datasetRef(stagingDataset().datasetReference()).fieldName(ingestMode().digestField().get()).build(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use .orElseThrow in these places

Copy link
Contributor

Choose a reason for hiding this comment

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

fixed this in my branch

Selection.builder()
.source(mainDataset())
.condition(And.of(whereClauseForNotInSink))
.addFields(FieldValue.builder().datasetRef(mainDataset().datasetReference()).fieldName(ingestMode().digestField().get()).build())
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use .orElseThrow in these places

Copy link
Contributor

Choose a reason for hiding this comment

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

fixed this in my branch

if (digestField.isPresent())
{
this.digestMatchCondition = LogicalPlanUtils.getDigestMatchCondition(mainDataset(), stagingDataset(), transactionMilestoned.digestField().get());
this.primaryKeysMatchCondition = LogicalPlanUtils.getPrimaryKeyMatchCondition(mainDataset(), stagingDataset(), primaryKeys.toArray(new String[0]));
Copy link
Contributor

Choose a reason for hiding this comment

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

Suppose this is a mistake? primaryKeysMatchCondition should be initialized with or without digest - correcting this in my branch

Comment on lines +94 to +97
if (digestField.isPresent())
{
remainingCols = Arrays.asList(digestField.get());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

fixed this in my branch

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