Skip to content

Commit

Permalink
Merge branch 'apache:dev' into connector-teradata
Browse files Browse the repository at this point in the history
  • Loading branch information
FWLamb committed Nov 14, 2022
2 parents 24d4479 + d82f8fa commit a28209b
Show file tree
Hide file tree
Showing 13 changed files with 289 additions and 19 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/backend.yml
Expand Up @@ -138,6 +138,8 @@ jobs:
- "seatunnel-engine/**"
engine-e2e:
- "seatunnel-e2e/seatunnel-engine-e2e/**"
deleted-poms:
- deleted: "**/pom.xml"
- name: Check Connector V2 Update
id: cv2-modules
Expand Down Expand Up @@ -193,13 +195,32 @@ jobs:
echo $modules
echo "modules=$modules" >> $GITHUB_OUTPUT
- name: Check Deleted Modules
id: deleted-modules
if: ${{ steps.filter.outputs.deleted-poms == 'true' }}
run: |
update_files='${{ steps.filter.outputs.deleted-poms_files }}'
modules=`python tools/update_modules_check/update_modules_check.py delete $update_files`
echo $modules
echo "modules=$modules" >> $GITHUB_OUTPUT
- name: Make unit test modules
id: ut-modules
if: ${{ steps.filter.outputs.api == 'false' && (steps.engine-modules.outputs.modules != '' || steps.cv2-modules.outputs.modules != '') }}
run: |
modules='${{ steps.engine-modules.outputs.modules }}${{ steps.cv2-modules.outputs.modules }}'
modules=${modules: 1}
pl_modules=`python tools/update_modules_check/update_modules_check.py replace $modules`
# remove deleted modules
delete_modules='${{ steps.deleted-modules.outputs.modules }}'
if [[ "zz"$delete_modules != "zz" ]];then
pl_modules=`python tools/update_modules_check/update_modules_check.py rm $pl_modules $delete_modules`
fi
if [[ "zz"$pl_modules == "zz" ]];then
exit 0
fi
./mvnw help:evaluate -Dexpression=project.modules -q -DforceStdout -pl $pl_modules > /tmp/sub_module.txt
sub_modules=`python tools/update_modules_check/update_modules_check.py sub /tmp/sub_module.txt`
tree_modules="$modules$sub_modules"
Expand All @@ -216,6 +237,16 @@ jobs:
modules='${{ steps.cv2-e2e-modules.outputs.modules }}${{ steps.cv2-flink-e2e-modules.outputs.modules }}${{ steps.cv2-spark-e2e-modules.outputs.modules }}${{ steps.engine-e2e-modules.outputs.modules }}${{ steps.engine-modules.outputs.modules }}${{ steps.cv2-modules.outputs.modules }}'
modules=${modules: 1}
pl_modules=`python tools/update_modules_check/update_modules_check.py replace $modules`
# remove deleted modules
delete_modules='${{ steps.deleted-modules.outputs.modules }}'
if [[ "zz"$delete_modules != "zz" ]];then
pl_modules=`python tools/update_modules_check/update_modules_check.py rm $pl_modules $delete_modules`
fi
if [[ "zz"$pl_modules == "zz" ]];then
exit 0
fi
./mvnw help:evaluate -Dexpression=project.modules -q -DforceStdout -pl $pl_modules > /tmp/sub_module.txt
sub_modules=`python tools/update_modules_check/update_modules_check.py sub /tmp/sub_module.txt`
tree_modules="$modules$sub_modules"
Expand Down
Expand Up @@ -18,21 +18,22 @@
package org.apache.seatunnel.api.common;

import org.apache.seatunnel.common.constants.PluginType;
import org.apache.seatunnel.common.exception.SeaTunnelRuntimeException;

import org.apache.seatunnel.shade.com.typesafe.config.Config;

/**
* This exception will throw when {@link SeaTunnelPluginLifeCycle#prepare(Config)} failed.
*/
public class PrepareFailException extends RuntimeException {
public class PrepareFailException extends SeaTunnelRuntimeException {

public PrepareFailException(String pluginName, PluginType type, String message) {
super(String.format("PluginName: %s, PluginType: %s, Message: %s", pluginName, type.getType(),
message));
super(SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED, String.format("PluginName: %s, PluginType: %s, Message: %s",
pluginName, type.getType(), message));
}

public PrepareFailException(String pluginName, PluginType type, String message, Throwable cause) {
super(String.format("PluginName: %s, PluginType: %s, Message: %s", pluginName, type.getType(),
message), cause);
super(SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED, String.format("PluginName: %s, PluginType: %s, Message: %s",
pluginName, type.getType(), message), cause);
}
}
@@ -0,0 +1,47 @@
/*
* 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.seatunnel.api.common;

import org.apache.seatunnel.common.exception.SeaTunnelErrorCode;

public enum SeaTunnelAPIErrorCode implements SeaTunnelErrorCode {
CONFIG_VALIDATION_FAILED("API-01", "Configuration item validate failed"),
OPTION_VALIDATION_FAILED("API-02", "Option item validate failed"),
CATALOG_INITIALIZE_FAILED("API-03", "Catalog initialize failed"),
DATABASE_NOT_EXISTED("API-04", "Database not existed"),
TABLE_NOT_EXISTED("API-05", "Table not existed"),
FACTORY_INITIALIZE_FAILED("API-06", "Factory initialize failed"),;

private final String code;
private final String description;

SeaTunnelAPIErrorCode(String code, String description) {
this.code = code;
this.description = description;
}

@Override
public String getCode() {
return code;
}

@Override
public String getDescription() {
return description;
}
}
Expand Up @@ -17,16 +17,19 @@

package org.apache.seatunnel.api.configuration.util;

import org.apache.seatunnel.api.common.SeaTunnelAPIErrorCode;
import org.apache.seatunnel.common.exception.SeaTunnelRuntimeException;

/**
* Exception for all errors occurring during option validation phase.
*/
public class OptionValidationException extends RuntimeException {
public class OptionValidationException extends SeaTunnelRuntimeException {

public OptionValidationException(String message, Throwable cause) {
super(message, cause);
super(SeaTunnelAPIErrorCode.OPTION_VALIDATION_FAILED, message, cause);
}

public OptionValidationException(String message) {
super(message);
super(SeaTunnelAPIErrorCode.OPTION_VALIDATION_FAILED, message);
}
}
Expand Up @@ -17,30 +17,33 @@

package org.apache.seatunnel.api.table.catalog.exception;

import org.apache.seatunnel.api.common.SeaTunnelAPIErrorCode;
import org.apache.seatunnel.common.exception.SeaTunnelRuntimeException;

/**
* A catalog-related, runtime exception.
*/
public class CatalogException extends RuntimeException {
public class CatalogException extends SeaTunnelRuntimeException {

/**
* @param message the detail message.
*/
public CatalogException(String message) {
super(message);
super(SeaTunnelAPIErrorCode.CATALOG_INITIALIZE_FAILED, message);
}

/**
* @param cause the cause.
*/
public CatalogException(Throwable cause) {
super(cause);
super(SeaTunnelAPIErrorCode.CATALOG_INITIALIZE_FAILED, cause);
}

/**
* @param message the detail message.
* @param cause the cause.
*/
public CatalogException(String message, Throwable cause) {
super(message, cause);
super(SeaTunnelAPIErrorCode.CATALOG_INITIALIZE_FAILED, message, cause);
}
}
Expand Up @@ -18,12 +18,15 @@

package org.apache.seatunnel.api.table.catalog.exception;

import org.apache.seatunnel.api.common.SeaTunnelAPIErrorCode;
import org.apache.seatunnel.common.exception.SeaTunnelRuntimeException;

/** Exception for trying to operate on a database that doesn't exist. */
public class DatabaseNotExistException extends Exception {
public class DatabaseNotExistException extends SeaTunnelRuntimeException {
private static final String MSG = "Database %s does not exist in Catalog %s.";

public DatabaseNotExistException(String catalogName, String databaseName, Throwable cause) {
super(String.format(MSG, databaseName, catalogName), cause);
super(SeaTunnelAPIErrorCode.DATABASE_NOT_EXISTED, String.format(MSG, databaseName, catalogName), cause);
}

public DatabaseNotExistException(String catalogName, String databaseName) {
Expand Down
Expand Up @@ -18,10 +18,12 @@

package org.apache.seatunnel.api.table.catalog.exception;

import org.apache.seatunnel.api.common.SeaTunnelAPIErrorCode;
import org.apache.seatunnel.api.table.catalog.TablePath;
import org.apache.seatunnel.common.exception.SeaTunnelRuntimeException;

/** Exception for trying to operate on a table that doesn't exist. */
public class TableNotExistException extends Exception {
public class TableNotExistException extends SeaTunnelRuntimeException {

private static final String MSG = "Table %s does not exist in Catalog %s.";

Expand All @@ -30,6 +32,6 @@ public TableNotExistException(String catalogName, TablePath tablePath) {
}

public TableNotExistException(String catalogName, TablePath tablePath, Throwable cause) {
super(String.format(MSG, tablePath.getFullName(), catalogName), cause);
super(SeaTunnelAPIErrorCode.TABLE_NOT_EXISTED, String.format(MSG, tablePath.getFullName(), catalogName), cause);
}
}
Expand Up @@ -17,13 +17,16 @@

package org.apache.seatunnel.api.table.factory;

public class FactoryException extends RuntimeException {
import org.apache.seatunnel.api.common.SeaTunnelAPIErrorCode;
import org.apache.seatunnel.common.exception.SeaTunnelRuntimeException;

public class FactoryException extends SeaTunnelRuntimeException {

public FactoryException(String message, Throwable cause) {
super(message, cause);
super(SeaTunnelAPIErrorCode.FACTORY_INITIALIZE_FAILED, message, cause);
}

public FactoryException(String message) {
super(message);
super(SeaTunnelAPIErrorCode.FACTORY_INITIALIZE_FAILED, message);
}
}
@@ -0,0 +1,52 @@
/*
* 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.seatunnel.common.exception;

public enum CommonErrorCode implements SeaTunnelErrorCode {
FILE_OPERATION_FAILED("COMMON-01", "File operation failed, such as (read,list,write,move,copy,sync) etc..."),
JSON_OPERATION_FAILED("COMMON-02", "Json covert/parse operation failed"),
REFLECT_CLASS_OPERATION_FAILED("COMMON-03", "Reflect class operation failed"),
SERIALIZE_OPERATION_FAILED("COMMON-04", "Serialize class operation failed"),
UNSUPPORTED_OPERATION("COMMON-05", "Unsupported operation"),
ILLEGAL_ARGUMENT("COMMON-06", "Illegal argument"),
UNSUPPORTED_DATA_TYPE("COMMON-07", "Unsupported data type"),
SQL_OPERATION_FAILED("COMMON-08", "Sql operation failed, such as (execute,addBatch,close) etc..."),
TABLE_SCHEMA_GET_FAILED("COMMON-09", "Get table schema from upstream data failed"),
FLUSH_DATA_FAILED("COMMON-10", "Flush data operation that in sink connector failed"),
WRITER_OPERATION_FAILED("COMMON-11", "Sink writer operation failed, such as (open, close) etc..."),
READER_OPERATION_FAILED("COMMON-12", "Source reader operation failed, such as (open, close) etc..."),
HTTP_OPERATION_FAILED("COMMON-13", "Http operation failed, such as (open, close, response) etc...");

private final String code;
private final String description;

CommonErrorCode(String code, String description) {
this.code = code;
this.description = description;
}

@Override
public String getCode() {
return code;
}

@Override
public String getDescription() {
return description;
}
}
@@ -0,0 +1,39 @@
/*
* 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.seatunnel.common.exception;

/**
* SeaTunnel connector error code interface
*/
public interface SeaTunnelErrorCode {
/**
* Get error code
* @return error code
*/
String getCode();

/**
* Get error description
* @return error description
*/
String getDescription();

default String getErrorMessage() {
return String.format("ErrorCode:[%s], ErrorDescription:[%s]", getCode(), getDescription());
}
}

0 comments on commit a28209b

Please sign in to comment.