cube-js/cube

Extra brackets need to be specified when using dynamic measures

開放

#6,064 建立於 2023年1月26日

 (2 則留言) (0 個反應) (0 位負責人)Rust (1,965 個分叉)batch import
help wanted

倉庫指標

星標
 (19,563 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Is your feature request related to a problem? Please describe. Example of schema:

"sales":{
   "sql":"sum(${CUBE}."Sales")"
},
"wholesaleCost":{
   "sql":"sum(${CUBE}."WholesaleCost")"
},
"profit":{
   "sql":"${sales} - ${wholesaleCost}"
},
"someCoef":{
   "sql":"${profit} / ${sales}"
}

This schema is not working. someCoef generates wrong formula${sales} - ${wholesaleCost}/${sales} while correct is (${sales} - ${wholesaleCost})/${sales} It can be fixed in 2 ways:

  1. someCoef sql should be (${profit}) / ${sales} (profit inside brackets)
  2. profit sql should be (${sales} - ${wholesaleCost}) (whole formula inside brackets)

Describe the solution you'd like Cube should check and automatically add brackets if needed

貢獻者指南