MCPcopy Create free account
hub / github.com/PRQL/prql / wrap

Function wrap

prqlc/prqlc/src/sql/pq/preprocess.rs:96–117  ·  view source on GitHub ↗
(pipe: Vec<Transform>, ctx: &mut Context)

Source from the content-addressed store, hash-verified

94}
95
96pub(in crate::sql) fn wrap(pipe: Vec<Transform>, ctx: &mut Context) -> Result<Vec<SqlTransform>> {
97 // We map From and Join into SqlTransforms, because we need to change their RIIds.
98 // Others we just wrap into SqlTransform::Super.
99
100 pipe.into_iter()
101 .map(|x| {
102 Ok(match x {
103 Transform::From(table_ref) => {
104 let riid = ctx
105 .anchor
106 .create_relation_instance(table_ref, HashMap::new());
107 SqlTransform::From(riid)
108 }
109 Transform::Join { with, side, filter } => {
110 let with = ctx.anchor.create_relation_instance(with, HashMap::new());
111 SqlTransform::Join { with, side, filter }
112 }
113 x => SqlTransform::Super(x),
114 })
115 })
116 .try_collect()
117}
118
119fn vecs_contain_same_elements<T: Eq + std::hash::Hash>(a: &[T], b: &[T]) -> bool {
120 let a: HashSet<&T, RandomState> = a.iter().collect();

Callers 1

preprocessFunction · 0.85

Calls 3

mapMethod · 0.80
into_iterMethod · 0.80

Tested by

no test coverage detected