-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PipelineMetaDataProcessConfigurationGovernanceRepository
- Loading branch information
Showing
31 changed files
with
1,170 additions
and
41 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
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
55 changes: 55 additions & 0 deletions
55
...ngsphere/sqltranslator/distsql/handler/update/AlterSQLTranslatorRuleStatementUpdater.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,55 @@ | ||
/* | ||
* 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.sqltranslator.distsql.handler.update; | ||
|
||
import org.apache.shardingsphere.distsql.handler.ral.update.GlobalRuleRALUpdater; | ||
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; | ||
import org.apache.shardingsphere.sqltranslator.api.config.SQLTranslatorRuleConfiguration; | ||
import org.apache.shardingsphere.sqltranslator.distsql.statement.updateable.AlterSQLTranslatorRuleStatement; | ||
import org.apache.shardingsphere.sqltranslator.spi.SQLTranslator; | ||
|
||
/** | ||
* Alter SQL translator rule statement handler. | ||
*/ | ||
public final class AlterSQLTranslatorRuleStatementUpdater implements GlobalRuleRALUpdater<AlterSQLTranslatorRuleStatement, SQLTranslatorRuleConfiguration> { | ||
|
||
@Override | ||
public void checkSQLStatement(final SQLTranslatorRuleConfiguration currentRuleConfig, final AlterSQLTranslatorRuleStatement sqlStatement) { | ||
checkProvider(sqlStatement); | ||
} | ||
|
||
private void checkProvider(final AlterSQLTranslatorRuleStatement sqlStatement) { | ||
TypedSPILoader.checkService(SQLTranslator.class, sqlStatement.getType(), sqlStatement.getProps()); | ||
} | ||
|
||
@Override | ||
public SQLTranslatorRuleConfiguration buildAlteredRuleConfiguration(final SQLTranslatorRuleConfiguration currentRuleConfig, final AlterSQLTranslatorRuleStatement sqlStatement) { | ||
return new SQLTranslatorRuleConfiguration(sqlStatement.getType(), sqlStatement.getProps(), | ||
null == sqlStatement.getUseOriginalSQLWhenTranslatingFailed() ? currentRuleConfig.isUseOriginalSQLWhenTranslatingFailed() : sqlStatement.getUseOriginalSQLWhenTranslatingFailed()); | ||
} | ||
|
||
@Override | ||
public Class<SQLTranslatorRuleConfiguration> getRuleConfigurationClass() { | ||
return SQLTranslatorRuleConfiguration.class; | ||
} | ||
|
||
@Override | ||
public Class<AlterSQLTranslatorRuleStatement> getType() { | ||
return AlterSQLTranslatorRuleStatement.class; | ||
} | ||
} |
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
18 changes: 18 additions & 0 deletions
18
...TA-INF/services/org.apache.shardingsphere.distsql.handler.ral.update.GlobalRuleRALUpdater
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,18 @@ | ||
# | ||
# 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. | ||
# | ||
|
||
org.apache.shardingsphere.sqltranslator.distsql.handler.update.AlterSQLTranslatorRuleStatementUpdater |
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
51 changes: 51 additions & 0 deletions
51
...here/sqltranslator/distsql/handler/update/AlterSQLTranslatorRuleStatementUpdaterTest.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,51 @@ | ||
/* | ||
* 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.sqltranslator.distsql.handler.update; | ||
|
||
import org.apache.shardingsphere.infra.props.PropertiesConverter; | ||
import org.apache.shardingsphere.sqltranslator.api.config.SQLTranslatorRuleConfiguration; | ||
import org.apache.shardingsphere.sqltranslator.distsql.statement.updateable.AlterSQLTranslatorRuleStatement; | ||
import org.apache.shardingsphere.test.util.PropertiesBuilder; | ||
import org.apache.shardingsphere.test.util.PropertiesBuilder.Property; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Properties; | ||
|
||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
class AlterSQLTranslatorRuleStatementUpdaterTest { | ||
|
||
@Test | ||
void assertExecute() { | ||
AlterSQLTranslatorRuleStatementUpdater updater = new AlterSQLTranslatorRuleStatementUpdater(); | ||
SQLTranslatorRuleConfiguration actual = updater.buildAlteredRuleConfiguration(createSQLTranslatorRuleConfiguration(), new AlterSQLTranslatorRuleStatement("JOOQ", | ||
PropertiesBuilder.build(new Property("foo", "bar")), null)); | ||
assertThat(actual.getType(), is("JOOQ")); | ||
assertFalse(actual.getProps().isEmpty()); | ||
String props = PropertiesConverter.convert(actual.getProps()); | ||
assertThat(props, is("{\"foo\":\"bar\"}")); | ||
assertTrue(actual.isUseOriginalSQLWhenTranslatingFailed()); | ||
} | ||
|
||
private SQLTranslatorRuleConfiguration createSQLTranslatorRuleConfiguration() { | ||
return new SQLTranslatorRuleConfiguration("NATIVE", new Properties(), true); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
kernel/sql-translator/distsql/parser/src/main/antlr4/imports/sqltranslator/BaseRule.g4
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,36 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
grammar BaseRule; | ||
|
||
import Symbol, Keyword, Literals; | ||
|
||
propertiesDefinition | ||
: PROPERTIES LP_ properties? RP_ | ||
; | ||
|
||
properties | ||
: property (COMMA_ property)* | ||
; | ||
|
||
property | ||
: key=STRING_ EQ_ value=literal | ||
; | ||
|
||
literal | ||
: STRING_ | (MINUS_)? INT_ | TRUE | FALSE | ||
; |
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
Oops, something went wrong.