cube-js/cube

Extra brackets need to be specified when using dynamic measures

Open

#6.064 geöffnet am 26. Jan. 2023

Auf GitHub ansehen
 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Rust (1.965 Forks)batch import
help wanted

Repository-Metriken

Stars
 (19.563 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 5T 16h) (138 gemergte PRs in 30 T)

Beschreibung

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

Contributor Guide