-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into comment-switch-remove
- Loading branch information
Showing
62 changed files
with
518 additions
and
431 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# | ||
# 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: NativeTest CI - GraalVM Native Image | ||
|
||
# Only execute CI when changes involving GraalVM Reachability Metadata and nativeTest are involved. Because most Contributors don't use GraalVM CE. | ||
on: | ||
pull_request: | ||
branches: [ master ] | ||
paths: | ||
- '.github/workflows/graalvm.yml' | ||
- 'infra/reachability-metadata/src/**' | ||
- 'test/native/native-image-filter/**' | ||
- 'test/native/src/**' | ||
|
||
concurrency: | ||
group: graalvm-${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dspotless.apply.skip=true | ||
|
||
jobs: | ||
nativetest: | ||
if: github.repository == 'apache/shardingsphere' | ||
name: GraalVM - GraalVM CE for JDK ${{ matrix.java-version }} on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 60 | ||
strategy: | ||
max-parallel: 20 | ||
fail-fast: false | ||
matrix: | ||
os: [ 'ubuntu-latest' ] | ||
java-version: [ '17.0.9' ] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: graalvm/setup-graalvm@v1 | ||
with: | ||
java-version: ${{ matrix.java-version }} | ||
distribution: 'graalvm-community' | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
cache: 'maven' | ||
- name: Run nativeTest with GraalVM CE for ${{ matrix.java-version }} | ||
run: ./mvnw -PnativeTestInShardingSphere -T1C -e clean test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,14 @@ WS | |
: [ \t\r\n] + ->skip | ||
; | ||
|
||
TRUE | ||
: T R U E | ||
; | ||
|
||
FALSE | ||
: F A L S E | ||
; | ||
|
||
CREATE | ||
: C R E A T E | ||
; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...rg/apache/shardingsphere/infra/binder/segment/parameter/ParameterMarkerSegmentBinder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package org.apache.shardingsphere.infra.binder.segment.parameter; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.NoArgsConstructor; | ||
import org.apache.shardingsphere.infra.binder.segment.parameter.impl.ParameterMarkerExpressionSegmentBinder; | ||
import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.ParameterMarkerExpressionSegment; | ||
import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.ParameterMarkerSegment; | ||
import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.bounded.ColumnSegmentBoundedInfo; | ||
|
||
import java.util.Collection; | ||
import java.util.LinkedList; | ||
import java.util.Map; | ||
|
||
/** | ||
* Parameter marker segment binder. | ||
*/ | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public final class ParameterMarkerSegmentBinder { | ||
|
||
/** | ||
* Bind parameter marker segment with metadata. | ||
* | ||
* @param parameterMarkerSegments parameter marker segments | ||
* @param parameterMarkerSegmentBoundedInfos parameter marker segment bounded infos | ||
* @return bounded parameter marker segment | ||
*/ | ||
public static Collection<ParameterMarkerSegment> bind(final Collection<ParameterMarkerSegment> parameterMarkerSegments, | ||
final Map<ParameterMarkerSegment, ColumnSegmentBoundedInfo> parameterMarkerSegmentBoundedInfos) { | ||
Collection<ParameterMarkerSegment> result = new LinkedList<>(); | ||
parameterMarkerSegments.forEach(each -> result.add(bind(each, parameterMarkerSegmentBoundedInfos))); | ||
return result; | ||
} | ||
|
||
private static ParameterMarkerSegment bind(final ParameterMarkerSegment parameterMarkerSegment, | ||
final Map<ParameterMarkerSegment, ColumnSegmentBoundedInfo> parameterMarkerSegmentBoundedInfos) { | ||
if (parameterMarkerSegment instanceof ParameterMarkerExpressionSegment) { | ||
return ParameterMarkerExpressionSegmentBinder.bind((ParameterMarkerExpressionSegment) parameterMarkerSegment, parameterMarkerSegmentBoundedInfos); | ||
} | ||
// TODO support more ParameterMarkerSegment bind | ||
return parameterMarkerSegment; | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
...ingsphere/infra/binder/segment/parameter/impl/ParameterMarkerExpressionSegmentBinder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package org.apache.shardingsphere.infra.binder.segment.parameter.impl; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.NoArgsConstructor; | ||
import org.apache.shardingsphere.infra.binder.enums.SegmentType; | ||
import org.apache.shardingsphere.infra.binder.segment.expression.ExpressionSegmentBinder; | ||
import org.apache.shardingsphere.infra.binder.segment.from.TableSegmentBinderContext; | ||
import org.apache.shardingsphere.infra.binder.statement.SQLStatementBinderContext; | ||
import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.BinaryOperationExpression; | ||
import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExpressionSegment; | ||
import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.ParameterMarkerExpressionSegment; | ||
import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.ParameterMarkerSegment; | ||
import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.bounded.ColumnSegmentBoundedInfo; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Binary operation expression binder. | ||
*/ | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public final class ParameterMarkerExpressionSegmentBinder { | ||
|
||
/** | ||
* Bind binary operation expression with metadata. | ||
* | ||
* @param segment binary operation expression segment | ||
* @param parentSegmentType parent segment type | ||
* @param statementBinderContext statement binder context | ||
* @param tableBinderContexts table binder contexts | ||
* @param outerTableBinderContexts outer table binder contexts | ||
* @return bounded binary operation expression segment | ||
*/ | ||
public static BinaryOperationExpression bind(final BinaryOperationExpression segment, final SegmentType parentSegmentType, final SQLStatementBinderContext statementBinderContext, | ||
final Map<String, TableSegmentBinderContext> tableBinderContexts, final Map<String, TableSegmentBinderContext> outerTableBinderContexts) { | ||
ExpressionSegment boundedLeft = ExpressionSegmentBinder.bind(segment.getLeft(), parentSegmentType, statementBinderContext, tableBinderContexts, outerTableBinderContexts); | ||
ExpressionSegment boundedRight = ExpressionSegmentBinder.bind(segment.getRight(), parentSegmentType, statementBinderContext, tableBinderContexts, outerTableBinderContexts); | ||
return new BinaryOperationExpression(segment.getStartIndex(), segment.getStopIndex(), boundedLeft, boundedRight, segment.getOperator(), segment.getText()); | ||
} | ||
|
||
/** | ||
* Bind parameter marker expression segment with metadata. | ||
* | ||
* @param segment parameter marker expression segment | ||
* @param boundedInfos parameter marker expression segment bounded info map | ||
* @return bounded parameter marker expression segment | ||
*/ | ||
public static ParameterMarkerExpressionSegment bind(final ParameterMarkerExpressionSegment segment, | ||
final Map<ParameterMarkerSegment, ColumnSegmentBoundedInfo> boundedInfos) { | ||
ColumnSegmentBoundedInfo boundedInfo = boundedInfos.get(segment); | ||
if (null != boundedInfo) { | ||
ParameterMarkerExpressionSegment result = | ||
new ParameterMarkerExpressionSegment(segment.getStartIndex(), segment.getStopIndex(), segment.getParameterMarkerIndex(), segment.getParameterMarkerType()); | ||
segment.getAliasSegment().ifPresent(result::setAlias); | ||
result.setBoundedInfo(boundedInfo); | ||
return result; | ||
} | ||
return segment; | ||
} | ||
} |
Oops, something went wrong.