From 56278df05a2ee78ff1cb7e91d5a0a358c8255fd7 Mon Sep 17 00:00:00 2001 From: ChenYunHey <1908166778@qq.com> Date: Sat, 20 Jan 2024 21:15:28 +0800 Subject: [PATCH] Reformar Code Signed-off-by: ChenYunHey <1908166778@qq.com> --- .../flink/lakesoul/entry/SyncDatabase.java | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/lakesoul-flink/src/main/java/org/apache/flink/lakesoul/entry/SyncDatabase.java b/lakesoul-flink/src/main/java/org/apache/flink/lakesoul/entry/SyncDatabase.java index fb22ef623..ba3770d05 100644 --- a/lakesoul-flink/src/main/java/org/apache/flink/lakesoul/entry/SyncDatabase.java +++ b/lakesoul-flink/src/main/java/org/apache/flink/lakesoul/entry/SyncDatabase.java @@ -77,7 +77,7 @@ public static String pgAndMsqlCreateTableSql(String[] stringFieldTypes, String[] createTableQuery.append(", "); } } - if (pk!=null){ + if (pk != null) { createTableQuery.append(" ,PRIMARY KEY(").append(pk); createTableQuery.append(")"); } @@ -91,7 +91,7 @@ public static String[] getMysqlFieldsTypes(DataType[] fieldTypes, String[] field for (int i = 0; i < fieldTypes.length; i++) { if (fieldTypes[i].getLogicalType() instanceof VarCharType) { String mysqlType = "VARCHAR(255)"; - if (pk!=null){ + if (pk != null) { if (pk.contains(fieldNames[i])) { mysqlType = "VARCHAR(100)"; } @@ -103,8 +103,7 @@ public static String[] getMysqlFieldsTypes(DataType[] fieldTypes, String[] field stringFieldTypes[i] = "BINARY"; } else if (fieldTypes[i].getLogicalType() instanceof LocalZonedTimestampType | fieldTypes[i].getLogicalType() instanceof TimestampType) { stringFieldTypes[i] = "TIMESTAMP"; - } - else if (fieldTypes[i].getLogicalType() instanceof BooleanType) { + } else if (fieldTypes[i].getLogicalType() instanceof BooleanType) { stringFieldTypes[i] = "BOOLEAN"; } else { stringFieldTypes[i] = fieldTypes[i].toString(); @@ -119,7 +118,7 @@ public static String[] getPgFieldsTypes(DataType[] fieldTypes, String[] fieldNam for (int i = 0; i < fieldTypes.length; i++) { if (fieldTypes[i].getLogicalType() instanceof VarCharType) { String mysqlType = "TEXT"; - if (pk!=null){ + if (pk != null) { if (pk.contains(fieldNames[i])) { mysqlType = "VARCHAR(100)"; } @@ -143,13 +142,12 @@ public static String[] getPgFieldsTypes(DataType[] fieldTypes, String[] fieldNam public static String[] getDorisFieldTypes(DataType[] fieldTypes) { String[] stringFieldTypes = new String[fieldTypes.length]; for (int i = 0; i < fieldTypes.length; i++) { - if (fieldTypes[i].getLogicalType() instanceof TimestampType){ + if (fieldTypes[i].getLogicalType() instanceof TimestampType) { stringFieldTypes[i] = "DATETIME"; - } - else if (fieldTypes[i].getLogicalType() instanceof VarCharType){ + } else if (fieldTypes[i].getLogicalType() instanceof VarCharType) { stringFieldTypes[i] = "VARCHAR"; - } else { + } else { stringFieldTypes[i] = fieldTypes[i].toString(); } } @@ -165,7 +163,7 @@ public static String getTablePk(String sourceDataBae, String sourceTableName) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < primaryKeys.size(); i++) { stringBuilder.append(primaryKeys.get(i)); - if (i