| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
DataFrame.Internal.Interpreter
Synopsis
- data Value a where
- Scalar :: forall a. Columnable a => a -> Value a
- Flat :: forall a. Columnable a => Column -> Value a
- Group :: forall a. Columnable a => Vector Column -> Value a
- data Ctx
- eval :: Columnable a => Ctx -> Expr a -> Either DataFrameException (Value a)
- materialize :: Columnable a => Int -> Value a -> Column
- interpret :: Columnable a => DataFrame -> Expr a -> Either DataFrameException (TypedColumn a)
- interpretAggregation :: Columnable a => GroupedDataFrame -> Expr a -> Either DataFrameException (AggregationResult a)
- data AggregationResult a
- = UnAggregated Column
- | Aggregated (TypedColumn a)
New core API
The result of interpreting an expression. Keeps literals as scalars until the point where a concrete column is needed, avoiding premature broadcast allocations.
Constructors
| Scalar :: forall a. Columnable a => a -> Value a | A single value, not yet broadcast to any length. |
| Flat :: forall a. Columnable a => Column -> Value a | A flat column (one element per row in the flat case, or one element per group after aggregation). |
| Group :: forall a. Columnable a => Vector Column -> Value a | A grouped column: one |
eval :: Columnable a => Ctx -> Expr a -> Either DataFrameException (Value a) Source #
Evaluate an expression in a given context, producing a Value.
This single function replaces both the old interpret (flat) and
interpretAggregation (grouped) code paths.
materialize :: Columnable a => Int -> Value a -> Column Source #
Backward-compatible API
interpret :: Columnable a => DataFrame -> Expr a -> Either DataFrameException (TypedColumn a) Source #
Interpret an expression against a flat DataFrame, producing a
typed column. This is the original top-level entry point; internally
it calls eval and materialises the result.
NOTE: unlike the old implementation, Lit values are no longer
eagerly broadcast. The broadcast happens here, at the boundary,
via materialize.
interpretAggregation :: Columnable a => GroupedDataFrame -> Expr a -> Either DataFrameException (AggregationResult a) Source #
Interpret an expression against a GroupedDataFrame,
distinguishing aggregated results from bare column references.
Internally calls eval.
data AggregationResult a Source #
Result of interpreting an expression in a grouped context.
Retained for backward compatibility with aggregate and friends.
Constructors
| UnAggregated Column | |
| Aggregated (TypedColumn a) |