Skip to content

Commit

Permalink
Added YAML support to calcite.
Browse files Browse the repository at this point in the history
  • Loading branch information
kenstott committed Aug 19, 2024
1 parent b1c9b4a commit 2b73b14
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 39 deletions.
30 changes: 30 additions & 0 deletions adapters/file/resources/test/bug/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
- 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
82 changes: 47 additions & 35 deletions adapters/hive/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,43 +1,55 @@
version: '3'

services:
postgres-db:
image: postgres:13
hive:
image: openjdk:8-jdk-slim
platform: linux/arm64
ports:
- "5432:5432"
volumes:
- ./hive_data:/opt/hive_data
environment:
- POSTGRES_DB=metastore
- POSTGRES_USER=hive
- POSTGRES_PASSWORD=hive

hive-metastore:
build:
context: .
dockerfile: Dockerfile.hive
platform: linux/arm64
ports:
- "9083:9083"
depends_on:
- postgres-db
command: ["metastore"]

hive-server:
build:
context: .
dockerfile: Dockerfile.hive
platform: linux/arm64
- HIVE_VERSION=2.3.9
ports:
- "10000:10000"
- "10002:10002"
depends_on:
- hive-metastore
command: ["hiveserver2"]
- "9083:9083"
command: >
/bin/bash -c "
apt-get update &&
apt-get install -y wget procps &&
wget https://downloads.apache.org/hive/hive-2.3.9/apache-hive-2.3.9-bin.tar.gz &&
tar -xzf apache-hive-2.3.9-bin.tar.gz &&
mv apache-hive-2.3.9-bin /opt/hive &&
rm apache-hive-2.3.9-bin.tar.gz &&
echo 'export HIVE_HOME=/opt/hive' >> ~/.bashrc &&
echo 'export PATH=$$PATH:$$HIVE_HOME/bin' >> ~/.bashrc &&
source ~/.bashrc &&
sed -i 's|$${system:java.io.tmpdir}|/opt/hive_data|g' /opt/hive/conf/hive-site.xml &&
sed -i 's|$${system:user.name}|root|g' /opt/hive/conf/hive-site.xml &&
/opt/hive/bin/schematool -dbType derby -initSchema &&
/opt/hive/bin/hive --service metastore &
sleep 10 &&
/opt/hive/bin/hive --service hiveserver2
"
beeline:
build:
context: .
dockerfile: Dockerfile.hive
hive-beeline:
image: openjdk:8-jdk-slim
platform: linux/arm64
depends_on:
- hive-server
entrypoint: [ "/bin/bash" ]
command: [ "-c", "sleep infinity" ]
- hive
volumes:
- ./hive_data:/opt/hive_data
environment:
- HIVE_VERSION=2.3.9
command: >
/bin/bash -c "
apt-get update &&
apt-get install -y wget procps &&
wget https://downloads.apache.org/hive/hive-2.3.9/apache-hive-2.3.9-bin.tar.gz &&
tar -xzf apache-hive-2.3.9-bin.tar.gz &&
mv apache-hive-2.3.9-bin /opt/hive &&
rm apache-hive-2.3.9-bin.tar.gz &&
echo 'export HIVE_HOME=/opt/hive' >> ~/.bashrc &&
echo 'export PATH=$$PATH:$$HIVE_HOME/bin' >> ~/.bashrc &&
source ~/.bashrc &&
sleep 30 &&
/opt/hive/bin/beeline -u jdbc:hive2://hive:10000
"
12 changes: 11 additions & 1 deletion calcite-rs-jni/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,20 @@
<artifactId>gson</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>2.12.3</version>
<version>2.17.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.17.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
4 changes: 2 additions & 2 deletions calcite-rs-jni/src/main/java/org/kenstott/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class Main {
public static void main(String[] args) {

String modelPath = "../adapters/cassandra/model.json";
String modelPath = "../adapters/file/model.json";
String username = "<username>";
String password = "<password>";
Connection calciteConnection = null;
Expand All @@ -34,7 +34,7 @@ public static void main(String[] args) {
// """);
// System.out.println(zz);
String z1 = query.queryModels("""
SELECT "article_id" FROM "twissandra"."news_articles_by_source" LIMIT 10
SELECT "a" FROM "sales"."test" LIMIT 10
"""
);
System.out.println(z1);
Expand Down
Binary file modified connector-definition.tgz
Binary file not shown.

0 comments on commit 2b73b14

Please sign in to comment.