-
Notifications
You must be signed in to change notification settings - Fork 151
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
Add getSchema() to SourceClient interface #294
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ | |
|
||
import io.onetable.model.*; | ||
import io.onetable.model.CommitsBacklog; | ||
import io.onetable.model.schema.OneSchema; | ||
import io.onetable.model.schema.SchemaCatalog; | ||
|
||
/** | ||
|
@@ -48,6 +49,14 @@ public interface SourceClient<COMMIT> extends Closeable { | |
*/ | ||
SchemaCatalog getSchemaCatalog(OneTable table, COMMIT commit); | ||
|
||
/** | ||
* Extracts the {@link OneSchema} as of the latest state. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method requires a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @the-other-tim-brown, could you please confirm this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's correct There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, for the point-in-time schema, we would need the commit/snapshot param. I will make the changes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @coded9 the changes required for this are quite straightforward. You can copy the implementation for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually wonder if this getSchema method is even required when the schema itself is already present in the OneTable object. |
||
* | ||
* @param table the current state of the table | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment might require an update, depending on Tim's response. |
||
* @return | ||
*/ | ||
OneSchema getSchema(OneTable table); | ||
|
||
/** | ||
* Extracts the {@link OneSnapshot} as of latest state. | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ | |
import io.onetable.exception.OneIOException; | ||
import io.onetable.model.*; | ||
import io.onetable.model.CommitsBacklog; | ||
import io.onetable.model.schema.OneSchema; | ||
import io.onetable.model.schema.SchemaCatalog; | ||
import io.onetable.spi.extractor.SourceClient; | ||
|
||
|
@@ -82,6 +83,11 @@ public SchemaCatalog getSchemaCatalog(OneTable table, HoodieInstant commit) { | |
return HudiSchemaCatalogExtractor.catalogWithTableSchema(table); | ||
} | ||
|
||
@Override | ||
public OneSchema getSchema(OneTable table) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add unit tests for Hudi and Delta sources also. |
||
return table.getReadSchema(); | ||
} | ||
|
||
@Override | ||
public OneSnapshot getCurrentSnapshot() { | ||
HoodieActiveTimeline activeTimeline = metaClient.getActiveTimeline(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we can eliminate the
SchemaCatalog
class with this change?It was one of the objectives of #77