@@ -41,6 +41,8 @@ public class CreateTableParser implements IParser {
4141
4242 private static final Pattern PATTERN = Pattern .compile (PATTERN_STR );
4343
44+ private static final Pattern PROP_PATTERN = Pattern .compile ("^'\\ s*(.+)\\ s*'$" );
45+
4446 public static CreateTableParser newInstance (){
4547 return new CreateTableParser ();
4648 }
@@ -69,18 +71,27 @@ public void parseSql(String sql, SqlTree sqlTree) {
6971 }
7072
7173 private Map parseProp (String propsStr ){
72- String [] strs = propsStr .trim ().split ("'\\ s*," );
74+ propsStr = propsStr .replaceAll ("'\\ s*," , "'|" );
75+ String [] strs = propsStr .trim ().split ("\\ |" );
7376 Map <String , Object > propMap = Maps .newHashMap ();
7477 for (int i =0 ; i <strs .length ; i ++){
7578 List <String > ss = DtStringUtil .splitIgnoreQuota (strs [i ], '=' );
7679 String key = ss .get (0 ).trim ();
77- String value = ss .get (1 ). trim (). replaceAll ( "'" , "" ). trim ( );
80+ String value = extractValue ( ss .get (1 ));
7881 propMap .put (key , value );
7982 }
8083
8184 return propMap ;
8285 }
8386
87+ private String extractValue (String value ) {
88+ Matcher matcher = PROP_PATTERN .matcher (value );
89+ if (matcher .find ()) {
90+ return matcher .group (1 );
91+ }
92+ throw new RuntimeException ("[" + value + "] format is invalid" );
93+ }
94+
8495 public static class SqlParserResult {
8596
8697 private String tableName ;
0 commit comments