private static IndexMetadata build(ColumnMetadata column, Row row) { if (row == null) return null; String type = row.getString(INDEX_TYPE); if (type == null) return null; IndexMetadata index = new IndexMetadata(column, type, row.getString(INDEX_NAME)); return index; }
private static void checkExecuteResultSet(ResultSet rs, String key) { assertTrue(!rs.isExhausted()); Row row = rs.one(); assertTrue(rs.isExhausted()); assertEquals(key, row.getString("k")); assertEquals("foo", row.getString("t")); assertEquals(42, row.getInt("i")); assertEquals(24.03f, row.getFloat("f"), 0.1f); }
static ColumnMetadata build(TableMetadata tm, Row row) { try { String name = row.getString(COLUMN_NAME); AbstractType<?> t = TypeParser.parse(row.getString(VALIDATOR)); ColumnMetadata cm = new ColumnMetadata(tm, name, Codec.rawTypeToDataType(t), row); tm.add(cm); return cm; } catch (RequestValidationException e) { // The server will have validated the type throw new RuntimeException(e); } }