Package smile.io
Class Arrow
java.lang.Object
smile.io.Arrow
Apache Arrow is a cross-language development platform for in-memory data.
It specifies a standardized language-independent columnar memory format
for flat and hierarchical data, organized for efficient analytic
operations on modern hardware.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
allocate
(long limit) Creates the root allocator.read
(InputStream input, int limit) Reads a limited number of records from an arrow file.Reads a limited number of records from an arrow file.Reads a limited number of records from an arrow file.Reads an arrow file.Reads an arrow file.static org.apache.arrow.vector.types.pojo.Field
toArrow
(StructField field) Converts a smile struct field to arrow field.static org.apache.arrow.vector.types.pojo.Schema
toArrow
(StructType schema) Converts smile schema to an arrow schema.static DataType
toDataType
(org.apache.arrow.vector.types.pojo.Field field) Converts an arrow field to smile data type.static StructField
toStructField
(org.apache.arrow.vector.types.pojo.Field field) Converts an arrow field to smile field.static StructType
toStructType
(org.apache.arrow.vector.types.pojo.Schema schema) Converts an arrow schema to smile schema.void
Writes the data frame to an arrow file.
-
Constructor Details
-
Arrow
public Arrow()Constructor. -
Arrow
public Arrow(int batch) Constructor.- Parameters:
batch
- the number of records in a record batch.
-
-
Method Details
-
allocate
public static void allocate(long limit) Creates the root allocator. The RootAllocator is responsible for being the master bookeeper for memory allocations.- Parameters:
limit
- the memory allocation limit in bytes.
-
read
Reads an arrow file.- Parameters:
path
- the input file path.- Returns:
- the data frame.
- Throws:
IOException
- when fails to read the file.
-
read
Reads an arrow file.- Parameters:
path
- the input file path.limit
- the number of records to read.- Returns:
- the data frame.
- Throws:
IOException
- when fails to read the file.
-
read
Reads a limited number of records from an arrow file.- Parameters:
path
- the input file path.- Returns:
- the data frame.
- Throws:
IOException
- when fails to read the file.URISyntaxException
- when the file path syntax is wrong.
-
read
Reads a limited number of records from an arrow file.- Parameters:
path
- the input file path.limit
- the number of records to read.- Returns:
- the data frame.
- Throws:
IOException
- when fails to read the file.URISyntaxException
- when the file path syntax is wrong.
-
read
Reads a limited number of records from an arrow file.- Parameters:
input
- the input stream.limit
- the number of records to read.- Returns:
- the data frame.
- Throws:
IOException
- when fails to read the file.
-
write
Writes the data frame to an arrow file.- Parameters:
data
- the data frame.path
- the output file path.- Throws:
IOException
- when fails to write the file.
-
toDataType
Converts an arrow field to smile data type.- Parameters:
field
- an arrow field.- Returns:
- the data type.
-
toStructField
Converts an arrow field to smile field.- Parameters:
field
- an arrow field.- Returns:
- the struct field.
-
toArrow
Converts a smile struct field to arrow field.- Parameters:
field
- smile struct field.- Returns:
- the arrow field.
-
toStructType
Converts an arrow schema to smile schema.- Parameters:
schema
- an arrow schema.- Returns:
- the struct type.
-
toArrow
Converts smile schema to an arrow schema.- Parameters:
schema
- smile schema.- Returns:
- the arrow schema.
-