[regression test](broker load) add case for without filepath (#27658)

This commit is contained in:
Guangdong Liu
2023-12-07 10:15:37 +08:00
committed by GitHub
parent e3e78a79d7
commit 42b3dd35bb
6 changed files with 105 additions and 7 deletions

View File

@ -88,7 +88,7 @@ public class BrokerLoadStmt extends InsertStmt {
String location = brokerDesc.getFileLocation(dataDescription.getFilePaths().get(i));
dataDescription.getFilePaths().set(i, location);
StorageBackend.checkPath(dataDescription.getFilePaths().get(i),
brokerDesc.getStorageType());
brokerDesc.getStorageType(), "DATA INFILE must be specified.");
dataDescription.getFilePaths().set(i, dataDescription.getFilePaths().get(i));
}
}

View File

@ -178,7 +178,7 @@ public class ExportStmt extends StatementBase {
}
// check path is valid
StorageBackend.checkPath(path, brokerDesc.getStorageType());
StorageBackend.checkPath(path, brokerDesc.getStorageType(), null);
if (brokerDesc.getStorageType() == StorageBackend.StorageType.BROKER) {
BrokerMgr brokerMgr = analyzer.getEnv().getBrokerMgr();
if (!brokerMgr.containsBroker(brokerDesc.getName())) {

View File

@ -434,7 +434,7 @@ public class LoadStmt extends DdlStmt {
String location = brokerDesc.getFileLocation(dataDescription.getFilePaths().get(i));
dataDescription.getFilePaths().set(i, location);
StorageBackend.checkPath(dataDescription.getFilePaths().get(i),
brokerDesc.getStorageType());
brokerDesc.getStorageType(), "DATA INFILE must be specified.");
dataDescription.getFilePaths().set(i, dataDescription.getFilePaths().get(i));
}
}

View File

@ -35,9 +35,10 @@ public class StorageBackend implements ParseNode {
private String location;
private StorageDesc storageDesc;
public static void checkPath(String path, StorageBackend.StorageType type) throws AnalysisException {
public static void checkPath(String path, StorageBackend.StorageType type, String exceptionMsg)
throws AnalysisException {
if (Strings.isNullOrEmpty(path)) {
throw new AnalysisException("No destination path specified.");
throw new AnalysisException(exceptionMsg == null ? "No destination path specified." : exceptionMsg);
}
checkUri(URI.create(path), type);
}
@ -120,7 +121,7 @@ public class StorageBackend implements ParseNode {
if (Strings.isNullOrEmpty(location)) {
throw new AnalysisException("You must specify a location on the repository");
}
checkPath(location, storageType);
checkPath(location, storageType, null);
}
@Override

View File

@ -220,7 +220,7 @@ public class ExportCommand extends Command implements ForwardWithSync {
private void checkBrokerDesc(ConnectContext ctx) throws UserException {
// check path is valid
StorageBackend.checkPath(this.path, this.brokerDesc.get().getStorageType());
StorageBackend.checkPath(this.path, this.brokerDesc.get().getStorageType(), null);
if (brokerDesc.get().getStorageType() == StorageBackend.StorageType.BROKER) {
BrokerMgr brokerMgr = ctx.getEnv().getBrokerMgr();