Read Primitives — JSON Extract Simple
Read Primitives benchmark · all Read Primitives queries
Extract from JSON with simple path expressions
Representative SQL
Rendered in the benchmark’s native SQL with default parameters (no dialect translation available).
SELECT o_orderkey, JSON_EXTRACT(o_comment, '$.priority') AS order_priority, JSON_EXTRACT(o_comment, '$.notes') AS order_notesFROM ordersWHERE NOT JSON_EXTRACT(o_comment, '$.priority') IS NULLLIMIT 1000Representative DataFrame
Expression family (Polars, PySpark, DataFusion), default parameters.
def json_extract_simple_expression_impl(ctx: DataFrameContext) -> Any: orders = ctx.get_table("orders") col = ctx.col lit = ctx.lit
return ( orders.with_columns( col("o_comment").str.split(" ").list.get(0).alias("first_word"), col("o_comment").str.len_chars().alias("comment_length"), ) .filter(col("comment_length") > lit(10)) .select("o_orderkey", "o_comment", "first_word", "comment_length") .limit(1000) )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['json_extract_simple'])For the DataFrame form:
from benchbox.core.query_catalog import get_dataframe_render
print(get_dataframe_render('read_primitives', 'json_extract_simple', family="expression").source) # or family="pandas"Source
Query text: benchbox/core/read_primitives/queries.py