@Test public void makePartitionName() throws IOException { List<Column> columns = ImmutableList.of(MockGlueDatabase.glueTestColumn(COLUMN_NAME)); List<Column> emptyColumns = ImmutableList.of(); List<String> partitionValueList1 = ImmutableList.of(PARTITION_VALUE_1); List<String> partitionValueList2 = ImmutableList.of(PARTITION_VALUE_1, PARTITION_VALUE_2); String expectedMessageEmpty = "Invalid partition key & values; key [], values [value1, ]"; String expectedMessageUneven = "Invalid partition key & values; key [testColumn,], values [value1, value2, ]"; assertEquals( GlueUtils.makePartitionName(columns, partitionValueList1), GlueUtils.makePartName(ImmutableList.of(COLUMN_NAME), partitionValueList1)); assertMakePartName(emptyColumns, partitionValueList1, expectedMessageEmpty); assertMakePartName(columns, partitionValueList2, expectedMessageUneven); }
public static String makePartitionName(List<Column> columns, List<String> partitionValues) throws IOException { if ((columns.size() != partitionValues.size()) || columns.size() == 0) { String errorMesg = "Invalid partition key & values; key ["; for (Column column : columns) { errorMesg += (column.getName() + ","); } errorMesg += "], values ["; for (String partitionValue : partitionValues) { errorMesg += (partitionValue + ", "); } throw new IOException(errorMesg + "]"); } List<String> columnNames = new ArrayList<>(); for (Column column : columns) { columnNames.add(column.getName()); } return makePartName(columnNames, partitionValues); }
GlueUtils { public static String makePartitionName(List<Column> columns, List<String> partitionValues) throws IOException { if ((columns.size() != partitionValues.size()) || columns.size() == 0) { String errorMesg = "Invalid partition key & values; key ["; for (Column column : columns) { errorMesg += (column.getName() + ","); } errorMesg += "], values ["; for (String partitionValue : partitionValues) { errorMesg += (partitionValue + ", "); } throw new IOException(errorMesg + "]"); } List<String> columnNames = new ArrayList<>(); for (Column column : columns) { columnNames.add(column.getName()); } return makePartName(columnNames, partitionValues); } }
GlueUtils { public static String makePartitionName(List<Column> columns, List<String> partitionValues) throws IOException { if ((columns.size() != partitionValues.size()) || columns.size() == 0) { String errorMesg = "Invalid partition key & values; key ["; for (Column column : columns) { errorMesg += (column.getName() + ","); } errorMesg += "], values ["; for (String partitionValue : partitionValues) { errorMesg += (partitionValue + ", "); } throw new IOException(errorMesg + "]"); } List<String> columnNames = new ArrayList<>(); for (Column column : columns) { columnNames.add(column.getName()); } return makePartName(columnNames, partitionValues); } private  GlueUtils(); }
GlueUtils { public static String makePartitionName(List<Column> columns, List<String> partitionValues) throws IOException { if ((columns.size() != partitionValues.size()) || columns.size() == 0) { String errorMesg = "Invalid partition key & values; key ["; for (Column column : columns) { errorMesg += (column.getName() + ","); } errorMesg += "], values ["; for (String partitionValue : partitionValues) { errorMesg += (partitionValue + ", "); } throw new IOException(errorMesg + "]"); } List<String> columnNames = new ArrayList<>(); for (Column column : columns) { columnNames.add(column.getName()); } return makePartName(columnNames, partitionValues); } private  GlueUtils(); static Schema toProtoSchema(List<Column> glueColumns); static List<alluxio.grpc.table.FieldSchema> toProto(List<Column> glueCloumns); static ColumnStatisticsInfo toProto(ColumnStatistics glueColumnStatistic); static Storage toProto(StorageDescriptor sd, PathTranslator translator); static String makePartitionName(List<Column> columns, List<String> partitionValues); static String makePartName(List<String> partCols, List<String> vals); }
GlueUtils { public static String makePartitionName(List<Column> columns, List<String> partitionValues) throws IOException { if ((columns.size() != partitionValues.size()) || columns.size() == 0) { String errorMesg = "Invalid partition key & values; key ["; for (Column column : columns) { errorMesg += (column.getName() + ","); } errorMesg += "], values ["; for (String partitionValue : partitionValues) { errorMesg += (partitionValue + ", "); } throw new IOException(errorMesg + "]"); } List<String> columnNames = new ArrayList<>(); for (Column column : columns) { columnNames.add(column.getName()); } return makePartName(columnNames, partitionValues); } private  GlueUtils(); static Schema toProtoSchema(List<Column> glueColumns); static List<alluxio.grpc.table.FieldSchema> toProto(List<Column> glueCloumns); static ColumnStatisticsInfo toProto(ColumnStatistics glueColumnStatistic); static Storage toProto(StorageDescriptor sd, PathTranslator translator); static String makePartitionName(List<Column> columns, List<String> partitionValues); static String makePartName(List<String> partCols, List<String> vals);  }