R/tpch_raw_oo_02.R

Defines functions tpch_raw_oo_02

# Generated by meta_replay_to_fun_file(), do not edit by hand
tpch_raw_oo_02 <- function(con, experimental) {
  df1 <- partsupp
  "select"
  rel1 <- duckdb$rel_from_df(con, df1, experimental = experimental)
  "select"
  rel2 <- duckdb$rel_project(
    rel1,
    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_supplycost")
        duckdb$expr_set_alias(tmp_expr, "ps_supplycost")
        tmp_expr
      }
    )
  )
  df2 <- part
  "select"
  rel3 <- duckdb$rel_from_df(con, df2, experimental = experimental)
  "select"
  rel4 <- duckdb$rel_project(
    rel3,
    list(
      {
        tmp_expr <- duckdb$expr_reference("p_partkey")
        duckdb$expr_set_alias(tmp_expr, "p_partkey")
        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_mfgr")
        duckdb$expr_set_alias(tmp_expr, "p_mfgr")
        tmp_expr
      }
    )
  )
  "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_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_mfgr")
        duckdb$expr_set_alias(tmp_expr, "p_mfgr")
        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"
  rel6 <- duckdb$rel_filter(
    rel5,
    list(
      duckdb$expr_function(
        "r_base::==",
        list(
          duckdb$expr_reference("p_size"),
          if ("experimental" %in% names(formals(duckdb$expr_constant))) {
            duckdb$expr_constant(15, experimental = experimental)
          } else {
            duckdb$expr_constant(15)
          }
        )
      ),
      duckdb$expr_function(
        "grepl",
        list(
          if ("experimental" %in% names(formals(duckdb$expr_constant))) {
            duckdb$expr_constant("BRASS$", experimental = experimental)
          } else {
            duckdb$expr_constant("BRASS$")
          },
          duckdb$expr_reference("p_type")
        )
      )
    )
  )
  "filter"
  rel7 <- duckdb$rel_order(rel6, list(duckdb$expr_reference("___row_number")))
  "filter"
  rel8 <- duckdb$rel_project(
    rel7,
    list(
      {
        tmp_expr <- duckdb$expr_reference("p_partkey")
        duckdb$expr_set_alias(tmp_expr, "p_partkey")
        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_mfgr")
        duckdb$expr_set_alias(tmp_expr, "p_mfgr")
        tmp_expr
      }
    )
  )
  "select"
  rel9 <- 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_mfgr")
        duckdb$expr_set_alias(tmp_expr, "p_mfgr")
        tmp_expr
      }
    )
  )
  "inner_join"
  rel10 <- duckdb$rel_set_alias(rel9, "lhs")
  "inner_join"
  rel11 <- duckdb$rel_set_alias(rel2, "rhs")
  "inner_join"
  rel12 <- duckdb$rel_project(
    rel10,
    list(
      {
        tmp_expr <- duckdb$expr_reference("p_partkey")
        duckdb$expr_set_alias(tmp_expr, "p_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("p_mfgr")
        duckdb$expr_set_alias(tmp_expr, "p_mfgr")
        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"
  rel13 <- duckdb$rel_project(
    rel11,
    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_supplycost")
        duckdb$expr_set_alias(tmp_expr, "ps_supplycost")
        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"
  rel14 <- duckdb$rel_join(
    rel12,
    rel13,
    list(
      duckdb$expr_function(
        "==",
        list(duckdb$expr_reference("p_partkey", rel12), duckdb$expr_reference("ps_partkey", rel13))
      )
    ),
    "inner"
  )
  "inner_join"
  rel15 <- duckdb$rel_order(
    rel14,
    list(duckdb$expr_reference("___row_number_x", rel12), duckdb$expr_reference("___row_number_y", rel13))
  )
  "inner_join"
  rel16 <- duckdb$rel_project(
    rel15,
    list(
      {
        tmp_expr <- duckdb$expr_function(
          "___coalesce",
          list(duckdb$expr_reference("p_partkey", rel12), duckdb$expr_reference("ps_partkey", rel13))
        )
        duckdb$expr_set_alias(tmp_expr, "p_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("p_mfgr")
        duckdb$expr_set_alias(tmp_expr, "p_mfgr")
        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_supplycost")
        duckdb$expr_set_alias(tmp_expr, "ps_supplycost")
        tmp_expr
      }
    )
  )
  df3 <- supplier
  "select"
  rel17 <- duckdb$rel_from_df(con, df3, experimental = experimental)
  "select"
  rel18 <- duckdb$rel_project(
    rel17,
    list(
      {
        tmp_expr <- duckdb$expr_reference("s_suppkey")
        duckdb$expr_set_alias(tmp_expr, "s_suppkey")
        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_acctbal")
        duckdb$expr_set_alias(tmp_expr, "s_acctbal")
        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_phone")
        duckdb$expr_set_alias(tmp_expr, "s_phone")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_comment")
        duckdb$expr_set_alias(tmp_expr, "s_comment")
        tmp_expr
      }
    )
  )
  "inner_join"
  rel19 <- duckdb$rel_set_alias(rel16, "lhs")
  "inner_join"
  rel20 <- duckdb$rel_set_alias(rel18, "rhs")
  "inner_join"
  rel21 <- duckdb$rel_project(
    rel19,
    list(
      {
        tmp_expr <- duckdb$expr_reference("p_partkey")
        duckdb$expr_set_alias(tmp_expr, "p_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("p_mfgr")
        duckdb$expr_set_alias(tmp_expr, "p_mfgr")
        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_supplycost")
        duckdb$expr_set_alias(tmp_expr, "ps_supplycost")
        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"
  rel22 <- duckdb$rel_project(
    rel20,
    list(
      {
        tmp_expr <- duckdb$expr_reference("s_suppkey")
        duckdb$expr_set_alias(tmp_expr, "s_suppkey")
        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_acctbal")
        duckdb$expr_set_alias(tmp_expr, "s_acctbal")
        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_phone")
        duckdb$expr_set_alias(tmp_expr, "s_phone")
        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"
  rel23 <- duckdb$rel_join(
    rel21,
    rel22,
    list(
      duckdb$expr_function(
        "___eq_na_matches_na",
        list(duckdb$expr_reference("ps_suppkey", rel21), duckdb$expr_reference("s_suppkey", rel22))
      )
    ),
    "inner"
  )
  "inner_join"
  rel24 <- duckdb$rel_order(
    rel23,
    list(duckdb$expr_reference("___row_number_x", rel21), duckdb$expr_reference("___row_number_y", rel22))
  )
  "inner_join"
  rel25 <- duckdb$rel_project(
    rel24,
    list(
      {
        tmp_expr <- duckdb$expr_reference("p_partkey")
        duckdb$expr_set_alias(tmp_expr, "p_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("p_mfgr")
        duckdb$expr_set_alias(tmp_expr, "p_mfgr")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_function(
          "___coalesce",
          list(duckdb$expr_reference("ps_suppkey", rel21), duckdb$expr_reference("s_suppkey", rel22))
        )
        duckdb$expr_set_alias(tmp_expr, "ps_suppkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_supplycost")
        duckdb$expr_set_alias(tmp_expr, "ps_supplycost")
        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_acctbal")
        duckdb$expr_set_alias(tmp_expr, "s_acctbal")
        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_phone")
        duckdb$expr_set_alias(tmp_expr, "s_phone")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_comment")
        duckdb$expr_set_alias(tmp_expr, "s_comment")
        tmp_expr
      }
    )
  )
  "select"
  rel26 <- duckdb$rel_project(
    rel25,
    list(
      {
        tmp_expr <- duckdb$expr_reference("p_partkey")
        duckdb$expr_set_alias(tmp_expr, "p_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_supplycost")
        duckdb$expr_set_alias(tmp_expr, "ps_supplycost")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("p_mfgr")
        duckdb$expr_set_alias(tmp_expr, "p_mfgr")
        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_acctbal")
        duckdb$expr_set_alias(tmp_expr, "s_acctbal")
        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_phone")
        duckdb$expr_set_alias(tmp_expr, "s_phone")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_comment")
        duckdb$expr_set_alias(tmp_expr, "s_comment")
        tmp_expr
      }
    )
  )
  df4 <- region
  "filter"
  rel27 <- duckdb$rel_from_df(con, df4, experimental = experimental)
  "filter"
  rel28 <- duckdb$rel_project(
    rel27,
    list(
      {
        tmp_expr <- duckdb$expr_reference("r_regionkey")
        duckdb$expr_set_alias(tmp_expr, "r_regionkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("r_name")
        duckdb$expr_set_alias(tmp_expr, "r_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("r_comment")
        duckdb$expr_set_alias(tmp_expr, "r_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"
  rel29 <- duckdb$rel_filter(
    rel28,
    list(
      duckdb$expr_function(
        "r_base::==",
        list(
          duckdb$expr_reference("r_name"),
          if ("experimental" %in% names(formals(duckdb$expr_constant))) {
            duckdb$expr_constant("EUROPE", experimental = experimental)
          } else {
            duckdb$expr_constant("EUROPE")
          }
        )
      )
    )
  )
  "filter"
  rel30 <- duckdb$rel_order(rel29, list(duckdb$expr_reference("___row_number")))
  "filter"
  rel31 <- duckdb$rel_project(
    rel30,
    list(
      {
        tmp_expr <- duckdb$expr_reference("r_regionkey")
        duckdb$expr_set_alias(tmp_expr, "r_regionkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("r_name")
        duckdb$expr_set_alias(tmp_expr, "r_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("r_comment")
        duckdb$expr_set_alias(tmp_expr, "r_comment")
        tmp_expr
      }
    )
  )
  df5 <- nation
  "inner_join"
  rel32 <- duckdb$rel_from_df(con, df5, experimental = experimental)
  "inner_join"
  rel33 <- duckdb$rel_set_alias(rel32, "lhs")
  "inner_join"
  rel34 <- duckdb$rel_set_alias(rel31, "rhs")
  "inner_join"
  rel35 <- duckdb$rel_project(
    rel33,
    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_x")
        tmp_expr
      }
    )
  )
  "inner_join"
  rel36 <- duckdb$rel_project(
    rel34,
    list(
      {
        tmp_expr <- duckdb$expr_reference("r_regionkey")
        duckdb$expr_set_alias(tmp_expr, "r_regionkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("r_name")
        duckdb$expr_set_alias(tmp_expr, "r_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("r_comment")
        duckdb$expr_set_alias(tmp_expr, "r_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"
  rel37 <- duckdb$rel_join(
    rel35,
    rel36,
    list(
      duckdb$expr_function(
        "___eq_na_matches_na",
        list(duckdb$expr_reference("n_regionkey", rel35), duckdb$expr_reference("r_regionkey", rel36))
      )
    ),
    "inner"
  )
  "inner_join"
  rel38 <- duckdb$rel_order(
    rel37,
    list(duckdb$expr_reference("___row_number_x", rel35), duckdb$expr_reference("___row_number_y", rel36))
  )
  "inner_join"
  rel39 <- duckdb$rel_project(
    rel38,
    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_function(
          "___coalesce",
          list(duckdb$expr_reference("n_regionkey", rel35), duckdb$expr_reference("r_regionkey", rel36))
        )
        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_reference("r_name")
        duckdb$expr_set_alias(tmp_expr, "r_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("r_comment")
        duckdb$expr_set_alias(tmp_expr, "r_comment")
        tmp_expr
      }
    )
  )
  "select"
  rel40 <- duckdb$rel_project(
    rel39,
    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
      }
    )
  )
  "inner_join"
  rel41 <- duckdb$rel_set_alias(rel26, "lhs")
  "inner_join"
  rel42 <- duckdb$rel_set_alias(rel40, "rhs")
  "inner_join"
  rel43 <- duckdb$rel_project(
    rel41,
    list(
      {
        tmp_expr <- duckdb$expr_reference("p_partkey")
        duckdb$expr_set_alias(tmp_expr, "p_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_supplycost")
        duckdb$expr_set_alias(tmp_expr, "ps_supplycost")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("p_mfgr")
        duckdb$expr_set_alias(tmp_expr, "p_mfgr")
        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_acctbal")
        duckdb$expr_set_alias(tmp_expr, "s_acctbal")
        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_phone")
        duckdb$expr_set_alias(tmp_expr, "s_phone")
        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"
  rel44 <- duckdb$rel_project(
    rel42,
    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_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"
  rel45 <- duckdb$rel_join(
    rel43,
    rel44,
    list(
      duckdb$expr_function(
        "___eq_na_matches_na",
        list(duckdb$expr_reference("s_nationkey", rel43), duckdb$expr_reference("n_nationkey", rel44))
      )
    ),
    "inner"
  )
  "inner_join"
  rel46 <- duckdb$rel_order(
    rel45,
    list(duckdb$expr_reference("___row_number_x", rel43), duckdb$expr_reference("___row_number_y", rel44))
  )
  "inner_join"
  rel47 <- duckdb$rel_project(
    rel46,
    list(
      {
        tmp_expr <- duckdb$expr_reference("p_partkey")
        duckdb$expr_set_alias(tmp_expr, "p_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_supplycost")
        duckdb$expr_set_alias(tmp_expr, "ps_supplycost")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("p_mfgr")
        duckdb$expr_set_alias(tmp_expr, "p_mfgr")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_function(
          "___coalesce",
          list(duckdb$expr_reference("s_nationkey", rel43), duckdb$expr_reference("n_nationkey", rel44))
        )
        duckdb$expr_set_alias(tmp_expr, "s_nationkey")
        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_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_phone")
        duckdb$expr_set_alias(tmp_expr, "s_phone")
        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
      }
    )
  )
  "select"
  rel48 <- duckdb$rel_project(
    rel47,
    list(
      {
        tmp_expr <- duckdb$expr_reference("p_partkey")
        duckdb$expr_set_alias(tmp_expr, "p_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_supplycost")
        duckdb$expr_set_alias(tmp_expr, "ps_supplycost")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("p_mfgr")
        duckdb$expr_set_alias(tmp_expr, "p_mfgr")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("n_name")
        duckdb$expr_set_alias(tmp_expr, "n_name")
        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_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_phone")
        duckdb$expr_set_alias(tmp_expr, "s_phone")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_comment")
        duckdb$expr_set_alias(tmp_expr, "s_comment")
        tmp_expr
      }
    )
  )
  "summarise"
  rel49 <- duckdb$rel_project(
    rel48,
    list(
      {
        tmp_expr <- duckdb$expr_reference("p_partkey")
        duckdb$expr_set_alias(tmp_expr, "p_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_supplycost")
        duckdb$expr_set_alias(tmp_expr, "ps_supplycost")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("p_mfgr")
        duckdb$expr_set_alias(tmp_expr, "p_mfgr")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("n_name")
        duckdb$expr_set_alias(tmp_expr, "n_name")
        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_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_phone")
        duckdb$expr_set_alias(tmp_expr, "s_phone")
        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")
        tmp_expr
      }
    )
  )
  "summarise"
  rel50 <- duckdb$rel_aggregate(
    rel49,
    groups = list(duckdb$expr_reference("p_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("min", list(duckdb$expr_reference("ps_supplycost")))
        duckdb$expr_set_alias(tmp_expr, "min_ps_supplycost")
        tmp_expr
      }
    )
  )
  "summarise"
  rel51 <- duckdb$rel_order(rel50, list(duckdb$expr_reference("___row_number")))
  "summarise"
  rel52 <- duckdb$rel_project(
    rel51,
    list(
      {
        tmp_expr <- duckdb$expr_reference("p_partkey")
        duckdb$expr_set_alias(tmp_expr, "p_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("min_ps_supplycost")
        duckdb$expr_set_alias(tmp_expr, "min_ps_supplycost")
        tmp_expr
      }
    )
  )
  "inner_join"
  rel53 <- duckdb$rel_set_alias(rel48, "lhs")
  "inner_join"
  rel54 <- duckdb$rel_set_alias(rel52, "rhs")
  "inner_join"
  rel55 <- duckdb$rel_project(
    rel53,
    list(
      {
        tmp_expr <- duckdb$expr_reference("p_partkey")
        duckdb$expr_set_alias(tmp_expr, "p_partkey_x")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_supplycost")
        duckdb$expr_set_alias(tmp_expr, "ps_supplycost_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("n_name")
        duckdb$expr_set_alias(tmp_expr, "n_name_x")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_acctbal")
        duckdb$expr_set_alias(tmp_expr, "s_acctbal_x")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_name")
        duckdb$expr_set_alias(tmp_expr, "s_name_x")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_address")
        duckdb$expr_set_alias(tmp_expr, "s_address_x")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_phone")
        duckdb$expr_set_alias(tmp_expr, "s_phone_x")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_comment")
        duckdb$expr_set_alias(tmp_expr, "s_comment_x")
        tmp_expr
      }
    )
  )
  "inner_join"
  rel56 <- duckdb$rel_project(
    rel54,
    list(
      {
        tmp_expr <- duckdb$expr_reference("p_partkey")
        duckdb$expr_set_alias(tmp_expr, "p_partkey_y")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("min_ps_supplycost")
        duckdb$expr_set_alias(tmp_expr, "min_ps_supplycost_y")
        tmp_expr
      }
    )
  )
  "inner_join"
  rel57 <- duckdb$rel_project(
    rel55,
    list(
      {
        tmp_expr <- duckdb$expr_reference("p_partkey_x")
        duckdb$expr_set_alias(tmp_expr, "p_partkey_x")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("ps_supplycost_x")
        duckdb$expr_set_alias(tmp_expr, "ps_supplycost_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("n_name_x")
        duckdb$expr_set_alias(tmp_expr, "n_name_x")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_acctbal_x")
        duckdb$expr_set_alias(tmp_expr, "s_acctbal_x")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_name_x")
        duckdb$expr_set_alias(tmp_expr, "s_name_x")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_address_x")
        duckdb$expr_set_alias(tmp_expr, "s_address_x")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_phone_x")
        duckdb$expr_set_alias(tmp_expr, "s_phone_x")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_comment_x")
        duckdb$expr_set_alias(tmp_expr, "s_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"
  rel58 <- duckdb$rel_project(
    rel56,
    list(
      {
        tmp_expr <- duckdb$expr_reference("p_partkey_y")
        duckdb$expr_set_alias(tmp_expr, "p_partkey_y")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("min_ps_supplycost_y")
        duckdb$expr_set_alias(tmp_expr, "min_ps_supplycost_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"
  rel59 <- duckdb$rel_join(
    rel57,
    rel58,
    list(
      duckdb$expr_function(
        "___eq_na_matches_na",
        list(duckdb$expr_reference("p_partkey_x", rel57), duckdb$expr_reference("p_partkey_y", rel58))
      ),
      duckdb$expr_function(
        "___eq_na_matches_na",
        list(duckdb$expr_reference("ps_supplycost_x", rel57), duckdb$expr_reference("min_ps_supplycost_y", rel58))
      )
    ),
    "inner"
  )
  "inner_join"
  rel60 <- duckdb$rel_order(
    rel59,
    list(duckdb$expr_reference("___row_number_x", rel57), duckdb$expr_reference("___row_number_y", rel58))
  )
  "inner_join"
  rel61 <- duckdb$rel_project(
    rel60,
    list(
      {
        tmp_expr <- duckdb$expr_function(
          "___coalesce",
          list(duckdb$expr_reference("p_partkey_x", rel57), duckdb$expr_reference("p_partkey_y", rel58))
        )
        duckdb$expr_set_alias(tmp_expr, "p_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_function(
          "___coalesce",
          list(duckdb$expr_reference("ps_supplycost_x", rel57), duckdb$expr_reference("min_ps_supplycost_y", rel58))
        )
        duckdb$expr_set_alias(tmp_expr, "ps_supplycost")
        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("n_name_x")
        duckdb$expr_set_alias(tmp_expr, "n_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_acctbal_x")
        duckdb$expr_set_alias(tmp_expr, "s_acctbal")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_name_x")
        duckdb$expr_set_alias(tmp_expr, "s_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_address_x")
        duckdb$expr_set_alias(tmp_expr, "s_address")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_phone_x")
        duckdb$expr_set_alias(tmp_expr, "s_phone")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_comment_x")
        duckdb$expr_set_alias(tmp_expr, "s_comment")
        tmp_expr
      }
    )
  )
  "select"
  rel62 <- duckdb$rel_project(
    rel61,
    list(
      {
        tmp_expr <- duckdb$expr_reference("s_acctbal")
        duckdb$expr_set_alias(tmp_expr, "s_acctbal")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_name")
        duckdb$expr_set_alias(tmp_expr, "s_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("n_name")
        duckdb$expr_set_alias(tmp_expr, "n_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("p_partkey")
        duckdb$expr_set_alias(tmp_expr, "p_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("p_mfgr")
        duckdb$expr_set_alias(tmp_expr, "p_mfgr")
        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_phone")
        duckdb$expr_set_alias(tmp_expr, "s_phone")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_comment")
        duckdb$expr_set_alias(tmp_expr, "s_comment")
        tmp_expr
      }
    )
  )
  "arrange"
  rel63 <- duckdb$rel_project(
    rel62,
    list(
      {
        tmp_expr <- duckdb$expr_reference("s_acctbal")
        duckdb$expr_set_alias(tmp_expr, "s_acctbal")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_name")
        duckdb$expr_set_alias(tmp_expr, "s_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("n_name")
        duckdb$expr_set_alias(tmp_expr, "n_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("p_partkey")
        duckdb$expr_set_alias(tmp_expr, "p_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("p_mfgr")
        duckdb$expr_set_alias(tmp_expr, "p_mfgr")
        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_phone")
        duckdb$expr_set_alias(tmp_expr, "s_phone")
        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")
        tmp_expr
      }
    )
  )
  "arrange"
  rel64 <- duckdb$rel_order(
    rel63,
    list(duckdb$expr_reference("s_acctbal"), duckdb$expr_reference("n_name"), duckdb$expr_reference("s_name"), duckdb$expr_reference("p_partkey"), duckdb$expr_reference("___row_number"))
  )
  "arrange"
  rel65 <- duckdb$rel_project(
    rel64,
    list(
      {
        tmp_expr <- duckdb$expr_reference("s_acctbal")
        duckdb$expr_set_alias(tmp_expr, "s_acctbal")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_name")
        duckdb$expr_set_alias(tmp_expr, "s_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("n_name")
        duckdb$expr_set_alias(tmp_expr, "n_name")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("p_partkey")
        duckdb$expr_set_alias(tmp_expr, "p_partkey")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("p_mfgr")
        duckdb$expr_set_alias(tmp_expr, "p_mfgr")
        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_phone")
        duckdb$expr_set_alias(tmp_expr, "s_phone")
        tmp_expr
      },
      {
        tmp_expr <- duckdb$expr_reference("s_comment")
        duckdb$expr_set_alias(tmp_expr, "s_comment")
        tmp_expr
      }
    )
  )
  "head"
  rel66 <- duckdb$rel_limit(rel65, 100)
  rel66
  duckdb$rel_to_altrep(rel66)
}
duckdblabs/duckplyr documentation built on Nov. 6, 2024, 10 p.m.