Skip to content

Commit 9b84f9b

Browse files
authored
Merge pull request #8 from sanjibansg/cli
feat: CLI tool for visualizing plans
2 parents 153dc81 + c013471 commit 9b84f9b

20 files changed

+8866
-2595
lines changed

.eslintrc.cjs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
plugins: ['@typescript-eslint', 'prettier', 'import'],
4+
ignorePatterns: ['node_modules/', 'dist/', 'generated/'],
5+
extends: ['plugin:@typescript-eslint/recommended', 'prettier'],
6+
rules: {
7+
'@typescript-eslint/no-explicit-any': 'off',
8+
'prettier/prettier': 'error',
9+
'import/order': [
10+
'error',
11+
{
12+
'groups': [['builtin', 'external'], ['internal', 'parent', 'sibling', 'index']],
13+
'newlines-between': 'always',
14+
},
15+
],
16+
},
17+
};

.eslintrc.js

-12
This file was deleted.

.github/workflows/lint.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Lint
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
66
ESLint:

.github/workflows/test.yaml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: substraitJS
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
9+
strategy:
10+
matrix:
11+
node-version: [18]
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Initialize and update submodules
17+
run: |
18+
git submodule update --init --recursive
19+
20+
- name: Use Node.js
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: 18
24+
cache: "npm"
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Run tests
30+
run: npm run test
31+

README.md

+25-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
# susbtrait-js
3-
Typescript typings for Substrait specifications. Also provides a parser for translating substrait plans.
3+
Typescript typings for Substrait specifications. Also provides a parser for translating substrait plans and a CLI tool to visualize substrait plans.
44

55
Substrait is cross-language specification for data compute operations, composed primarily of:
66
1. a formal specification
@@ -29,6 +29,30 @@ Installation includes the following steps:
2929
npm ci
3030
npm run build
3131
```
32+
33+
## Visualization
34+
substrait-JS provides a CLI tool for exporting graph visualization of substrait JSON and binary plans. The tool currently uses the `--experimental-specifier-resolution` flag for module resolution. The visualization functions are the required helper methods for the [substrait-fiddle](https://github.com/voltrondata/substrait-fiddle) tool.
35+
36+
The tool uses [viz-js](https://github.com/mdaines/viz-js) for rendering plots on JSDOM using [Graphviz](https://graphviz.org/)'s DOT language.
37+
38+
Plot generation includes the following steps:
39+
```
40+
// The tool currently requires NodeJS version 18.0.0 for operation
41+
source ~/.nvm/nvm.sh
42+
nvm use 18.0.0
43+
44+
substrait -p ../plan.json -o <output path>
45+
```
46+
47+
## Testing
48+
Jest is used for testing the visualization functionality of the library. To run the test, we need
49+
to use `nvm v18.0.0`
50+
```
51+
source ~/.nvm/nvm.sh
52+
nvm use 18.0.0
53+
54+
npm run test
55+
```
3256

3357
## License
3458
[Apache-2.0 license](https://www.apache.org/licenses/LICENSE-2.0)

0 commit comments

Comments
 (0)