mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-14 22:56:54 +00:00
review fixes
This commit is contained in:
@@ -270,6 +270,23 @@ describe.each([arrow15, arrow16, arrow17, arrow18])(
|
||||
expect(columnBytes["id"] + columnBytes["meta"]).toBe(stats.totalBytes);
|
||||
});
|
||||
|
||||
it("should not break out list elements as their own column", async () => {
|
||||
const conn = await connect(tmpDir.name);
|
||||
const lists = await conn.createTable("list_stats", [
|
||||
{ id: 1, tags: ["a", "b"] },
|
||||
{ id: 2, tags: ["c", "d"] },
|
||||
]);
|
||||
const stats = await lists.stats();
|
||||
const columnBytes = stats.columnBytes!;
|
||||
|
||||
// A list's element is an encoding detail, not a column, so there is no
|
||||
// redundant "tags.item" entry duplicating "tags".
|
||||
expect(Object.keys(columnBytes).sort()).toEqual(["id", "tags"]);
|
||||
// The element bytes are rolled into the list column, not dropped.
|
||||
expect(columnBytes["tags"]).toBeGreaterThan(0);
|
||||
expect(columnBytes["id"] + columnBytes["tags"]).toBe(stats.totalBytes);
|
||||
});
|
||||
|
||||
it("should overwrite data if asked", async () => {
|
||||
const addRes = await table.add([{ id: 1 }, { id: 2 }]);
|
||||
expect(addRes).toHaveProperty("version");
|
||||
|
||||
+13
-8
@@ -1019,14 +1019,19 @@ pub struct TableStatistics {
|
||||
pub fragment_stats: FragmentStatistics,
|
||||
|
||||
/// The compressed on-disk bytes of each column, keyed by dotted field path
|
||||
/// ("meta", "meta.geo", "meta.geo.lat"). Every nesting level gets an entry
|
||||
/// covering the field's own bytes plus its whole subtree, so a struct
|
||||
/// reports its total while its children report the breakdown (the
|
||||
/// top-level entries alone sum to `totalBytes`). Counts data-file bytes
|
||||
/// only: blob sidecar payloads and index files are not included, and blob
|
||||
/// columns therefore report just their descriptor bytes. Undefined when
|
||||
/// the backend provides no per-column breakdown (e.g. older remote
|
||||
/// servers).
|
||||
/// ("meta", "meta.geo", "meta.geo.lat"). A struct's subfields each get
|
||||
/// their own entry, and every entry covers the field's own bytes plus its
|
||||
/// whole subtree, so a struct reports its total while its children report
|
||||
/// the breakdown (the top-level entries alone sum to `totalBytes`). List
|
||||
/// elements are not broken out: a list column reports a single total with
|
||||
/// its element bytes rolled in. Path segments containing anything other
|
||||
/// than letters, digits, or `_` are backtick-quoted, so a subfield named
|
||||
/// `a.b` under `meta` is keyed as "meta.`a.b`".
|
||||
///
|
||||
/// Counts data-file bytes only: blob sidecar payloads and index files are
|
||||
/// not included, and blob columns therefore report just their descriptor
|
||||
/// bytes. Undefined when the backend provides no per-column breakdown
|
||||
/// (e.g. older remote servers).
|
||||
pub column_bytes: Option<HashMap<String, i64>>,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user