[fix](tvf) s3 tvf specify region and s3.region params failed (#19921)

This commit is contained in:
lvshaokang
2023-06-01 10:00:49 +08:00
committed by GitHub
parent 09e6b6580f
commit 90cd791789
2 changed files with 5 additions and 4 deletions

View File

@ -50,10 +50,10 @@ public class S3TableValuedFunction extends ExternalFileTableValuedFunction {
public static final String S3_URI = "uri";
private static final ImmutableSet<String> DEPRECATED_KEYS =
ImmutableSet.of("access_key", "secret_key", "session_token", "region", S3Properties.REGION);
ImmutableSet.of("access_key", "secret_key", "session_token", "region");
private static final ImmutableSet<String> OPTIONAL_KEYS =
ImmutableSet.of(S3Properties.SESSION_TOKEN, PropertyConverter.USE_PATH_STYLE);
ImmutableSet.of(S3Properties.SESSION_TOKEN, PropertyConverter.USE_PATH_STYLE, S3Properties.REGION);
private static final ImmutableSet<String> PROPERTIES_SET = ImmutableSet.<String>builder()
.add(S3_URI)
@ -72,7 +72,7 @@ public class S3TableValuedFunction extends ExternalFileTableValuedFunction {
s3uri = getS3Uri(tvfParams);
String endpoint = getEndpointFromUri();
CloudCredentialWithEndpoint credential = new CloudCredentialWithEndpoint(endpoint,
S3Properties.getRegionOfEndpoint(endpoint),
tvfParams.getOrDefault(S3Properties.REGION, S3Properties.getRegionOfEndpoint(endpoint)),
tvfParams.get(S3Properties.ACCESS_KEY),
tvfParams.get(S3Properties.SECRET_KEY));
if (tvfParams.containsKey(S3Properties.SESSION_TOKEN)) {

View File

@ -102,7 +102,8 @@ suite("test_export_with_s3", "p2") {
"uri" = "http://${s3_endpoint}${outfile_url.substring(4)}0.${file_suffix}",
"ACCESS_KEY"= "${ak}",
"SECRET_KEY" = "${sk}",
"format" = "${format}"
"format" = "${format}",
"region" = "${region}"
);
"""
}