Expand description
Dataset discovery for the home screen.
This is deliberately not a catalogue. Nothing here is persisted: every listing is computed from the filesystem when asked for, and forgotten when the session ends. The only state datui keeps between runs is a list of recently opened paths.
Discovery is also deliberately shallow. Interesting datasets tend to live on mounts — network filesystems, spinning disks, hive trees with a hundred thousand partition files — so a recursive walk would make the home screen slowest exactly where the data is most interesting. Every function here scans one directory level and stops.
Structs§
- Cost
- What pressing Enter on a dataset will actually cost.
- Entry
- One row on the home screen.
- Holds
- What one listing of a directory found in it, counted rather than judged.
- HowRead
- How opening a file row will read it. See
how_read. - Partitions
- How a hive dataset is laid out on disk.
- Scan
- What one directory listing produced, and whether it saw all of it.
- TableOf
- What a row inside a file of tables says about its table.
Enums§
- Directory
Format - What the data files sitting directly in a directory say about how to read it.
- Entry
Kind - What a home-screen row represents.
- Sniffed
- What a listing finds a file to be by its first bytes.
Constants§
- CLASSIFIER_
VERSION - Bumped whenever a build starts classifying something differently.
- MAX_
ENTRIES_ PER_ DIR - Upper bound on entries read from a single directory, so a pathological directory cannot hang the UI.
- NO_
READER - What the home screen says of a file
unreadable_by_nameturns away.
Functions§
- classify_
directory - Classify a directory without walking it.
- column_
names - Column names from a Parquet footer.
- data_
extension - The extension that says what a file is, with any compression suffix walked past.
- data_
format - The format a file’s name says it holds, compression suffix walked past.
- database_
rows - The rows of a file of tables’ listing on the home screen: a database’s tables and views, or an archive’s arrays, by name, as a directory lists its files, SQLite’s own marked to be hidden, each at its path inside the file.
- directory_
format - What
DirectoryFormatthe data files directly indiramount to. - enrich
- Fill in row and column counts for a dataset, from Parquet footers only.
- enrich_
as - As
enrich, reading each file the way the open that follows will read it. - enrich_
parquet - Fill in row and column counts for a Parquet file from its footer.
- enrich_
tables - A file of tables’ tables (a SQLite database’s schema, a NumPy archive’s directory):
how many of its own, whether Enter opens one of them, and the columns of the one when
there is one. A file whose name says a format its bytes must say (a
.dbfile that is not SQLite) is one datui cannot open. - enrich_
with - As
enrich_as, taking a dataset’s measure from the shape an open kept of it inremembered, where its files are as they were then, rather than from a sample of its footers. - format_
age - Render “how long ago” compactly (
2d,3h). - format_
rows - Render a row count compactly (
2.4M). - format_
size - Render a byte count compactly for a listing (
340 MB). - has_
no_ extension - Whether a file’s name has no extension at all:
part-00000,LICENSE. - has_
parquet_ magic - Whether a local file is Parquet by its contents:
PAR1at both ends. - hive_
leaf_ format - What the files under a hive root’s
key=valuepartitions actually are. - how_
read - How opening
entrywill read it, ascrate::FileFormat::read_modesays for its format and how it is stored, and whether a remote one is downloaded first.Nonefor anything but a file whose name says its format. - is_
bookkeeping - Whether a listing entry is bookkeeping rather than data.
- is_
data_ file - Whether a path looks like something datui can open.
- is_
parquet_ key - Whether an object key or path is Parquet: named
.parquet, or a part file with no extension inside a directory named.parquet, as Spark and GBIF write them (occurrence.parquet/000001). Hidden and job files (_SUCCESS,.crc) are not. - is_
parquet_ path - Whether a path names a Parquet file: by its extension, or by sitting as a part file
with no extension inside a
.parquetdirectory. - is_
partition_ name - Whether a name is a hive partition (
year=2024):key=value, with a non-empty key. The value may be empty in practice. - look_
at_ directory - The kind and what the listing found, from one read of it.
- name_
spec_ file - Name
entrya file ofspec, which reads it; a spec that reads its records as several variants makes it a place too, whose tables → lists. - name_
unlisted_ file - Name a local file row no listing classified (a recent) by the spec that reads it, as a listing names one: a spec’s glob, else, when its name says nothing, the magic in its first bytes.
- partition_
layout - Describe how a hive dataset is partitioned, from directory names alone.
- physical_
facts - Pull layout and compression out of a footer that has already been read.
- scan_
dir - List one directory level, classified. Never recurses.
- scan_
dir_ bounded - List one directory, doing a bounded amount of work regardless of what is in it.
- scan_
dir_ progressive scan_dir_bounded, handingprogressthe rows read so far, sorted, every [LISTING_PROGRESS_EVERY] while the read goes on. A directory a share takes seconds to list shows its first rows as they arrive rather than a spinner until the last.- scan_
dir_ specs scan_dir_bounded, naming the files it looks inside byformatstoo: a file whose first bytes carry a spec’s magic is listed as that spec’s.- schema_
preview - Read a dataset’s column names and types without reading any data.
- sniff_
format - What a file with no usable extension turns out to be, from the bytes at its start.
- sniff_
listed sniff_format, and when no format datui reads says it, the format spec that reads it as an open would pick one: by glob, else by magic andmatch.where. One read of the file’s head answers both, so a listing reads nothing more for specs.- split_
row - The row of a split named by its path inside its cache directory, as a recent is
listed:
Nonewhen the path names no split of one. - split_
rows - The rows of a Hugging Face cache directory’s splits, each at its path inside the
directory (
cache/test): opened, it is the directory read with--table. Empty for any other directory, and for a cache of one split, which its door opens. - table_
row - The row of a table inside a file of tables named by its path (
app.db/users), as a recent is listed:Nonewhen the path names no table of such a file. - unreadable_
by_ name - Whether a file’s name already says datui will not open it: an extension no reader
takes, under any compression suffix. A bare
data.gzis left to the open, which looks inside, and so is a name with no extension. - variant_
row - The row of a variant named by its path inside its file (
day.itch/add), as a recent is listed:Nonewhen the path names no variant of such a file. - variant_
rows - The rows of a file a format spec reads as several variants, one a variant, each at
its path inside the file (
day.itch/add): opened, it is the file read with--table. Empty for any other file. - worth_
sniffing - Whether a listing looks inside a file to say what it is: one with no extension, or
one whose extension says nothing (
.bin, which ArduPilot’s logs and model checkpoints share with everything else) or only text (.log, which candump writes;.txt).
Type Aliases§
- Schema
Preview - Column name and type, for the home screen’s preview pane.