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

Client side version #87

Open
vasner opened this issue Aug 29, 2019 · 14 comments
Open

Client side version #87

vasner opened this issue Aug 29, 2019 · 14 comments

Comments

@vasner
Copy link

vasner commented Aug 29, 2019

Hi All,
Is it possible to build parquetjs as client side (browser) js library?

@dobesv
Copy link
Contributor

dobesv commented Dec 9, 2019

I think for compression it does depend on some other modules that are not available in the browser, though for uncompressed data it might work. Have you tried it?

@vasner
Copy link
Author

vasner commented Dec 10, 2019

I've never tried.

@aviillouz
Copy link

brotli has an issue with encoding on browsers (foliojs/brotli.js#20) and suggests to import only 'brotli/decompress' in the browser as a workaround.
suppose I want only to read files - can I just import ParquetReader?

import ParquetReader from 'parquetjs/lib/reader';

I'm still getting the following error from brotli.

ReferenceError: Browser is not defined
node_modules/brotli/build/encode.js:49

@sota1235
Copy link

I also got an error - same as aviillouz - when running Jest test, but I don't get that when I run same file on production...

@danb235
Copy link

danb235 commented Nov 21, 2020

I ran into the same error. This package isn't intended to run in the browser, Jest by default tests in a browser environment. Set the testEnvironment to node in your package.json, and the error will go away when using parquetjs.

"jest": {
    "testEnvironment": "node"
  },

https://jestjs.io/docs/en/configuration#testenvironment-string

@dobesv
Copy link
Contributor

dobesv commented Nov 22, 2020

I have been using a derived package, parquets in the browser, and it works.

@eatonphil
Copy link

Thanks @dobesv! Link for everyone: https://github.com/kbajalc/parquets.

@eatonphil
Copy link

Hmm after trying it myself kbajalc/parquets does not work in the browser either. Maybe I'm doing it wrong but it fails while importing thrift.

@dobesv
Copy link
Contributor

dobesv commented Jun 21, 2021

Make sure you're using thrift 0.14.0, I believe 0.13.0 was a broken build.

@eatonphil
Copy link

A problem is that thrift includes a lot of nodejs-only libraries:

 > node_modules/parquets/lib/compression.js:4:21: error: Could not resolve "zlib" (use "--platform=node" when building for node)
    4 │ const zlib = require("zlib");
      ╵                      ~~~~~~

 > node_modules/thrift/lib/nodejs/lib/thrift/log.js:20:19: error: Could not resolve "util" (use "--platform=node" when building for node)
    20 │ var util = require('util');
       ╵                    ~~~~~~

 > node_modules/thrift/lib/nodejs/lib/thrift/thrift.js:19:19: error: Could not resolve "util" (use "--platform=node" when building for node)
    19 │ var util = require('util');
       ╵                    ~~~~~~

 > node_modules/thrift/lib/nodejs/lib/thrift/ws_connection.js:19:19: error: Could not resolve "util" (use "--platform=node" when building for node)
    19 │ var util = require('util');
       ╵                    ~~~~~~

 > node_modules/thrift/lib/nodejs/lib/thrift/ws_connection.js:21:27: error: Could not resolve "events" (use "--platform=node" when building for node)
    21 │ var EventEmitter = require("events").EventEmitter;

So it doesn't help me out trying to run parquets in the browser :/

@dobesv
Copy link
Contributor

dobesv commented Jun 21, 2021

Maybe these webpack settings will help:

resolve: {
    extensions,
    fallback: {
      assert: require.resolve('assert/'),
      console: require.resolve('console-browserify'),
      crypto: require.resolve('crypto-browserify'),
      domain: require.resolve('domain-browser'),
      events: require.resolve('events'),
      path: require.resolve('path-browserify'),
      stream: require.resolve('stream-browserify'),
      string_decoder: require.resolve('string_decoder/'),
      util: require.resolve('util/util.js'),
      vm: require.resolve('vm-browserify'),
      zlib: require.resolve('browserify-zlib'),
    },
    mainFields: ['browser', 'main', 'module'],
    modules: modulesSearchPath,
    alias: enableHotReload ? { 'react-dom': '@hot-loader/react-dom' } : {},
  },

@kylebarron
Copy link

kylebarron commented Mar 6, 2022

Maybe relevant to people in this thread: I have a basic but functional WebAssembly Parquet reader/writer here: https://github.com/kylebarron/parquet-wasm, compiled from Rust.

@jonnor
Copy link

jonnor commented Jun 6, 2022

There also seems to be a fork with browser support (and Typescript types) at https://github.com/LibertyDSNP/parquetjs - which is also available on NPM.

@plotka
Copy link

plotka commented Jun 15, 2022

I have been using a derived package, parquets in the browser, and it works.

@dobesv Would you mind sharing an example implementation? I am struggling to make it work in the browser.

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

9 participants