qloadm("tools/tpch/001.qs")
duckdb <- asNamespace("duckdb")
drv <- duckdb::duckdb()
con <- DBI::dbConnect(drv)
experimental <- FALSE
invisible(duckdb$rapi_load_rfuns(drv@database_ref))
invisible(DBI::dbExecute(con, 'CREATE MACRO "=="(x, y) AS (x == y)'))
invisible(DBI::dbExecute(con, 'CREATE MACRO "___coalesce"(x, y) AS COALESCE(x, y)'))
invisible(
DBI::dbExecute(
con,
r"[CREATE MACRO "___divide"(x, y) AS CASE WHEN y = 0 THEN CASE WHEN x = 0 THEN CAST('NaN' AS double) WHEN x > 0 THEN CAST('+Infinity' AS double) ELSE CAST('-Infinity' AS double) END ELSE CAST(x AS double) / y END]"
)
)
df1 <- part
"filter"
rel1 <- duckdb$rel_from_df(con, df1, experimental = experimental)
"filter"
rel2 <- duckdb$rel_project(
rel1,
list(
{
tmp_expr <- duckdb$expr_reference("p_partkey")
duckdb$expr_set_alias(tmp_expr, "p_partkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_name")
duckdb$expr_set_alias(tmp_expr, "p_name")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_mfgr")
duckdb$expr_set_alias(tmp_expr, "p_mfgr")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_brand")
duckdb$expr_set_alias(tmp_expr, "p_brand")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_type")
duckdb$expr_set_alias(tmp_expr, "p_type")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_size")
duckdb$expr_set_alias(tmp_expr, "p_size")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_container")
duckdb$expr_set_alias(tmp_expr, "p_container")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_retailprice")
duckdb$expr_set_alias(tmp_expr, "p_retailprice")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_comment")
duckdb$expr_set_alias(tmp_expr, "p_comment")
tmp_expr
},
{
tmp_expr <- duckdb$expr_window(duckdb$expr_function("row_number", list()), list(), list(), offset_expr = NULL, default_expr = NULL)
duckdb$expr_set_alias(tmp_expr, "___row_number")
tmp_expr
}
)
)
"filter"
rel3 <- duckdb$rel_filter(
rel2,
list(
duckdb$expr_function(
"r_base::==",
list(
duckdb$expr_reference("p_brand"),
if ("experimental" %in% names(formals(duckdb$expr_constant))) {
duckdb$expr_constant("Brand#23", experimental = experimental)
} else {
duckdb$expr_constant("Brand#23")
}
)
),
duckdb$expr_function(
"r_base::==",
list(
duckdb$expr_reference("p_container"),
if ("experimental" %in% names(formals(duckdb$expr_constant))) {
duckdb$expr_constant("MED BOX", experimental = experimental)
} else {
duckdb$expr_constant("MED BOX")
}
)
)
)
)
"filter"
rel4 <- duckdb$rel_order(rel3, list(duckdb$expr_reference("___row_number")))
"filter"
rel5 <- duckdb$rel_project(
rel4,
list(
{
tmp_expr <- duckdb$expr_reference("p_partkey")
duckdb$expr_set_alias(tmp_expr, "p_partkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_name")
duckdb$expr_set_alias(tmp_expr, "p_name")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_mfgr")
duckdb$expr_set_alias(tmp_expr, "p_mfgr")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_brand")
duckdb$expr_set_alias(tmp_expr, "p_brand")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_type")
duckdb$expr_set_alias(tmp_expr, "p_type")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_size")
duckdb$expr_set_alias(tmp_expr, "p_size")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_container")
duckdb$expr_set_alias(tmp_expr, "p_container")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_retailprice")
duckdb$expr_set_alias(tmp_expr, "p_retailprice")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_comment")
duckdb$expr_set_alias(tmp_expr, "p_comment")
tmp_expr
}
)
)
df2 <- lineitem
"inner_join"
rel6 <- duckdb$rel_from_df(con, df2, experimental = experimental)
"inner_join"
rel7 <- duckdb$rel_set_alias(rel6, "lhs")
"inner_join"
rel8 <- duckdb$rel_set_alias(rel5, "rhs")
"inner_join"
rel9 <- duckdb$rel_project(
rel7,
list(
{
tmp_expr <- duckdb$expr_reference("l_orderkey")
duckdb$expr_set_alias(tmp_expr, "l_orderkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_partkey")
duckdb$expr_set_alias(tmp_expr, "l_partkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_suppkey")
duckdb$expr_set_alias(tmp_expr, "l_suppkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_linenumber")
duckdb$expr_set_alias(tmp_expr, "l_linenumber")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_quantity")
duckdb$expr_set_alias(tmp_expr, "l_quantity")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_extendedprice")
duckdb$expr_set_alias(tmp_expr, "l_extendedprice")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_discount")
duckdb$expr_set_alias(tmp_expr, "l_discount")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_tax")
duckdb$expr_set_alias(tmp_expr, "l_tax")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_returnflag")
duckdb$expr_set_alias(tmp_expr, "l_returnflag")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_linestatus")
duckdb$expr_set_alias(tmp_expr, "l_linestatus")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipdate")
duckdb$expr_set_alias(tmp_expr, "l_shipdate")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_commitdate")
duckdb$expr_set_alias(tmp_expr, "l_commitdate")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_receiptdate")
duckdb$expr_set_alias(tmp_expr, "l_receiptdate")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipinstruct")
duckdb$expr_set_alias(tmp_expr, "l_shipinstruct")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipmode")
duckdb$expr_set_alias(tmp_expr, "l_shipmode")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_comment")
duckdb$expr_set_alias(tmp_expr, "l_comment")
tmp_expr
},
{
tmp_expr <- duckdb$expr_window(duckdb$expr_function("row_number", list()), list(), list(), offset_expr = NULL, default_expr = NULL)
duckdb$expr_set_alias(tmp_expr, "___row_number_x")
tmp_expr
}
)
)
"inner_join"
rel10 <- duckdb$rel_project(
rel8,
list(
{
tmp_expr <- duckdb$expr_reference("p_partkey")
duckdb$expr_set_alias(tmp_expr, "p_partkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_name")
duckdb$expr_set_alias(tmp_expr, "p_name")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_mfgr")
duckdb$expr_set_alias(tmp_expr, "p_mfgr")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_brand")
duckdb$expr_set_alias(tmp_expr, "p_brand")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_type")
duckdb$expr_set_alias(tmp_expr, "p_type")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_size")
duckdb$expr_set_alias(tmp_expr, "p_size")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_container")
duckdb$expr_set_alias(tmp_expr, "p_container")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_retailprice")
duckdb$expr_set_alias(tmp_expr, "p_retailprice")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_comment")
duckdb$expr_set_alias(tmp_expr, "p_comment")
tmp_expr
},
{
tmp_expr <- duckdb$expr_window(duckdb$expr_function("row_number", list()), list(), list(), offset_expr = NULL, default_expr = NULL)
duckdb$expr_set_alias(tmp_expr, "___row_number_y")
tmp_expr
}
)
)
"inner_join"
rel11 <- duckdb$rel_join(
rel9,
rel10,
list(
duckdb$expr_function(
"==",
list(duckdb$expr_reference("l_partkey", rel9), duckdb$expr_reference("p_partkey", rel10))
)
),
"inner"
)
"inner_join"
rel12 <- duckdb$rel_order(
rel11,
list(duckdb$expr_reference("___row_number_x", rel9), duckdb$expr_reference("___row_number_y", rel10))
)
"inner_join"
rel13 <- duckdb$rel_project(
rel12,
list(
{
tmp_expr <- duckdb$expr_reference("l_orderkey")
duckdb$expr_set_alias(tmp_expr, "l_orderkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_function(
"___coalesce",
list(duckdb$expr_reference("l_partkey", rel9), duckdb$expr_reference("p_partkey", rel10))
)
duckdb$expr_set_alias(tmp_expr, "l_partkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_suppkey")
duckdb$expr_set_alias(tmp_expr, "l_suppkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_linenumber")
duckdb$expr_set_alias(tmp_expr, "l_linenumber")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_quantity")
duckdb$expr_set_alias(tmp_expr, "l_quantity")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_extendedprice")
duckdb$expr_set_alias(tmp_expr, "l_extendedprice")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_discount")
duckdb$expr_set_alias(tmp_expr, "l_discount")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_tax")
duckdb$expr_set_alias(tmp_expr, "l_tax")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_returnflag")
duckdb$expr_set_alias(tmp_expr, "l_returnflag")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_linestatus")
duckdb$expr_set_alias(tmp_expr, "l_linestatus")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipdate")
duckdb$expr_set_alias(tmp_expr, "l_shipdate")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_commitdate")
duckdb$expr_set_alias(tmp_expr, "l_commitdate")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_receiptdate")
duckdb$expr_set_alias(tmp_expr, "l_receiptdate")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipinstruct")
duckdb$expr_set_alias(tmp_expr, "l_shipinstruct")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipmode")
duckdb$expr_set_alias(tmp_expr, "l_shipmode")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_comment")
duckdb$expr_set_alias(tmp_expr, "l_comment")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_name")
duckdb$expr_set_alias(tmp_expr, "p_name")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_mfgr")
duckdb$expr_set_alias(tmp_expr, "p_mfgr")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_brand")
duckdb$expr_set_alias(tmp_expr, "p_brand")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_type")
duckdb$expr_set_alias(tmp_expr, "p_type")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_size")
duckdb$expr_set_alias(tmp_expr, "p_size")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_container")
duckdb$expr_set_alias(tmp_expr, "p_container")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_retailprice")
duckdb$expr_set_alias(tmp_expr, "p_retailprice")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_comment")
duckdb$expr_set_alias(tmp_expr, "p_comment")
tmp_expr
}
)
)
"summarise"
rel14 <- duckdb$rel_project(
rel13,
list(
{
tmp_expr <- duckdb$expr_reference("l_orderkey")
duckdb$expr_set_alias(tmp_expr, "l_orderkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_partkey")
duckdb$expr_set_alias(tmp_expr, "l_partkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_suppkey")
duckdb$expr_set_alias(tmp_expr, "l_suppkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_linenumber")
duckdb$expr_set_alias(tmp_expr, "l_linenumber")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_quantity")
duckdb$expr_set_alias(tmp_expr, "l_quantity")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_extendedprice")
duckdb$expr_set_alias(tmp_expr, "l_extendedprice")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_discount")
duckdb$expr_set_alias(tmp_expr, "l_discount")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_tax")
duckdb$expr_set_alias(tmp_expr, "l_tax")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_returnflag")
duckdb$expr_set_alias(tmp_expr, "l_returnflag")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_linestatus")
duckdb$expr_set_alias(tmp_expr, "l_linestatus")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipdate")
duckdb$expr_set_alias(tmp_expr, "l_shipdate")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_commitdate")
duckdb$expr_set_alias(tmp_expr, "l_commitdate")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_receiptdate")
duckdb$expr_set_alias(tmp_expr, "l_receiptdate")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipinstruct")
duckdb$expr_set_alias(tmp_expr, "l_shipinstruct")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipmode")
duckdb$expr_set_alias(tmp_expr, "l_shipmode")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_comment")
duckdb$expr_set_alias(tmp_expr, "l_comment")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_name")
duckdb$expr_set_alias(tmp_expr, "p_name")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_mfgr")
duckdb$expr_set_alias(tmp_expr, "p_mfgr")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_brand")
duckdb$expr_set_alias(tmp_expr, "p_brand")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_type")
duckdb$expr_set_alias(tmp_expr, "p_type")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_size")
duckdb$expr_set_alias(tmp_expr, "p_size")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_container")
duckdb$expr_set_alias(tmp_expr, "p_container")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_retailprice")
duckdb$expr_set_alias(tmp_expr, "p_retailprice")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_comment")
duckdb$expr_set_alias(tmp_expr, "p_comment")
tmp_expr
},
{
tmp_expr <- duckdb$expr_window(duckdb$expr_function("row_number", list()), list(), list(), offset_expr = NULL, default_expr = NULL)
duckdb$expr_set_alias(tmp_expr, "___row_number")
tmp_expr
}
)
)
"summarise"
rel15 <- duckdb$rel_aggregate(
rel14,
groups = list(duckdb$expr_reference("l_partkey")),
aggregates = list(
{
tmp_expr <- duckdb$expr_function("min", list(duckdb$expr_reference("___row_number")))
duckdb$expr_set_alias(tmp_expr, "___row_number")
tmp_expr
},
{
tmp_expr <- duckdb$expr_function(
"*",
list(
if ("experimental" %in% names(formals(duckdb$expr_constant))) {
duckdb$expr_constant(0.2, experimental = experimental)
} else {
duckdb$expr_constant(0.2)
},
duckdb$expr_function("mean", list(duckdb$expr_reference("l_quantity")))
)
)
duckdb$expr_set_alias(tmp_expr, "quantity_threshold")
tmp_expr
}
)
)
"summarise"
rel16 <- duckdb$rel_order(rel15, list(duckdb$expr_reference("___row_number")))
"summarise"
rel17 <- duckdb$rel_project(
rel16,
list(
{
tmp_expr <- duckdb$expr_reference("l_partkey")
duckdb$expr_set_alias(tmp_expr, "l_partkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("quantity_threshold")
duckdb$expr_set_alias(tmp_expr, "quantity_threshold")
tmp_expr
}
)
)
"inner_join"
rel18 <- duckdb$rel_set_alias(rel13, "lhs")
"inner_join"
rel19 <- duckdb$rel_set_alias(rel17, "rhs")
"inner_join"
rel20 <- duckdb$rel_project(
rel18,
list(
{
tmp_expr <- duckdb$expr_reference("l_orderkey")
duckdb$expr_set_alias(tmp_expr, "l_orderkey_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_partkey")
duckdb$expr_set_alias(tmp_expr, "l_partkey_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_suppkey")
duckdb$expr_set_alias(tmp_expr, "l_suppkey_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_linenumber")
duckdb$expr_set_alias(tmp_expr, "l_linenumber_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_quantity")
duckdb$expr_set_alias(tmp_expr, "l_quantity_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_extendedprice")
duckdb$expr_set_alias(tmp_expr, "l_extendedprice_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_discount")
duckdb$expr_set_alias(tmp_expr, "l_discount_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_tax")
duckdb$expr_set_alias(tmp_expr, "l_tax_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_returnflag")
duckdb$expr_set_alias(tmp_expr, "l_returnflag_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_linestatus")
duckdb$expr_set_alias(tmp_expr, "l_linestatus_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipdate")
duckdb$expr_set_alias(tmp_expr, "l_shipdate_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_commitdate")
duckdb$expr_set_alias(tmp_expr, "l_commitdate_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_receiptdate")
duckdb$expr_set_alias(tmp_expr, "l_receiptdate_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipinstruct")
duckdb$expr_set_alias(tmp_expr, "l_shipinstruct_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipmode")
duckdb$expr_set_alias(tmp_expr, "l_shipmode_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_comment")
duckdb$expr_set_alias(tmp_expr, "l_comment_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_name")
duckdb$expr_set_alias(tmp_expr, "p_name_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_mfgr")
duckdb$expr_set_alias(tmp_expr, "p_mfgr_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_brand")
duckdb$expr_set_alias(tmp_expr, "p_brand_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_type")
duckdb$expr_set_alias(tmp_expr, "p_type_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_size")
duckdb$expr_set_alias(tmp_expr, "p_size_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_container")
duckdb$expr_set_alias(tmp_expr, "p_container_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_retailprice")
duckdb$expr_set_alias(tmp_expr, "p_retailprice_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_comment")
duckdb$expr_set_alias(tmp_expr, "p_comment_x")
tmp_expr
}
)
)
"inner_join"
rel21 <- duckdb$rel_project(
rel19,
list(
{
tmp_expr <- duckdb$expr_reference("l_partkey")
duckdb$expr_set_alias(tmp_expr, "l_partkey_y")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("quantity_threshold")
duckdb$expr_set_alias(tmp_expr, "quantity_threshold_y")
tmp_expr
}
)
)
"inner_join"
rel22 <- duckdb$rel_project(
rel20,
list(
{
tmp_expr <- duckdb$expr_reference("l_orderkey_x")
duckdb$expr_set_alias(tmp_expr, "l_orderkey_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_partkey_x")
duckdb$expr_set_alias(tmp_expr, "l_partkey_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_suppkey_x")
duckdb$expr_set_alias(tmp_expr, "l_suppkey_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_linenumber_x")
duckdb$expr_set_alias(tmp_expr, "l_linenumber_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_quantity_x")
duckdb$expr_set_alias(tmp_expr, "l_quantity_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_extendedprice_x")
duckdb$expr_set_alias(tmp_expr, "l_extendedprice_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_discount_x")
duckdb$expr_set_alias(tmp_expr, "l_discount_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_tax_x")
duckdb$expr_set_alias(tmp_expr, "l_tax_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_returnflag_x")
duckdb$expr_set_alias(tmp_expr, "l_returnflag_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_linestatus_x")
duckdb$expr_set_alias(tmp_expr, "l_linestatus_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipdate_x")
duckdb$expr_set_alias(tmp_expr, "l_shipdate_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_commitdate_x")
duckdb$expr_set_alias(tmp_expr, "l_commitdate_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_receiptdate_x")
duckdb$expr_set_alias(tmp_expr, "l_receiptdate_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipinstruct_x")
duckdb$expr_set_alias(tmp_expr, "l_shipinstruct_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipmode_x")
duckdb$expr_set_alias(tmp_expr, "l_shipmode_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_comment_x")
duckdb$expr_set_alias(tmp_expr, "l_comment_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_name_x")
duckdb$expr_set_alias(tmp_expr, "p_name_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_mfgr_x")
duckdb$expr_set_alias(tmp_expr, "p_mfgr_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_brand_x")
duckdb$expr_set_alias(tmp_expr, "p_brand_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_type_x")
duckdb$expr_set_alias(tmp_expr, "p_type_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_size_x")
duckdb$expr_set_alias(tmp_expr, "p_size_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_container_x")
duckdb$expr_set_alias(tmp_expr, "p_container_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_retailprice_x")
duckdb$expr_set_alias(tmp_expr, "p_retailprice_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_comment_x")
duckdb$expr_set_alias(tmp_expr, "p_comment_x")
tmp_expr
},
{
tmp_expr <- duckdb$expr_window(duckdb$expr_function("row_number", list()), list(), list(), offset_expr = NULL, default_expr = NULL)
duckdb$expr_set_alias(tmp_expr, "___row_number_x")
tmp_expr
}
)
)
"inner_join"
rel23 <- duckdb$rel_project(
rel21,
list(
{
tmp_expr <- duckdb$expr_reference("l_partkey_y")
duckdb$expr_set_alias(tmp_expr, "l_partkey_y")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("quantity_threshold_y")
duckdb$expr_set_alias(tmp_expr, "quantity_threshold_y")
tmp_expr
},
{
tmp_expr <- duckdb$expr_window(duckdb$expr_function("row_number", list()), list(), list(), offset_expr = NULL, default_expr = NULL)
duckdb$expr_set_alias(tmp_expr, "___row_number_y")
tmp_expr
}
)
)
"inner_join"
rel24 <- duckdb$rel_join(
rel22,
rel23,
list(
duckdb$expr_function(
"==",
list(duckdb$expr_reference("l_partkey_x", rel22), duckdb$expr_reference("l_partkey_y", rel23))
)
),
"inner"
)
"inner_join"
rel25 <- duckdb$rel_order(
rel24,
list(duckdb$expr_reference("___row_number_x", rel22), duckdb$expr_reference("___row_number_y", rel23))
)
"inner_join"
rel26 <- duckdb$rel_project(
rel25,
list(
{
tmp_expr <- duckdb$expr_reference("l_orderkey_x")
duckdb$expr_set_alias(tmp_expr, "l_orderkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_function(
"___coalesce",
list(duckdb$expr_reference("l_partkey_x", rel22), duckdb$expr_reference("l_partkey_y", rel23))
)
duckdb$expr_set_alias(tmp_expr, "l_partkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_suppkey_x")
duckdb$expr_set_alias(tmp_expr, "l_suppkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_linenumber_x")
duckdb$expr_set_alias(tmp_expr, "l_linenumber")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_quantity_x")
duckdb$expr_set_alias(tmp_expr, "l_quantity")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_extendedprice_x")
duckdb$expr_set_alias(tmp_expr, "l_extendedprice")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_discount_x")
duckdb$expr_set_alias(tmp_expr, "l_discount")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_tax_x")
duckdb$expr_set_alias(tmp_expr, "l_tax")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_returnflag_x")
duckdb$expr_set_alias(tmp_expr, "l_returnflag")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_linestatus_x")
duckdb$expr_set_alias(tmp_expr, "l_linestatus")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipdate_x")
duckdb$expr_set_alias(tmp_expr, "l_shipdate")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_commitdate_x")
duckdb$expr_set_alias(tmp_expr, "l_commitdate")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_receiptdate_x")
duckdb$expr_set_alias(tmp_expr, "l_receiptdate")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipinstruct_x")
duckdb$expr_set_alias(tmp_expr, "l_shipinstruct")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipmode_x")
duckdb$expr_set_alias(tmp_expr, "l_shipmode")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_comment_x")
duckdb$expr_set_alias(tmp_expr, "l_comment")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_name_x")
duckdb$expr_set_alias(tmp_expr, "p_name")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_mfgr_x")
duckdb$expr_set_alias(tmp_expr, "p_mfgr")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_brand_x")
duckdb$expr_set_alias(tmp_expr, "p_brand")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_type_x")
duckdb$expr_set_alias(tmp_expr, "p_type")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_size_x")
duckdb$expr_set_alias(tmp_expr, "p_size")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_container_x")
duckdb$expr_set_alias(tmp_expr, "p_container")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_retailprice_x")
duckdb$expr_set_alias(tmp_expr, "p_retailprice")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_comment_x")
duckdb$expr_set_alias(tmp_expr, "p_comment")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("quantity_threshold_y")
duckdb$expr_set_alias(tmp_expr, "quantity_threshold")
tmp_expr
}
)
)
"filter"
rel27 <- duckdb$rel_project(
rel26,
list(
{
tmp_expr <- duckdb$expr_reference("l_orderkey")
duckdb$expr_set_alias(tmp_expr, "l_orderkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_partkey")
duckdb$expr_set_alias(tmp_expr, "l_partkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_suppkey")
duckdb$expr_set_alias(tmp_expr, "l_suppkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_linenumber")
duckdb$expr_set_alias(tmp_expr, "l_linenumber")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_quantity")
duckdb$expr_set_alias(tmp_expr, "l_quantity")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_extendedprice")
duckdb$expr_set_alias(tmp_expr, "l_extendedprice")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_discount")
duckdb$expr_set_alias(tmp_expr, "l_discount")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_tax")
duckdb$expr_set_alias(tmp_expr, "l_tax")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_returnflag")
duckdb$expr_set_alias(tmp_expr, "l_returnflag")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_linestatus")
duckdb$expr_set_alias(tmp_expr, "l_linestatus")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipdate")
duckdb$expr_set_alias(tmp_expr, "l_shipdate")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_commitdate")
duckdb$expr_set_alias(tmp_expr, "l_commitdate")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_receiptdate")
duckdb$expr_set_alias(tmp_expr, "l_receiptdate")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipinstruct")
duckdb$expr_set_alias(tmp_expr, "l_shipinstruct")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipmode")
duckdb$expr_set_alias(tmp_expr, "l_shipmode")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_comment")
duckdb$expr_set_alias(tmp_expr, "l_comment")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_name")
duckdb$expr_set_alias(tmp_expr, "p_name")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_mfgr")
duckdb$expr_set_alias(tmp_expr, "p_mfgr")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_brand")
duckdb$expr_set_alias(tmp_expr, "p_brand")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_type")
duckdb$expr_set_alias(tmp_expr, "p_type")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_size")
duckdb$expr_set_alias(tmp_expr, "p_size")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_container")
duckdb$expr_set_alias(tmp_expr, "p_container")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_retailprice")
duckdb$expr_set_alias(tmp_expr, "p_retailprice")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_comment")
duckdb$expr_set_alias(tmp_expr, "p_comment")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("quantity_threshold")
duckdb$expr_set_alias(tmp_expr, "quantity_threshold")
tmp_expr
},
{
tmp_expr <- duckdb$expr_window(duckdb$expr_function("row_number", list()), list(), list(), offset_expr = NULL, default_expr = NULL)
duckdb$expr_set_alias(tmp_expr, "___row_number")
tmp_expr
}
)
)
"filter"
rel28 <- duckdb$rel_filter(
rel27,
list(
duckdb$expr_function(
"r_base::<",
list(duckdb$expr_reference("l_quantity"), duckdb$expr_reference("quantity_threshold"))
)
)
)
"filter"
rel29 <- duckdb$rel_order(rel28, list(duckdb$expr_reference("___row_number")))
"filter"
rel30 <- duckdb$rel_project(
rel29,
list(
{
tmp_expr <- duckdb$expr_reference("l_orderkey")
duckdb$expr_set_alias(tmp_expr, "l_orderkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_partkey")
duckdb$expr_set_alias(tmp_expr, "l_partkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_suppkey")
duckdb$expr_set_alias(tmp_expr, "l_suppkey")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_linenumber")
duckdb$expr_set_alias(tmp_expr, "l_linenumber")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_quantity")
duckdb$expr_set_alias(tmp_expr, "l_quantity")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_extendedprice")
duckdb$expr_set_alias(tmp_expr, "l_extendedprice")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_discount")
duckdb$expr_set_alias(tmp_expr, "l_discount")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_tax")
duckdb$expr_set_alias(tmp_expr, "l_tax")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_returnflag")
duckdb$expr_set_alias(tmp_expr, "l_returnflag")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_linestatus")
duckdb$expr_set_alias(tmp_expr, "l_linestatus")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipdate")
duckdb$expr_set_alias(tmp_expr, "l_shipdate")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_commitdate")
duckdb$expr_set_alias(tmp_expr, "l_commitdate")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_receiptdate")
duckdb$expr_set_alias(tmp_expr, "l_receiptdate")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipinstruct")
duckdb$expr_set_alias(tmp_expr, "l_shipinstruct")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_shipmode")
duckdb$expr_set_alias(tmp_expr, "l_shipmode")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("l_comment")
duckdb$expr_set_alias(tmp_expr, "l_comment")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_name")
duckdb$expr_set_alias(tmp_expr, "p_name")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_mfgr")
duckdb$expr_set_alias(tmp_expr, "p_mfgr")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_brand")
duckdb$expr_set_alias(tmp_expr, "p_brand")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_type")
duckdb$expr_set_alias(tmp_expr, "p_type")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_size")
duckdb$expr_set_alias(tmp_expr, "p_size")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_container")
duckdb$expr_set_alias(tmp_expr, "p_container")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_retailprice")
duckdb$expr_set_alias(tmp_expr, "p_retailprice")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("p_comment")
duckdb$expr_set_alias(tmp_expr, "p_comment")
tmp_expr
},
{
tmp_expr <- duckdb$expr_reference("quantity_threshold")
duckdb$expr_set_alias(tmp_expr, "quantity_threshold")
tmp_expr
}
)
)
"summarise"
rel31 <- duckdb$rel_aggregate(
rel30,
groups = list(),
aggregates = list(
{
tmp_expr <- duckdb$expr_function(
"___divide",
list(
duckdb$expr_function("sum", list(duckdb$expr_reference("l_extendedprice"))),
if ("experimental" %in% names(formals(duckdb$expr_constant))) {
duckdb$expr_constant(7, experimental = experimental)
} else {
duckdb$expr_constant(7)
}
)
)
duckdb$expr_set_alias(tmp_expr, "avg_yearly")
tmp_expr
}
)
)
"summarise"
rel32 <- duckdb$rel_distinct(rel31)
rel32
duckdb$rel_to_altrep(rel32)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.