adbc icon indicating copy to clipboard operation
adbc copied to clipboard

Postgres List Response

Open maennchen opened this issue 2 years ago • 2 comments

Lists in responses are handled wrong.

diff --git a/test/adbc_test.exs b/test/adbc_test.exs
index 2758db6..3a96b79 100644
--- a/test/adbc_test.exs
+++ b/test/adbc_test.exs
@@ -33,6 +33,9 @@ defmodule AdbcTest do
     test "runs queries", %{conn: conn} do
       assert {:ok, %Adbc.Result{data: %{"num" => [123]}}} =
                Connection.query(conn, "SELECT 123 as num")
+
+      assert {:ok, %Adbc.Result{data: %{"num" => [[1, 2, 3]]}}} =
+               Connection.query(conn, "SELECT ARRAY[1, 2, 3] as num")
     end
 
     test "select with temporal types", %{conn: conn} do

=>

  1) test postgresql smoke tests runs queries (AdbcTest)
     test/adbc_test.exs:33
     match (=) failed
     code:  assert {:ok, %Adbc.Result{data: %{"num" => [[1, 2, 3]]}}} =
              Connection.query(conn, "SELECT ARRAY[1, 2, 3] as num")
     left:  {:ok, %Adbc.Result{data: %{"num" => [[1, 2, 3]]}}}
     right: {:ok, %Adbc.Result{data: %{"num" => []}, num_rows: nil}}
     stacktrace:
       test/adbc_test.exs:37: (test)

Judging by get_arrow_array_list_children in c_src/adbc_nif.cpp, that should be supported.

maennchen avatar Nov 14 '23 11:11 maennchen

This seems to be an issue when converting the Arrow data structure to Erlang terms. It works when using Explorer.DataFrame.from_query/3.

maennchen avatar Nov 14 '23 12:11 maennchen

Yes, exactly. Explorer uses the Rust integration for this conversion. We need to add support here as well.

josevalim avatar Nov 14 '23 12:11 josevalim