/** * @return the max repetition level that might be needed to encode the * type at 'path'. */ public int getMaxRepetitionLevel(String ... path) { return getMaxRepetitionLevel(path, 0) - 1; }
/** * @return the max repetition level that might be needed to encode the * type at 'path'. */ public int getMaxRepetitionLevel(String ... path) { return getMaxRepetitionLevel(path, 0) - 1; }
public List<ColumnDescriptor> getColumns() { List<String[]> paths = this.getPaths(0); List<ColumnDescriptor> columns = new ArrayList<ColumnDescriptor>(paths.size()); for (String[] path : paths) { // TODO: optimize this columns.add(new ColumnDescriptor(path, getType(path).asPrimitiveType().getPrimitiveTypeName(), getMaxRepetitionLevel(path), getMaxDefinitionLevel(path))); } return columns; }
public List<ColumnDescriptor> getColumns() { List<String[]> paths = this.getPaths(0); List<ColumnDescriptor> columns = new ArrayList<ColumnDescriptor>(paths.size()); for (String[] path : paths) { // TODO: optimize this PrimitiveType primitiveType = getType(path).asPrimitiveType(); columns.add(new ColumnDescriptor( path, primitiveType.getPrimitiveTypeName(), primitiveType.getTypeLength(), getMaxRepetitionLevel(path), getMaxDefinitionLevel(path))); } return columns; }
public ColumnDescriptor getColumnDescription(String[] path) { int maxRep = getMaxRepetitionLevel(path); int maxDef = getMaxDefinitionLevel(path); PrimitiveTypeName type = getType(path).asPrimitiveType().getPrimitiveTypeName(); return new ColumnDescriptor(path, type, maxRep, maxDef); }
public ColumnDescriptor getColumnDescription(String[] path) { int maxRep = getMaxRepetitionLevel(path); int maxDef = getMaxDefinitionLevel(path); PrimitiveType type = getType(path).asPrimitiveType(); return new ColumnDescriptor(path, type.getPrimitiveTypeName(), type.getTypeLength(), maxRep, maxDef); }
@Test public void testNestedTypes() { MessageType schema = MessageTypeParser.parseMessageType(Paper.schema.toString()); Type type = schema.getType("Links", "Backward"); assertEquals(PrimitiveTypeName.INT64, type.asPrimitiveType().getPrimitiveTypeName()); assertEquals(0, schema.getMaxRepetitionLevel("DocId")); assertEquals(1, schema.getMaxRepetitionLevel("Name")); assertEquals(2, schema.getMaxRepetitionLevel("Name", "Language")); assertEquals(0, schema.getMaxDefinitionLevel("DocId")); assertEquals(1, schema.getMaxDefinitionLevel("Links")); assertEquals(2, schema.getMaxDefinitionLevel("Links", "Backward")); } }