[regression test](broker load) add case for without filepath (#27658)
This commit is contained in:
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -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())) {
|
||||
|
||||
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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();
|
||||
|
||||
Reference in New Issue
Block a user