Documentation
¶
Overview ¶
Package rowdiff compares two CSV artifacts as sets of logical rows: A is a source export and B the re-export of the cluster A was imported into. Rows are keyed per catalog, replicas are deduplicated, measure versions are reduced to the newest one (with Options.TopN, the copies of a _top_n_result data point are merged instead, see TopN), and cells are compared as their canonical CSV encoding, with columns aligned by header name. A property is keyed by its entity (group, _name, _id) and only its latest revision is compared (the largest _mod_revision; at an equal revision a tombstone wins over a live copy), with _delete_time compared as live or tombstone only; older revisions are ignored on both sides.
Memory: every deduplicated row of the compared groups of both artifacts is held in memory with its encoded cells. It is meant for test-scale artifacts (integration and e2e), not for production-size exports.
Index ¶
Constants ¶
const ( KindMissingInB = "missing_in_b" KindExtraInB = "extra_in_b" KindValueMismatch = "value_mismatch" KindReplicaConflict = "replica_conflict" KindStageCountMismatch = "stage_count_mismatch" KindLayoutMismatch = "layout_mismatch" )
Diff kinds.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CatalogStat ¶
CatalogStat counts the deduplicated rows of one catalog in each artifact; for property it counts entities.
type Diff ¶
type Diff struct {
Catalog string
Group string
Resource string
Key string
Kind string
Detail string
}
Diff is one difference between the artifacts. Key is the readable logical key of the row, the stage of a stage_count_mismatch, or empty for a group-level layout_mismatch.
type Options ¶
type Options struct {
// TopN merges and renders the values of the _top_n_result measure. When it is set, every
// copy of a data point of that measure is merged and the merged values are compared as
// rendered; nil compares the measure like any other.
TopN TopN
// Groups restricts the comparison to these groups; empty means every group present in A.
Groups []string
}
Options configures Compare.
type Report ¶
type Report struct {
// StageCounts maps "catalog/group/stage" to the deduplicated row counts {A, B}; for
// property, the entity counts.
StageCounts map[string][2]int
Diffs []Diff
Stats []CatalogStat
}
Report is the result of Compare.
type TopN ¶
type TopN interface {
// MergeTopNResults combines two stored values of one data point the way a query does.
MergeTopNResults(entity []*modelv1.TagValue, timestamp, leftVersion, rightVersion int64, left, right []byte) ([]byte, error)
// RenderTopNResult renders a value so that equal results render equally, whatever the
// order of their tied items.
RenderTopNResult(entity []*modelv1.TagValue, value []byte) (string, error)
}
TopN merges and renders the values of the _top_n_result measure. A data point of it is stored as one partial result per source shard and version, which a query merges, and an import may route those copies into one shard, where a part merge combines them and may reorder tied items. rowdiff cannot decode the engine encoding itself: that needs banyand/measure.