Rows added on release-2026-11-21.2: pointers 611 to 614, made by the table store
Browse files- data/biorxiv-medrxiv/added-000611-000614.parquet +3 -0
- data/europe-pmc-open-access/added-000611-000614.parquet +3 -0
- data/gh-archive-events/added-000611-000614.parquet +3 -0
- data/github-repositories/added-000611-000614.parquet +3 -0
- data/kde-webkit-gentoo-bugzilla/added-000611-000614.parquet +3 -0
- data/mozilla-bugzilla/added-000611-000614.parquet +3 -0
- data/opendev-meeting-logs/added-000611-000614.parquet +3 -0
- data/software-heritage-graph-index/added-000611-000614.parquet +3 -0
- data/zenodo/added-000611-000614.parquet +3 -0
- data/zulip-public-chats/added-000611-000614.parquet +3 -0
- meta/batches.parquet +2 -2
- meta/bench_checked.parquet +2 -2
- meta/catalog.parquet +2 -2
- meta/sources.json +45 -0
- tools/fetch.py +149 -7
data/biorxiv-medrxiv/added-000611-000614.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0f5737ef9442de8d40f22e77d702be245798fdd471e53f3ffb189e666d5edf72
|
| 3 |
+
size 7700085
|
data/europe-pmc-open-access/added-000611-000614.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8f5efdf9f8668b31634a4a87ad803b69412aa2e73d65799e89677c2fbc0868a2
|
| 3 |
+
size 5863890
|
data/gh-archive-events/added-000611-000614.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9e5f7e42de3c8b4534afe71fb201ec0177cf466b273813608202ae16d097c644
|
| 3 |
+
size 206201
|
data/github-repositories/added-000611-000614.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e18d21fea3b412f007c39d6c216cca53065b4a2e30e1d90a55eebd4d6b8ba240
|
| 3 |
+
size 6544189
|
data/kde-webkit-gentoo-bugzilla/added-000611-000614.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:edf6a8b14c7943d4684ce8761f6eccec5c27164ef14964208e2c6119e5952a61
|
| 3 |
+
size 25143
|
data/mozilla-bugzilla/added-000611-000614.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a7a347b3bd4bffc33359605bb8390af62bacbbb5213e558956081c49daf117ff
|
| 3 |
+
size 234390
|
data/opendev-meeting-logs/added-000611-000614.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8d1ff6c3280a4fa3d6d18b68a7af0c8a7dd33277a93bee7d28b3eea3501a1ec0
|
| 3 |
+
size 1338858
|
data/software-heritage-graph-index/added-000611-000614.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:87fffbd7bc4fc4e8b2c714d18d460d2f9fcafc6bab5c4db624720b5b9c9cbe62
|
| 3 |
+
size 22022
|
data/zenodo/added-000611-000614.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9e9d5d02bb1a9e4660c4c9d7a9bd3dfe06fc60305683001c3dda4b51a695a39d
|
| 3 |
+
size 909233921
|
data/zulip-public-chats/added-000611-000614.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d43db8ba999d1f9215dad05b4755c346a92193bf627551504502d4592d81abe9
|
| 3 |
+
size 11112
|
meta/batches.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:11026afe69a861836f157bbcc499b3090d8472bf0a61ee5acb60f788aba6e250
|
| 3 |
+
size 69959
|
meta/bench_checked.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:30ae4434209cfad76bd0efac42dea408259239a02c2af3c54db8c94aef89eda8
|
| 3 |
+
size 69876
|
meta/catalog.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6ecd2c1fe9b0d72465c8083e7d46db6f2469461a8eb6ad16ec9cccaf6c208aec
|
| 3 |
+
size 389748
|
meta/sources.json
CHANGED
|
@@ -14793,6 +14793,21 @@
|
|
| 14793 |
},
|
| 14794 |
"rows": 1923669,
|
| 14795 |
"status": "complete"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14796 |
}
|
| 14797 |
],
|
| 14798 |
"by_ext": {
|
|
@@ -21417,6 +21432,21 @@
|
|
| 21417 |
},
|
| 21418 |
"rows": 3430386,
|
| 21419 |
"status": "complete"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21420 |
}
|
| 21421 |
],
|
| 21422 |
"by_ext": {
|
|
@@ -32422,6 +32452,21 @@
|
|
| 32422 |
},
|
| 32423 |
"rows": 1300638,
|
| 32424 |
"status": "complete"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32425 |
}
|
| 32426 |
],
|
| 32427 |
"by_ext": {
|
|
|
|
| 14793 |
},
|
| 14794 |
"rows": 1923669,
|
| 14795 |
"status": "complete"
|
| 14796 |
+
},
|
| 14797 |
+
{
|
| 14798 |
+
"batch": "inc",
|
| 14799 |
+
"bytes": 28927135,
|
| 14800 |
+
"content": [
|
| 14801 |
+
"issue-tickets"
|
| 14802 |
+
],
|
| 14803 |
+
"files": 1,
|
| 14804 |
+
"license": {
|
| 14805 |
+
"name": "Copyright of the contributors; no license stated",
|
| 14806 |
+
"redistribution_ok": "unknown",
|
| 14807 |
+
"training_ok": "unknown"
|
| 14808 |
+
},
|
| 14809 |
+
"rows": 160,
|
| 14810 |
+
"status": "complete"
|
| 14811 |
}
|
| 14812 |
],
|
| 14813 |
"by_ext": {
|
|
|
|
| 21432 |
},
|
| 21433 |
"rows": 3430386,
|
| 21434 |
"status": "complete"
|
| 21435 |
+
},
|
| 21436 |
+
{
|
| 21437 |
+
"batch": "inc",
|
| 21438 |
+
"bytes": 75611201,
|
| 21439 |
+
"content": [
|
| 21440 |
+
"issue-tickets"
|
| 21441 |
+
],
|
| 21442 |
+
"files": 1,
|
| 21443 |
+
"license": {
|
| 21444 |
+
"name": "No license stated for bug content",
|
| 21445 |
+
"redistribution_ok": "unknown",
|
| 21446 |
+
"training_ok": "unknown"
|
| 21447 |
+
},
|
| 21448 |
+
"rows": 2999,
|
| 21449 |
+
"status": "complete"
|
| 21450 |
}
|
| 21451 |
],
|
| 21452 |
"by_ext": {
|
|
|
|
| 32452 |
},
|
| 32453 |
"rows": 1300638,
|
| 32454 |
"status": "complete"
|
| 32455 |
+
},
|
| 32456 |
+
{
|
| 32457 |
+
"batch": "inc",
|
| 32458 |
+
"bytes": 3597,
|
| 32459 |
+
"content": [
|
| 32460 |
+
"chat-logs"
|
| 32461 |
+
],
|
| 32462 |
+
"files": 1,
|
| 32463 |
+
"license": {
|
| 32464 |
+
"name": "No content license stated; Zulip Cloud Terms of Service",
|
| 32465 |
+
"redistribution_ok": "conditional",
|
| 32466 |
+
"training_ok": "no"
|
| 32467 |
+
},
|
| 32468 |
+
"rows": 13,
|
| 32469 |
+
"status": "complete"
|
| 32470 |
}
|
| 32471 |
],
|
| 32472 |
"by_ext": {
|
tools/fetch.py
CHANGED
|
@@ -118,6 +118,9 @@ is written, at the unit's place; its manifest line says extracted and keeps the
|
|
| 118 |
The steps run in transform.py, taken from next to this script or else from tools/ of the index at the commit read
|
| 119 |
(or of the local --data copy). A unit marked expand (an archive meant to be used as a folder) is delivered as the
|
| 120 |
archive; tools/to_pool.py unpacks it (python to_pool.py DIR --out ./pools --name <name>).
|
|
|
|
|
|
|
|
|
|
| 121 |
|
| 122 |
--sample N takes at most N units per selected source (a source with fewer gives all it has), the same ones on every
|
| 123 |
run, so a category can be tried within a few MB;
|
|
@@ -166,9 +169,14 @@ Rows built from a selection file (a collection tag campaign:<name>) carry their
|
|
| 166 |
source_meta (pool_domain, pool_leaf, pool_path, unit_group, origin_kind, pool_fields and the
|
| 167 |
others in CAMPAIGN_KEYS); the layout above follows them, and fetch_manifest.jsonl copies them as they are. Some
|
| 168 |
of these rows point at small files kept in the index repository itself (uri campaign_files/...); such a uri is
|
| 169 |
-
read from the same commit as the tables (or from the local --data copy)
|
| 170 |
-
|
| 171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
|
| 173 |
Examples:
|
| 174 |
|
|
@@ -797,6 +805,9 @@ CAMPAIGN_KEYS = ("campaign", "pool_domain", "pool_leaf", "pool_path", "pool_sour
|
|
| 797 |
"original_name", "generated_by", "expand", "expand_rule")
|
| 798 |
# a uri without a scheme that starts here names a file in the index repository, at the commit the tables are read at
|
| 799 |
REPO_FILES = "campaign_files/"
|
|
|
|
|
|
|
|
|
|
| 800 |
|
| 801 |
|
| 802 |
# ---------- SQL ----------
|
|
@@ -1856,7 +1867,9 @@ def catalog_table(con, root: str) -> dict:
|
|
| 1856 |
where this revision of the catalog has no such column; #2006: from its column fetch_check, FETCH_CHECK, or in
|
| 1857 |
release-2026-11-09.1 from its column fetch), and (#1746) data_files and batch_files (DATA_FILES, BATCH_FILES: the
|
| 1858 |
repository paths of the source's data files, and of each batch's) only where this revision of the catalog has them
|
| 1859 |
-
(source_files)
|
|
|
|
|
|
|
| 1860 |
of DuckDB's parser, so an unquoted fetch.level does not parse. -> {column: present}, FETCH_CHECK for the fetch check
|
| 1861 |
under either name."""
|
| 1862 |
con.execute(f"CREATE OR REPLACE TABLE s_raw AS SELECT * FROM read_parquet({sql_str(root + '/' + CATALOG)})")
|
|
@@ -1879,6 +1892,7 @@ def catalog_table(con, root: str) -> dict:
|
|
| 1879 |
col(f"{fc}.fetched", "fetch_fetched", "BIGINT", fetch),
|
| 1880 |
col(f"{fc}.read_at", "fetch_read_at", "VARCHAR", fetch)]
|
| 1881 |
cols += [c for c in (DATA_FILES, BATCH_FILES) if c in have]
|
|
|
|
| 1882 |
cols += [col("kind", "kind", "VARCHAR", "kind" in have), col("units", "units", "BIGINT", "units" in have)]
|
| 1883 |
con.execute(f"CREATE OR REPLACE TABLE s AS SELECT {', '.join(cols)} FROM s_raw")
|
| 1884 |
con.execute("DROP TABLE s_raw")
|
|
@@ -4363,6 +4377,8 @@ def package_kind(uri) -> str | None:
|
|
| 4363 |
return "tar_package"
|
| 4364 |
if path.endswith(SEVENZIP_SUFFIXES):
|
| 4365 |
return "sevenzip_member"
|
|
|
|
|
|
|
| 4366 |
return None
|
| 4367 |
|
| 4368 |
|
|
@@ -4458,6 +4474,42 @@ def fetch_tar_package(row, dest, url, timeout, opener):
|
|
| 4458 |
return _finish(row, dest, data, url, "tar_package")
|
| 4459 |
|
| 4460 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4461 |
# 7z members: py7zr over remote_file (a solid block is decoded from its start up to the member)
|
| 4462 |
|
| 4463 |
SEVENZIP_BLOCK = 8 << 20 # bytes per range request when a 7z archive is read through remote_file
|
|
@@ -4538,6 +4590,55 @@ def fetch_gzip_member(row, dest, url, timeout, opener):
|
|
| 4538 |
return res
|
| 4539 |
|
| 4540 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4541 |
# requester-pays S3 (the requester's own AWS account pays; credentials come from the environment)
|
| 4542 |
|
| 4543 |
AWS_REGION = "us-east-1"
|
|
@@ -4692,6 +4793,9 @@ def method_of(row: dict) -> str:
|
|
| 4692 |
return "zip_member"
|
| 4693 |
if scope == "gzip_member":
|
| 4694 |
return "gzip_member"
|
|
|
|
|
|
|
|
|
|
| 4695 |
if row.get("member_path") is not None and not _rng(row):
|
| 4696 |
kind = package_kind(row.get("uri"))
|
| 4697 |
if kind:
|
|
@@ -4709,7 +4813,9 @@ def method_of(row: dict) -> str:
|
|
| 4709 |
|
| 4710 |
FETCHERS = {"file": fetch_file, "range": fetch_file, "warc_record": fetch_payload, "api_body": fetch_api_body,
|
| 4711 |
"zip_member": fetch_member, "zip_package": fetch_zip_package, "tar_package": fetch_tar_package,
|
|
|
|
| 4712 |
"sevenzip_member": fetch_sevenzip_member, "gzip_member": fetch_gzip_member,
|
|
|
|
| 4713 |
"lichess_game": fetch_lichess_game, "zip_member_deflate": fetch_zip_deflate,
|
| 4714 |
"html_region": fetch_html_region, REGISTRY_SCOPE: fetch_registry_manifest}
|
| 4715 |
|
|
@@ -5642,6 +5748,39 @@ def resolve_repo_uri(row: dict, root: str, public: str | None = None) -> dict:
|
|
| 5642 |
return out
|
| 5643 |
|
| 5644 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5645 |
def campaign_fields(row: dict) -> dict:
|
| 5646 |
"""The CAMPAIGN_KEYS of the row's source_meta, for the manifest line."""
|
| 5647 |
sm = row.get("source_meta") if isinstance(row.get("source_meta"), dict) else {}
|
|
@@ -6181,7 +6320,7 @@ def main(argv=None) -> int:
|
|
| 6181 |
rounds = 0
|
| 6182 |
secs = 0.0
|
| 6183 |
try:
|
| 6184 |
-
queries, specs, entries, cat = [], {}, {}, {}
|
| 6185 |
try:
|
| 6186 |
with step_bar("reading the index", "tables", 1, args.quiet) as bar:
|
| 6187 |
has = waiting(bar, con, catalog_table, con, root)
|
|
@@ -6224,6 +6363,8 @@ def main(argv=None) -> int:
|
|
| 6224 |
for s, d, sp, f, lv, fr, ff, fd in con.execute(
|
| 6225 |
"SELECT source, domain, spdx, files, fetch_level, fetch_rows, fetch_fetched, fetch_read_at "
|
| 6226 |
"FROM s").fetchall()}
|
|
|
|
|
|
|
| 6227 |
if sources and batches != []:
|
| 6228 |
names = sorted({s for s, _ in batches}) if batches else sources
|
| 6229 |
# the sources whose rows the selection reads: every one but those whose units are read in place
|
|
@@ -6394,8 +6535,9 @@ def main(argv=None) -> int:
|
|
| 6394 |
elif args.select_only:
|
| 6395 |
res = {**_key(row), "status": "selected", "spdx": layout.spdx(row)}
|
| 6396 |
else:
|
| 6397 |
-
res = {**_key(row), **
|
| 6398 |
-
|
|
|
|
| 6399 |
if args.decompress and res.get("status") == "ok" and res.get("path"):
|
| 6400 |
d = decompress_file(Path(res["path"]), row, cap_of(row))
|
| 6401 |
if d is not None:
|
|
|
|
| 118 |
The steps run in transform.py, taken from next to this script or else from tools/ of the index at the commit read
|
| 119 |
(or of the local --data copy). A unit marked expand (an archive meant to be used as a folder) is delivered as the
|
| 120 |
archive; tools/to_pool.py unpacks it (python to_pool.py DIR --out ./pools --name <name>).
|
| 121 |
+
A row whose source_meta names a cell of a Parquet table (parquet_column, parquet_key_column, parquet_key,
|
| 122 |
+
parquet_row) is a member of the tar archive that cell holds (parquet_member): the table's row is read by DuckDB over
|
| 123 |
+
the network, the member taken out of the archive and checked against the row.
|
| 124 |
|
| 125 |
--sample N takes at most N units per selected source (a source with fewer gives all it has), the same ones on every
|
| 126 |
run, so a category can be tried within a few MB;
|
|
|
|
| 169 |
source_meta (pool_domain, pool_leaf, pool_path, unit_group, origin_kind, pool_fields and the
|
| 170 |
others in CAMPAIGN_KEYS); the layout above follows them, and fetch_manifest.jsonl copies them as they are. Some
|
| 171 |
of these rows point at small files kept in the index repository itself (uri campaign_files/...); such a uri is
|
| 172 |
+
read from the same commit as the tables (or from the local --data copy): as the member of that name of the zip the
|
| 173 |
+
catalog's column campaign_part names for the row's source (campaign_files/<protocol>/<part>.zip, the files of its
|
| 174 |
+
upstream's protocol, read by HTTP byte ranges, whose manifest line names it in campaign_part), and at the path itself
|
| 175 |
+
when the catalog names no part (a revision older than the parts) or the part does not give the file (a file a release
|
| 176 |
+
added since, which lies at its path until the next projection moves it into its part; the line's
|
| 177 |
+
campaign_part_reason says why). The manifests record the URL it was read from at that commit
|
| 178 |
+
(https://huggingface.co/datasets/<repo>/resolve/<commit>/campaign_files/...; for a local copy, at --revision, else at
|
| 179 |
+
main), and its uri as the row gives it.
|
| 180 |
|
| 181 |
Examples:
|
| 182 |
|
|
|
|
| 805 |
"original_name", "generated_by", "expand", "expand_rule")
|
| 806 |
# a uri without a scheme that starts here names a file in the index repository, at the commit the tables are read at
|
| 807 |
REPO_FILES = "campaign_files/"
|
| 808 |
+
# the catalog's column that names the campaign part holding a source's files of REPO_FILES (artpool.public_layout
|
| 809 |
+
# campaign_parts): a zip of one member per file, named by its repository path
|
| 810 |
+
CAMPAIGN_PART = "campaign_part"
|
| 811 |
|
| 812 |
|
| 813 |
# ---------- SQL ----------
|
|
|
|
| 1867 |
where this revision of the catalog has no such column; #2006: from its column fetch_check, FETCH_CHECK, or in
|
| 1868 |
release-2026-11-09.1 from its column fetch), and (#1746) data_files and batch_files (DATA_FILES, BATCH_FILES: the
|
| 1869 |
repository paths of the source's data files, and of each batch's) only where this revision of the catalog has them
|
| 1870 |
+
(source_files), and campaign_part (CAMPAIGN_PART: the campaign part that holds the source's files of the index
|
| 1871 |
+
repository; NULL where this revision has no such column). Every catalog column and struct field is read as a
|
| 1872 |
+
quoted identifier (col): fetch is a reserved word
|
| 1873 |
of DuckDB's parser, so an unquoted fetch.level does not parse. -> {column: present}, FETCH_CHECK for the fetch check
|
| 1874 |
under either name."""
|
| 1875 |
con.execute(f"CREATE OR REPLACE TABLE s_raw AS SELECT * FROM read_parquet({sql_str(root + '/' + CATALOG)})")
|
|
|
|
| 1892 |
col(f"{fc}.fetched", "fetch_fetched", "BIGINT", fetch),
|
| 1893 |
col(f"{fc}.read_at", "fetch_read_at", "VARCHAR", fetch)]
|
| 1894 |
cols += [c for c in (DATA_FILES, BATCH_FILES) if c in have]
|
| 1895 |
+
cols.append(col(CAMPAIGN_PART, CAMPAIGN_PART, "VARCHAR", CAMPAIGN_PART in have))
|
| 1896 |
cols += [col("kind", "kind", "VARCHAR", "kind" in have), col("units", "units", "BIGINT", "units" in have)]
|
| 1897 |
con.execute(f"CREATE OR REPLACE TABLE s AS SELECT {', '.join(cols)} FROM s_raw")
|
| 1898 |
con.execute("DROP TABLE s_raw")
|
|
|
|
| 4377 |
return "tar_package"
|
| 4378 |
if path.endswith(SEVENZIP_SUFFIXES):
|
| 4379 |
return "sevenzip_member"
|
| 4380 |
+
if path.endswith(".parquet"):
|
| 4381 |
+
return "table_member"
|
| 4382 |
return None
|
| 4383 |
|
| 4384 |
|
|
|
|
| 4474 |
return _finish(row, dest, data, url, "tar_package")
|
| 4475 |
|
| 4476 |
|
| 4477 |
+
def fetch_table_member(row, dest, url, timeout, opener):
|
| 4478 |
+
"""A file of a task held in one row of a Parquet table, as a member of the tar archive in that row (the task tables
|
| 4479 |
+
of artpool.hf_datasets): the table downloaded whole into the package cache, the row whose name column
|
| 4480 |
+
(source_meta.task_columns, "<name column> <archive column>") is source_meta.task read by DuckDB, and the member
|
| 4481 |
+
member_path less "<task>/" read out of its archive."""
|
| 4482 |
+
import duckdb
|
| 4483 |
+
|
| 4484 |
+
sm = row.get("source_meta") if isinstance(row.get("source_meta"), dict) else {}
|
| 4485 |
+
cols, task = str(sm.get("task_columns") or "").split(), str(sm.get("task") or "")
|
| 4486 |
+
if len(cols) != 2 or not task:
|
| 4487 |
+
raise Unsupported("a table member row without source_meta.task_columns and source_meta.task")
|
| 4488 |
+
path = download_package(url, timeout, opener, whole_cap_of(row))
|
| 4489 |
+
name = str(row.get("member_path") or "").removeprefix(task + "/")
|
| 4490 |
+
con = duckdb.connect()
|
| 4491 |
+
try:
|
| 4492 |
+
got = con.execute(f"SELECT {_ident(cols[1])} FROM read_parquet(?) WHERE {_ident(cols[0])} = ?",
|
| 4493 |
+
[str(path), task]).fetchone()
|
| 4494 |
+
finally:
|
| 4495 |
+
con.close()
|
| 4496 |
+
if got is None:
|
| 4497 |
+
return {"status": "failed", "url": url, "reason": f"task {task} is not in the table"}
|
| 4498 |
+
limit = member_limit(row)
|
| 4499 |
+
try:
|
| 4500 |
+
tf = tarfile.open(fileobj=io.BytesIO(got[0]), mode="r:*")
|
| 4501 |
+
except (tarfile.TarError, OSError, EOFError) as e:
|
| 4502 |
+
return {"status": "failed", "url": url, "reason": f"cannot open task {task}'s archive: {e}"}
|
| 4503 |
+
with tf:
|
| 4504 |
+
m = _tar_lookup(tf, name)
|
| 4505 |
+
if m is None or not m.isfile():
|
| 4506 |
+
return {"status": "failed", "url": url, "reason": f"{name} is not a regular file of task {task}'s archive"}
|
| 4507 |
+
_too_large_unknown(row, m.size, limit)
|
| 4508 |
+
f = tf.extractfile(m)
|
| 4509 |
+
data = f.read(limit + 1) if f else b""
|
| 4510 |
+
return _finish(row, dest, data, url, "table_member")
|
| 4511 |
+
|
| 4512 |
+
|
| 4513 |
# 7z members: py7zr over remote_file (a solid block is decoded from its start up to the member)
|
| 4514 |
|
| 4515 |
SEVENZIP_BLOCK = 8 << 20 # bytes per range request when a 7z archive is read through remote_file
|
|
|
|
| 4590 |
return res
|
| 4591 |
|
| 4592 |
|
| 4593 |
+
# members of a tar archive held in one cell of a Parquet table (tasktrove: a task's folder, a gzipped tar archive in
|
| 4594 |
+
# the task's row): source_meta names the cell (PARQUET_CELL: its column, the column that names the row, the row's value
|
| 4595 |
+
# of it and the row's number) and the member (parquet_member; absent on a row that is the cell's bytes)
|
| 4596 |
+
PARQUET_CELL = ("parquet_column", "parquet_key_column", "parquet_key", "parquet_row")
|
| 4597 |
+
|
| 4598 |
+
|
| 4599 |
+
@functools.lru_cache(maxsize=8)
|
| 4600 |
+
def parquet_cell(url: str, column: str, key_column: str, key: str, row: int) -> bytes | None:
|
| 4601 |
+
"""The cell of column in row number row (from 0) of the Parquet table at url, a row whose key_column is key, read
|
| 4602 |
+
by DuckDB over the network (the row groups whose statistics may hold key) -> its bytes, None when the table has no
|
| 4603 |
+
such row; kept for the next members of the same cell."""
|
| 4604 |
+
con = connect(remote=True)
|
| 4605 |
+
try:
|
| 4606 |
+
got = con.execute(f"SELECT {_ident(column)} FROM read_parquet({sql_str(url)}, file_row_number = true) "
|
| 4607 |
+
f"WHERE {_ident(key_column)} = {sql_str(key)} AND file_row_number = {int(row)}").fetchone()
|
| 4608 |
+
finally:
|
| 4609 |
+
con.close()
|
| 4610 |
+
return None if got is None or got[0] is None else bytes(got[0])
|
| 4611 |
+
|
| 4612 |
+
|
| 4613 |
+
def fetch_parquet_cell_member(row, dest, url, timeout, opener):
|
| 4614 |
+
sm = row.get("source_meta") if isinstance(row.get("source_meta"), dict) else {}
|
| 4615 |
+
if any(sm.get(k) is None for k in PARQUET_CELL):
|
| 4616 |
+
raise Unsupported("a Parquet cell row without " + ", ".join(k for k in PARQUET_CELL if sm.get(k) is None))
|
| 4617 |
+
cell = parquet_cell(url, str(sm["parquet_column"]), str(sm["parquet_key_column"]), str(sm["parquet_key"]),
|
| 4618 |
+
int(sm["parquet_row"]))
|
| 4619 |
+
if cell is None:
|
| 4620 |
+
return {"status": "failed", "url": url, "reason": f"row {sm['parquet_row']} of the table has no "
|
| 4621 |
+
f"{sm['parquet_key_column']} {sm['parquet_key']}"}
|
| 4622 |
+
name = sm.get("parquet_member")
|
| 4623 |
+
if name is None:
|
| 4624 |
+
return _finish(row, dest, cell, url, "parquet_cell")
|
| 4625 |
+
limit = member_limit(row)
|
| 4626 |
+
try:
|
| 4627 |
+
tf = tarfile.open(fileobj=io.BytesIO(cell), mode="r:*")
|
| 4628 |
+
except (tarfile.TarError, OSError, EOFError) as e:
|
| 4629 |
+
return {"status": "failed", "url": url, "reason": f"cannot open the cell as a tar archive: {e}"}
|
| 4630 |
+
with tf:
|
| 4631 |
+
m = _tar_lookup(tf, str(name))
|
| 4632 |
+
if m is None:
|
| 4633 |
+
return {"status": "failed", "url": url, "reason": f"{name} is not in the cell's archive"}
|
| 4634 |
+
if not m.isfile():
|
| 4635 |
+
return {"status": "failed", "url": url, "reason": f"{name} is not a regular file in the cell's archive"}
|
| 4636 |
+
_too_large_unknown(row, m.size, limit)
|
| 4637 |
+
f = tf.extractfile(m)
|
| 4638 |
+
data = f.read(limit + 1) if f else b""
|
| 4639 |
+
return _finish(row, dest, data, url, "parquet_cell_member")
|
| 4640 |
+
|
| 4641 |
+
|
| 4642 |
# requester-pays S3 (the requester's own AWS account pays; credentials come from the environment)
|
| 4643 |
|
| 4644 |
AWS_REGION = "us-east-1"
|
|
|
|
| 4793 |
return "zip_member"
|
| 4794 |
if scope == "gzip_member":
|
| 4795 |
return "gzip_member"
|
| 4796 |
+
sm = row.get("source_meta") if isinstance(row.get("source_meta"), dict) else {}
|
| 4797 |
+
if row.get("member_path") is not None and sm.get("parquet_column") is not None:
|
| 4798 |
+
return "parquet_cell_member"
|
| 4799 |
if row.get("member_path") is not None and not _rng(row):
|
| 4800 |
kind = package_kind(row.get("uri"))
|
| 4801 |
if kind:
|
|
|
|
| 4813 |
|
| 4814 |
FETCHERS = {"file": fetch_file, "range": fetch_file, "warc_record": fetch_payload, "api_body": fetch_api_body,
|
| 4815 |
"zip_member": fetch_member, "zip_package": fetch_zip_package, "tar_package": fetch_tar_package,
|
| 4816 |
+
"table_member": fetch_table_member,
|
| 4817 |
"sevenzip_member": fetch_sevenzip_member, "gzip_member": fetch_gzip_member,
|
| 4818 |
+
"parquet_cell_member": fetch_parquet_cell_member,
|
| 4819 |
"lichess_game": fetch_lichess_game, "zip_member_deflate": fetch_zip_deflate,
|
| 4820 |
"html_region": fetch_html_region, REGISTRY_SCOPE: fetch_registry_manifest}
|
| 4821 |
|
|
|
|
| 5748 |
return out
|
| 5749 |
|
| 5750 |
|
| 5751 |
+
def part_row(row: dict, part, root: str, public: str | None = None) -> dict | None:
|
| 5752 |
+
"""A row resolve_repo_uri read (its repo_uri a file of the index repository) of a source whose files the campaign
|
| 5753 |
+
part part holds (the catalog's column CAMPAIGN_PART) -> the same row read as the member of that name of the part:
|
| 5754 |
+
the part read from root as resolve_repo_uri reads a repository path, member_path the file's repository path, so it
|
| 5755 |
+
is read as a zip member by byte ranges (fetch_zip_package); its part in _part. None for any other row, or without
|
| 5756 |
+
a part."""
|
| 5757 |
+
rp = row.get("repo_uri")
|
| 5758 |
+
if not part or not rp:
|
| 5759 |
+
return None
|
| 5760 |
+
base = {k: v for k, v in row.items() if k not in ("_local_file", "_public_url")}
|
| 5761 |
+
out = resolve_repo_uri({**base, "uri": part}, root, public)
|
| 5762 |
+
if out.get("repo_uri") != part:
|
| 5763 |
+
return None
|
| 5764 |
+
return {**out, "member_path": rp, "repo_uri": rp, "_part": part}
|
| 5765 |
+
|
| 5766 |
+
|
| 5767 |
+
def fetch_repo_unit(row: dict, part, root: str, public: str | None, out: Path, **kw) -> dict:
|
| 5768 |
+
"""fetch_unit of a row, a file of the index repository whose source's campaign part is part (part_row) read first
|
| 5769 |
+
as its member there, and at its own path when the part does not give it (a part a send held back, or a file a
|
| 5770 |
+
release added after the part was written) -> the manifest fields: campaign_part, the part it was read from, or
|
| 5771 |
+
campaign_part_reason, why the part did not give it; url and read_from as a local copy's file records them."""
|
| 5772 |
+
packed = part_row(row, part, root, public)
|
| 5773 |
+
if packed is not None:
|
| 5774 |
+
got = fetch_unit(packed, out, **kw)
|
| 5775 |
+
if got.get("status") == "ok":
|
| 5776 |
+
if packed.get("_public_url") and got.get("url") == packed.get("_local_file"):
|
| 5777 |
+
got.update(url=packed["_public_url"], read_from="local copy")
|
| 5778 |
+
return {**got, "campaign_part": packed["_part"]}
|
| 5779 |
+
why = f"{packed['_part']}: {got.get('status')}: {got.get('reason')}"
|
| 5780 |
+
got = fetch_unit(row, out, **kw)
|
| 5781 |
+
return {**got, "campaign_part_reason": why} if packed is not None else got
|
| 5782 |
+
|
| 5783 |
+
|
| 5784 |
def campaign_fields(row: dict) -> dict:
|
| 5785 |
"""The CAMPAIGN_KEYS of the row's source_meta, for the manifest line."""
|
| 5786 |
sm = row.get("source_meta") if isinstance(row.get("source_meta"), dict) else {}
|
|
|
|
| 6320 |
rounds = 0
|
| 6321 |
secs = 0.0
|
| 6322 |
try:
|
| 6323 |
+
queries, specs, entries, cat, camp_parts = [], {}, {}, {}, {}
|
| 6324 |
try:
|
| 6325 |
with step_bar("reading the index", "tables", 1, args.quiet) as bar:
|
| 6326 |
has = waiting(bar, con, catalog_table, con, root)
|
|
|
|
| 6363 |
for s, d, sp, f, lv, fr, ff, fd in con.execute(
|
| 6364 |
"SELECT source, domain, spdx, files, fetch_level, fetch_rows, fetch_fetched, fetch_read_at "
|
| 6365 |
"FROM s").fetchall()}
|
| 6366 |
+
camp_parts = dict(con.execute(
|
| 6367 |
+
f"SELECT source, {CAMPAIGN_PART} FROM s WHERE {CAMPAIGN_PART} IS NOT NULL").fetchall())
|
| 6368 |
if sources and batches != []:
|
| 6369 |
names = sorted({s for s, _ in batches}) if batches else sources
|
| 6370 |
# the sources whose rows the selection reads: every one but those whose units are read in place
|
|
|
|
| 6535 |
elif args.select_only:
|
| 6536 |
res = {**_key(row), "status": "selected", "spdx": layout.spdx(row)}
|
| 6537 |
else:
|
| 6538 |
+
res = {**_key(row), **fetch_repo_unit(row, camp_parts.get(row.get("source")), root, public, out,
|
| 6539 |
+
timeout=args.timeout, opener=opener, skip_present=True,
|
| 6540 |
+
local=local)}
|
| 6541 |
if args.decompress and res.get("status") == "ok" and res.get("path"):
|
| 6542 |
d = decompress_file(Path(res["path"]), row, cap_of(row))
|
| 6543 |
if d is not None:
|