From a9e3154d89e17a1b9fc167fac9184f61cd694575 Mon Sep 17 00:00:00 2001 From: mozhenghua Date: Tue, 11 Apr 2023 09:08:04 +0800 Subject: [PATCH] nomatter isGenerateCreateDDLSwitchOff is on or not , DDL script will be generated at the end of create DataX instance,https://github.com/qlangtech/tis/issues/211 --- .../qlangtech/tis/datax/impl/DataXCfgGenerator.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tis-plugin/src/main/java/com/qlangtech/tis/datax/impl/DataXCfgGenerator.java b/tis-plugin/src/main/java/com/qlangtech/tis/datax/impl/DataXCfgGenerator.java index cc9d2028e..a00854129 100644 --- a/tis-plugin/src/main/java/com/qlangtech/tis/datax/impl/DataXCfgGenerator.java +++ b/tis-plugin/src/main/java/com/qlangtech/tis/datax/impl/DataXCfgGenerator.java @@ -329,12 +329,12 @@ public static void generateTabCreateDDL(IPluginContext pluginCtx, IDataxProcesso String sqlFileName = mapper.getTo() + IDataxProcessor.DATAX_CREATE_DDL_FILE_NAME_SUFFIX; if (!createDDLFiles.contains(sqlFileName)) { - CreateTableSqlBuilder.CreateDDL createDDL = writer.generateCreateDDL(mapper); - if (createDDL != null) { - createDDLFiles.add(sqlFileName); - // 由于用户可能已经手动改动过生成的DDL文件,所以不能强行覆盖已经存在的DDL文件,overWrite参数应该为false - dataxProcessor.saveCreateTableDDL(pluginCtx, createDDL.getDDLScript(), sqlFileName, overWrite); - } + CreateTableSqlBuilder.CreateDDL createDDL + = Objects.requireNonNull(writer.generateCreateDDL(mapper), "createDDL can not be null"); + + createDDLFiles.add(sqlFileName); + // 由于用户可能已经手动改动过生成的DDL文件,所以不能强行覆盖已经存在的DDL文件,overWrite参数应该为false + dataxProcessor.saveCreateTableDDL(pluginCtx, createDDL.getDDLScript(), sqlFileName, overWrite); } } }