Documentation
¶
Overview ¶
Deprecated: Try https://github.com/apache/arrow/tree/master/go instead
Example ¶
package main
import (
"fmt"
"github.com/353solutions/carrow"
)
func main() {
size := 100
intBld := carrow.NewInteger64ArrayBuilder()
floatBld := carrow.NewFloat64ArrayBuilder()
for i := 0; i < size; i++ {
if err := intBld.Append(int64(i)); err != nil {
fmt.Printf("intBld.Append error: %s", err)
return
}
if err := floatBld.Append(float64(i)); err != nil {
fmt.Printf("floatBld.Append error: %s", err)
return
}
}
intArr, err := intBld.Finish()
if err != nil {
fmt.Printf("intBld.Finish error: %s", err)
return
}
floatArr, err := floatBld.Finish()
if err != nil {
fmt.Printf("floatBld.Finish error: %s", err)
return
}
intField, err := carrow.NewField("incCol", carrow.Integer64Type)
if err != nil {
fmt.Printf("intField error: %s", err)
return
}
floatField, err := carrow.NewField("floatCol", carrow.Float64Type)
if err != nil {
fmt.Printf("floatField error: %s", err)
return
}
schema, err := carrow.NewSchema([]*carrow.Field{intField, floatField})
if err != nil {
fmt.Printf("can't create schema: %s", err)
return
}
arrs := []*carrow.Array{intArr, floatArr}
table, err := carrow.NewTableFromArrays(schema, arrs)
if err != nil {
fmt.Printf("table creation error: %s", err)
return
}
fmt.Printf("num cols: %d\n", table.NumCols())
fmt.Printf("num rows: %d\n", table.NumRows())
}
Output: num cols: 2 num rows: 100
Index ¶
- type Array
- type Field
- type Metadata
- type Schema
- type Table
- func (t *Table) Column(i int) (*Array, error)
- func (t *Table) ColumnByName(name string) (*Array, error)
- func (t *Table) ColumnNames() ([]string, error)
- func (t *Table) Field(i int) (*Field, error)
- func (t *Table) NumCols() int
- func (t *Table) NumRows() int
- func (t *Table) Ptr() unsafe.Pointer
- func (t *Table) Schema() *Schema
- func (t *Table) Slice(offset int, length int) *Table
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Array ¶
type Array struct {
// contains filtered or unexported fields
}
Array is arrow array
type Field ¶
type Field struct {
// contains filtered or unexported fields
}
Field is a field description
type Metadata ¶
type Metadata struct {
// contains filtered or unexported fields
}
Metadata in schema
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
Schema is table schema
func (*Schema) SetMetadata ¶
SetMetadata sets the metadata
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table is arrow table
func NewTableFromArrays ¶
NewTableFromArrays creates new Table from slice of arrays
func NewTableFromPtr ¶
NewTableFromPtr creates a new table from underlying C pointer You probably shouldn't use this function
func (*Table) ColumnByName ¶
ColumnByName returns column by name
func (*Table) ColumnNames ¶
ColumnNames names returns names of columns
Click to show internal directories.
Click to hide internal directories.