@@ -103,16 +103,15 @@ public void parseFieldsInfo(String fieldsInfo, AbstractTableInfo tableInfo){
103103 }
104104
105105 // 处理复合类型,例如 ARRAY<ROW<foo INT, bar STRING>>
106+ // 把ARRAY类型的长串字符压入Buffer
106107 Matcher headMatcher = compositeTypeHeadPattern .matcher (fieldRow );
107108 Matcher tailMatcher = compositeTypeTailPattern .matcher (fieldRow );
108- if (
109- !tailMatcher .matches () &&
110- (headMatcher .matches () ||
111- !buffer .isEmpty ())
112- ) {
109+ boolean isNotTail = !tailMatcher .matches ();
110+ boolean isToNeedPush = headMatcher .matches () || !buffer .isEmpty ();
111+
112+ if (isNotTail && isToNeedPush ) {
113113 writeBuffer (buffer , fieldRow );
114114 } else {
115-
116115 String [] fieldInfoArr ;
117116 if (tailMatcher .matches ()) {
118117 buffer .add (fieldRow );
@@ -122,9 +121,8 @@ public void parseFieldsInfo(String fieldsInfo, AbstractTableInfo tableInfo){
122121 fieldInfoArr = fieldRow .split ("\\ s+" );
123122 }
124123
125- if (fieldInfoArr .length < 2 ) {
126- throw new RuntimeException (String .format ("table [%s] field [%s] format error." , tableInfo .getName (), fieldRow ));
127- }
124+ String errorMsg = String .format ("table [%s] field [%s] format error." , tableInfo .getName (), fieldRow );
125+ Preconditions .checkState (fieldInfoArr .length >= 2 , errorMsg );
128126
129127 boolean isMatcherKey = dealKeyPattern (fieldRow , tableInfo );
130128 if (isMatcherKey ) {
@@ -149,7 +147,7 @@ public void parseFieldsInfo(String fieldsInfo, AbstractTableInfo tableInfo){
149147 fieldClass = dbTypeConvertToJavaType (fieldType );
150148 }
151149
152- tableInfo .addPhysicalMappings (fieldInfoArr [0 ],fieldInfoArr [0 ]);
150+ tableInfo .addPhysicalMappings (fieldInfoArr [0 ], fieldInfoArr [0 ]);
153151 tableInfo .addField (fieldName );
154152 tableInfo .addFieldClass (fieldClass );
155153 tableInfo .addFieldType (fieldType );
0 commit comments