From 2b73b1471658fe23ba452d4f13774532aa7abc70 Mon Sep 17 00:00:00 2001 From: kenstott <128912107+kenstott@users.noreply.github.com> Date: Mon, 19 Aug 2024 09:05:20 -0400 Subject: [PATCH] Added YAML support to calcite. --- adapters/file/resources/test/bug/test.yaml | 30 +++++++ adapters/hive/docker-compose.yaml | 82 ++++++++++-------- calcite-rs-jni/calcite | 2 +- calcite-rs-jni/pom.xml | 12 ++- .../src/main/java/org/kenstott/Main.java | 4 +- connector-definition.tgz | Bin 439 -> 439 bytes 6 files changed, 91 insertions(+), 39 deletions(-) create mode 100644 adapters/file/resources/test/bug/test.yaml diff --git a/adapters/file/resources/test/bug/test.yaml b/adapters/file/resources/test/bug/test.yaml new file mode 100644 index 0000000..138ff3b --- /dev/null +++ b/adapters/file/resources/test/bug/test.yaml @@ -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 \ No newline at end of file diff --git a/adapters/hive/docker-compose.yaml b/adapters/hive/docker-compose.yaml index 81d8b84..a45648b 100644 --- a/adapters/hive/docker-compose.yaml +++ b/adapters/hive/docker-compose.yaml @@ -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" ] \ No newline at end of file + - 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 + " \ No newline at end of file diff --git a/calcite-rs-jni/calcite b/calcite-rs-jni/calcite index 14f430b..880a0ae 160000 --- a/calcite-rs-jni/calcite +++ b/calcite-rs-jni/calcite @@ -1 +1 @@ -Subproject commit 14f430b8a28e205dac6387dd7cdc8b146fe4ad71 +Subproject commit 880a0ae44a8cc0c5c0782f37844e264348712c54 diff --git a/calcite-rs-jni/pom.xml b/calcite-rs-jni/pom.xml index d45e55d..b7e3378 100644 --- a/calcite-rs-jni/pom.xml +++ b/calcite-rs-jni/pom.xml @@ -175,10 +175,20 @@ gson 2.11.0 + + org.yaml + snakeyaml + 2.2 + com.fasterxml.jackson.dataformat jackson-dataformat-yaml - 2.12.3 + 2.17.2 + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + 2.17.2 org.apache.commons diff --git a/calcite-rs-jni/src/main/java/org/kenstott/Main.java b/calcite-rs-jni/src/main/java/org/kenstott/Main.java index 11e273a..b68a5b8 100644 --- a/calcite-rs-jni/src/main/java/org/kenstott/Main.java +++ b/calcite-rs-jni/src/main/java/org/kenstott/Main.java @@ -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 = ""; String password = ""; Connection calciteConnection = null; @@ -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); diff --git a/connector-definition.tgz b/connector-definition.tgz index 4ee40d8bc00115b11cef26d3a7a9da334571a9f4..e66d18c7372e36f9e0aa71c99e5485c298935558 100644 GIT binary patch delta 16 Xcmdnayq%d{zMF$VYyJL>>>C&XDryBU delta 16 Ycmdnayq%d{zMF$#-l}~Y**7o(04;L`od5s;