Skip to content

Research/Prototype: Reflection based to Generics based column types and apis #1716

@kavirajk

Description

@kavirajk

Problem

  1. Currently in clickhouse-go all the column types are generated via this template based code. Which uses reflection heavily. And we lose type-safety-ness.
  2. Because of (1), we also lots of public api's that are not type-safe (accepts any as arguments).

Proposal

Can we solve these two problems by using Go's generics?

Goal

  1. How much effort needed to move from reflection based column types to re-usable generics based column types? (without template based code generation).

Measure: Lesser the reflection, more type-safe compile time checked code. Readability and Re-usability without code generation.

  1. What kind of performance gain we get at runtime for any kind of column operations like Scan and ScanRows operations.

Measure: Can we prove by some benchmarks?

  1. This will break some public api's related to columns scan. But is it worth the effort? Can we think any way to support this without breaking changes?

Measure: All tests passes in main branch without changing the old tests code.

This is more of a research/prototype problem. So expect multiple iterations and multiple unknowns. This issue is there to discuss and record our experiments.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions