Enforce schema during conversion from binary to hex
Browse files
README.md
CHANGED
|
@@ -58,7 +58,7 @@ In binary form, the raw bytes are stored in most fields:
|
|
| 58 |
```python
|
| 59 |
datasets.Features({
|
| 60 |
"chain_id": datasets.features.Value(dtype='uint64'),
|
| 61 |
-
"block_number": datasets.features.Value(dtype='
|
| 62 |
'block_hash': datasets.features.Value(dtype='large_binary'),
|
| 63 |
'transaction_hash': datasets.features.Value(dtype='large_binary'),
|
| 64 |
'deployer_address': datasets.features.Value(dtype='large_binary'),
|
|
|
|
| 58 |
```python
|
| 59 |
datasets.Features({
|
| 60 |
"chain_id": datasets.features.Value(dtype='uint64'),
|
| 61 |
+
"block_number": datasets.features.Value(dtype='uint64'),
|
| 62 |
'block_hash': datasets.features.Value(dtype='large_binary'),
|
| 63 |
'transaction_hash': datasets.features.Value(dtype='large_binary'),
|
| 64 |
'deployer_address': datasets.features.Value(dtype='large_binary'),
|
hexify.py
CHANGED
|
@@ -16,7 +16,7 @@ OUTPUT_DATASET_PATH = 'hex/ethereum/train/'
|
|
| 16 |
|
| 17 |
INPUT_SCHEMA = pa.schema(fields=[
|
| 18 |
pl.field('chain_id', pa.uint64()),
|
| 19 |
-
pl.field('block_number', pa.
|
| 20 |
pl.field('block_hash', pa.large_binary()),
|
| 21 |
pl.field('transaction_hash', pa.large_binary()),
|
| 22 |
pl.field('deployer_address', pa.large_binary()),
|
|
@@ -84,7 +84,7 @@ def process_dataset(dataset: pq.ParquetDataset, output: str=OUTPUT_DATASET_PATH,
|
|
| 84 |
for __f in dataset.fragments:
|
| 85 |
__path = os.path.join(output, os.path.basename(__f.path))
|
| 86 |
# encode each record
|
| 87 |
-
__table = pl.Table.from_pylist(process_table(table=__f.to_table()))
|
| 88 |
# save
|
| 89 |
pq.write_table(table=__table, where=__path)
|
| 90 |
# log
|
|
|
|
| 16 |
|
| 17 |
INPUT_SCHEMA = pa.schema(fields=[
|
| 18 |
pl.field('chain_id', pa.uint64()),
|
| 19 |
+
pl.field('block_number', pa.uint64()),
|
| 20 |
pl.field('block_hash', pa.large_binary()),
|
| 21 |
pl.field('transaction_hash', pa.large_binary()),
|
| 22 |
pl.field('deployer_address', pa.large_binary()),
|
|
|
|
| 84 |
for __f in dataset.fragments:
|
| 85 |
__path = os.path.join(output, os.path.basename(__f.path))
|
| 86 |
# encode each record
|
| 87 |
+
__table = pl.Table.from_pylist(process_table(table=__f.to_table()), schema=schema)
|
| 88 |
# save
|
| 89 |
pq.write_table(table=__table, where=__path)
|
| 90 |
# log
|