From 5ae2b06afc1bb5adf0b19bd4f0fe9744898599af Mon Sep 17 00:00:00 2001 From: Simeon Widdis Date: Mon, 10 Nov 2025 19:07:47 +0000 Subject: [PATCH 1/3] Add workflow for SQL CLI integration tests Signed-off-by: Simeon Widdis --- .../workflows/sql-cli-integration-test.yml | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 .github/workflows/sql-cli-integration-test.yml diff --git a/.github/workflows/sql-cli-integration-test.yml b/.github/workflows/sql-cli-integration-test.yml new file mode 100644 index 0000000000..8ea621c71f --- /dev/null +++ b/.github/workflows/sql-cli-integration-test.yml @@ -0,0 +1,103 @@ +name: SQL CLI Integration Test + +# This workflow tests sql-cli against the current SQL changes +# to catch breaking changes before they're published + +on: + pull_request: + paths: + - 'api/**' + - 'sql/**' + - 'ppl/**' + - 'core/**' + - 'opensearch/**' + - 'common/**' + - 'protocol/**' + - '**/*.gradle' + - '.github/workflows/sql-cli-integration-test.yml' + push: + branches: + - main + - '[0-9]+.[0-9]+' + - '[0-9]+.x' + paths: + - 'api/**' + - 'sql/**' + - 'ppl/**' + - 'core/**' + - 'opensearch/**' + - 'common/**' + - 'protocol/**' + - '**/*.gradle' + - '.github/workflows/sql-cli-integration-test.yml' + workflow_dispatch: + +jobs: + test-sql-cli-integration: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + java: [21] + + steps: + - name: Checkout SQL repository (current changes) + uses: actions/checkout@v4 + with: + path: sql + + - name: Checkout SQL CLI repository (latest main) + uses: actions/checkout@v4 + with: + repository: opensearch-project/sql-cli + path: sql-cli + ref: main + + - name: Set up JDK ${{ matrix.java }} + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: ${{ matrix.java }} + + - name: Build and publish SQL modules to Maven Local + working-directory: sql + run: | + echo "Building SQL modules from current branch..." + ./gradlew publishToMavenLocal -x test -x integTest + echo "SQL modules published to Maven Local" + + - name: Verify SQL CLI settings.gradle exists + working-directory: sql-cli + run: | + if [ ! -f "settings.gradle" ]; then + echo "ERROR: settings.gradle not found in sql-cli repository" + echo "The composite build configuration may not be merged yet." + echo "This workflow requires the composite build setup to work." + exit 1 + fi + echo "settings.gradle found, proceeding with tests" + + - name: Run SQL CLI tests with local SQL modules + working-directory: sql-cli + run: | + echo "Running SQL CLI tests against local SQL modules..." + ./gradlew clean test -PuseLocalSql=true --info --stacktrace + + - name: Upload SQL CLI test reports + if: always() + uses: actions/upload-artifact@v4 + continue-on-error: true + with: + name: sql-cli-test-reports-java-${{ matrix.java }} + path: | + sql-cli/build/reports/** + sql-cli/build/test-results/** + + - name: Test Summary + if: always() + run: | + echo "## SQL CLI Integration Test Results" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "Tested SQL CLI against SQL changes from: \`${{ github.ref }}\`" >> $GITHUB_STEP_SUMMARY + echo "SQL CLI version: main branch (latest)" >> $GITHUB_STEP_SUMMARY + echo "Java version: ${{ matrix.java }}" >> $GITHUB_STEP_SUMMARY From bc4e06cca16eaa2e5dd426ceaa20a63ee2528f6c Mon Sep 17 00:00:00 2001 From: Simeon Widdis Date: Fri, 14 Nov 2025 21:50:21 +0000 Subject: [PATCH 2/3] The SPath fix Signed-off-by: Simeon Widdis --- .../src/main/java/org/opensearch/sql/ast/tree/SPath.java | 7 +++++-- .../org/opensearch/sql/ppl/utils/SPathRewriteTest.java | 9 +++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/opensearch/sql/ast/tree/SPath.java b/core/src/main/java/org/opensearch/sql/ast/tree/SPath.java index 89eab6cf16..7a507121fa 100644 --- a/core/src/main/java/org/opensearch/sql/ast/tree/SPath.java +++ b/core/src/main/java/org/opensearch/sql/ast/tree/SPath.java @@ -5,6 +5,8 @@ package org.opensearch.sql.ast.tree; +import static org.opensearch.sql.common.utils.StringUtils.unquoteIdentifier; + import com.google.common.collect.ImmutableList; import java.util.List; import lombok.AllArgsConstructor; @@ -48,8 +50,9 @@ public T accept(AbstractNodeVisitor nodeVisitor, C context) { public Eval rewriteAsEval() { String outField = this.outField; + String unquotedPath = unquoteIdentifier(this.path); if (outField == null) { - outField = this.path; + outField = unquotedPath; } return AstDSL.eval( @@ -57,6 +60,6 @@ public Eval rewriteAsEval() { AstDSL.let( AstDSL.field(outField), AstDSL.function( - "json_extract", AstDSL.field(inField), AstDSL.stringLiteral(this.path)))); + "json_extract", AstDSL.field(inField), AstDSL.stringLiteral(unquotedPath)))); } } diff --git a/ppl/src/test/java/org/opensearch/sql/ppl/utils/SPathRewriteTest.java b/ppl/src/test/java/org/opensearch/sql/ppl/utils/SPathRewriteTest.java index e97fb51ea9..45e20c8f73 100644 --- a/ppl/src/test/java/org/opensearch/sql/ppl/utils/SPathRewriteTest.java +++ b/ppl/src/test/java/org/opensearch/sql/ppl/utils/SPathRewriteTest.java @@ -64,4 +64,13 @@ public void testSpathMissingPathArgumentHandling() { public void testSpathArgumentDeshuffle() { assertEquals(plan("source = t | spath path=a input=a"), plan("source = t | spath input=a a")); } + + @Test + public void testSpathEscapedParse() { + SPath sp = + (SPath) plan("source = t | spath input=f output=o path=`attributes.['cluster.name']`"); + Eval ev = (Eval) plan("source = t | eval o=json_extract(f, \"attributes.['cluster.name']\")"); + + assertEquals(ev, sp.rewriteAsEval()); + } } From b5d6996858e85943a1572a063cfd92583a267e72 Mon Sep 17 00:00:00 2001 From: Simeon Widdis Date: Fri, 14 Nov 2025 21:50:32 +0000 Subject: [PATCH 3/3] Revert "Add workflow for SQL CLI integration tests" This reverts commit 5ae2b06afc1bb5adf0b19bd4f0fe9744898599af. Signed-off-by: Simeon Widdis --- .../workflows/sql-cli-integration-test.yml | 103 ------------------ 1 file changed, 103 deletions(-) delete mode 100644 .github/workflows/sql-cli-integration-test.yml diff --git a/.github/workflows/sql-cli-integration-test.yml b/.github/workflows/sql-cli-integration-test.yml deleted file mode 100644 index 8ea621c71f..0000000000 --- a/.github/workflows/sql-cli-integration-test.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: SQL CLI Integration Test - -# This workflow tests sql-cli against the current SQL changes -# to catch breaking changes before they're published - -on: - pull_request: - paths: - - 'api/**' - - 'sql/**' - - 'ppl/**' - - 'core/**' - - 'opensearch/**' - - 'common/**' - - 'protocol/**' - - '**/*.gradle' - - '.github/workflows/sql-cli-integration-test.yml' - push: - branches: - - main - - '[0-9]+.[0-9]+' - - '[0-9]+.x' - paths: - - 'api/**' - - 'sql/**' - - 'ppl/**' - - 'core/**' - - 'opensearch/**' - - 'common/**' - - 'protocol/**' - - '**/*.gradle' - - '.github/workflows/sql-cli-integration-test.yml' - workflow_dispatch: - -jobs: - test-sql-cli-integration: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - java: [21] - - steps: - - name: Checkout SQL repository (current changes) - uses: actions/checkout@v4 - with: - path: sql - - - name: Checkout SQL CLI repository (latest main) - uses: actions/checkout@v4 - with: - repository: opensearch-project/sql-cli - path: sql-cli - ref: main - - - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: ${{ matrix.java }} - - - name: Build and publish SQL modules to Maven Local - working-directory: sql - run: | - echo "Building SQL modules from current branch..." - ./gradlew publishToMavenLocal -x test -x integTest - echo "SQL modules published to Maven Local" - - - name: Verify SQL CLI settings.gradle exists - working-directory: sql-cli - run: | - if [ ! -f "settings.gradle" ]; then - echo "ERROR: settings.gradle not found in sql-cli repository" - echo "The composite build configuration may not be merged yet." - echo "This workflow requires the composite build setup to work." - exit 1 - fi - echo "settings.gradle found, proceeding with tests" - - - name: Run SQL CLI tests with local SQL modules - working-directory: sql-cli - run: | - echo "Running SQL CLI tests against local SQL modules..." - ./gradlew clean test -PuseLocalSql=true --info --stacktrace - - - name: Upload SQL CLI test reports - if: always() - uses: actions/upload-artifact@v4 - continue-on-error: true - with: - name: sql-cli-test-reports-java-${{ matrix.java }} - path: | - sql-cli/build/reports/** - sql-cli/build/test-results/** - - - name: Test Summary - if: always() - run: | - echo "## SQL CLI Integration Test Results" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "Tested SQL CLI against SQL changes from: \`${{ github.ref }}\`" >> $GITHUB_STEP_SUMMARY - echo "SQL CLI version: main branch (latest)" >> $GITHUB_STEP_SUMMARY - echo "Java version: ${{ matrix.java }}" >> $GITHUB_STEP_SUMMARY