forked from apache/paimon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flink][procedure] Support named argument in procedures without compa…
…tibility issue
- Loading branch information
1 parent
4d237c5
commit 5d623fd
Showing
31 changed files
with
1,307 additions
and
512 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
...k/paimon-flink-common/src/main/java/org/apache/paimon/flink/procedure/CloneProcedure.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.paimon.flink.procedure; | ||
|
||
import org.apache.paimon.flink.action.CloneAction; | ||
|
||
import org.apache.flink.table.annotation.ArgumentHint; | ||
import org.apache.flink.table.annotation.DataTypeHint; | ||
import org.apache.flink.table.annotation.ProcedureHint; | ||
import org.apache.flink.table.procedure.ProcedureContext; | ||
|
||
/** Clone Procedure. */ | ||
public class CloneProcedure extends ProcedureBase { | ||
public static final String IDENTIFIER = "clone"; | ||
|
||
@ProcedureHint( | ||
argument = { | ||
@ArgumentHint(name = "warehouse", type = @DataTypeHint("STRING")), | ||
@ArgumentHint(name = "database", type = @DataTypeHint("STRING"), isOptional = true), | ||
@ArgumentHint(name = "table", type = @DataTypeHint("STRING"), isOptional = true), | ||
@ArgumentHint( | ||
name = "catalog_conf", | ||
type = @DataTypeHint("STRING"), | ||
isOptional = true), | ||
@ArgumentHint(name = "target_warehouse", type = @DataTypeHint("STRING")), | ||
@ArgumentHint( | ||
name = "target_database", | ||
type = @DataTypeHint("STRING"), | ||
isOptional = true), | ||
@ArgumentHint( | ||
name = "target_table", | ||
type = @DataTypeHint("STRING"), | ||
isOptional = true), | ||
@ArgumentHint( | ||
name = "target_catalog_conf", | ||
type = @DataTypeHint("STRING"), | ||
isOptional = true), | ||
@ArgumentHint(name = "parallelism", type = @DataTypeHint("INT"), isOptional = true) | ||
}) | ||
public String[] call( | ||
ProcedureContext procedureContext, | ||
String warehouse, | ||
String database, | ||
String tableName, | ||
String sourceCatalogConfigStr, | ||
String targetWarehouse, | ||
String targetDatabase, | ||
String targetTableName, | ||
String targetCatalogConfigStr, | ||
Integer parallelismStr) | ||
throws Exception { | ||
CloneAction cloneAction = | ||
new CloneAction( | ||
warehouse, | ||
database, | ||
tableName, | ||
optionalConfigMap(sourceCatalogConfigStr), | ||
targetWarehouse, | ||
targetDatabase, | ||
targetTableName, | ||
optionalConfigMap(targetCatalogConfigStr), | ||
parallelismStr == null ? null : Integer.toString(parallelismStr)); | ||
return execute(procedureContext, cloneAction, "Clone Job"); | ||
} | ||
|
||
@Override | ||
public String identifier() { | ||
return IDENTIFIER; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.