File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
core/src/main/java/com/dtstack/flink/sql/util Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -261,14 +261,43 @@ public static String firstUpperCase(String str) {
261261 }
262262
263263 public static String getTableFullPath (String schema , String tableName ) {
264+ String [] tableInfoSplit = StringUtils .split (tableName , "." );
265+ //表明表信息带了schema
266+ if (tableInfoSplit .length == 2 ){
267+ schema = tableInfoSplit [0 ];
268+ tableName = tableInfoSplit [1 ];
269+ }
270+
271+ //清理首个字符" 和最后字符 "
272+ schema = rmStrQuote (schema );
273+ tableName = rmStrQuote (tableName );
274+
264275 if (StringUtils .isEmpty (schema )){
265276 return addQuoteForStr (tableName );
266277 }
278+
267279 String schemaAndTabName = addQuoteForStr (schema ) + "." + addQuoteForStr (tableName );
268280 return schemaAndTabName ;
269281 }
270282
283+ /**
284+ * 清理首个字符" 和最后字符 "
285+ */
286+ public static String rmStrQuote (String str ){
287+ if (StringUtils .isEmpty (str )){
288+ return str ;
289+ }
290+
291+ if (str .startsWith ("\" " )){
292+ str = str .substring (1 );
293+ }
294+
295+ if (str .endsWith ("\" " )){
296+ str = str .substring (0 , str .length ()-1 );
297+ }
271298
299+ return str ;
300+ }
272301
273302 public static String addQuoteForStr (String column ) {
274303 return getStartQuote () + column + getEndQuote ();
You can’t perform that action at this time.
0 commit comments