Run artifact

workspace/targets/CsvStat/blueprint/FEATURE-RowCounts.md

FEATURE: Row Counts

FieldValue
Version20261025 V1
DescriptionCount data records, null values, and distinct non-null values for one column.
Depends OnFEATURE-NullValues.md, FEATURE-InputRejection.md
Providesprofile.Counts
Consumescsvdata.IsNull

Purpose

For each column the profile reports rows, nulls, and distinct. This story implements the counting function in internal/profile. Rendering the counts into the profile CSV belongs to the profile output story.

Interface

// Counts holds the three counts reported for one column.
type CountResult struct {
    Rows     int
    Nulls    int
    Distinct int
}

// Counts takes every trimmed value of one column, in file order, and returns its counts.
func Counts(values []string) CountResult

Behavior

and therefore Rows 0.

ignoring case).

Globex and globex are different values. Null values are never counted as distinct.

Required Tests

The project suite in internal/profile includes these tests by exact name, each written against real output:

count once.

Programmatic Acceptance

=== AC rowcounts-rows-nulls-distinct ===
Intent: Counts reports rows, nulls, and distinct for a mixed column.
Requires: executable=go; scope=test

from drydock_go import run_test

result = run_test("./internal/profile", "TestCountsRowsNullsDistinct") print(result.stdout) print(result.stderr) assert result.passed, (result.status, result.stdout, result.stderr) === END AC rowcounts-rows-nulls-distinct ===

=== AC rowcounts-header-only ===
Intent: A column with no data records reports zero for every count.
Requires: executable=go; scope=test

from drydock_go import run_test

result = run_test("./internal/profile", "TestCountsHeaderOnly") print(result.stdout) print(result.stderr) assert result.passed, (result.status, result.stdout, result.stderr) === END AC rowcounts-header-only ===

=== AC rowcounts-distinct-exact ===
Intent: Distinct compares exact strings and counts repeats once.
Requires: executable=go; scope=test

from drydock_go import run_test

result = run_test("./internal/profile", "TestCountsDistinctExactStrings") print(result.stdout) print(result.stderr) assert result.passed, (result.status, result.stdout, result.stderr) === END AC rowcounts-distinct-exact ===

=== AC rowcounts-all-null ===
Intent: An all-null column has zero distinct values and every row null.
Requires: executable=go; scope=test

from drydock_go import run_test

result = run_test("./internal/profile", "TestCountsAllNull") print(result.stdout) print(result.stderr) assert result.passed, (result.status, result.stdout, result.stderr) === END AC rowcounts-all-null ===

User Acceptance

Guardrails