hackergin commented on code in PR #25754:
URL: https://github.com/apache/flink/pull/25754#discussion_r1904858265
##########
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliClient.java:
##########
@@ -125,21 +137,37 @@ void executeInInteractiveMode(LineReader lineReader) {
}
/** Opens the non-interactive CLI shell. */
- public void executeInNonInteractiveMode(String content) {
+ public void executeInNonInteractiveMode(URI uri) {
try {
terminal = terminalFactory.get();
- executeFile(content, terminal.output(),
ExecutionMode.NON_INTERACTIVE_EXECUTION);
+ if (isApplicationMode(executor.getSessionConfig())) {
+ String scheme = StringUtils.lowerCase(uri.getScheme());
+ String clusterId;
+ // local files
+ if (scheme == null || scheme.equals("file")) {
Review Comment:
Would it be better if we could support shipping local files to the remote?
That said, I think the current implementation is also fine.
##########
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliOptionsParser.java:
##########
@@ -308,32 +309,30 @@ private static URL parseGatewayAddress(String
cliOptionAddress) {
//
--------------------------------------------------------------------------------------------
- private static URL checkUrl(CommandLine line, Option option) {
- final List<URL> urls = checkUrls(line, option);
- if (urls != null && !urls.isEmpty()) {
- return urls.get(0);
+ private static @Nullable URI parseURI(CommandLine line, Option option) {
+ List<URI> uris = parseURIs(line, option);
+ if (uris == null || uris.isEmpty()) {
+ return null;
+ } else {
+ return uris.get(0);
}
- return null;
}
- private static List<URL> checkUrls(CommandLine line, Option option) {
+ private static @Nullable List<URI> parseURIs(CommandLine line, Option
option) {
if (line.hasOption(option.getOpt())) {
- final String[] urls = line.getOptionValues(option.getOpt());
- return Arrays.stream(urls)
+ final String[] uris = line.getOptionValues(option.getOpt());
+ return Arrays.stream(uris)
.distinct()
.map(
- (url) -> {
- checkFilePath(url);
+ uri -> {
try {
- return Path.fromLocalFile(new
File(url).getAbsoluteFile())
- .toUri()
- .toURL();
+ return URI.create(uri);
} catch (Exception e) {
throw new SqlClientException(
"Invalid path for option '"
Review Comment:
Invalid url for option ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]