Summary Table
- Lazy vs Eager Execution
pandas (Eager)
Operations execute immediately:DataStore (Lazy)
Operations are deferred until results are needed:Why It Matters
Lazy execution enables:- Query optimization: Multiple operations compile to one SQL query
- Column pruning: Only needed columns are read
- Filter pushdown: Filters apply at the source
- Memory efficiency: Don’t load data you don’t need
- Return Types
pandas
DataStore
Converting to pandas Types
- Execution Triggers
DataStore executes when you need actual values:
Operations That Stay Lazy
- Row Order
pandas
Row order is always preserved:DataStore
Row order is automatically preserved for most operations:rowNumberInAllBlocks()) to ensure order consistency with pandas.
When Order Is Preserved
- File sources (CSV, Parquet, JSON, etc.)
- pandas DataFrame sources
- Filter operations
- Column selection
- After explicit
sort()orsort_values() - Operations that define order (
nlargest(),nsmallest(),head(),tail())
When Order May Differ
- After
groupby()aggregations (usesort_values()to ensure consistent order) - After
merge()/join()with certain join types - In performance mode (
config.use_performance_mode()): row order is not guaranteed for any operation. See Performance Mode.
- No inplace Parameter
pandas
DataStore
inplace=True is not supported. Always assign the result:
Why No inplace?
DataStore uses immutable operations to enable:- Query building (lazy evaluation)
- Thread safety
- Easier debugging
- Cleaner code
- Index Support
pandas
Full index support:DataStore
Simplified index support:DataStore Source Matters
- DataFrame source: Preserves pandas index
- File source: Uses simple integer index
- Comparison Behavior
Comparing with pandas
pandas doesn’t recognize DataStore objects:Using equals()
- Type Inference
pandas
Uses numpy/pandas types:DataStore
May use ClickHouse types:Explicit Casting
- Memory Model
pandas
All data lives in memory:DataStore
Data stays at source until needed:
- Error Messages
Different Error Sources
- pandas errors: From pandas library
- DataStore errors: From chDB or ClickHouse
Debugging Tips
Migration Checklist
When migrating from pandas:- Change import statement
- Remove
inplace=Trueparameters - Add explicit
to_df()where pandas DataFrame is required - Add sorting if row order matters
- Use
to_pandas()for comparison tests - Test with representative data sizes