Skip to content

Latest commit

 

History

History

geospatial-default

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Geospatial Default Values

In this recipe we'll learn how to add a default value for a Geospatial column.

Pinot Version 1.0.0
Schema config/schema.json
Real-Time Table Config config/table.json

This is the code for the following recipe: https://dev.startree.ai/docs/pinot/recipes/geospatial


git clone git@github.com:startreedata/pinot-recipes.git
cd pinot-recipes/recipes/geospatial-default

Spin up a Pinot cluster using Docker Compose:

docker-compose up

Ingest data into Kafka:

python datagen.py --sleep 0.0001 2>/dev/null |
jq -cr --arg sep ø '[.uuid, tostring] | join($sep)' |
kcat -P -b localhost:9092 -t events -Kø

Add schema:

docker run \
   --network geospatial \
   -v $PWD/config:/config \
   apachepinot/pinot:1.0.0 AddSchema \
     -schemaFile /config/schema.json \
     -controllerHost "pinot-controller-geospatial" \
    -exec

Add table:

curl -X POST http://localhost:9000/tables --data @config/table.json

Sample queries:

select StDistance(ST_GeomFromText('POINT (0.6861134172138761 83.5002942140996)'), toGeometry(point)) AS distance, 
       count(*)
from events 
group by distance
order by count(*) DESC, distance desc
limit 10