elixir-explorer / adbc

Apache Arrow ADBC bindings for Elixir
https://arrow.apache.org/adbc/
Apache License 2.0
50 stars 16 forks source link

[WIP] Implement `ArrowArrayStream`, `ArrowSchema` and `ArrowArray` #13

Closed cocoa-xu closed 1 year ago

cocoa-xu commented 1 year ago

This PR added support for parsing ArrowSchema and convert ArrowArray to Elixir values in NIF. Formats listed below are supported

format description
l int64_t
c int8_t
s int16_t
i int32_t
L uint64_t
C uint8_t
S uint16_t
I uint32_t
f float
g double
u string
+s struct
cocoa-xu commented 1 year ago

Currently, we can test it with mix run test.exs, and it should print something like

%Adbc.ArrowSchema{
  format: "+s",
  name: "",
  metadata: nil,
  flags: 2,
  n_children: 3,
  children: [
    %Adbc.ArrowSchema{
      format: "l",
      name: "i64",
      metadata: nil,
      flags: 2,
      n_children: 0,
      children: [],
      reference: nil
    },
    %Adbc.ArrowSchema{
      format: "g",
      name: "f64",
      metadata: nil,
      flags: 2,
      n_children: 0,
      children: [],
      reference: nil
    },
    %Adbc.ArrowSchema{
      format: "u",
      name: "str",
      metadata: nil,
      flags: 2,
      n_children: 0,
      children: [],
      reference: nil
    }
  ],
  reference: #Reference<0.2938969449.2598502403.117250>
}