@Namespace(value="arrow") @NoOffset @Properties(inherit=arrow.class) public class FieldRef extends Pointer
int field_index
and const std::string& field_name
; it can be implicitly constructed from either a
field index or a name.
Nested fields can be referenced as well. Given
schema({field("a", struct_({field("n", null())})), field("b", int32())})
the following all indicate the nested field named "n":
FieldRef ref1(0, 0);
FieldRef ref2("a", 0);
FieldRef ref3("a", "n");
FieldRef ref4(0, "n");
ARROW_ASSIGN_OR_RAISE(FieldRef ref5,
FieldRef::FromDotPath(".a[0]"));
FieldPaths matching a FieldRef are retrieved using the member function FindAll.
Multiple matches are possible because field names may be duplicated within a schema.
For example:
Schema a_is_ambiguous({field("a", int32()), field("a", float32())});
auto matches = FieldRef("a").FindAll(a_is_ambiguous);
assert(matches.size() == 2);
assert(matches[0].Get(a_is_ambiguous)->Equals(a_is_ambiguous.field(0)));
assert(matches[1].Get(a_is_ambiguous)->Equals(a_is_ambiguous.field(1)));
Convenience accessors are available which raise a helpful error if the field is not
found or ambiguous, and for immediately calling FieldPath::Get to retrieve any
matching children:
auto maybe_match = FieldRef("struct", "field_i32").FindOneOrNone(schema);
auto maybe_column = FieldRef("struct", "field_i32").GetOne(some_table);Modifier and Type | Class and Description |
---|---|
static class |
FieldRef.Hash |
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
FieldRef() |
FieldRef(BytePointer name) |
FieldRef(FieldPath indices)
Construct a FieldRef using a string of indices.
|
FieldRef(int index)
Equivalent to a single index string of indices.
|
FieldRef(Pointer p)
Pointer cast constructor.
|
FieldRef(String name)
Construct a by-name FieldRef.
|
Modifier and Type | Method and Description |
---|---|
boolean |
asBoolean() |
boolean |
equals(FieldRef other) |
boolean |
Equals(FieldRef other) |
FieldPath |
field_path() |
FieldPath |
FindAll(Array array) |
FieldPath |
FindAll(ArrayData array)
\brief Convenience function which applies FindAll to arg's type or schema.
|
FieldPath |
FindAll(DataType type) |
FieldPath |
FindAll(Field field) |
FieldPath |
FindAll(FieldVector fields) |
FieldPath |
FindAll(RecordBatch batch) |
FieldPath |
FindAll(Schema schema)
\brief Retrieve FieldPath of every child field which matches this FieldRef.
|
static FieldRefResult |
FromDotPath(BytePointer dot_path) |
static FieldRefResult |
FromDotPath(String dot_path)
Parse a dot path into a FieldRef.
|
long |
hash() |
boolean |
IsFieldPath() |
boolean |
IsName() |
boolean |
IsNested() |
BytePointer |
name() |
boolean |
not() |
String |
ToString() |
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getDirectBufferAddress, getPointer, getPointer, getPointer, getPointer, hashCode, interruptDeallocatorThread, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, physicalBytesInaccurate, position, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zero
public FieldRef(Pointer p)
Pointer(Pointer)
.public FieldRef()
public FieldRef(@ByVal FieldPath indices)
public FieldRef(@StdString String name)
public FieldRef(@StdString BytePointer name)
public FieldRef(int index)
@ByVal public static FieldRefResult FromDotPath(@StdString String dot_path)
@ByVal public static FieldRefResult FromDotPath(@StdString BytePointer dot_path)
@Cast(value="bool") @Name(value="operator ==") public boolean equals(@Const @ByRef FieldRef other)
@StdString public String ToString()
@StdString @Cast(value={"char*","std::string*"}) public BytePointer name()
@StdVector public FieldPath FindAll(@Const @ByRef Schema schema)
@StdVector public FieldPath FindAll(@Const @ByRef Field field)
@StdVector public FieldPath FindAll(@Const @ByRef DataType type)
@StdVector public FieldPath FindAll(@Const @ByRef FieldVector fields)
@StdVector public FieldPath FindAll(@Const @ByRef ArrayData array)
@StdVector public FieldPath FindAll(@Const @ByRef Array array)
@StdVector public FieldPath FindAll(@Const @ByRef RecordBatch batch)
Copyright © 2022. All rights reserved.