Skip to content

Commit fe5b0ba

Browse files
committed
added array of fixed size into supported typed
1 parent 058383d commit fe5b0ba

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

c_src/value_to_term.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ bool nif::value_to_term(ErlNifEnv* env, const duckdb::Value& value, ERL_NIF_TERM
190190
sink = make_binary_term(env, varchar.c_str(), varchar.size());
191191
return true;
192192
}
193+
case duckdb::LogicalTypeId::ARRAY:
193194
case duckdb::LogicalTypeId::LIST: {
194195
auto& list = duckdb::ListValue::GetChildren(value);
195196
std::vector<ERL_NIF_TERM> term_array(list.size());

mix.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule Duckdbex.MixProject do
22
use Mix.Project
33

4-
@version "0.3.0"
4+
@version "0.3.1"
55
@duckdb_version "1.0.0"
66

77
def project do

test/nif/types_test.exs

+7
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,13 @@ defmodule Duckdbex.Nif.QueryTest do
378378
assert [] = NIF.fetch_all(r)
379379
end
380380

381+
test "ARRAY", %{conn: conn} do
382+
assert {:ok, _} = NIF.query(conn, "CREATE TABLE an_array(embeddings FLOAT[3])")
383+
assert {:ok, _} = NIF.query(conn, "INSERT INTO an_array VALUES ([1, 2, 3])")
384+
assert {:ok, r} = NIF.query(conn, "SELECT * FROM an_array")
385+
assert [[[1.0, 2.0, 3.0]]] = NIF.fetch_all(r)
386+
end
387+
381388
test "MAP", %{conn: conn} do
382389
assert {:ok, r} = NIF.query(conn, "select map();")
383390
assert [[%{}]] = NIF.fetch_all(r)

0 commit comments

Comments
 (0)