allegro / turnilo

Business intelligence, data exploration and visualization web application for Druid, formerly known as Swiv and Pivot
https://allegro.github.io/turnilo/
Apache License 2.0
730 stars 174 forks source link

testing proof of concept #1116

Open jsaltermedialab opened 1 week ago

jsaltermedialab commented 1 week ago

i think the most complex problem to solve is turning {"op":"apply","operand":{"op":"apply","operand":{"op":"apply","operand":{"op":"apply","operand":{"op":"literal","value":{"attributes":[],"data":[{}]},"type":"DATASET"},"expression":{"op":"filter","operand":{"op":"ref","name":"main"},"expression":{"op":"overlap","operand":{"op":"ref","name":"__time"},"expression":{"op":"literal","value":{"setType":"TIME_RANGE","elements":[{"start":"2019-02-01T00:01:00.000Z","end":"2019-03-01T00:01:00.000Z"}]},"type":"SET"}}},"name":"main"},"expression":{"op":"literal","value":2592000000},"name":"MillisecondsInInterval"},"expression":{"op":"count","operand":{"op":"ref","name":"main"}},"name":"count"},"expression":{"op":"limit","operand":{"op":"sort","operand":{"op":"apply","operand":{"op":"split","operand":{"op":"ref","name":"main"},"name":"terminal","expression":{"op":"ref","name":"terminal"},"dataName":"main"},"expression":{"op":"count","operand":{"op":"ref","name":"main"}},"name":"count"},"expression":{"op":"ref","name":"count"},"direction":"descending"},"value":100},"name":"SPLIT"}

into SQL to run on BQ, and then turning the BQ response into something that looks like

{"attributes":[{"name":"main","type":"DATASET"},{"name":"MillisecondsInInterval","type":"NUMBER"},{"name":"count","type":"NUMBER"},{"name":"SPLIT","type":"DATASET"}],"data":[{"MillisecondsInInterval":2592000000,"count":20,"SPLIT":{"keys":["terminal"],"attributes":[{"name":"terminal","type":"STRING"},{"name":"main","type":"DATASET"},{"name":"count","type":"NUMBER"}],"data":[{"terminal":"Misc. Terminal","count":2},{"terminal":"Terminal 1","count":2},{"terminal":"Terminal 2","count":2},{"terminal":"Terminal 3","count":2},{"terminal":"Terminal 4","count":2},{"terminal":"Terminal 5","count":2},{"terminal":"Terminal 6","count":2},{"terminal":"Terminal 7","count":2},{"terminal":"Terminal 8","count":2},{"terminal":"Tom Bradley International Terminal","count":2}]}}]}

jsaltermedialab commented 1 week ago
Screenshot 2024-11-13 at 1 40 56 AM