...
Code Block |
---|
|
CREATE TABLE ctas_hudi
(
id BIGINT,
name STRING,
age INT
)
WITH ('connector.type' = 'hudi');
INSERT INTO ctas_hudi SELECT id, name, age FROM hive_catalog.default.test WHERE mod(id, 10) = 0; |
Table
...
Providing method that are used to execute CTAS for Table API user.
@PublicEvolving public interface |
TableEnvironment Table extends Explainable<Table>, Executable {
/** * |
Registersgiven{@link Table}'s result as a catalog table withdefined by the given {@link |
TableDescriptor'soptions.*<p>CTAS for Table API* <p>Examples:
*
* <pre>{CreatingTable saveAs(String tablePath);
} |
CreatingTable
Add CreatingTable to use CTAS for table API.
@code/** A table that need to be created for CTAS. */ @PublicEvolving public interface CreatingTable { |
Map<String,String>options=new HashMap<String, String>(); options.put such as option("connector |
.typehudi tEnv.createTable("MyTable", options, tEnv.sqlQuery("select id, name from user_table"))/ CreatingTable option(String key, String value);
|
* }</pre>*@paramThepathunderwhichthetablewillberegistered.Seealsothe{@link * @param options Table options. TableEnvironment} class description for the format of the path.TablePipeline create();
/** * Create the table under the specified path if not exist |
@param query The {@link Table} object describing forfurthertransformationscreateTable(String path, Map<String, String> options, Table query);
void Catalog
Providing method that are used to create stage table.
@PublicEvolving public interface Catalog {
|
Creates a new stage table for. * and will be created when the Job status changes to Created;
* will be dropped when the job status changes to FAILED or CANCELED.
* * This table will be recorded in the Catalog's memorywas used, the Catalog combined {@link Catalog#supportsManagedTable} |
<p>Theframework will make surecallthismethodwithfully validated * ResolvedCatalogTableThoseinstancesareeasy to serialize for a durable catalog implementation. {@link JdbcCatalog} can add |
*@paramtablePathpathofthe tablebe created {@link CatalogBaseTable}. */ |
@paramtablethetabledefinitionvoid inferTableOptions(CatalogBaseTable |
* @param ignoreIfExists flag to specify behavior when a table already exists at the
* given path: if set to false, it throws a TableAlreadyExistException, if set to true, dotable) {}
/** * Assist in the serialization of different catalogs. * Catalog decides for itself which information needs to be serialized. */ default |
*void serialize(OutputStream output) throws IOException |
nothing. @throwsTableAlreadyExistExceptioniftablealreadyexistsandignoreIfExistsisfalse*@throwsDatabaseNotExistExceptionifthedatabaseintablePathdoesn'texist*@throwsCatalogExceptionincaseany runtime exception voidcreateStageTableObjectPathtablePath,CatalogBaseTabletablebooleanignoreIfExists)throws TableAlreadyExistException, DatabaseNotExistException, CatalogException;
Proposed Changes
First of all, make it clear, CTAS command create table must go through catalog.
...
public class StreamGraph implements Pipeline {
... ...
/** Registers the JobStatusHook. */ void setJobStatusHookaddJobStatusHook(JobStatusHook hook) { ... } } |
...