Skip to content

Read Primitives — String Concatenation

Read Primitives benchmark · all Read Primitives queries

String concatenation

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
c_custkey,
c_name || ' - ' || c_mktsegment AS customer_info
FROM customer
LIMIT 100

Representative DataFrame

Expression family (Polars, PySpark, DataFusion), default parameters.

def string_concat_expression_impl(ctx: DataFrameContext) -> Any:
col, lit = ctx.col, ctx.lit
return (
ctx.get_table("customer")
.select(col("c_custkey"), (col("c_name") + lit(" - ") + col("c_mktsegment")).alias("customer_info"))
.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 factor
queries = bench.get_queries(dialect="datafusion") # your platform's dialect; drop dialect= for native SQL
print(queries['string_concat'])

For the DataFrame form:

from benchbox.core.query_catalog import get_dataframe_render
print(get_dataframe_render('read_primitives', 'string_concat', family="expression").source) # or family="pandas"

Source

Query text: benchbox/core/read_primitives/queries.py