@ThreadSafe public class TableSchemaResolver extends Object
| Modifier and Type | Field and Description |
|---|---|
protected HoodieTableMetaClient |
metaClient |
| Constructor and Description |
|---|
TableSchemaResolver(HoodieTableMetaClient metaClient) |
| Modifier and Type | Method and Description |
|---|---|
static org.apache.avro.Schema |
appendPartitionColumns(org.apache.avro.Schema dataSchema,
Option<String[]> partitionFields) |
org.apache.avro.Schema |
getTableAvroSchema()
Gets full schema (user + metadata) for a hoodie table in Avro format.
|
org.apache.avro.Schema |
getTableAvroSchema(boolean includeMetadataFields)
Gets schema for a hoodie table in Avro format, can choice if include metadata fields.
|
org.apache.avro.Schema |
getTableAvroSchema(HoodieInstant instant,
boolean includeMetadataFields)
Fetches tables schema in Avro format as of the given instant
|
org.apache.avro.Schema |
getTableAvroSchema(String timestamp)
Fetches tables schema in Avro format as of the given instant
|
org.apache.avro.Schema |
getTableAvroSchemaFromDataFile() |
Option<org.apache.avro.Schema> |
getTableAvroSchemaFromLatestCommit(boolean includeMetadataFields)
Returns table's latest Avro
Schema iff table is non-empty (ie there's at least
a single commit)
This method differs from getTableAvroSchema(boolean) in that it won't fallback
to use table's schema used at creation |
Option<org.apache.avro.Schema> |
getTableAvroSchemaIfPresent(boolean includeMetadataFields) |
org.apache.avro.Schema |
getTableAvroSchemaWithoutMetadataFields()
Deprecated.
use
getTableAvroSchema(boolean) instead |
Option<String> |
getTableHistorySchemaStrFromCommitMetadata()
Gets the history schemas as String for a hoodie table from the HoodieCommitMetadata of the instant.
|
Option<InternalSchema> |
getTableInternalSchemaFromCommitMetadata()
Gets the InternalSchema for a hoodie table from the HoodieCommitMetadata of the instant.
|
Option<InternalSchema> |
getTableInternalSchemaFromCommitMetadata(String timestamp)
Gets the InternalSchema for a hoodie table from the HoodieCommitMetadata of the instant.
|
boolean |
hasOperationField()
NOTE: This method could only be used in tests
|
org.apache.avro.Schema |
readSchemaFromLastCompaction(Option<HoodieInstant> lastCompactionCommitOpt)
Deprecated.
please use
getTableAvroSchema(HoodieInstant, boolean) instead |
static org.apache.avro.Schema |
readSchemaFromLogFile(HoodieStorage storage,
StoragePath path)
Read the schema from the log file on path.
|
protected final HoodieTableMetaClient metaClient
public TableSchemaResolver(HoodieTableMetaClient metaClient)
public org.apache.avro.Schema getTableAvroSchemaFromDataFile()
throws Exception
Exceptionpublic org.apache.avro.Schema getTableAvroSchema()
throws Exception
Exceptionpublic org.apache.avro.Schema getTableAvroSchema(boolean includeMetadataFields)
throws Exception
includeMetadataFields - choice if include metadata fieldsExceptionpublic org.apache.avro.Schema getTableAvroSchema(String timestamp) throws Exception
timestamp - as of which table's schema will be fetchedExceptionpublic org.apache.avro.Schema getTableAvroSchema(HoodieInstant instant, boolean includeMetadataFields) throws Exception
instant - as of which table's schema will be fetchedException@Deprecated public org.apache.avro.Schema getTableAvroSchemaWithoutMetadataFields() throws Exception
getTableAvroSchema(boolean) insteadExceptionpublic Option<org.apache.avro.Schema> getTableAvroSchemaIfPresent(boolean includeMetadataFields)
public Option<org.apache.avro.Schema> getTableAvroSchemaFromLatestCommit(boolean includeMetadataFields) throws Exception
Schema iff table is non-empty (ie there's at least
a single commit)
This method differs from getTableAvroSchema(boolean) in that it won't fallback
to use table's schema used at creationExceptionpublic org.apache.avro.Schema readSchemaFromLastCompaction(Option<HoodieInstant> lastCompactionCommitOpt) throws Exception
getTableAvroSchema(HoodieInstant, boolean) insteadExceptionpublic static org.apache.avro.Schema readSchemaFromLogFile(HoodieStorage storage, StoragePath path) throws IOException
IOExceptionpublic Option<InternalSchema> getTableInternalSchemaFromCommitMetadata()
public Option<InternalSchema> getTableInternalSchemaFromCommitMetadata(String timestamp)
public Option<String> getTableHistorySchemaStrFromCommitMetadata()
public boolean hasOperationField()
Copyright © 2024 The Apache Software Foundation. All rights reserved.