diff --git a/.github/workflows/ansi_sql_mode_test.yml b/.github/workflows/ansi_sql_mode_test.yml new file mode 100644 index 000000000000..e68b04b5420f --- /dev/null +++ b/.github/workflows/ansi_sql_mode_test.yml @@ -0,0 +1,34 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +name: ANSI SQL mode test + +on: + push: + branches: + - master + +jobs: + ansi_sql_test: + uses: ./.github/workflows/build_and_test.yml + if: github.repository == 'apache/spark' + with: + ansi_enabled: true + + diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 67f57218d316..fbd5db251334 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -37,6 +37,12 @@ on: - cron: '0 13 * * *' # Java 17 - cron: '0 16 * * *' + workflow_call: + inputs: + ansi_enabled: + required: false + type: boolean + default: false jobs: configure-jobs: @@ -92,7 +98,7 @@ jobs: echo '::set-output name=java::8' echo '::set-output name=branch::master' # Default branch to run on. CHANGE here when a branch is cut out. echo '::set-output name=type::regular' - echo '::set-output name=envs::{}' + echo '::set-output name=envs::{"SPARK_ANSI_SQL_MODE": "${{ inputs.ansi_enabled }}"}' echo '::set-output name=hadoop::hadoop3' fi @@ -311,6 +317,7 @@ jobs: SKIP_UNIDOC: true SKIP_MIMA: true METASPACE_SIZE: 1g + SPARK_ANSI_SQL_MODE: ${{ inputs.ansi_enabled }} steps: - name: Checkout Spark repository uses: actions/checkout@v2 @@ -398,6 +405,7 @@ jobs: GITHUB_PREV_SHA: ${{ github.event.before }} SPARK_LOCAL_IP: localhost SKIP_MIMA: true + SPARK_ANSI_SQL_MODE: ${{ inputs.ansi_enabled }} steps: - name: Checkout Spark repository uses: actions/checkout@v2 @@ -671,6 +679,7 @@ jobs: runs-on: ubuntu-20.04 env: SPARK_LOCAL_IP: localhost + SPARK_ANSI_SQL_MODE: ${{ inputs.ansi_enabled }} steps: - name: Checkout Spark repository uses: actions/checkout@v2 diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala index c7aec8e023b2..edb388e21987 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala @@ -2706,7 +2706,7 @@ object SQLConf { "standard directly, but their behaviors align with ANSI SQL's style") .version("3.0.0") .booleanConf - .createWithDefault(false) + .createWithDefault(sys.env.get("SPARK_ANSI_SQL_MODE").contains("true")) val ENFORCE_RESERVED_KEYWORDS = buildConf("spark.sql.ansi.enforceReservedKeywords") .doc(s"When true and '${ANSI_ENABLED.key}' is true, the Spark SQL parser enforces the ANSI " +