Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/julianhyde/druid-mdx
Example of running MDX on Druid via Mondrian and Calcite
https://github.com/julianhyde/druid-mdx
Last synced: 29 days ago
JSON representation
Example of running MDX on Druid via Mondrian and Calcite
- Host: GitHub
- URL: https://github.com/julianhyde/druid-mdx
- Owner: julianhyde
- License: apache-2.0
- Created: 2016-08-01T23:29:02.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-08-03T01:31:17.000Z (over 8 years ago)
- Last Synced: 2024-05-07T18:15:46.330Z (6 months ago)
- Language: Java
- Size: 10.7 KB
- Stars: 26
- Watchers: 6
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# druid-mdx
This project is an example of running MDX on
[Druid](http://druid.io) via
[Mondrian](http://mondrian.pentaho.org) and
[Apache Calcite](http://calcite.apache.org).## What it does
First, it creates a JDBC connection using
[Calcite's Druid adapter](https://calcite.apache.org/docs/druid_adapter.html).
Next, it generates a Mondrian model (assuming that numeric columns are
measures and other columns are dimensions).
Last, it connects to Mondrian and executes an MDX query.## Running it
Here is the Mondrian model that is generated:
```xml
```
When the query
```sql
select
[Measures].members on columns,
Order([countryName].members, [Measures].[added], DESC) on rows
from [wiki]
```is run, it produces the following output:
```
__time added count deleted delta
=============== =========================== ====================== ========= ====== ======= =========
All countryName 56,592,352,129,829,184 9,385,573 39,244 394,298 8,991,275
#null 51,113,948,353,410,816 8,761,516 35,445 346,816 8,414,700
Colombia 99,503,304,065,741 60,398 69 787 59,611
Russia 279,761,176,573,129 50,561 194 2,457 48,104
United States 761,411,157,953,310 44,433 528 5,551 38,882
Italy 369,169,251,122,223 41,073 256 1,982 39,091
France 295,623,947,063,302 39,853 205 2,572 37,281
United Kingdom 337,444,146,319,684 38,587 234 2,730 35,857
India 180,257,135,637,316 30,313 125 1,147 29,166
Germany 233,615,258,310,628 26,807 162 1,224 25,583
```## How to build and run
To build, you need Java 1.7 or 1.8, Apache Maven 3.2.1 or higher:
```sh
$ mvn install
```To run, you need Druid running with the query node at
`http://localhost:8082`, the coordinator at `http://localhost:8081`,
populated with the the "wikiticker" data source.You can run from the command line as follows:
```sh
$ mvn exec:java
```or run `net.hydromatic.druid.mdx.Main` from any Java IDE.
## Running against different schemas
Because the Mondrian model is generated on the fly, you could probably
apply this example to other Druid data sources. If you want advanced
features such as hierarchies, dimensions with composite keys, or
calculated members, you can write the Mondrian model by hand.