Read Primitives — Struct Construction
Read Primitives benchmark · all Read Primitives queries
Construct struct from columns
Representative SQL
Rendered for DataFusion with default parameters.
SELECT c_custkey, STRUCT(c_name, c_address, c_phone) AS contact_info, c_acctbalFROM customerWHERE c_nationkey = 1ORDER BY c_custkeyLIMIT 100Representative DataFrame
Expression family (Polars, PySpark, DataFusion), default parameters.
def struct_construction_expression_impl(ctx: DataFrameContext) -> Any: import polars as pl
return ( ctx.get_table("customer") .native.filter(pl.col("c_nationkey") == 1) .sort("c_custkey") .select( "c_custkey", pl.concat_list([pl.col("c_name"), pl.col("c_address"), pl.col("c_phone")]).alias("contact_info"), "c_acctbal", ) .limit(100) )Get the exact query for your run
The blocks above are representative. To get the precise statement a specific platform runs at a specific scale, substitute your own values:
from benchbox import ReadPrimitives
bench = ReadPrimitives(scale_factor=0.01) # your scale factorqueries = bench.get_queries(dialect="datafusion") # your platform's dialect; drop dialect= for native SQLprint(queries['struct_construction'])For the DataFrame form:
from benchbox.core.query_catalog import get_dataframe_render
print(get_dataframe_render('read_primitives', 'struct_construction', family="expression").source) # or family="pandas"Source
Query text: benchbox/core/read_primitives/queries.py