Skip to content

Core: Address Anton's comments from the PR 4744 (incremental append scan impl)#4886

Merged
aokolnychyi merged 3 commits intoapache:masterfrom
stevenzwu:incrementAppendScanFollowup
Jun 1, 2022
Merged

Core: Address Anton's comments from the PR 4744 (incremental append scan impl)#4886
aokolnychyi merged 3 commits intoapache:masterfrom
stevenzwu:incrementAppendScanFollowup

Conversation

@stevenzwu
Copy link
Contributor

No description provided.

@stevenzwu
Copy link
Contributor Author

@aokolnychyi

For the boolean flag comment, do you think a builder class for IncrementalScanEvent would be better?

For the helper methods comment, I feel we are adding a bunch of methods without making the code much simpler.

For the schema evolution comment, I think it is outside the scope of streaming source.

return TableScanUtil.planTasks(splitFiles, targetSplitSize(), splitLookback(), splitOpenFileCost());
}

private long toSnapshotIdExclusive() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't toSnapshotId always inclusive, not exclusive?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch. I meant inclusive. somehow typed exclusive

// by finding the oldest ancestor of end snapshot.
Long fromSnapshotIdExclusive = context().fromSnapshotId();
if (context().fromSnapshotId() != null) {
Long fromSnapshotIdExclusive = fromSnapshotId;
Copy link
Contributor

Choose a reason for hiding this comment

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

If fromSnapshotId may be inclusive, then it should never be assigned to fromSnapshotIdExclusive without first checking. Otherwise, there is temporarily a value for fromSnapshotIdExclusive that is incorrect. If you have a guarantee in the variable name, you should never violate that guarantee because someone might not know about it later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point. will update

protected abstract T newRefinedScan(
TableOperations newOps, Table newTable, Schema newSchema, TableScanContext newContext);
protected abstract T newRefinedScan(TableOperations newOps, Table newTable, Schema newSchema,
TableScanContext newContext);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think these reformatting changes are worth it, since the alternative is already in master.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok. will revert

* @return null if there is no current snapshot in the table, else the oldest Snapshot.
*/
public static Snapshot oldestAncestor(long snapshotId, Function<Long, Snapshot> lookup) {
public static Snapshot oldestAncestorOf(long snapshotId, Function<Long, Snapshot> lookup) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Didn't this exist before the other commit? If this has been released, I doubt it is a good idea to rename it just to add "Of".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was added by the other PR #4744 (incremental append scan impl) that just merged. It is not released and should be safe to rename

Copy link
Contributor

Choose a reason for hiding this comment

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

It was just added and hasn't been released. All other methods in this class follow this name pattern.

@stevenzwu stevenzwu closed this May 30, 2022
@stevenzwu stevenzwu reopened this May 30, 2022
@stevenzwu stevenzwu changed the title Address Anton's comments from the PR 4744 (incremental append scan impl) Core: Address Anton's comments from the PR 4744 (incremental append scan impl) May 30, 2022
Copy link
Contributor

@aokolnychyi aokolnychyi left a comment

Choose a reason for hiding this comment

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

Thanks, @stevenzwu! I had one question in TableScanContext but looks good to me otherwise.

TableScanContext fromSnapshotIdExclusive(long id) {
return new TableScanContext(snapshotId, rowFilter, ignoreResiduals,
caseSensitive, colStats, projectedSchema, selectedColumns, options, id, toSnapshotId,
planExecutor, fromSnapshotInclusive);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I think we should probably pass false explicitly instead of using fromSnapshotInclusive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree. explicit false is more clear.

* @return null if there is no current snapshot in the table, else the oldest Snapshot.
*/
public static Snapshot oldestAncestor(long snapshotId, Function<Long, Snapshot> lookup) {
public static Snapshot oldestAncestorOf(long snapshotId, Function<Long, Snapshot> lookup) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It was just added and hasn't been released. All other methods in this class follow this name pattern.

@aokolnychyi aokolnychyi merged commit 9ab94f8 into apache:master Jun 1, 2022
@aokolnychyi
Copy link
Contributor

Thanks, @stevenzwu!

@stevenzwu stevenzwu deleted the incrementAppendScanFollowup branch July 26, 2022 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants