Skip to content

Commit 68b3154

Browse files
author
Wes Biggs
committed
Change to use STRING instead of BYTE_ARRAY for (targetC|c)ontentHash columns
1 parent ae7fe5c commit 68b3154

10 files changed

+17
-21
lines changed

__snapshots__/parquet.spec.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ exports[`DSNP Schema Conversion Test File schema is encoded correctly 1`] = `
2727
"type_length": null,
2828
},
2929
{
30-
"converted_type": null,
30+
"converted_type": 0,
3131
"field_id": null,
3232
"logicalType": null,
3333
"name": "contentHash",
@@ -90,7 +90,7 @@ ParquetSchema {
9090
"dLevelMax": 0,
9191
"encoding": "PLAIN",
9292
"name": "contentHash",
93-
"originalType": undefined,
93+
"originalType": "UTF8",
9494
"path": [
9595
"contentHash",
9696
],
@@ -160,7 +160,7 @@ ParquetSchema {
160160
"dLevelMax": 0,
161161
"encoding": "PLAIN",
162162
"name": "contentHash",
163-
"originalType": undefined,
163+
"originalType": "UTF8",
164164
"path": [
165165
"contentHash",
166166
],
@@ -218,7 +218,7 @@ ParquetSchema {
218218
"compression": "GZIP",
219219
"encoding": "PLAIN",
220220
"statistics": false,
221-
"type": "BYTE_ARRAY",
221+
"type": "UTF8",
222222
},
223223
"fromId": {
224224
"compression": "GZIP",

parquet.spec.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe("DSNP Schema Conversion Test File", () => {
1010

1111
const row1 = {
1212
announcementType: AnnouncementType.Broadcast,
13-
contentHash: "0x12345678",
13+
contentHash: "bciqdnu347gcfmxzbkhgoubiobphm6readngitfywktdtbdocgogop2q",
1414
fromId: 12n,
1515
url: "https://github.com/LibertyDSNP/parquetjs/",
1616
};
@@ -35,18 +35,14 @@ describe("DSNP Schema Conversion Test File", () => {
3535
it("schema is generated correctly", () => {
3636
expect(parquetSchema).toMatchSnapshot();
3737
});
38-
38+
3939
it("schema is encoded correctly", () => {
4040
expect(reader.metadata?.schema).toMatchSnapshot();
4141
});
4242

4343
it("output matches input", async () => {
4444
const cursor = reader.getCursor();
4545
const row = await cursor.next();
46-
const rowData = {
47-
...row1,
48-
contentHash: Buffer.from([48, 120, 49, 50, 51, 52, 53, 54, 55, 56]),
49-
};
50-
expect(row).toEqual(rowData);
46+
expect(row).toEqual(row1);
5147
});
5248
});

parquet/broadcast.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe("Broadcast Spec", () => {
77

88
testCompression("broadcast", broadcastSchema, () => ({
99
announcementType: 2,
10-
contentHash: generators.generateHash(),
10+
contentHash: "bciqdnu347gcfmxzbkhgoubiobphm6readngitfywktdtbdocgogop2q",
1111
fromId: generators.randInt(10000000),
1212
url: `https://www.imadapp.com/data/posts/${generators.generateHash()}`,
1313
}));

parquet/broadcast.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const broadcast: DSNPParquetSchema = [
1414
},
1515
{
1616
name: "contentHash",
17-
column_type: "BYTE_ARRAY",
17+
column_type: "STRING",
1818
compression: "GZIP",
1919
bloom_filter: true,
2020
},

parquet/reply.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe("Reply Spec", () => {
77

88
testCompression("reply", replySchema, () => ({
99
announcementType: 3,
10-
contentHash: generators.generateHash(),
10+
contentHash: "bciqdnu347gcfmxzbkhgoubiobphm6readngitfywktdtbdocgogop2q",
1111
fromId: generators.randInt(10000000),
1212
inReplyTo: `dsnp://${generators.randInt(10000000)}/${generators.generateHash()}`,
1313
url: `https://www.imadapp.com/data/posts/${generators.generateHash()}`,

parquet/reply.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const reply: DSNPParquetSchema = [
1414
},
1515
{
1616
name: "contentHash",
17-
column_type: "BYTE_ARRAY",
17+
column_type: "STRING",
1818
compression: "GZIP",
1919
bloom_filter: true,
2020
},

parquet/tombstone.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ describe("Tombstone Spec", () => {
99
announcementType: 0,
1010
fromId: generators.randInt(10000000),
1111
targetAnnouncementType: 2,
12-
targetContentHash: generators.generateHash(),
12+
targetContentHash: "bciqdnu347gcfmxzbkhgoubiobphm6readngitfywktdtbdocgogop2q",
1313
}));
1414
});

parquet/tombstone.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const tombstone: DSNPParquetSchema = [
3636
},
3737
{
3838
name: "targetContentHash",
39-
column_type: "BYTE_ARRAY",
39+
column_type: "STRING",
4040
compression: "GZIP",
4141
bloom_filter: true,
4242
},

parquet/update.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ describe("Update Spec", () => {
77

88
testCompression("update", updateSchema, () => ({
99
announcementType: 6,
10-
contentHash: generators.generateHash(),
10+
contentHash: "bciqdnu347gcfmxzbkhgoubiobphm6readngitfywktdtbdocgogop2q",
1111
fromId: generators.randInt(10000000),
1212
targetAnnouncementType: 2,
13-
targetContentHash: generators.generateHash(),
13+
targetContentHash: "bciqdnu347gcfmxzbkhgoubiobphm6readngitfywktdtbdocgogop2q",
1414
url: `https://www.imadapp.com/data/posts/${generators.generateHash()}`,
1515
}));
1616
});

parquet/update.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const update: DSNPParquetSchema = [
1414
},
1515
{
1616
name: "contentHash",
17-
column_type: "BYTE_ARRAY",
17+
column_type: "STRING",
1818
compression: "GZIP",
1919
bloom_filter: true,
2020
},
@@ -48,7 +48,7 @@ const update: DSNPParquetSchema = [
4848
},
4949
{
5050
name: "targetContentHash",
51-
column_type: "BYTE_ARRAY",
51+
column_type: "STRING",
5252
compression: "GZIP",
5353
bloom_filter: true,
5454
},

0 commit comments

Comments
 (0)