From 4aaa51d8fb93174542adf827de1f41cb5834a987 Mon Sep 17 00:00:00 2001 From: Alex Qyoun-ae <4062971+MazterQyou@users.noreply.github.com> Date: Fri, 3 Nov 2023 10:21:30 +0400 Subject: [PATCH] feat(cubesql): SQL push down for several ANSI SQL functions --- .../src/adapter/BaseQuery.js | 17 +++++++++++++++++ .../cubesql/src/compile/engine/df/wrapper.rs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/cubejs-schema-compiler/src/adapter/BaseQuery.js b/packages/cubejs-schema-compiler/src/adapter/BaseQuery.js index 852e1895d991e..e58ddc1b1cdbb 100644 --- a/packages/cubejs-schema-compiler/src/adapter/BaseQuery.js +++ b/packages/cubejs-schema-compiler/src/adapter/BaseQuery.js @@ -2440,6 +2440,23 @@ class BaseQuery { UPPER: 'UPPER({{ args_concat }})', LEFT: 'LEFT({{ args_concat }})', RIGHT: 'RIGHT({{ args_concat }})', + SQRT: 'SQRT({{ args_concat }})', + ABS: 'ABS({{ args_concat }})', + ACOS: 'ACOS({{ args_concat }})', + ASIN: 'ASIN({{ args_concat }})', + ATAN: 'ATAN({{ args_concat }})', + COS: 'COS({{ args_concat }})', + EXP: 'EXP({{ args_concat }})', + LN: 'LN({{ args_concat }})', + LOG: 'LOG({{ args_concat }})', + PI: 'PI()', + POWER: 'POWER({{ args_concat }})', + SIN: 'SIN({{ args_concat }})', + TAN: 'TAN({{ args_concat }})', + REPEAT: 'REPEAT({{ args_concat }})', + + STDDEV: 'STDDEV_SAMP({{ args_concat }})', + SUBSTR: 'SUBSTRING({{ args_concat }})', }, statements: { select: 'SELECT {{ select_concat | map(attribute=\'aliased\') | join(\', \') }} \n' + diff --git a/rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs b/rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs index 3f891b51e42a7..f90844c2a0d39 100644 --- a/rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs +++ b/rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs @@ -1034,7 +1034,7 @@ impl CubeScanWrapperNode { DataType::UInt64 => "INTEGER", DataType::Float16 => "FLOAT", DataType::Float32 => "FLOAT", - DataType::Float64 => "DOUBLE", + DataType::Float64 => "DOUBLE PRECISION", DataType::Timestamp(_, _) => "TIMESTAMP", DataType::Date32 => "DATE", DataType::Date64 => "DATE",