Principle:Eventual Inc Daft Column Input Normalization
| Knowledge Sources | |
|---|---|
| Domains | Utilities, API_Design |
| Last Updated | 2026-02-08 14:00 GMT |
Overview
Pattern for normalizing heterogeneous column input types (strings, Expression objects, iterables) into a uniform list of Expression objects at DataFrame API boundaries.
Description
DataFrame APIs commonly accept column references in multiple forms: bare strings (`"name"`), Expression objects (`col("name")`), single values, or iterables of mixed types. Column Input Normalization converts all these forms into a canonical `list[Expression]` before the operation proceeds, eliminating type-checking boilerplate from every DataFrame method.
Usage
Apply this principle at the top of any DataFrame operation that accepts column references. This enables the flexible API that users expect (passing strings, expressions, or lists interchangeably) while keeping the internal implementation simple.
Theoretical Basis
This is an instance of the Adapter pattern: a normalization layer translates multiple input representations into a single internal representation. The type alias `ManyColumnsInputType = ColumnInputType | Iterable[ColumnInputType]` defines the contract, and the normalization functions enforce it.