Skip to content

Instantly share code, notes, and snippets.

@ls12styler
ls12styler / docker-compose.yml
Created April 21, 2020 15:43 — forked from brunosimioni/docker-compose.yml
Docker Compose to Prometheus, PushGateway and Grafana setup
version: '2.1'
networks:
monitor-net:
driver: bridge
volumes:
prometheus_data: {}
grafana_data: {}
+-----------------------------------------+-------------+-----+
|Supplier |total |count|
+-----------------------------------------+-------------+-----+
|EUROPEAN SPACE AGENCY |56,098,583.99|3 |
|SCIENCE AND TECHNOLOGY FACILITIES COUNCIL|4,511,225.33 |4 |
|ECOMETRICA LTD |1,044,096.22 |2 |
+-----------------------------------------+-------------+-----+
...
val supplierSpends = data.groupBy("Supplier")
.agg(
sum("Amount").as("total"),
count("Supplier").as("count")
)
.orderBy(desc("total"))
.limit(3)
.withColumn("total", format_number($"total", 2))
supplierSpends.show(false)
+-----------------------------------------+-------------+
|Supplier |total |
+-----------------------------------------+-------------+
|EUROPEAN SPACE AGENCY |56,098,583.99|
|SCIENCE AND TECHNOLOGY FACILITIES COUNCIL|4,511,225.33 |
|ECOMETRICA LTD |1,044,096.22 |
+-----------------------------------------+-------------+
...
val supplierSpends = data
.groupBy("Supplier")
.agg(sum("Amount").as("total"))
.orderBy(desc("total"))
.limit(3)
.withColumn("total", format_number($"total", 2))
supplierSpends.show(false)
...
...
val expenses = data
.groupBy("Expense Type")
.agg(sum("Amount").as("total"))
.withColumn("total", format_number($"total", 2))
expenses.show(false)
...
+-------------+
| total|
+-------------+
|67,366,632.28|
+-------------+
...
val totalSpend = data.agg(sum("Amount").as("total"))
.withColumn("total", format_number($"total", 2))
totalSpend.show(false)
...
+-------------------+
| total|
+-------------------+
|6.736663227999993E7|
+-------------------+
...
val totalSpend = data.agg(sum("Amount").as("total"))
totalSpend.show(false)
...