Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When serving a project with vite, loadParquet fails if i don't provide a fully qualified url #636

Open
kszlim opened this issue Dec 26, 2024 · 1 comment

Comments

@kszlim
Copy link

kszlim commented Dec 26, 2024

Repro:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="module" defer>
        import * as vg from "@uwdata/vgplot";

        vg.coordinator().databaseConnector(vg.wasmConnector());

        vg.coordinator().exec(vg.loadParquet("penguins", "/data/some_parquet.parquet")); // stored in public/data/some_parquet.parquet

        const chart = vg.plot(
            vg.hexbin(vg.from("penguins"), { x: "col_0", y: "col_2" })
        );

        document.getElementById('chart-container').appendChild(chart);
    </script>
</head>
<body>
    <div id="chart-container"></div>
</body>

Then i run:

npm start

Which is defined as:
"start": "vite"

I get the error:

Error: IO Error: No files found that match the pattern "/data/some_parquet.parquet"
    at ma.runQuery (bindings_base.ts:172:19)
    at Fo.onMessage (worker_dispatcher.ts:202:51)
    at Wc.globalThis.onmessage (duckdb-browser-eh.worker.ts:29:19)

whereas it seems to work if I provide something like:

vg.coordinator().exec(vg.loadParquet("penguins", "http://localhost:MY_PORT/data/some_parquet.parquet"));
@declann
Copy link

declann commented Dec 27, 2024

The higher level astToESM function takes a baseURL that it bakes into the loadParquet calls.

The default Mosaic app in dev folder - which is a vite app, sets baseURL using location.origin + '/' : is pre-pending that ok?

https://vscode.dev/github/uwdata/mosaic/blob/main/dev/index.html#L194

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants