TableUtil { public static int findColIndexWithAssertAndHint(String[] tableCols, String targetCol) { int index = findColIndex(tableCols, targetCol); if(index < 0){ double maxSimilarity = 0.0; String similarCol = null; for(String s : tableCols){ double similarity = levenshteinSimilarity.similarity(s, targetCol); if(similarity > maxSimilarity){ maxSimilarity = similarity; similarCol = s; } } if(maxSimilarity > 0.7) { throw new IllegalArgumentException( "Can not find column: " + targetCol + ", do you mean: " + similarCol + " ?"); }else{ throw new IllegalArgumentException("Can not find column: " + targetCol); } } return index; }  static synchronized String getTempTableName(); static int findColIndex(String[] tableCols, String targetCol); static int findColIndexWithAssert(String[] tableCols, String targetCol); static int findColIndexWithAssertAndHint(String[] tableCols, String targetCol); static int findColIndex(TableSchema tableSchema, String targetCol); static int findColIndexWithAssert(TableSchema tableSchema, String targetCol); static int findColIndexWithAssertAndHint(TableSchema tableSchema, String targetCol); static int[] findColIndices(String[] tableCols, String[] targetCols); static int[] findColIndicesWithAssert(String[] tableCols, String[] targetCols); static int[] findColIndicesWithAssertAndHint(String[] tableCols, String[] targetCols); static int[] findColIndices(TableSchema tableSchema, String[] targetCols); static int[] findColIndicesWithAssert(TableSchema tableSchema, String[] targetCols); static int[] findColIndicesWithAssertAndHint(TableSchema tableSchema, String[] targetCols); static TypeInformation[] findColTypes(TableSchema tableSchema, String[] targetCols); static TypeInformation[] findColTypesWithAssert(TableSchema tableSchema, String[] targetCols); static TypeInformation[] findColTypesWithAssertAndHint(TableSchema tableSchema, String[] targetCols); static TypeInformation findColType(TableSchema tableSchema, String targetCol); static TypeInformation findColTypeWithAssert(TableSchema tableSchema, String targetCol); static TypeInformation findColTypeWithAssertAndHint(TableSchema tableSchema, String targetCol); static boolean isNumber(TypeInformation dataType); static boolean isString(TypeInformation dataType); static boolean isVector(TypeInformation dataType); static void assertSelectedColExist(String[] tableCols, String... selectedCols); static void assertNumericalCols(TableSchema tableSchema, String... selectedCols); static void assertStringCols(TableSchema tableSchema, String... selectedCols); static void assertVectorCols(TableSchema tableSchema, String... selectedCols); static String[] getStringCols(TableSchema tableSchema); static String[] getStringCols(TableSchema tableSchema, String[] excludeCols); static String[] getNumericCols(TableSchema tableSchema); static String[] getNumericCols(TableSchema tableSchema, String[] excludeCols); static String[] getCategoricalCols(
        TableSchema tableSchema, String[] featureCols, String[] categoricalCols); static String formatTitle(String[] colNames); static String formatRows(Row row); static String format(String[] colNames, List<Row> data); static String columnsToSqlClause(String[] colNames); static String toSchemaJson(TableSchema schema); static TableSchema fromSchemaJson(String schemaJson); static Table concatTables(Table[] tables, Long sessionId); static Table[] splitTable(Table table); static Row getRow(Row row, int... keepIdxs);  }
@Test public void findColIndexWithAssertAndHintTest() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Can not find column: features, do you mean: feature ?"); String[] colNames = new String[]{"id", "text", "vector", "feature"}; TableUtil.findColIndexWithAssertAndHint(colNames, "features"); }