Skip to content

Conversation

@drblard
Copy link

@drblard drblard commented Dec 22, 2025

Add ColNested helper type for working with ClickHouse Nested columns. Nested types are stored as multiple parallel Array columns with dot notation (e.g., col.field), and this implementation provides:

  • ColNested type with InputColumns/ResultColumns helpers for INSERT/SELECT
  • NewNested constructor for manual column setup
  • Infer method for automatic type inference from type strings
  • ParseNestedFields parser for complex nested type definitions
  • Integration with ColAuto for automatic column creation
  • ColumnTypeNested constant

The implementation handles nested types at the application level since ClickHouse transmits them as separate Array columns over the wire.

Includes comprehensive tests and benchmarks comparing native Nested encoding performance vs JSON string alternatives (~40x faster).

Screenshot 2025-12-22 at 22 45 29
  • Nested is 2x faster than String
  • Nested is 6x faster than JSON type
Screenshot 2025-12-22 at 22 46 19
  • Nested is 11.5x faster than String+Unmarshal
  • String+Unmarshal is 2.7x faster than JSON type
  • 250M allocations from json.Unmarshal (hello gc)

Summary

Add support for Nested columns #381 #1103

Checklist

Delete items not relevant to your PR:

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELO

@CLAassistant
Copy link

CLAassistant commented Dec 22, 2025

CLA assistant check
All committers have signed the CLA.

@drblard drblard force-pushed the feat/add-nested-type-support branch from d0ac24a to da7f31a Compare December 22, 2025 20:54
Add ColNested helper type for working with ClickHouse Nested columns.
Nested types are stored as multiple parallel Array columns with dot
notation (e.g., `col.field`), and this implementation provides:

- ColNested type with InputColumns/ResultColumns helpers for INSERT/SELECT
- NewNested constructor for manual column setup
- Infer method for automatic type inference from type strings
- ParseNestedFields parser for complex nested type definitions
- Integration with ColAuto for automatic column creation
- ColumnTypeNested constant

The implementation handles nested types at the application level since
ClickHouse transmits them as separate Array columns over the wire.

Includes comprehensive tests and benchmarks comparing native Nested
encoding performance vs JSON string alternatives (~40x faster).
@drblard drblard force-pushed the feat/add-nested-type-support branch from da7f31a to fc9a9fa Compare December 22, 2025 20:56
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