Skip to content

simplify and improve VNG format#4984

Merged
mccanne merged 8 commits into
mainfrom
vng-cleanup
Jan 15, 2024
Merged

simplify and improve VNG format#4984
mccanne merged 8 commits into
mainfrom
vng-cleanup

Conversation

@mccanne
Copy link
Copy Markdown
Collaborator

@mccanne mccanne commented Jan 15, 2024

This commit simplifies the VNG format with a new VNG metadata object called Variant, which represents a sequence of typed values (without putting the types into a union), in line with the Zed data model. This replaces the ad hoc data structures that were encoded in the VNG trailer. We also changed vectors so they are all represented in a single segment in the data section, which simplifies vector stats and reading. To support streaming, we replaced the trailer with a header and added framing so that VNG objects can simply be concatenated in a stream or file. We added the command "zed dev vng" to displace the fixed VNG framing header (with magic) and the metadata as Zed data.

Nulls are now handled completely by the Nulls metadata structure and vector metadata now includes length information, which will be used by the vcache in a subsequent commit to faciliate easier flattening of leaf vectors so that all leaf values within a type all have the same length (except perhaps for vectors below unions, TBD).

The VNG write path now stores each object entirely in memory. Once all writes have completed, the vectors are encoded in parallel (e.g., applying compression). Then a DFS traversal computes the data layout and produces a single Zed value representing the vector metadata with data locations. The header, metadatasection, and data vectors are then written out sequentially from a single thread such that the buffers end up being written in the same locations that were computed in the metadata pass.

Closes #4312

@mccanne mccanne requested a review from nwt January 15, 2024 04:07
Comment thread cmd/zed/dev/vng/command.go Outdated
Comment thread zio/vngio/writer.go Outdated
Comment thread cli/outputflags/flags.go Outdated
Comment thread cmd/zed/dev/vng/command.go Outdated
Comment thread cmd/zed/dev/vng/command.go Outdated
Comment thread cmd/zed/dev/vng/command.go Outdated
Comment thread vng/object.go Outdated
Comment thread cmd/zed/dev/vng/command.go Outdated
Comment thread vng/vector/array.go Outdated
Comment thread vng/vector/io.go Outdated
Comment on lines 46 to 49
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nice.

Comment thread vng/vector/io.go Outdated
Comment thread vng/vector/map.go Outdated
Comment thread vng/vector/nulls.go Outdated
Comment thread vng/vector/variant.go Outdated
Comment thread vng/writer.go Outdated
This commit simplifies the VNG format with a new VNG metadata object
called Variant, which represents a sequence of typed values (without
putting the types into a union), in line with the Zed data model.
This replaces the ad hoc data structures that were encoded in the
VNG trailer.  We also changed vectors so they are all represented in
a single segment in the data section, which simplifies vector stats and
reading.  To support streaming, we replaced the trailer with
a header and added framing so that VNG objects can simply be concatenated
in a stream or file.  We added the command "zed dev vng" to displace
the fixed VNG framing header (with magic) and the metadata as Zed data.

Nulls are now handled completely by the Nulls metadata structure and
vector metadata now includes length information, which will be used by the
vcache in a subsequent commit to faciliate easier flattening of leaf
vectors so that all leaf values within a type all have the same length
(except perhaps for vectors below unions, TBD).

The VNG write path now stores each object entirely in memory.  Once
all writes have completed, the vectors are encoded in parallel (e.g.,
applying compression). Then a DFS traversal computes the data layout
and produces a single Zed value representing the vector metadata
with data locations.  The header, metadatasection, and data vectors
are  then written out sequentially from a single thread such that the
buffers end up being written in the same locations that were computed
in the metadata pass.
Comment thread vng/writer.go Outdated
return err
meta, dataSize, err := w.variant.Encode()
if err != nil {
//XXX can encode return an error?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the answer here, at least for now, is yes.

@mccanne mccanne merged commit 8a48163 into main Jan 15, 2024
@mccanne mccanne deleted the vng-cleanup branch January 15, 2024 18:35
nwt added a commit that referenced this pull request Feb 14, 2024
As of #4984, VNG no longer includes a zngio.Trailer.  Remove it and the
"zed dev dig section" and "zed dev dig trailer" commands, which depend
on it.
nwt added a commit that referenced this pull request Feb 16, 2024
As of #4984, VNG no longer includes a zngio.Trailer.  Remove it and the
"zed dev dig section" and "zed dev dig trailer" commands, which depend
on it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi-threaded compression of VNG columns

2 participants