-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Flink reserved key led to error 源数据库的表中存在flink保留字段,导致创建增量同步时异常 datav…
- Loading branch information
1 parent
6f43fbe
commit 2a62202
Showing
20 changed files
with
472 additions
and
201 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
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
51 changes: 51 additions & 0 deletions
51
...ax/tis-datax-doris-plugin/src/main/java/com/qlangtech/tis/plugin/datax/seq/OffSeqKey.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,51 @@ | ||
/** | ||
* 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 | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* 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 com.qlangtech.tis.plugin.datax.seq; | ||
|
||
import com.alibaba.fastjson.JSONObject; | ||
import com.qlangtech.tis.extension.Descriptor; | ||
import com.qlangtech.tis.extension.TISExtension; | ||
|
||
/** | ||
* @author: 百岁(baisui@qlangtech.com) | ||
* @create: 2023-07-31 15:09 | ||
**/ | ||
public class OffSeqKey extends SeqKey { | ||
|
||
@Override | ||
public void appendBatchCfgs(JSONObject props) { | ||
|
||
} | ||
|
||
@Override | ||
public boolean isOn() { | ||
return false; | ||
} | ||
|
||
@TISExtension | ||
public static class DftDescriptor extends Descriptor<SeqKey> { | ||
public DftDescriptor() { | ||
} | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return SWITCH_OFF; | ||
} | ||
} | ||
} |
114 changes: 114 additions & 0 deletions
114
...tax/tis-datax-doris-plugin/src/main/java/com/qlangtech/tis/plugin/datax/seq/OnSeqKey.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,114 @@ | ||
/** | ||
* 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 | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* 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 com.qlangtech.tis.plugin.datax.seq; | ||
|
||
import com.alibaba.datax.plugin.writer.doriswriter.Keys; | ||
import com.alibaba.fastjson.JSONObject; | ||
import com.qlangtech.tis.datax.IDataxProcessor; | ||
import com.qlangtech.tis.extension.Descriptor; | ||
import com.qlangtech.tis.extension.TISExtension; | ||
import com.qlangtech.tis.manage.common.Option; | ||
import com.qlangtech.tis.plugin.annotation.FormField; | ||
import com.qlangtech.tis.plugin.annotation.FormFieldType; | ||
import com.qlangtech.tis.plugin.annotation.Validator; | ||
import com.qlangtech.tis.plugin.datax.SelectedTab; | ||
import com.qlangtech.tis.plugin.ds.CMeta; | ||
import com.qlangtech.tis.plugin.ds.DataXReaderColType; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
/** | ||
* @author: 百岁(baisui@qlangtech.com) | ||
* @create: 2023-07-31 15:12 | ||
**/ | ||
public class OnSeqKey extends SeqKey { | ||
|
||
@FormField(ordinal = 4, type = FormFieldType.ENUM, validate = {Validator.require}) | ||
public String seqKey; | ||
|
||
@Override | ||
public void appendBatchCfgs(JSONObject props) { | ||
props.put(Keys.COL_SEQUENCE_NAME, this.seqKey); | ||
} | ||
|
||
@Override | ||
public boolean isOn() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public String getSeqColName() { | ||
return this.seqKey; | ||
} | ||
|
||
@Override | ||
public StringBuffer createDDLScript(IDataxProcessor.TableMap tableMapper) { | ||
// if (StringUtils.isNotEmpty(this.seqKey)) { | ||
if (tableMapper == null) { | ||
throw new IllegalArgumentException("param tableMapper can not be null"); | ||
} | ||
if (StringUtils.isEmpty(seqKey)) { | ||
throw new IllegalArgumentException("param seqKey can not be null"); | ||
} | ||
StringBuffer seqBuffer = new StringBuffer(); | ||
List<CMeta> cols = tableMapper.getSourceCols(); | ||
Optional<CMeta> p = cols.stream().filter((c) -> seqKey.equals(c.getName())).findFirst(); | ||
if (!p.isPresent()) { | ||
throw new IllegalStateException("can not find col:" + seqKey); | ||
} | ||
|
||
// seqBuffer.append("\n\t, \"function_column.sequence_col\" = '").append(dorisTab.seqKey) | ||
// .append("'\n\t, \"function_column.sequence_type\"='").append(createColWrapper(p.get()).getMapperType()).append("'"); | ||
|
||
seqBuffer.append("\n\t, \"function_column.sequence_col\" = '").append(seqKey); | ||
// .append("'\n\t, \"function_column.sequence_type\"='").append(createColWrapper(p.get()).getMapperType()).append("'"); | ||
|
||
// } | ||
return seqBuffer; | ||
} | ||
|
||
/** | ||
* seq cols候选列 | ||
* | ||
* @return | ||
*/ | ||
public static List<Option> getSeqKeys() { | ||
List<Option> result = SelectedTab.getContextTableCols((cols) -> { | ||
return cols.stream().filter((c) -> { | ||
DataXReaderColType t = c.getType().getCollapse(); | ||
return t == DataXReaderColType.INT || t == DataXReaderColType.Long || t == DataXReaderColType.Date; | ||
}); | ||
}); | ||
return result; | ||
} | ||
|
||
@TISExtension | ||
public static class DftDescriptor extends Descriptor<SeqKey> { | ||
public DftDescriptor() { | ||
} | ||
|
||
|
||
@Override | ||
public String getDisplayName() { | ||
return SWITCH_ON; | ||
} | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...datax/tis-datax-doris-plugin/src/main/java/com/qlangtech/tis/plugin/datax/seq/SeqKey.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,49 @@ | ||
/** | ||
* 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 | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* 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 com.qlangtech.tis.plugin.datax.seq; | ||
|
||
import com.alibaba.fastjson.JSONObject; | ||
import com.qlangtech.tis.datax.IDataxProcessor; | ||
import com.qlangtech.tis.extension.Describable; | ||
|
||
/** | ||
* https://doris.apache.org/docs/dev/data-operate/update-delete/sequence-column-manual?_highlight=seq | ||
* | ||
* @author: 百岁(baisui@qlangtech.com) | ||
* @create: 2023-07-31 15:05 | ||
**/ | ||
public abstract class SeqKey implements Describable<SeqKey> { | ||
|
||
public StringBuffer createDDLScript(IDataxProcessor.TableMap tableMapper) { | ||
return new StringBuffer(); | ||
} | ||
|
||
/** | ||
* 是否已经开启时间序列功能 | ||
* | ||
* @return | ||
*/ | ||
public abstract boolean isOn(); | ||
|
||
public String getSeqColName() { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
public abstract void appendBatchCfgs(JSONObject props); | ||
} |
2 changes: 1 addition & 1 deletion
2
...oris-plugin/src/main/resources/com/qlangtech/tis/plugin/datax/doris/DorisSelectedTab.json
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"seqKey": { | ||
"label": "Sequence列", | ||
"enum": "com.qlangtech.tis.plugin.datax.doris.DorisSelectedTab.getSeqKeys():uncache_true" | ||
"dftVal": "off" | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
...is-datax-doris-plugin/src/main/resources/com/qlangtech/tis/plugin/datax/seq/OnSeqKey.json
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,5 @@ | ||
{ | ||
"seqKey": { | ||
"enum": "com.qlangtech.tis.plugin.datax.seq.OnSeqKey.getSeqKeys():uncache_true" | ||
} | ||
} |
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.