Skip to content

Commit

Permalink
feat(cubesql): SQL push down for several ANSI SQL functions
Browse files Browse the repository at this point in the history
  • Loading branch information
MazterQyou committed Nov 3, 2023
1 parent b8aa735 commit 4aaa51d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions packages/cubejs-schema-compiler/src/adapter/BaseQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' +
Expand Down
2 changes: 1 addition & 1 deletion rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ impl CubeScanWrapperNode {
DataType::UInt64 => "INTEGER",
DataType::Float16 => "FLOAT",
DataType::Float32 => "FLOAT",
DataType::Float64 => "DOUBLE",
DataType::Float64 => "DOUBLE PRECISION",

Check warning on line 1037 in rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs

View check run for this annotation

Codecov / codecov/patch

rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs#L1037

Added line #L1037 was not covered by tests
DataType::Timestamp(_, _) => "TIMESTAMP",
DataType::Date32 => "DATE",
DataType::Date64 => "DATE",
Expand Down

0 comments on commit 4aaa51d

Please sign in to comment.