[Fix](outfile) FE check the hdfs URI of outfile (#38602)
bp: #38203 1. Previously, if the root path of the HDFS URI started with two slashes, the outfile would be successfully exported without errors, but the exported path would not be the expected path. Currently, we will delete repeated '/' which specified by users in FE. 2. move the test case for outfile HDFS from p2 to p0.
This commit is contained in:
@ -55,6 +55,8 @@ import org.apache.hadoop.fs.Path;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -535,6 +537,12 @@ public class OutFileClause {
|
||||
filePath = filePath.replace(HDFS_FILE_PREFIX, HDFS_FILE_PREFIX + dfsNameServices);
|
||||
}
|
||||
}
|
||||
// delete repeated '/'
|
||||
try {
|
||||
filePath = new URI(filePath).normalize().toString();
|
||||
} catch (URISyntaxException e) {
|
||||
throw new AnalysisException("Can not normalize the URI, error: " + e.getMessage());
|
||||
}
|
||||
if (Strings.isNullOrEmpty(filePath)) {
|
||||
throw new AnalysisException("Must specify file in OUTFILE clause");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user