Skip to content

Commit ed8ea29

Browse files
committed
feat(cubesql): Remove cube_to_data_source in MetaContext::new
1 parent 8784193 commit ed8ea29

File tree

4 files changed

+4
-32
lines changed

4 files changed

+4
-32
lines changed

packages/cubejs-backend-native/src/transport.rs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl TransportService for NodeBridgeTransport {
142142

143143
let channel = self.channel.clone();
144144

145-
let (cube_to_data_source, member_to_data_source, data_source_to_sql_generator) =
145+
let (member_to_data_source, data_source_to_sql_generator) =
146146
call_raw_js_with_channel_as_callback(
147147
self.channel.clone(),
148148
self.sql_generators.clone(),
@@ -152,17 +152,6 @@ impl TransportService for NodeBridgeTransport {
152152
let obj = v
153153
.downcast::<JsObject, _>(cx)
154154
.map_err(|e| CubeError::user(e.to_string()))?;
155-
let cube_to_data_source_obj = obj
156-
.get::<JsObject, _, _>(cx, "cubeNameToDataSource")
157-
.map_cube_err("Can't cast cubeNameToDataSource to object")?;
158-
159-
let cube_to_data_source =
160-
key_to_values(cx, cube_to_data_source_obj, |cx, v| {
161-
let res = v.downcast::<JsString, _>(cx).map_cube_err(
162-
"Can't cast value to string in cube_to_data_source",
163-
)?;
164-
Ok(res.value(cx))
165-
})?;
166155

167156
let member_to_data_source_obj = obj
168157
.get::<JsObject, _, _>(cx, "memberToDataSource")
@@ -194,11 +183,7 @@ impl TransportService for NodeBridgeTransport {
194183
Ok(res)
195184
})?;
196185

197-
Ok((
198-
cube_to_data_source,
199-
member_to_data_source,
200-
data_source_to_sql_generator,
201-
))
186+
Ok((member_to_data_source, data_source_to_sql_generator))
202187
}),
203188
)
204189
.await?;
@@ -223,7 +208,6 @@ impl TransportService for NodeBridgeTransport {
223208
})?;
224209
Ok(Arc::new(MetaContext::new(
225210
response.cubes.unwrap_or_default(),
226-
cube_to_data_source,
227211
member_to_data_source,
228212
data_source_to_sql_generator,
229213
compiler_id,

rust/cubesql/cubesql/src/compile/test/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -656,10 +656,6 @@ fn get_test_tenant_ctx_with_meta_and_templates(
656656
meta: Vec<CubeMeta>,
657657
custom_templates: Vec<(String, String)>,
658658
) -> Arc<MetaContext> {
659-
let cube_to_data_source = meta
660-
.iter()
661-
.map(|c| (c.name.clone(), "default".to_string()))
662-
.collect();
663659
let member_to_data_source = meta
664660
.iter()
665661
.flat_map(|cube| {
@@ -673,7 +669,6 @@ fn get_test_tenant_ctx_with_meta_and_templates(
673669
.collect();
674670
Arc::new(MetaContext::new(
675671
meta,
676-
cube_to_data_source,
677672
member_to_data_source,
678673
vec![("default".to_string(), sql_generator(custom_templates))]
679674
.into_iter()

rust/cubesql/cubesql/src/transport/ctx.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ impl<'meta> DataSource<'meta> {
7676
impl MetaContext {
7777
pub fn new(
7878
cubes: Vec<CubeMeta>,
79-
cube_to_data_source: HashMap<String, String>,
8079
member_to_data_source: HashMap<String, String>,
8180
data_source_to_sql_generator: HashMap<String, Arc<dyn SqlGenerator + Send + Sync>>,
8281
compiler_id: Uuid,
@@ -293,13 +292,8 @@ mod tests {
293292
];
294293

295294
// TODO
296-
let test_context = MetaContext::new(
297-
test_cubes,
298-
HashMap::new(),
299-
HashMap::new(),
300-
HashMap::new(),
301-
Uuid::new_v4(),
302-
);
295+
let test_context =
296+
MetaContext::new(test_cubes, HashMap::new(), HashMap::new(), Uuid::new_v4());
303297

304298
match test_context.find_cube_table_with_oid(18000) {
305299
Some(table) => assert_eq!(18000, table.oid),

rust/cubesql/cubesql/src/transport/service.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ impl TransportService for HttpTransport {
250250
response.cubes.unwrap_or_else(Vec::new),
251251
HashMap::new(),
252252
HashMap::new(),
253-
HashMap::new(),
254253
Uuid::new_v4(),
255254
));
256255

0 commit comments

Comments
 (0)