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

[fix](tvf) fix azure tvf: can not build s3() #45872

Merged
merged 4 commits into from
Dec 27, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ public class S3TableValuedFunction extends ExternalFileTableValuedFunction {
"ACCESS_KEY", "SECRET_KEY", "SESSION_TOKEN", "REGION");

public S3TableValuedFunction(Map<String, String> properties) throws AnalysisException {
final boolean isAzureTvf = AzureProperties.checkAzureProviderPropertyExist(properties);
// Azure could run without region
if (isAzureTvf) {
properties.put(S3Properties.REGION, "DUMMY-REGION");
}
// 1. analyze common properties
Map<String, String> otherProps = super.parseCommonProperties(properties);

Expand All @@ -84,8 +79,14 @@ public S3TableValuedFunction(Map<String, String> properties) throws AnalysisExce
// If endpoint is missing, exception will be thrown.
String endpoint = constructEndpoint(otherProps, s3uri);
if (!otherProps.containsKey(S3Properties.REGION)) {
String region = s3uri.getRegion().orElseThrow(() ->
new AnalysisException(String.format("Properties '%s' is required.", S3Properties.REGION)));
String region;
if (AzureProperties.checkAzureProviderPropertyExist(properties)) {
// Azure could run without region
region = s3uri.getRegion().orElse("DUMMY-REGION");
} else {
region = s3uri.getRegion().orElseThrow(() -> new AnalysisException(
String.format("Properties '%s' is required.", S3Properties.REGION)));
}
otherProps.put(S3Properties.REGION, region);
}
checkNecessaryS3Properties(otherProps);
Expand All @@ -99,7 +100,7 @@ public S3TableValuedFunction(Map<String, String> properties) throws AnalysisExce

locationProperties = S3Properties.credentialToMap(credential);
locationProperties.put(PropertyConverter.USE_PATH_STYLE, usePathStyle);
if (isAzureTvf) {
if (AzureProperties.checkAzureProviderPropertyExist(properties)) {
// For Azure's compatibility, we need bucket to connect to the blob storage's container
locationProperties.put(S3Properties.BUCKET, s3uri.getBucket());
}
Expand Down
Loading