R/tpch_raw_oo_11.R

Defines functions tpch_raw_oo_11

# Generated by meta_replay_to_fun_file(), do not edit by hand
tpch_raw_oo_11 <- function(con, experimental) {
  df1 <- nation
  "filter"
  rel1 <- duckdb$rel_from_df(con, df1, experimental = experimental)
  "filter"
  rel2 <- duckdb$rel_project(
    rel1,
    list(
      {
        tmp_expr <- duckdb$expr_reference("n_nationkey")
        duckdb$expr_set_alias(tmp_expr, "n_nationkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("n_name")
        duckdb$expr_set_alias(tmp_expr, "n_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("n_regionkey")
        duckdb$expr_set_alias(tmp_expr, "n_regionkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("n_comment")
        duckdb$expr_set_alias(tmp_expr, "n_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("n_name"),
          if ("experimental" %in% names(formals(duckdb$expr_constant))) {
            duckdb$expr_constant("GERMANY", experimental = experimental)
          } else {
            duckdb$expr_constant("GERMANY")
          }
        )
      )
    )
  )
  "filter"
  rel4 <- duckdb$rel_order(rel3, list(duckdb$expr_reference("___row_number")))
  "filter"
  rel5 <- duckdb$rel_project(
    rel4,
    list(
      {
        tmp_expr <- duckdb$expr_reference("n_nationkey")
        duckdb$expr_set_alias(tmp_expr, "n_nationkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("n_name")
        duckdb$expr_set_alias(tmp_expr, "n_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("n_regionkey")
        duckdb$expr_set_alias(tmp_expr, "n_regionkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("n_comment")
        duckdb$expr_set_alias(tmp_expr, "n_comment")
        tmp_expr
      }
    )
  )
  df2 <- partsupp
  "inner_join"
  rel6 <- duckdb$rel_from_df(con, df2, experimental = experimental)
  "inner_join"
  rel7 <- duckdb$rel_set_alias(rel6, "lhs")
  df3 <- supplier
  "inner_join"
  rel8 <- duckdb$rel_from_df(con, df3, experimental = experimental)
  "inner_join"
  rel9 <- duckdb$rel_set_alias(rel8, "rhs")
  "inner_join"
  rel10 <- duckdb$rel_project(
    rel7,
    list(
      {
        tmp_expr <- duckdb$expr_reference("ps_partkey")
        duckdb$expr_set_alias(tmp_expr, "ps_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_suppkey")
        duckdb$expr_set_alias(tmp_expr, "ps_suppkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_availqty")
        duckdb$expr_set_alias(tmp_expr, "ps_availqty")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_supplycost")
        duckdb$expr_set_alias(tmp_expr, "ps_supplycost")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_comment")
        duckdb$expr_set_alias(tmp_expr, "ps_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"
  rel11 <- duckdb$rel_project(
    rel9,
    list(
      {
        tmp_expr <- duckdb$expr_reference("s_suppkey")
        duckdb$expr_set_alias(tmp_expr, "s_suppkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_name")
        duckdb$expr_set_alias(tmp_expr, "s_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_address")
        duckdb$expr_set_alias(tmp_expr, "s_address")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_nationkey")
        duckdb$expr_set_alias(tmp_expr, "s_nationkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_phone")
        duckdb$expr_set_alias(tmp_expr, "s_phone")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_acctbal")
        duckdb$expr_set_alias(tmp_expr, "s_acctbal")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_comment")
        duckdb$expr_set_alias(tmp_expr, "s_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"
  rel12 <- duckdb$rel_join(
    rel10,
    rel11,
    list(
      duckdb$expr_function(
        "==",
        list(duckdb$expr_reference("ps_suppkey", rel10), duckdb$expr_reference("s_suppkey", rel11))
      )
    ),
    "inner"
  )
  "inner_join"
  rel13 <- duckdb$rel_order(
    rel12,
    list(duckdb$expr_reference("___row_number_x", rel10), duckdb$expr_reference("___row_number_y", rel11))
  )
  "inner_join"
  rel14 <- duckdb$rel_project(
    rel13,
    list(
      {
        tmp_expr <- duckdb$expr_reference("ps_partkey")
        duckdb$expr_set_alias(tmp_expr, "ps_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_function(
          "___coalesce",
          list(duckdb$expr_reference("ps_suppkey", rel10), duckdb$expr_reference("s_suppkey", rel11))
        )
        duckdb$expr_set_alias(tmp_expr, "ps_suppkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_availqty")
        duckdb$expr_set_alias(tmp_expr, "ps_availqty")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_supplycost")
        duckdb$expr_set_alias(tmp_expr, "ps_supplycost")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_comment")
        duckdb$expr_set_alias(tmp_expr, "ps_comment")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_name")
        duckdb$expr_set_alias(tmp_expr, "s_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_address")
        duckdb$expr_set_alias(tmp_expr, "s_address")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_nationkey")
        duckdb$expr_set_alias(tmp_expr, "s_nationkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_phone")
        duckdb$expr_set_alias(tmp_expr, "s_phone")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_acctbal")
        duckdb$expr_set_alias(tmp_expr, "s_acctbal")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_comment")
        duckdb$expr_set_alias(tmp_expr, "s_comment")
        tmp_expr
      }
    )
  )
  "inner_join"
  rel15 <- duckdb$rel_set_alias(rel14, "lhs")
  "inner_join"
  rel16 <- duckdb$rel_set_alias(rel5, "rhs")
  "inner_join"
  rel17 <- duckdb$rel_project(
    rel15,
    list(
      {
        tmp_expr <- duckdb$expr_reference("ps_partkey")
        duckdb$expr_set_alias(tmp_expr, "ps_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_suppkey")
        duckdb$expr_set_alias(tmp_expr, "ps_suppkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_availqty")
        duckdb$expr_set_alias(tmp_expr, "ps_availqty")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_supplycost")
        duckdb$expr_set_alias(tmp_expr, "ps_supplycost")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_comment")
        duckdb$expr_set_alias(tmp_expr, "ps_comment")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_name")
        duckdb$expr_set_alias(tmp_expr, "s_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_address")
        duckdb$expr_set_alias(tmp_expr, "s_address")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_nationkey")
        duckdb$expr_set_alias(tmp_expr, "s_nationkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_phone")
        duckdb$expr_set_alias(tmp_expr, "s_phone")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_acctbal")
        duckdb$expr_set_alias(tmp_expr, "s_acctbal")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_comment")
        duckdb$expr_set_alias(tmp_expr, "s_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"
  rel18 <- duckdb$rel_project(
    rel16,
    list(
      {
        tmp_expr <- duckdb$expr_reference("n_nationkey")
        duckdb$expr_set_alias(tmp_expr, "n_nationkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("n_name")
        duckdb$expr_set_alias(tmp_expr, "n_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("n_regionkey")
        duckdb$expr_set_alias(tmp_expr, "n_regionkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("n_comment")
        duckdb$expr_set_alias(tmp_expr, "n_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"
  rel19 <- duckdb$rel_join(
    rel17,
    rel18,
    list(
      duckdb$expr_function(
        "==",
        list(duckdb$expr_reference("s_nationkey", rel17), duckdb$expr_reference("n_nationkey", rel18))
      )
    ),
    "inner"
  )
  "inner_join"
  rel20 <- duckdb$rel_order(
    rel19,
    list(duckdb$expr_reference("___row_number_x", rel17), duckdb$expr_reference("___row_number_y", rel18))
  )
  "inner_join"
  rel21 <- duckdb$rel_project(
    rel20,
    list(
      {
        tmp_expr <- duckdb$expr_reference("ps_partkey")
        duckdb$expr_set_alias(tmp_expr, "ps_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_suppkey")
        duckdb$expr_set_alias(tmp_expr, "ps_suppkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_availqty")
        duckdb$expr_set_alias(tmp_expr, "ps_availqty")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_supplycost")
        duckdb$expr_set_alias(tmp_expr, "ps_supplycost")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_comment")
        duckdb$expr_set_alias(tmp_expr, "ps_comment")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_name")
        duckdb$expr_set_alias(tmp_expr, "s_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_address")
        duckdb$expr_set_alias(tmp_expr, "s_address")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_function(
          "___coalesce",
          list(duckdb$expr_reference("s_nationkey", rel17), duckdb$expr_reference("n_nationkey", rel18))
        )
        duckdb$expr_set_alias(tmp_expr, "s_nationkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_phone")
        duckdb$expr_set_alias(tmp_expr, "s_phone")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_acctbal")
        duckdb$expr_set_alias(tmp_expr, "s_acctbal")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_comment")
        duckdb$expr_set_alias(tmp_expr, "s_comment")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("n_name")
        duckdb$expr_set_alias(tmp_expr, "n_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("n_regionkey")
        duckdb$expr_set_alias(tmp_expr, "n_regionkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("n_comment")
        duckdb$expr_set_alias(tmp_expr, "n_comment")
        tmp_expr
      }
    )
  )
  "summarise"
  rel22 <- duckdb$rel_aggregate(
    rel21,
    groups = list(),
    aggregates = list(
      {
        tmp_expr <- duckdb$expr_function(
          "*",
          list(
            duckdb$expr_function(
              "sum",
              list(
                duckdb$expr_function(
                  "*",
                  list(duckdb$expr_reference("ps_supplycost"), duckdb$expr_reference("ps_availqty"))
                )
              )
            ),
            if ("experimental" %in% names(formals(duckdb$expr_constant))) {
              duckdb$expr_constant(1e-04, experimental = experimental)
            } else {
              duckdb$expr_constant(1e-04)
            }
          )
        )
        duckdb$expr_set_alias(tmp_expr, "global_value")
        tmp_expr
      }
    )
  )
  "summarise"
  rel23 <- duckdb$rel_distinct(rel22)
  "mutate"
  rel24 <- duckdb$rel_project(
    rel23,
    list(
      {
        tmp_expr <- duckdb$expr_reference("global_value")
        duckdb$expr_set_alias(tmp_expr, "global_value")
        tmp_expr
      },
      {
        tmp_expr <- if ("experimental" %in% names(formals(duckdb$expr_constant))) {
          duckdb$expr_constant(1L, experimental = experimental)
        } else {
          duckdb$expr_constant(1L)
        }
        duckdb$expr_set_alias(tmp_expr, "global_agr_key")
        tmp_expr
      }
    )
  )
  "summarise"
  rel25 <- duckdb$rel_project(
    rel21,
    list(
      {
        tmp_expr <- duckdb$expr_reference("ps_partkey")
        duckdb$expr_set_alias(tmp_expr, "ps_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_suppkey")
        duckdb$expr_set_alias(tmp_expr, "ps_suppkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_availqty")
        duckdb$expr_set_alias(tmp_expr, "ps_availqty")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_supplycost")
        duckdb$expr_set_alias(tmp_expr, "ps_supplycost")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_comment")
        duckdb$expr_set_alias(tmp_expr, "ps_comment")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_name")
        duckdb$expr_set_alias(tmp_expr, "s_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_address")
        duckdb$expr_set_alias(tmp_expr, "s_address")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_nationkey")
        duckdb$expr_set_alias(tmp_expr, "s_nationkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_phone")
        duckdb$expr_set_alias(tmp_expr, "s_phone")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_acctbal")
        duckdb$expr_set_alias(tmp_expr, "s_acctbal")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_comment")
        duckdb$expr_set_alias(tmp_expr, "s_comment")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("n_name")
        duckdb$expr_set_alias(tmp_expr, "n_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("n_regionkey")
        duckdb$expr_set_alias(tmp_expr, "n_regionkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("n_comment")
        duckdb$expr_set_alias(tmp_expr, "n_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"
  rel26 <- duckdb$rel_aggregate(
    rel25,
    groups = list(duckdb$expr_reference("ps_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(
          "sum",
          list(
            duckdb$expr_function(
              "*",
              list(duckdb$expr_reference("ps_supplycost"), duckdb$expr_reference("ps_availqty"))
            )
          )
        )
        duckdb$expr_set_alias(tmp_expr, "value")
        tmp_expr
      }
    )
  )
  "summarise"
  rel27 <- duckdb$rel_order(rel26, list(duckdb$expr_reference("___row_number")))
  "summarise"
  rel28 <- duckdb$rel_project(
    rel27,
    list(
      {
        tmp_expr <- duckdb$expr_reference("ps_partkey")
        duckdb$expr_set_alias(tmp_expr, "ps_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("value")
        duckdb$expr_set_alias(tmp_expr, "value")
        tmp_expr
      }
    )
  )
  "mutate"
  rel29 <- duckdb$rel_project(
    rel28,
    list(
      {
        tmp_expr <- duckdb$expr_reference("ps_partkey")
        duckdb$expr_set_alias(tmp_expr, "ps_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("value")
        duckdb$expr_set_alias(tmp_expr, "value")
        tmp_expr
      },
      {
        tmp_expr <- if ("experimental" %in% names(formals(duckdb$expr_constant))) {
          duckdb$expr_constant(1L, experimental = experimental)
        } else {
          duckdb$expr_constant(1L)
        }
        duckdb$expr_set_alias(tmp_expr, "global_agr_key")
        tmp_expr
      }
    )
  )
  "inner_join"
  rel30 <- duckdb$rel_set_alias(rel29, "lhs")
  "inner_join"
  rel31 <- duckdb$rel_set_alias(rel24, "rhs")
  "inner_join"
  rel32 <- duckdb$rel_project(
    rel30,
    list(
      {
        tmp_expr <- duckdb$expr_reference("ps_partkey")
        duckdb$expr_set_alias(tmp_expr, "ps_partkey_x")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("value")
        duckdb$expr_set_alias(tmp_expr, "value_x")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("global_agr_key")
        duckdb$expr_set_alias(tmp_expr, "global_agr_key_x")
        tmp_expr
      }
    )
  )
  "inner_join"
  rel33 <- duckdb$rel_project(
    rel31,
    list(
      {
        tmp_expr <- duckdb$expr_reference("global_value")
        duckdb$expr_set_alias(tmp_expr, "global_value_y")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("global_agr_key")
        duckdb$expr_set_alias(tmp_expr, "global_agr_key_y")
        tmp_expr
      }
    )
  )
  "inner_join"
  rel34 <- duckdb$rel_project(
    rel32,
    list(
      {
        tmp_expr <- duckdb$expr_reference("ps_partkey_x")
        duckdb$expr_set_alias(tmp_expr, "ps_partkey_x")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("value_x")
        duckdb$expr_set_alias(tmp_expr, "value_x")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("global_agr_key_x")
        duckdb$expr_set_alias(tmp_expr, "global_agr_key_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"
  rel35 <- duckdb$rel_project(
    rel33,
    list(
      {
        tmp_expr <- duckdb$expr_reference("global_value_y")
        duckdb$expr_set_alias(tmp_expr, "global_value_y")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("global_agr_key_y")
        duckdb$expr_set_alias(tmp_expr, "global_agr_key_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"
  rel36 <- duckdb$rel_join(
    rel34,
    rel35,
    list(
      duckdb$expr_function(
        "==",
        list(duckdb$expr_reference("global_agr_key_x", rel34), duckdb$expr_reference("global_agr_key_y", rel35))
      )
    ),
    "inner"
  )
  "inner_join"
  rel37 <- duckdb$rel_order(
    rel36,
    list(duckdb$expr_reference("___row_number_x", rel34), duckdb$expr_reference("___row_number_y", rel35))
  )
  "inner_join"
  rel38 <- duckdb$rel_project(
    rel37,
    list(
      {
        tmp_expr <- duckdb$expr_reference("ps_partkey_x")
        duckdb$expr_set_alias(tmp_expr, "ps_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("value_x")
        duckdb$expr_set_alias(tmp_expr, "value")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_function(
          "___coalesce",
          list(duckdb$expr_reference("global_agr_key_x", rel34), duckdb$expr_reference("global_agr_key_y", rel35))
        )
        duckdb$expr_set_alias(tmp_expr, "global_agr_key")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("global_value_y")
        duckdb$expr_set_alias(tmp_expr, "global_value")
        tmp_expr
      }
    )
  )
  "filter"
  rel39 <- duckdb$rel_project(
    rel38,
    list(
      {
        tmp_expr <- duckdb$expr_reference("ps_partkey")
        duckdb$expr_set_alias(tmp_expr, "ps_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("value")
        duckdb$expr_set_alias(tmp_expr, "value")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("global_agr_key")
        duckdb$expr_set_alias(tmp_expr, "global_agr_key")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("global_value")
        duckdb$expr_set_alias(tmp_expr, "global_value")
        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"
  rel40 <- duckdb$rel_filter(
    rel39,
    list(
      duckdb$expr_function("r_base::>", list(duckdb$expr_reference("value"), duckdb$expr_reference("global_value")))
    )
  )
  "filter"
  rel41 <- duckdb$rel_order(rel40, list(duckdb$expr_reference("___row_number")))
  "filter"
  rel42 <- duckdb$rel_project(
    rel41,
    list(
      {
        tmp_expr <- duckdb$expr_reference("ps_partkey")
        duckdb$expr_set_alias(tmp_expr, "ps_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("value")
        duckdb$expr_set_alias(tmp_expr, "value")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("global_agr_key")
        duckdb$expr_set_alias(tmp_expr, "global_agr_key")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("global_value")
        duckdb$expr_set_alias(tmp_expr, "global_value")
        tmp_expr
      }
    )
  )
  "arrange"
  rel43 <- duckdb$rel_project(
    rel42,
    list(
      {
        tmp_expr <- duckdb$expr_reference("ps_partkey")
        duckdb$expr_set_alias(tmp_expr, "ps_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("value")
        duckdb$expr_set_alias(tmp_expr, "value")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("global_agr_key")
        duckdb$expr_set_alias(tmp_expr, "global_agr_key")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("global_value")
        duckdb$expr_set_alias(tmp_expr, "global_value")
        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
      }
    )
  )
  "arrange"
  rel44 <- duckdb$rel_order(rel43, list(duckdb$expr_reference("value"), duckdb$expr_reference("___row_number")))
  "arrange"
  rel45 <- duckdb$rel_project(
    rel44,
    list(
      {
        tmp_expr <- duckdb$expr_reference("ps_partkey")
        duckdb$expr_set_alias(tmp_expr, "ps_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("value")
        duckdb$expr_set_alias(tmp_expr, "value")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("global_agr_key")
        duckdb$expr_set_alias(tmp_expr, "global_agr_key")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("global_value")
        duckdb$expr_set_alias(tmp_expr, "global_value")
        tmp_expr
      }
    )
  )
  "select"
  rel46 <- duckdb$rel_project(
    rel45,
    list(
      {
        tmp_expr <- duckdb$expr_reference("ps_partkey")
        duckdb$expr_set_alias(tmp_expr, "ps_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("value")
        duckdb$expr_set_alias(tmp_expr, "value")
        tmp_expr
      }
    )
  )
  rel46
  duckdb$rel_to_altrep(rel46)
}
duckdblabs/duckplyr documentation built on Nov. 6, 2024, 10 p.m.