Skip to content

Fix TPC-C initial population to match the specification#21

Open
zinal wants to merge 1 commit into
mainfrom
cursor/fix-tpcc-initial-population-53ca
Open

Fix TPC-C initial population to match the specification#21
zinal wants to merge 1 commit into
mainfrom
cursor/fix-tpcc-initial-population-53ca

Conversation

@zinal

@zinal zinal commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Correct a-string length generation (was off-by-one), W/D ZIP codes, H_DATA range, C_DISCOUNT inclusive lower bound, S_YTD numeric scale, and STATE fields that previously relied on the length bug.

Port of ydb-platform/tpcc-postgres-cpp#4.

Changes

src/import.cpp

  • Rename RandomStringBenchbaseRandomString and fix off-by-one length (TPC-C §4.3.2.2)
  • W_STATE / D_STATE / C_STATE: generate 2 uppercase letters (RandomUpperAlphaString(2, 2)) instead of 3
  • W_ZIP / D_ZIP / C_ZIP: RandomNumericString(4) + "11111" instead of hardcoded "123456789"
  • C_DISCOUNT: lower bound 0 instead of 1 (inclusive 0.0000–0.5000)
  • H_DATA: length range 12–24 instead of 10–24

src/init.cpp

  • S_YTD: decimal(8, 0) instead of decimal(8, 2) per TPC-C schema
Open in Web Open in Cursor 

Correct a-string length generation (was off-by-one), W/D ZIP codes,
H_DATA range, C_DISCOUNT inclusive lower bound, S_YTD numeric scale,
and STATE fields that previously relied on the length bug.

Co-authored-by: Maksim Zinal <zinal@ydb.tech>
@zinal
zinal marked this pull request as ready for review July 22, 2026 14:20
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.

2 participants