Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/ansi_sql_mode_test.yml
Original file line number Diff line number Diff line change
@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wow. This is nice. Now we can reuse workflow files. cc @dongjoon-hyun FYI

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I suggest that we move all the scheduled workflows to separated files.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we should separate them. This is nice. @Yikun too FYI

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya, it looks like a nice tip. Thanks, @HyukjinKwon .

Copy link
Member

@Yikun Yikun Mar 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, really good, also is an inspiration to reuse workflow in downstream repo.

Looks like there are some limitations we can only separated our workflow which is not using strategy.

[1] https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yikun the limitation is for the caller. The strategy in "build_and_test.yml" still works.

if: github.repository == 'apache/spark'
with:
ansi_enabled: true


11 changes: 10 additions & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will sys.env.get("SPARK_ANSI_SQL_MODE") be null?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The result type of sys.env.get("SPARK_ANSI_SQL_MODE") is Option[String]. It is totally fine here.


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 " +
Expand Down