Skip to content
Merged
Show file tree
Hide file tree
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 @@ -28,6 +28,7 @@
import org.apache.doris.common.FeNameFormat;
import org.apache.doris.common.UserException;
import org.apache.doris.common.util.PrintableMap;
import org.apache.doris.datasource.property.PropertyConverter;
import org.apache.doris.mysql.privilege.PrivPredicate;
import org.apache.doris.qe.ConnectContext;

Expand All @@ -46,7 +47,7 @@ public class CreateStorageVaultStmt extends DdlStmt implements NotFallbackInPars

private final boolean ifNotExists;
private final String vaultName;
private final ImmutableMap<String, String> properties;
private ImmutableMap<String, String> properties;
private boolean setAsDefault;
private int pathVersion = 0;
private int numShard = 0;
Expand Down Expand Up @@ -145,6 +146,14 @@ public void analyze(Analyzer analyzer) throws UserException {
}
setAsDefault = Boolean.parseBoolean(properties.getOrDefault(SET_AS_DEFAULT, "false"));
setStorageVaultType(StorageVault.StorageVaultType.fromString(type));

if (vaultType == StorageVault.StorageVaultType.S3
&& !properties.containsKey(PropertyConverter.USE_PATH_STYLE)) {
properties = ImmutableMap.<String, String>builder()
.putAll(properties)
.put(PropertyConverter.USE_PATH_STYLE, "true")
.build();
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.apache.doris.cloud.proto.Cloud;
import org.apache.doris.common.DdlException;
import org.apache.doris.common.UserException;
import org.apache.doris.datasource.property.PropertyConverter;
import org.apache.doris.qe.ShowResultSetMetaData;

import com.google.common.base.Preconditions;
Expand Down Expand Up @@ -147,10 +146,6 @@ public void setId(String id) {
vault.modifyProperties(stmt.getProperties());
break;
case S3:
if (!stmt.getProperties().containsKey(PropertyConverter.USE_PATH_STYLE)) {
stmt.getProperties().put(PropertyConverter.USE_PATH_STYLE, "true");
}

CreateResourceStmt resourceStmt =
new CreateResourceStmt(false, ifNotExists, name, stmt.getProperties());
resourceStmt.analyzeResourceType();
Expand Down
15 changes: 15 additions & 0 deletions regression-test/suites/vault_p0/create/test_create_vault.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,21 @@ suite("test_create_vault", "nonConcurrent") {
);
"""

sql """
CREATE STORAGE VAULT IF NOT EXISTS ${s3VaultName}
PROPERTIES (
"type"="S3",
"s3.endpoint"="${getS3Endpoint()}",
"s3.region" = "${getS3Region()}",
"s3.access_key" = "${getS3AK()}",
"s3.secret_key" = "${getS3SK()}",
"s3.root.path" = "${s3VaultName}",
"s3.bucket" = "${getS3BucketName()}",
"s3.external_endpoint" = "",
"provider" = "${getS3Provider()}"
);
"""

sql """
CREATE TABLE ${s3VaultName} (
C_CUSTKEY INTEGER NOT NULL,
Expand Down