These examples are based on the single-server quick start version of druid.
See this page how to install this: https://druid.apache.org/docs/latest/tutorials/index.html
We assume that you have imported the "wikipedia" file as data source. See this tutorial how to load the data:
https://druid.apache.org/docs/latest/tutorials/tutorial-batch.html
Each example can be tested on the console.
Execute the examples like:
php -f examples/GroupByQuery.php