예제 #1
0
파일: Field.java 프로젝트: apache/arrow
 public int getField(FlatBufferBuilder builder) {
   int nameOffset = name == null ? -1 : builder.createString(name);
   int typeOffset = type.getType(builder);
   int[] childrenData = new int[children.size()];
   for (int i = 0; i < children.size(); i++) {
     childrenData[i] = children.get(i).getField(builder);
   }
   int childrenOffset = org.apache.arrow.flatbuf.Field.createChildrenVector(builder, childrenData);
   int[] buffersData = new int[typeLayout.getVectors().size()];
   for (int i = 0; i < buffersData.length; i++) {
     VectorLayout vectorLayout = typeLayout.getVectors().get(i);
     buffersData[i] = vectorLayout.writeTo(builder);
   }
   int layoutOffset = org.apache.arrow.flatbuf.Field.createLayoutVector(builder, buffersData);
   org.apache.arrow.flatbuf.Field.startField(builder);
   if (name != null) {
     org.apache.arrow.flatbuf.Field.addName(builder, nameOffset);
   }
   org.apache.arrow.flatbuf.Field.addNullable(builder, nullable);
   org.apache.arrow.flatbuf.Field.addTypeType(builder, type.getTypeID().getFlatbufID());
   org.apache.arrow.flatbuf.Field.addType(builder, typeOffset);
   org.apache.arrow.flatbuf.Field.addChildren(builder, childrenOffset);
   org.apache.arrow.flatbuf.Field.addLayout(builder, layoutOffset);
   return org.apache.arrow.flatbuf.Field.endField(builder);
 }
예제 #2
0
파일: Field.java 프로젝트: apache/arrow
 public void validate() {
   TypeLayout expectedLayout = TypeLayout.getTypeLayout(type);
   if (!expectedLayout.equals(typeLayout)) {
     throw new IllegalArgumentException(
         "Deserialized field does not match expected vectors. expected: "
             + expectedLayout
             + " got "
             + typeLayout);
   }
 }
예제 #3
0
파일: Field.java 프로젝트: apache/arrow
 public Field(String name, boolean nullable, ArrowType type, List<Field> children) {
   this(name, nullable, type, children, TypeLayout.getTypeLayout(checkNotNull(type)));
 }