MotherDuck-Open-Source/metabase_duckdb_driver

Error: Cannot read properties of undefined (reading 'rows') while reading from s3

Opened this issue · 2 comments

I'm encountering an issue with the DuckDB driver in Metabase where I receive the following error when attempting to run a query:

Cannot read properties of undefined (reading 'rows')

-- Sample SQL query that triggers the error
SELECT * FROM 's3://sample_bucket/test/*.parquet';

Network Error response

{"database_id":2,"started_at":"2024-08-23T07:35:07.941803921Z","via":[{"status":"failed","class":"class clojure.lang.ExceptionInfo","error":"Error reducing result rows: Cannot invoke \"Object.getClass()\" because \"target\" is null","stacktrace":["--> query_processor.context.default$default_reducef$fn__53329.invoke(default.clj:60)","query_processor.context.default$default_reducef.invokeStatic(default.clj:57)","query_processor.context.default$default_reducef.invoke(default.clj:49)","query_processor.context$reducef.invokeStatic(context.clj:70)","query_processor.context$reducef.invoke(context.clj:63)","query_processor.context.default$default_runf$respond_STAR___53333.invoke(default.clj:69)","driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:513)","driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:489)","driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:497)","driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:489)","driver.sql_jdbc$fn__105083.invokeStatic(sql_jdbc.clj:63)","driver.sql_jdbc$fn__105083.invoke(sql_jdbc.clj:61)","query_processor.context$executef.invokeStatic(context.clj:60)","query_processor.context$executef.invoke(context.clj:49)","query_processor.context.default$default_runf.invokeStatic(default.clj:68)","query_processor.context.default$default_runf.invoke(default.clj:66)","query_processor.context$runf.invokeStatic(context.clj:46)","query_processor.context$runf.invoke(context.clj:40)","query_processor.reducible$identity_qp.invokeStatic(reducible.clj:15)","query_processor.reducible$identity_qp.invoke(reducible.clj:12)","query_processor.middleware.cache$maybe_return_cached_results$maybe_return_cached_results_STAR___69172.invoke(cache.clj:224)","query_processor.middleware.per....}

Frontend Error Response

error TypeError: Cannot read properties of undefined (reading 'rows')
    at index.js:19:14
    at Array.filter (<anonymous>)
    at O (index.js:16:6)
    at querying.js:198:11
    at u (runtime.js:63:40)
    at Generator._invoke (runtime.js:293:22)
    at Generator.next (runtime.js:118:21)
    at ie (app-main.bundle.js?58be9a4ec823cc62f9ff:2:1313746)
    at a (app-main.bundle.js?58be9a4ec823cc62f9ff:2:1313950)
    at app-main.bundle.js?58be9a4ec823cc62f9ff:2:1314011

The data is being returned in the network tab and when running the query outside metabase.

Seems to be happening if any of the column value is empty or null in any of the parquet files. W
hen filtering out the columns which are not null, the data is being rendered.

hrl20 commented

Thanks for the report and the workaround! Will look into handling null columns in the driver.