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

Use Flechette for Apache Arrow processing #362

Merged
merged 16 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: Update to flechette 0.0.5.
  • Loading branch information
jheer committed Sep 16, 2024
commit d1ccd5c2c6a6a7259b76b57a0b8b7ca7e7235fdb
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"prepublishOnly": "npm test && npm run build"
},
"dependencies": {
"@uwdata/flechette": "~0.0.4",
"@uwdata/flechette": "~0.0.5",
"acorn": "^8.12.1",
"apache-arrow": "^17.0.0",
"node-fetch": "^3.3.2"
Expand Down
9 changes: 4 additions & 5 deletions src/arrow/from-arrow.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,16 @@ export default function(input, options) {
const cols = columnSet();
sel.forEach((name, key) => {
const col = arrow.getChild(key);
const { typeId } = fields.find(f => f.name === key).type;
cols.add(name, typeId === -1 ? dictionaryColumn(col) : col);
cols.add(name, col.type.typeId === -1 ? dictionary(col) : col);
});

return new ColumnTable(cols.data, cols.names);
}

function dictionaryColumn(column) {
function dictionary(column) {
const { data, length, nullCount } = column;
const batch = data[data.length - 1];
// flechette ?? arrow-js
// support both flechette and arrow-js
const cache = batch.cache ?? batch.dictionary.toArray();
const size = cache.length;
const keys = dictKeys(data, length, nullCount, size);
Expand Down Expand Up @@ -120,7 +119,7 @@ function nullKeys(data, keys, key) {
for (let i = 0, idx = 0, byte; i < n; ++i) {
const batch = data[i];
const { length } = batch;
// flechette ?? arrow-js
// support both flechette and arrow-js
const validity = batch.validity ?? batch.nullBitmap;
const m = length >> 3;
if (validity && validity.length) {
Expand Down
1 change: 1 addition & 0 deletions src/arrow/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type ArrowInput =
| ArrowTable;

export interface ArrowColumn<T> extends ColumnType<T> {
type: ArrowDataType;
nullCount: number;
toArray(): ColumnType<T>
}
Expand Down