-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5ad5baa
commit 6d9d745
Showing
7 changed files
with
107 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { ReadMultiBPTree } from "../btree/multi"; | ||
import { PageFile } from "../btree/pagefile"; | ||
import { readFileMeta } from "../index-file/meta"; | ||
import { RangeResolver } from "../resolver"; | ||
import { readBinaryFile } from "./test-util"; | ||
|
||
describe("test index-file parsing", () => { | ||
|
||
let mockRangeResolver: RangeResolver; | ||
|
||
beforeEach(() => { | ||
mockRangeResolver = async ({ start, end }) => { | ||
const indexFile = await readBinaryFile("green_tripdata_2023-01.csv.index"); | ||
const slicedPart = indexFile.slice(start, end + 1); | ||
|
||
const arrayBuffer = slicedPart.buffer.slice(slicedPart.byteOffset, slicedPart.byteOffset + slicedPart.byteLength); | ||
|
||
|
||
|
||
console.log("indexFile", start, end, arrayBuffer.byteLength); | ||
|
||
return { | ||
data: arrayBuffer, | ||
totalLength: arrayBuffer.byteLength, | ||
} | ||
} | ||
}); | ||
|
||
|
||
|
||
it("should read the file meta", async () => { | ||
const pageFile = new PageFile(mockRangeResolver); | ||
|
||
const tree = ReadMultiBPTree(mockRangeResolver, pageFile); | ||
|
||
const metadata = await tree.metadata(); | ||
|
||
const fileMeta = await readFileMeta(metadata); | ||
|
||
console.log(fileMeta); | ||
|
||
expect(fileMeta.format).toEqual(1); | ||
expect(fileMeta.version).toEqual(1); | ||
|
||
console.log(fileMeta.readOffset) | ||
|
||
}); | ||
|
||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters