@Test public void parseStarResolveTypeInfo() { List<TypeInfo> typeInfos = SchemaUtils.parseResolveTypeInfo("ANY,*"); Assert.assertTrue(typeInfos.size() == 2); Assert.assertTrue(typeInfos.get(0) instanceof AnyTypeInfo); Assert.assertTrue(typeInfos.get(1) instanceof AnyTypeInfo); }
public static List<TypeInfo> parseResolveTypeInfo(String str) throws IllegalArgumentException { List<TypeInfo> types = new ArrayList<TypeInfo>(); String remain = str; int pos = 0; IllegalArgumentException exception = null; while (remain.length() > 0) { pos = remain.indexOf(RESOLVE_SEPARATOR, pos); if (pos < 0) { pos = remain.length(); } String candidate = remain.substring(0, pos).trim(); try { TypeInfo typeInfo; if ("*".equals(candidate) || "ANY".equalsIgnoreCase(candidate)) { typeInfo = new AnyTypeInfo(); } else { typeInfo = TypeInfoParser.getTypeInfoFromTypeString(candidate); } if (typeInfo != null) { exception = null; types.add(typeInfo); if (pos == remain.length()) { remain = ""; } else { remain = remain.substring(pos + 1); pos = 0; } continue; } } catch (IllegalArgumentException e) { exception = e; } if (pos == remain.length()) { remain = ""; } else { pos = pos + 1; } } if (exception != null) { throw exception; } else { return types; } }
SchemaUtils { public static List<TypeInfo> parseResolveTypeInfo(String str) throws IllegalArgumentException { List<TypeInfo> types = new ArrayList<TypeInfo>(); String remain = str; int pos = 0; IllegalArgumentException exception = null; while (remain.length() > 0) { pos = remain.indexOf(RESOLVE_SEPARATOR, pos); if (pos < 0) { pos = remain.length(); } String candidate = remain.substring(0, pos).trim(); try { TypeInfo typeInfo; if ("*".equals(candidate) || "ANY".equalsIgnoreCase(candidate)) { typeInfo = new AnyTypeInfo(); } else { typeInfo = TypeInfoParser.getTypeInfoFromTypeString(candidate); } if (typeInfo != null) { exception = null; types.add(typeInfo); if (pos == remain.length()) { remain = ""; } else { remain = remain.substring(pos + 1); pos = 0; } continue; } } catch (IllegalArgumentException e) { exception = e; } if (pos == remain.length()) { remain = ""; } else { pos = pos + 1; } } if (exception != null) { throw exception; } else { return types; } } }
SchemaUtils { public static List<TypeInfo> parseResolveTypeInfo(String str) throws IllegalArgumentException { List<TypeInfo> types = new ArrayList<TypeInfo>(); String remain = str; int pos = 0; IllegalArgumentException exception = null; while (remain.length() > 0) { pos = remain.indexOf(RESOLVE_SEPARATOR, pos); if (pos < 0) { pos = remain.length(); } String candidate = remain.substring(0, pos).trim(); try { TypeInfo typeInfo; if ("*".equals(candidate) || "ANY".equalsIgnoreCase(candidate)) { typeInfo = new AnyTypeInfo(); } else { typeInfo = TypeInfoParser.getTypeInfoFromTypeString(candidate); } if (typeInfo != null) { exception = null; types.add(typeInfo); if (pos == remain.length()) { remain = ""; } else { remain = remain.substring(pos + 1); pos = 0; } continue; } } catch (IllegalArgumentException e) { exception = e; } if (pos == remain.length()) { remain = ""; } else { pos = pos + 1; } } if (exception != null) { throw exception; } else { return types; } }  }
SchemaUtils { public static List<TypeInfo> parseResolveTypeInfo(String str) throws IllegalArgumentException { List<TypeInfo> types = new ArrayList<TypeInfo>(); String remain = str; int pos = 0; IllegalArgumentException exception = null; while (remain.length() > 0) { pos = remain.indexOf(RESOLVE_SEPARATOR, pos); if (pos < 0) { pos = remain.length(); } String candidate = remain.substring(0, pos).trim(); try { TypeInfo typeInfo; if ("*".equals(candidate) || "ANY".equalsIgnoreCase(candidate)) { typeInfo = new AnyTypeInfo(); } else { typeInfo = TypeInfoParser.getTypeInfoFromTypeString(candidate); } if (typeInfo != null) { exception = null; types.add(typeInfo); if (pos == remain.length()) { remain = ""; } else { remain = remain.substring(pos + 1); pos = 0; } continue; } } catch (IllegalArgumentException e) { exception = e; } if (pos == remain.length()) { remain = ""; } else { pos = pos + 1; } } if (exception != null) { throw exception; } else { return types; } }  static boolean existsSchemaFile(File dir); static void generateSchemaFile(TableMeta table, List<Integer> indexes, File dir); static TableMeta readSchema(File dir); static String[] getColumnNames(Column[] cols); static String toString(Column[] cols); static Column[] fromString(String str); static List<TypeInfo> parseResolveTypeInfo(String str); static String[] splitColumn(String str); static ColumnOrConstant parseColumn(String colStr, TableMeta tableMeta); static List<ColumnOrConstant> parseColumnConstant(String[] columns, TableMeta tableMeta); }
SchemaUtils { public static List<TypeInfo> parseResolveTypeInfo(String str) throws IllegalArgumentException { List<TypeInfo> types = new ArrayList<TypeInfo>(); String remain = str; int pos = 0; IllegalArgumentException exception = null; while (remain.length() > 0) { pos = remain.indexOf(RESOLVE_SEPARATOR, pos); if (pos < 0) { pos = remain.length(); } String candidate = remain.substring(0, pos).trim(); try { TypeInfo typeInfo; if ("*".equals(candidate) || "ANY".equalsIgnoreCase(candidate)) { typeInfo = new AnyTypeInfo(); } else { typeInfo = TypeInfoParser.getTypeInfoFromTypeString(candidate); } if (typeInfo != null) { exception = null; types.add(typeInfo); if (pos == remain.length()) { remain = ""; } else { remain = remain.substring(pos + 1); pos = 0; } continue; } } catch (IllegalArgumentException e) { exception = e; } if (pos == remain.length()) { remain = ""; } else { pos = pos + 1; } } if (exception != null) { throw exception; } else { return types; } }  static boolean existsSchemaFile(File dir); static void generateSchemaFile(TableMeta table, List<Integer> indexes, File dir); static TableMeta readSchema(File dir); static String[] getColumnNames(Column[] cols); static String toString(Column[] cols); static Column[] fromString(String str); static List<TypeInfo> parseResolveTypeInfo(String str); static String[] splitColumn(String str); static ColumnOrConstant parseColumn(String colStr, TableMeta tableMeta); static List<ColumnOrConstant> parseColumnConstant(String[] columns, TableMeta tableMeta);  }