Skip to content

Commit

Permalink
fix visit_full function
Browse files Browse the repository at this point in the history
  • Loading branch information
bmschmidt committed Jun 5, 2024
1 parent dc70233 commit 01e192e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Deeptable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,29 +498,31 @@ export class Deeptable {

let seen = 0;
const start = starting_tile || this.root_tile;
await start.deriveManifestInfoFromTileMetadata();
await start.populateManifest();
const total_points = JSON.parse(
start.record_batch.schema.metadata.get('total_points') || '1000000',
) as number;

async function resolve(tile: Tile) {
await tile.deriveManifestInfoFromTileMetadata();
async function visit(tile: Tile) {
await tile.populateManifest();
if (!filter(tile)) {
return;
}
if (after) {
await Promise.all(tile.loadedChildren.map(resolve));
const children = await tile.allChildren();
await Promise.all(children.map(visit));
await callback(tile);
seen += tile.record_batch.numRows;
void updateFunction(tile, seen, total_points);
} else {
await callback(tile);
seen += tile.record_batch.numRows;
void updateFunction(tile, seen, total_points);
await Promise.all(tile.loadedChildren.map(resolve));
const children = await tile.allChildren();
await Promise.all(children.map(visit));
}
}
await resolve(start);
await visit(start);
}

schema() {
Expand Down

0 comments on commit 01e192e

Please sign in to comment.