Skip to content

Commit

Permalink
Added query explain feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
kenstott committed Aug 1, 2024
1 parent aef4cca commit dd683ff
Show file tree
Hide file tree
Showing 29 changed files with 354 additions and 168 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
target/
*.rs.bk
/adapters/file/model.json
/config-test/*
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ ENV HASURA_CONFIGURATION_DIRECTORY=/etc/connector
ENV RUST_BACKTRACE=full

COPY calcite-rs-jni/ /calcite-rs-jni/
COPY config-templates/ /config-templates/

WORKDIR /calcite-rs-jni/calcite
RUN ./gradlew assemble
Expand Down
1 change: 0 additions & 1 deletion adapters/jdbc/.env.local
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
RUST_LOG=info
OTEL_LOGS_EXPORTER=console
OTEL_LOG_LEVEL=trace
LOG4J_CONFIGURATION_FILE=../../calcite-rs-jni/target/classes/log4j2.xml
11 changes: 11 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
release_info=$(curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/hasura/ndc-calcite/releases/latest)
TAG=$(echo "$release_info" | grep 'tag_name' | awk -F':' '{print $2}' | tr -d ' "",')
tar -czvf connector-definition.tgz connector-definition
docker build . --platform linux/arm64,linux/amd64 -t kstott/meta_connector:latest
docker tag kstott/meta_connector:latest kstott/meta_connector:"$TAG"
docker push kstott/meta_connector:latest
docker push kstott/meta_connector:"$TAG"
2 changes: 1 addition & 1 deletion calcite-rs-jni/calcite
139 changes: 0 additions & 139 deletions ci/deploy.sh

This file was deleted.

4 changes: 4 additions & 0 deletions config-templates/.env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RUST_LOG=info
OTEL_LOGS_EXPORTER=console
OTEL_LOG_LEVEL=trace
OTEL_EXPORTER_OTLP_ENDPOINT=http://local.hasura.dev:4317
6 changes: 6 additions & 0 deletions config-templates/configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"version": "4",
"$schema": "schema.json",
"model_file_path": "/etc/connector/model.json",
"fixes": true
}
Empty file.
42 changes: 42 additions & 0 deletions config-templates/data/files/ARCHERS.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[
{
"id": 19990101,
"a": "Friday",
"b": "New Years Day",
"c": "Tractor trouble.",
"d": [
"Alice",
"Bob",
"Xavier"
],
"e": "Julian Hyde",
"f": "",
"g": [
"Bob's tractor got stuck in a field.",
"Alice and Xavier hatch a plan to surprise Charlie."
],
"object": {
"count": 1
}
},
{
"id": 19990103,
"a": "Sunday",
"b": "Sunday 3rd January",
"c": "Charlie's surprise.",
"d": [
"Alice",
"Zebedee",
"Charlie",
"Xavier"
],
"e": "William Shakespeare",
"f": "",
"g": [
"Charlie is very surprised by Alice and Xavier's surprise plan."
],
"object": {
"count": 2
}
}
]
9 changes: 9 additions & 0 deletions config-templates/data/files/DATES.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
EMPNO:int,JOINEDAT:date,JOINTIME:time,JOINTIMES:timestamp
100,"1996-08-03","00:01:02","1996-08-03 00:01:02"
110,"2001-01-01","00:00:00","2001-01-01 00:00:00"
110,"2002-05-03","00:00:00","2002-05-03 00:00:00"
120,"2005-09-07","00:00:00","2005-09-07 00:00:00"
130,"2007-01-01","00:00:00","2007-01-01 00:00:00"
140,"2015-12-31","07:15:56","2015-12-31 07:15:56"
200,,,,
150,"2015-12-31","13:31:21","2015-12-31 13:31:21"
4 changes: 4 additions & 0 deletions config-templates/data/files/DEPTS.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DEPTNO:int,NAME:string
10,"Sales"
20,"Marketing"
30,"Accounts"
Binary file added config-templates/data/files/EMPS.csv.gz
Binary file not shown.
6 changes: 6 additions & 0 deletions config-templates/data/files/LONG_EMPS.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
EMPNO:long,NAME:string,DEPTNO:int,GENDER:string,CITY:string,EMPID:int,AGE:int,SLACKER:boolean,MANAGER:boolean,JOINEDAT:date
100,"Fred",10,,,30,25,true,false,"1996-08-03"
110,"Eric",20,"M","San Francisco",3,80,,false,"2001-01-01"
110,"John",40,"M","Vancouver",2,,false,true,"2002-05-03"
120,"Wilma",20,"F",,1,5,,true,"2005-09-07"
130,"Alice",40,"F","Vancouver",2,,false,true,"2007-01-01"
7 changes: 7 additions & 0 deletions config-templates/data/files/SDEPTS.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DEPTNO:int,NAME:string
10,"Sales"
20,"Marketing"
30,"Accounts"
40,"40"
50,"50"
60,"60"
6 changes: 6 additions & 0 deletions config-templates/data/files/WACKY_COLUMN_NAMES.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
EMPNO:int,naME:string,DEPTNO:Integer,2gender:string,CITY:string,EMPID:int,AGE:int,SLACKER:boolean,MANAGER:boolean,joined at:date
100,"Fred",10,,,30,25,true,false,"1996-08-03"
110,"Eric",20,"M","San Francisco",3,80,,false,"2001-01-01"
110,"John",40,"M","Vancouver",2,,false,true,"2002-05-03"
120,"Wilma",20,"F",,1,5,,true,"2005-09-07"
130,"Alice",40,"F","Vancouver",2,,false,true,"2007-01-01"
9 changes: 4 additions & 5 deletions config-templates/docker-compose.file.calcite.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
services:
${SUBGRAPH}_${CONNECTOR}:
meta_connector:
build:
context: .
dockerfile_inline: |-
FROM kstott/calcite_connector:latest
COPY ./ /etc/connector
FROM docker.io/kstott/meta_connector:latest
develop:
watch:
- path: ./
Expand All @@ -20,5 +19,5 @@ services:
published: ${HASURA_CONNECTOR_PORT:8080}
protocol: tcp
volumes:
- ${MODEL}:/model.json
- ./configuration.json:/update/connector/configuration.json
- .:/etc/connector
- ${MODEL_FILE:-./models/model.json}:/etc/connector/model.json
14 changes: 14 additions & 0 deletions config-templates/model.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "1.0",
"defaultSchema": "test",
"schemas": [
{
"type": "jdbc",
"name": "test",
"jdbcUser": "kenstott",
"jdbcPassword": "rN8qOh6AEMCP",
"jdbcUrl": "jdbc:postgresql://ep-yellow-salad-961725.us-west-2.aws.neon.tech/crisp-sheepdog-47_db_3216533?sslmode=require",
"jdbcCatalog": "public"
}
]
}
14 changes: 14 additions & 0 deletions config-templates/models/model.files.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "1.0",
"defaultSchema": "sales",
"schemas": [
{
"type": "custom",
"name": "sales",
"factory": "org.apache.calcite.adapter.file.FileSchemaFactory",
"operand": {
"directory": "/etc/connector/data/files"
}
}
]
}
12 changes: 12 additions & 0 deletions config-templates/models/model.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "1.0",
"defaultSchema": "test",
"schemas": [
{
"type": "jdbc",
"name": "test",
"sqlDialectFactory": "org.kenstott.SQLiteSqlDialectFactory",
"jdbcUrl": "jdbc:sqlite:/etc/connector/data/chinook.db"
}
]
}
14 changes: 14 additions & 0 deletions config-templates/models/model.pg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "1.0",
"defaultSchema": "test",
"schemas": [
{
"type": "jdbc",
"name": "test",
"jdbcUser": "<username>",
"jdbcPassword": "<password>",
"jdbcUrl": "jdbc:postgresql://<server>/<database>?sslmode=require",
"jdbcCatalog": "public"
}
]
}
Loading

0 comments on commit dd683ff

Please sign in to comment.