From 6a14e6302e722235082dd558d1ae49dab5fb19db Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 17 Dec 2024 22:01:21 +0200 Subject: [PATCH] remove not needed anymore native.transformQueryData --- packages/cubejs-api-gateway/src/gateway.ts | 2 - packages/cubejs-backend-native/js/index.ts | 17 -------- .../cubejs-backend-native/src/orchestrator.rs | 40 +------------------ 3 files changed, 1 insertion(+), 58 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index fbed0677418e0..7744a0e2beb15 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -14,8 +14,6 @@ import { getFinalQueryResult, getFinalQueryResultArray, getFinalQueryResultMulti, - transformData as transformDataNative, - TransformDataResponse } from '@cubejs-backend/native'; import type { Application as ExpressApplication, diff --git a/packages/cubejs-backend-native/js/index.ts b/packages/cubejs-backend-native/js/index.ts index 87fc2fe9c950b..c57f4846422d9 100644 --- a/packages/cubejs-backend-native/js/index.ts +++ b/packages/cubejs-backend-native/js/index.ts @@ -107,17 +107,6 @@ export type DBResponsePrimitive = number | string; -export type TransformDataResponse = { - members: string[], - dataset: DBResponsePrimitive[][] -} | { - [member: string]: DBResponsePrimitive -}[]; - -export type TransformDataResponseNative = { - result: string -}; - let loadedNative: any = null; export function loadNative() { @@ -387,12 +376,6 @@ export const getCubestoreResult = (ref: CubeStoreResultWrapper): ResultRow[] => return native.getCubestoreResult(ref); }; -export const transformData = (transformDataObj: Object, rows: any): Promise => { - const native = loadNative(); - - return native.transformQueryData(transformDataObj, rows); -}; - export const getFinalQueryResult = (transformDataObj: Object, rows: any, resultData: Object): Promise => { const native = loadNative(); diff --git a/packages/cubejs-backend-native/src/orchestrator.rs b/packages/cubejs-backend-native/src/orchestrator.rs index 95854cbd50950..2395a93ff4955 100644 --- a/packages/cubejs-backend-native/src/orchestrator.rs +++ b/packages/cubejs-backend-native/src/orchestrator.rs @@ -1,8 +1,7 @@ use crate::node_obj_deserializer::JsValueDeserializer; use cubeorchestrator::query_message_parser::QueryResult; use cubeorchestrator::query_result_transform::{ - get_final_cubestore_result_array, RequestResultArray, RequestResultData, - RequestResultDataMulti, TransformedData, + get_final_cubestore_result_array, RequestResultArray, RequestResultData, RequestResultDataMulti, }; use cubeorchestrator::transport::{JsRawData, TransformDataRequest}; use neon::context::{Context, FunctionContext, ModuleContext}; @@ -21,7 +20,6 @@ pub fn register_module(cx: &mut ModuleContext) -> NeonResult<()> { parse_cubestore_result_message, )?; cx.export_function("getCubestoreResult", get_cubestore_result)?; - cx.export_function("transformQueryData", transform_query_data)?; cx.export_function("getFinalQueryResult", final_query_result)?; cx.export_function("getFinalQueryResultMulti", final_query_result_multi)?; cx.export_function("getFinalQueryResultArray", final_query_result_array)?; @@ -110,42 +108,6 @@ pub fn get_cubestore_result(mut cx: FunctionContext) -> JsResult { Ok(js_array.upcast()) } -pub fn transform_query_data(mut cx: FunctionContext) -> JsResult { - let transform_data_js_object = cx.argument::(0)?; - let deserializer = JsValueDeserializer::new(&mut cx, transform_data_js_object); - - let request_data: TransformDataRequest = match Deserialize::deserialize(deserializer) { - Ok(data) => data, - Err(err) => return cx.throw_error(err.to_string()), - }; - - let cube_store_result = cx.argument::>>(1)?; - let cube_store_result = Arc::clone(&cube_store_result); - - let promise = cx - .task(move || { - let transformed = TransformedData::transform(&request_data, &cube_store_result)?; - - match serde_json::to_string(&transformed) { - Ok(json) => Ok(json), - Err(err) => Err(anyhow::Error::from(err)), - } - }) - .promise(move |mut cx, json_data| match json_data { - Ok(json_data) => { - let js_string = cx.string(json_data); - - let js_result = cx.empty_object(); - js_result.set(&mut cx, "result", js_string)?; - - Ok(js_result) - } - Err(err) => cx.throw_error(err.to_string()), - }); - - Ok(promise) -} - pub fn final_query_result(mut cx: FunctionContext) -> JsResult { let transform_data_js_object = cx.argument::(0)?; let deserializer = JsValueDeserializer::new(&mut cx, transform_data_js_object);