Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] [Maxcompute] Failed to parse some maxcompute type #3894

Merged
merged 18 commits into from
Mar 4, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
[Fix] throw new MaxcomputeConnectorException(CommonErrorCode.UNSUPPOR…
…TED_DATA_TYPE)
stdnt-xiao authored and TyrantLucifer committed Feb 15, 2023
commit 7263e6998637799884ae1afc26d5c6b743ef0a41
Original file line number Diff line number Diff line change
@@ -17,14 +17,17 @@

package com.aliyun.odps.type;

import org.apache.seatunnel.common.exception.CommonErrorCode;
import org.apache.seatunnel.connectors.seatunnel.maxcompute.exception.MaxcomputeConnectorException;

import com.aliyun.odps.OdpsType;

public class SimpleArrayTypeInfo implements ArrayTypeInfo {
private final TypeInfo valueType;

SimpleArrayTypeInfo(TypeInfo typeInfo) {
if (typeInfo == null) {
throw new IllegalArgumentException("Invalid element type.");
throw new MaxcomputeConnectorException(CommonErrorCode.UNSUPPORTED_DATA_TYPE,"Invalid element type.");
} else {
this.valueType = typeInfo;
}
Original file line number Diff line number Diff line change
@@ -17,6 +17,9 @@

package com.aliyun.odps.type;

import org.apache.seatunnel.common.exception.CommonErrorCode;
import org.apache.seatunnel.connectors.seatunnel.maxcompute.exception.MaxcomputeConnectorException;

import com.aliyun.odps.OdpsType;

public class SimpleMapTypeInfo implements MapTypeInfo {
@@ -28,7 +31,7 @@ public class SimpleMapTypeInfo implements MapTypeInfo {
this.keyType = keyType;
this.valueType = valueType;
} else {
throw new IllegalArgumentException("Invalid key or value type for map.");
throw new MaxcomputeConnectorException(CommonErrorCode.UNSUPPORTED_DATA_TYPE, "Invalid key or value type for map.");
}
}

Original file line number Diff line number Diff line change
@@ -17,6 +17,9 @@

package com.aliyun.odps.type;

import org.apache.seatunnel.common.exception.CommonErrorCode;
import org.apache.seatunnel.connectors.seatunnel.maxcompute.exception.MaxcomputeConnectorException;

import com.aliyun.odps.OdpsType;

import java.util.ArrayList;
@@ -48,10 +51,10 @@ private List<String> toLowerCase(List<String> names) {
private void validateParameters(List<String> names, List<TypeInfo> typeInfos) {
if (names != null && typeInfos != null && !names.isEmpty() && !typeInfos.isEmpty()) {
if (names.size() != typeInfos.size()) {
throw new IllegalArgumentException("The amount of field names must be equal to the amount of field types.");
throw new MaxcomputeConnectorException(CommonErrorCode.UNSUPPORTED_DATA_TYPE, "The amount of field names must be equal to the amount of field types.");
}
} else {
throw new IllegalArgumentException("Invalid name or element type for struct.");
throw new MaxcomputeConnectorException(CommonErrorCode.UNSUPPORTED_DATA_TYPE, "Invalid name or element type for struct.");
}
}