private static FieldType toFieldType(TypeInfo typeInfo) { return new FieldType(true, toArrowType(typeInfo), null); }
public static FieldType nullable(ArrowType type) { return new FieldType(true, type, null, null); }
@Deprecated public ListVector(String name, BufferAllocator allocator, DictionaryEncoding dictionary, CallBack callBack) { this(name, allocator, new FieldType(true, ArrowType.List.INSTANCE, dictionary, null), callBack); }
@Deprecated public StructVector(String name, BufferAllocator allocator, DictionaryEncoding dictionary, CallBack callBack) { this(name, allocator, new FieldType(true, ArrowType.Struct.INSTANCE, dictionary, null), callBack); }
@Deprecated public Field(String name, boolean nullable, ArrowType type, DictionaryEncoding dictionary, List<Field> children) { this(name, new FieldType(nullable, type, dictionary, null), children); }
@Deprecated public Field(String name, boolean nullable, ArrowType type, List<Field> children) { this(name, new FieldType(nullable, type, null, null), children); }
@Deprecated public NonNullableStructVector(String name, BufferAllocator allocator, CallBack callBack) { this(name, allocator, new FieldType(false, ArrowType.Struct.INSTANCE, null, null), callBack); }
public UnionVector(String name, BufferAllocator allocator, CallBack callBack) { this.name = name; this.allocator = allocator; this.internalStruct = new NonNullableStructVector("internal", allocator, new FieldType(false, ArrowType.Struct.INSTANCE, null, null), callBack); this.typeBuffer = allocator.getEmpty(); this.callBack = callBack; this.typeBufferAllocationSizeInBytes = BaseValueVector.INITIAL_VALUE_ALLOCATION * TYPE_WIDTH; }
@JsonCreator private Field( @JsonProperty("name") String name, @JsonProperty("nullable") boolean nullable, @JsonProperty("type") ArrowType type, @JsonProperty("dictionary") DictionaryEncoding dictionary, @JsonProperty("children") List<Field> children, @JsonProperty("metadata") Map<String, String> metadata) { this(name, new FieldType(nullable, type, dictionary, metadata), children); }
public static NonNullableStructVector empty(String name, BufferAllocator allocator) { FieldType fieldType = new FieldType(false, ArrowType.Struct.INSTANCE, null, null); return new NonNullableStructVector(name, allocator, fieldType, null); }
@Override public Field deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { JsonNode node = jsonParser.getCodec().readTree(jsonParser); JsonNode nameNode = node.get("name"); final String name; if (nameNode instanceof NullNode) { name = null; } else { name = nameNode.asText(); } boolean nullable = node.get("nullable").asBoolean(); JsonNode arrowTypeNode = node.get("type"); ArrowType arrowType = mapper.convertValue(arrowTypeNode, ArrowType.class); JsonNode dictionaryNode = node.get("dictionary"); DictionaryEncoding dictionary = mapper.convertValue(dictionaryNode, DictionaryEncoding.class); JsonNode childrenNode = node.get("children"); List<Field> children = fieldsReader.readValue(childrenNode); JsonNode metadataNode = node.get("metadata"); Map<String,String> metadata = mapper.convertValue(metadataNode, Map.class); FieldType fieldType = new FieldType(nullable, arrowType, dictionary, metadata); return new Field(name, fieldType, children); } }
return new Field(field.getName(), new FieldType(field.isNullable(), type, encoding, field.getMetadata()), updatedChildren);
Field dictionaryField = new Field(dictName, new FieldType(false, field.getType(), null, null), children); FieldVector dictionaryVector = dictionaryField.createVector(allocator); dictionaries.put(encoding.getId(), new Dictionary(dictionaryVector, encoding)); return new Field(field.getName(), new FieldType(field.isNullable(), type, encoding, field.getMetadata()), updatedChildren);
public FixedSizeListVector(String name, BufferAllocator allocator, FieldType fieldType, CallBack schemaChangeCallback) { super(name, allocator); this.validityBuffer = allocator.getEmpty(); this.vector = ZeroVector.INSTANCE; this.fieldType = fieldType; this.listSize = ((ArrowType.FixedSizeList) fieldType.getType()).getListSize(); Preconditions.checkArgument(listSize > 0, "list size must be positive"); this.reader = new UnionFixedSizeListReader(this); this.valueCount = 0; this.validityAllocationSizeInBytes = getValidityBufferSizeFromCount(INITIAL_VALUE_ALLOCATION); }
FieldType indexFieldType = new FieldType(valueField.isNullable(), dictionary.getEncoding().getIndexType(), dictionary.getEncoding(), valueField.getMetadata()); Field indexField = new Field(valueField.getName(), indexFieldType, null);
@Test public void falseWhenChildrenAreSelected() { BatchSchema schema = mock(BatchSchema.class); when(schema.iterator()) .thenReturn(Lists.newArrayList( new Field("a1", new FieldType(true, new ArrowType.Struct(), null), Lists.newArrayList(Field.nullable("a2", new ArrowType.Bool()))), Field.nullable("a3", new ArrowType.Bool())).iterator()); assertFalse(EasyScanOperatorCreator.selectsAllColumns(schema, Lists.newArrayList(SchemaPath.getSimplePath("a1"), SchemaPath.getCompoundPath("a1", "a2"), SchemaPath.getSimplePath("a3")))); }
@Override public Field getField() { Field f = super.getField(); FieldType type = new FieldType(true, f.getType(), f.getFieldType().getDictionary(), f.getFieldType().getMetadata()); return new Field(f.getName(), type, f.getChildren()); }