Skip to content

Commit

Permalink
Remove introspection at the startup of the connector (#5)
Browse files Browse the repository at this point in the history
* fix databricks

* code refactors

* Fix conflicts

* fix the warnings

* no introspection while the connector runs

* added conditional logic to use models from config where available in delivering schema

* clean up: removed debug lines and some commented out code

* fix more warnings

* use --release in the calcite dockerfile

* fix the initializing logic of the otel stuff

* fix the github workflow

* revert databricks change

* remove debug statements

* fix warnings

* do not intialize otel during introspection

* fix warnings and README

* update README

* fix trace attribute

* fix the rust-anaylzer.toml

---------

Co-authored-by: Jonathan Weiss <[email protected]>
  • Loading branch information
codingkarthik and gneeri authored Nov 28, 2024
1 parent b8388ec commit ce0c9a9
Show file tree
Hide file tree
Showing 29 changed files with 266 additions and 382 deletions.
1 change: 1 addition & 0 deletions .dir-locals.el
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
((nil . ((lsp-file-watch-ignored-directories . ["target" "calcite-rs-jni" "grafana" "scripts" "shared" "[/\\\\]\\.git$" "[/\\\\]\\.hg$" "[/\\\\]\\.svn$"]))))
12 changes: 4 additions & 8 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,21 @@ name: Docker Image CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
tags:
- 'v*' # This will match any tag that starts with 'v'

jobs:

build:

runs-on: ubuntu-latest

steps:
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v5
with:
context: .
tags: ghcr.io/hasura/ndc-calcite:latest
tags: ghcr.io/hasura/ndc-calcite:${{ github.ref_name }} # Use the tag name for the Docker image
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max

54 changes: 8 additions & 46 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ ndc-test = { git = "https://github.com/hasura/ndc-spec.git", tag = "v0.1.6" }

anyhow = "1"
async-trait = "0.1"
axum = "0.7.5"
axum-test-helper = "0.4.0"
axum = "0.6"
axum-test-helper = "0.3.0"
build-data = "0.2"
bytes = "1"
clap = "4"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ Different components are released under different licenses:
For support options:
- File issues on the respective GitHub repositories
- Contact Hasura support at [email protected] for commercial support
- Join the community discussions on calcite.apache.org/community/
- Join the community discussions on calcite.apache.org/community/
56 changes: 42 additions & 14 deletions build-local.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,42 @@
# prevents local build artifacts being added to image
cd calcite-rs-jni
mvn clean
cd calcite
./gradlew clean

create a tag name from the last connector release
cd ../..
docker build . -t ghcr.io/hasura/ndc-calcite:latest

cd calcite-rs-jni/calcite
./gradlew assemble
cd ..
mvn install -DskipTests
#!/bin/bash

# Check if version argument is provided
if [ $# -ne 1 ]; then
echo "Error: Version argument is required"
echo "Usage: $0 <version>"
echo "Example: $0 1.0.0"
exit 1
fi

VERSION=$1

# Store the script's starting directory
INITIAL_DIR=$(pwd)

# Function to handle errors
handle_error() {
echo "Error: $1"
cd "$INITIAL_DIR" # Return to initial directory
exit 1
}

# Clean Maven artifacts
cd calcite-rs-jni || handle_error "Failed to change directory to calcite-rs-jni"
mvn clean || handle_error "Maven clean failed"

# Clean Gradle artifacts
cd calcite || handle_error "Failed to change directory to calcite"
./gradlew clean || handle_error "Gradle clean failed"

# Build Docker image
cd ../.. || handle_error "Failed to return to root directory"
docker build . -t "ghcr.io/hasura/ndc-calcite:${VERSION}" || handle_error "Docker build failed"

# Build and install Java artifacts
cd calcite-rs-jni/calcite || handle_error "Failed to change directory to calcite-rs-jni/calcite"
./gradlew assemble || handle_error "Gradle assemble failed"
cd .. || handle_error "Failed to change directory"
mvn install -DskipTests || handle_error "Maven install failed"

echo "Build completed successfully!"
echo "Docker image tagged as: ghcr.io/hasura/ndc-calcite:${VERSION}"
2 changes: 1 addition & 1 deletion calcite-rs-jni/calcite
Submodule calcite updated 33 files
+1 −1 build.gradle.kts
+0 −70 graphql/README.md
+0 −88 graphql/build.gradle.kts
+0 −219 graphql/docs/caching.md
+0 −260 graphql/docs/configuration.md
+0 −414 graphql/docs/contributing.md
+0 −190 graphql/docs/features.md
+0 −501 graphql/docs/implementation.md
+0 −268 graphql/docs/limitations.md
+0 −388 graphql/docs/query-examples.md
+0 −324 graphql/docs/requirements.md
+0 −235 graphql/docs/sql-processing.md
+0 −216 graphql/docs/type-system.md
+0 −2 graphql/gradle.properties
+0 −248 graphql/src/main/java/org/apache/calcite/adapter/graphql/GraphQLCacheModule.java
+0 −82 graphql/src/main/java/org/apache/calcite/adapter/graphql/GraphQLCalciteSchema.java
+0 −120 graphql/src/main/java/org/apache/calcite/adapter/graphql/GraphQLEnumerator.java
+0 −293 graphql/src/main/java/org/apache/calcite/adapter/graphql/GraphQLExecutor.java
+0 −92 graphql/src/main/java/org/apache/calcite/adapter/graphql/GraphQLFilter.java
+0 −33 graphql/src/main/java/org/apache/calcite/adapter/graphql/GraphQLMethod.java
+0 −91 graphql/src/main/java/org/apache/calcite/adapter/graphql/GraphQLProject.java
+0 −43 graphql/src/main/java/org/apache/calcite/adapter/graphql/GraphQLRedisCodec.java
+0 −425 graphql/src/main/java/org/apache/calcite/adapter/graphql/GraphQLRel.java
+0 −448 graphql/src/main/java/org/apache/calcite/adapter/graphql/GraphQLRules.java
+0 −152 graphql/src/main/java/org/apache/calcite/adapter/graphql/GraphQLSDLRetriever.java
+0 −113 graphql/src/main/java/org/apache/calcite/adapter/graphql/GraphQLSchemaFactory.java
+0 −75 graphql/src/main/java/org/apache/calcite/adapter/graphql/GraphQLSort.java
+0 −288 graphql/src/main/java/org/apache/calcite/adapter/graphql/GraphQLTable.java
+0 −68 graphql/src/main/java/org/apache/calcite/adapter/graphql/GraphQLTableScan.java
+0 −85 graphql/src/main/java/org/apache/calcite/adapter/graphql/GraphQLToEnumerableConverter.java
+0 −20 graphql/src/main/java/org/apache/calcite/adapter/graphql/OrderByField.java
+2 −18 pom.xml
+0 −1 settings.gradle.kts
9 changes: 0 additions & 9 deletions calcite-rs-jni/jni/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,6 @@
</dependency>

<!-- JDBC drivers and dependencies -->
<dependency>
<groupId>sybase</groupId>
<artifactId>jconnect</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath>${project.basedir}/jars/jconn4.jar</systemPath>
</dependency>
<dependency>
<groupId>com.hasura</groupId>
<artifactId>bigquery-jdbc</artifactId>
Expand Down Expand Up @@ -271,7 +264,6 @@
<groupId>com.databricks</groupId>
<artifactId>databricks-jdbc</artifactId>
<version>2.6.40-patch-1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
Expand Down Expand Up @@ -361,4 +353,3 @@
</plugins>
</build>
</project>

Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ public String queryModels(String query, String parentTraceId, String parentSpanI
return result;
} else {

span.setAttribute("Using JSON_OBJECT() method", false);
span.setAttribute("Not Using JSON_OBJECT() method", false);
// Java's inbuilt DateTimeFormatter doesn't have any predefined format for RFC 3339
DateTimeFormatter rfcFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.ENGLISH).withZone(ZoneId.of("UTC"));
DateTimeFormatter rfcDateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd", Locale.ENGLISH).withZone(ZoneId.of("UTC"));
Expand Down
1 change: 1 addition & 0 deletions crates/calcite-schema/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ thiserror = { workspace = true }
tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true }
once_cell = { workspace = true}
dotenv = { workspace = true }
http = { workspace = true }

[dev-dependencies]
Expand Down
Loading

0 comments on commit ce0c9a9

Please sign in to comment.