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

[Kernel] [CC Refactor #1] Add TableIdentifier API #3795

Merged
merged 9 commits into from
Nov 1, 2024

Conversation

scottsand-db
Copy link
Collaborator

@scottsand-db scottsand-db commented Oct 22, 2024

Which Delta project/connector is this regarding?

  • Spark
  • Standalone
  • Flink
  • Kernel
  • Other (fill in here)

Description

  • adds a new TableIdentifier class, that kernel will pass on to Commit Coordinator Client
  • adds a new Table::forPathWithTableId(engine, path, tableId) interface
  • the tableId is stored as an Optional in the Table, and this PR does not propagate that value into SnapshotManager, Snapshot, etc. Future PRs can take care of that.

How was this patch tested?

TableIdentifier UTs

Does this PR introduce any user-facing changes?

Yes. See the above.

@scottsand-db scottsand-db self-assigned this Oct 22, 2024
@@ -269,6 +290,22 @@ public long getVersionAtOrAfterTimestamp(Engine engine, long millisSinceEpochUTC
}
}

////////////////////
// Protected APIs //
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

protected APIs should be below public APIs

this.tablePath = tablePath;
final Path dataPath = new Path(tablePath);
final Path logPath = new Path(dataPath, "_delta_log");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we were duplicating this Path creation in the getDataPath and getLogPath methods. might as well just save them as instance variables.

@@ -169,8 +199,7 @@ public CloseableIterator<ColumnarBatch> getChanges(
for (int rowId = 0; rowId < protocolVector.getSize(); rowId++) {
if (!protocolVector.isNullAt(rowId)) {
Protocol protocol = Protocol.fromColumnVector(protocolVector, rowId);
TableFeatures.validateReadSupportedTable(
protocol, getDataPath().toString(), Optional.empty());
TableFeatures.validateReadSupportedTable(protocol, tablePath, Optional.empty());
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

getDataPath().toString is the same as tablePath

* @return the table identifier, or {@link Optional#empty()} if none is set.
* @since 3.3.0
*/
Optional<TableIdentifier> getTableIdentifier(Engine engine);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought we wanted to remove the Engine as arg to APIs going forward.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup! We do. We should do that in one final pass. Until then, I'm going to stick with the current convention.

Copy link
Collaborator

@vkorukanti vkorukanti left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@allisonport-db allisonport-db left a comment

Choose a reason for hiding this comment

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

LGTM but please add java docs

@scottsand-db scottsand-db merged commit 024dadb into delta-io:master Nov 1, 2024
19 checks passed
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.

6 participants