Kinetica   C#   API  Version 7.2.3.1
Kinetica.Tests.UnitTests.RecordKeyDecimalTests Class Reference

Wire-format pinning tests for RecordKey decimal encoding. More...

Public Member Functions

void AddDecimal_8Byte_WithSimpleValue_StoresCorrectly ()
 WIRE FORMAT TEST: Verifies 8-byte decimal encoding for positive values. More...
 
void AddDecimal_8Byte_WithNegativeValue_StoresCorrectly ()
 WIRE FORMAT TEST: Verifies 8-byte decimal encoding for negative values. More...
 
void AddDecimal_8Byte_WithNull_StoresZeros ()
 
void AddDecimal_12Byte_WithSimpleValue_StoresCorrectly ()
 
void AddDecimal_12Byte_WithNull_StoresZeros ()
 
void AddDecimal_12Byte_WithLargeValue_StoresCorrectly ()
 
void AddDecimal_12Byte_WithNegativeValue_StoresCorrectly ()
 
void AddDecimal_PrecisionBoundary_At18_Uses8Bytes ()
 WIRE FORMAT TEST: Verifies precision boundary - precision 18 uses 8-byte encoding. More...
 
void AddDecimal_PrecisionBoundary_At19_Uses12Bytes ()
 WIRE FORMAT TEST: Verifies precision boundary - precision 19 uses 12-byte encoding. More...
 

Detailed Description

Wire-format pinning tests for RecordKey decimal encoding.

RecordKeys are used for shard routing in Kinetica. The binary encoding of decimal values in RecordKeys MUST remain stable across versions to ensure consistent routing of records to the correct shards.

This test suite verifies:

  • 8-byte decimal encoding (precision <= 18): stored as little-endian int64
  • 12-byte decimal encoding (precision > 18): stored as little-endian 96-bit integer
  • Sign handling (negative values use two's complement)
  • Null/empty value handling (encoded as zeros)
  • Precision boundary conditions (18 vs 19 precision)

Wire Format Details:

  • 8-byte: decimal value * 10^scale, stored as little-endian int64
  • 12-byte: decimal value * 10^scale, stored as little-endian 96-bit integer

Any changes to these encoding rules will break shard routing compatibility.

Definition at line 29 of file RecordKeyDecimalTests.cs.

Member Function Documentation

◆ AddDecimal_12Byte_WithLargeValue_StoresCorrectly()

void Kinetica.Tests.UnitTests.RecordKeyDecimalTests.AddDecimal_12Byte_WithLargeValue_StoresCorrectly ( )
inline

Definition at line 187 of file RecordKeyDecimalTests.cs.

◆ AddDecimal_12Byte_WithNegativeValue_StoresCorrectly()

void Kinetica.Tests.UnitTests.RecordKeyDecimalTests.AddDecimal_12Byte_WithNegativeValue_StoresCorrectly ( )
inline

Definition at line 206 of file RecordKeyDecimalTests.cs.

◆ AddDecimal_12Byte_WithNull_StoresZeros()

void Kinetica.Tests.UnitTests.RecordKeyDecimalTests.AddDecimal_12Byte_WithNull_StoresZeros ( )
inline

Definition at line 168 of file RecordKeyDecimalTests.cs.

◆ AddDecimal_12Byte_WithSimpleValue_StoresCorrectly()

void Kinetica.Tests.UnitTests.RecordKeyDecimalTests.AddDecimal_12Byte_WithSimpleValue_StoresCorrectly ( )
inline

Definition at line 142 of file RecordKeyDecimalTests.cs.

◆ AddDecimal_8Byte_WithNegativeValue_StoresCorrectly()

void Kinetica.Tests.UnitTests.RecordKeyDecimalTests.AddDecimal_8Byte_WithNegativeValue_StoresCorrectly ( )
inline

WIRE FORMAT TEST: Verifies 8-byte decimal encoding for negative values.

Test vector: "-987.6543" with scale 4 Expected encoding: -9876543 as little-endian int64 (two's complement)

Negative values use standard two's complement representation. This encoding MUST remain stable for shard routing compatibility.

Definition at line 108 of file RecordKeyDecimalTests.cs.

◆ AddDecimal_8Byte_WithNull_StoresZeros()

void Kinetica.Tests.UnitTests.RecordKeyDecimalTests.AddDecimal_8Byte_WithNull_StoresZeros ( )
inline

Definition at line 127 of file RecordKeyDecimalTests.cs.

◆ AddDecimal_8Byte_WithSimpleValue_StoresCorrectly()

void Kinetica.Tests.UnitTests.RecordKeyDecimalTests.AddDecimal_8Byte_WithSimpleValue_StoresCorrectly ( )
inline

WIRE FORMAT TEST: Verifies 8-byte decimal encoding for positive values.

Test vector: "123.45" with scale 4 Expected encoding: 1234500 as little-endian int64 Bytes: 0x84, 0xD7, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00

This encoding MUST remain stable for shard routing compatibility.

Definition at line 80 of file RecordKeyDecimalTests.cs.

◆ AddDecimal_PrecisionBoundary_At18_Uses8Bytes()

void Kinetica.Tests.UnitTests.RecordKeyDecimalTests.AddDecimal_PrecisionBoundary_At18_Uses8Bytes ( )
inline

WIRE FORMAT TEST: Verifies precision boundary - precision 18 uses 8-byte encoding.

CRITICAL: Precision <= 18 MUST use 8-byte encoding (int64). This boundary is part of the wire format specification and cannot change.

Rationale: int64 can represent values up to 9,223,372,036,854,775,807 (19 digits), which is sufficient for decimal(18,x) after scaling.

Definition at line 234 of file RecordKeyDecimalTests.cs.

◆ AddDecimal_PrecisionBoundary_At19_Uses12Bytes()

void Kinetica.Tests.UnitTests.RecordKeyDecimalTests.AddDecimal_PrecisionBoundary_At19_Uses12Bytes ( )
inline

WIRE FORMAT TEST: Verifies precision boundary - precision 19 uses 12-byte encoding.

CRITICAL: Precision > 18 MUST use 12-byte encoding (96-bit integer). This boundary is part of the wire format specification and cannot change.

Rationale: Values with precision > 18 can exceed int64 range after scaling, requiring a larger storage format.

Definition at line 256 of file RecordKeyDecimalTests.cs.


The documentation for this class was generated from the following file: