Skip to content

Latest commit

 

History

History
65 lines (44 loc) · 1.81 KB

File metadata and controls

65 lines (44 loc) · 1.81 KB

Connecting JavaScript and Apache DataFusion with ADBC

Instructions

Prerequisites

  1. Install Node.js (version 22 or later)

    • Alternatively, you can use Bun or Deno
  2. Install dbc

Connect to DataFusion

  1. Install the DataFusion ADBC driver:

    dbc install datafusion
  2. Install dependencies:

    npm --prefix .. install
  3. Customize the script main.js as needed

    • Change the SQL SELECT statement in conn.query(), or keep it set to SELECT * FROM 'games.parquet'; to query the Parquet file included with this example
    • The conn.execute() call disables DataFusion's Arrow StringView output for Parquet scans so that the results can be decoded by the apache-arrow JavaScript library; keep it as is
      • If you change the query to produce string columns another way (for example, casting to VARCHAR), you may also need to set datafusion.sql_parser.map_string_types_to_utf8view = false
  4. Run the script:

    Node.js:

    node main.js

    Bun:

    bun run main.js

    Deno:

    deno run --allow-ffi --allow-env main.js