DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
| ID | IEP-127 | ||||||||
| Author | |||||||||
| Sponsor | |||||||||
| Created |
| ||||||||
| Status |
|
| Table of Contents |
|---|
...
...
| Code Block | ||
|---|---|---|
| ||
/**
* Catalog service provides methods to access schema object's descriptors of exact version and/or last actual version at given timestamp,
* which is logical point-in-time.
*
* <p>Catalog service listens distributed schema update event, stores/restores schema evolution history (schema versions) for time-travelled
* queries purposes and for lazy data evolution purposes.
*/
public interface CatalogService extends EventProducer<CatalogEvent, CatalogEventParameters> {
@Nullable Catalog catalog(int catalogVersion);
@Nullable CatalogTableDescriptor table(String tableName, long timestamp);
@Nullable CatalogTableDescriptor table(int tableId, long timestamp);
@Nullable CatalogTab
leDescriptorCatalogTableDescriptor table(int tableId, int catalogVersion);
Collection<CatalogTableDescriptor> tables(int catalogVersion);
// rest of the access methods
} |
...
| Code Block | ||
|---|---|---|
| ||
public class CatalogTableDescriptor extends CatalogObjectDescriptor {
// private properties and constructors
/**
*
Returns an identifier of a schema this table descriptor belongs to.
*/
public int schemaId() {
return schemaId;
...}
/**
* Returns versions of this table descriptor.
*/
public CatalogTableSchemaVersions schemaVersions() {
return schemaVersions;
...}
/**
* Returns an identifier of a distribution zone this table descriptor belongs to.
*/
public int zoneId() {
return zoneId;
...}
/**
* Returns a identifier of the primary key index.
*/
public int primaryKeyIndexId() {
return pkIndexId;
}
...}
/**
* Returns a version of this table descriptor.
*/
public int tableVersion() {
return schemaVersions.latestVersion();
...}
/**
* Returns a list primary key column names.
*/
public List<String> primaryKeyColumns() {
return primaryKeyColumns;
...}
/**
* Returns a list colocation key column names.
*/
public List<String> colocationColumns() {...}
/**
return colocationColumns;
}
/**
* * Returns a list column descriptors for the table.
*/
public List<CatalogTableColumnDescriptor> columns() {
return columns;
...}
/** Returns a column descriptor for column with given name, {@code null} if absent. */
public @Nullable CatalogTableColumnDescriptor column(String name) {...}
/**
Entry<Integer, CatalogTableColumnDescriptor>* columnReturns = columnsMap.get(name);
if (column != null) {
return column.getValue();
} else {
return null;
}
}
/**
* Returns an index of a column with the given name, or {@code -1} if such column does not exist.
*/
public int columnIndex(String name) {
Entry<Integer, CatalogTableColumnDescriptor> column = columnsMap.get(name);
if (column != null) {
return column.getKey();
} else {
return -1;
}
}
/**
* Returns {@code true} if this the given column is a part of the primary keyan index of a column with the given name, or {@code -1} if such column does not exist.
*/
public booleanint isPrimaryKeyColumncolumnIndex(String name) {
return primaryKeyColumns.contains(name);
...}
/**
* Returns {@code true} if this the given column is a part of the collocationprimary key.
*/
public boolean isColocationColumnisPrimaryKeyColumn(String name) {...}
/**
return colocationColumns.contains(name);
}
@Override
public String toString() { * Returns {@code true} if this the given column is a part of collocation key.
*/
return S.toString(CatalogTableDescriptor.class, this, super.toString());
public boolean isColocationColumn(String name) {...}
/**
* Returns a name of a storage profile.
*/
public String storageProfile() {
return storageProfile;
...}
} |
Here is a complete example of creating new table in catalog:
...
| Code Block | ||
|---|---|---|
| ||
/**
* The catalog manager provides schema manipulation methods and is responsible for managing distributed operations.
*/
public interface CatalogManager extends IgniteComponent {
/**
* Executes given command.
*
* @param command Command to execute.
* @return Future representing result of execution (it will be completed with the created catalog version).
*/
CompletableFuture<Integer> execute(CatalogCommand command);
/**
* Executes given list of commands atomically. That is, either all commands will be applied at once
* or neither of them. The whole bulk will increment catalog's version by a single point.
*
* @param commands Commands to execute.
* @return Future representing result of execution (it will be completed with the created catalog version).
*/
CompletableFuture<Integer> execute(List<CatalogCommand> commands);
} |
and , builder for CreateTable command is defined as follow:
...