Skip to content

Commit

Permalink
Respect empty --execute argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Praveen2112 authored and findepi committed Sep 4, 2019
1 parent 9fdbf20 commit 5d2c2f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion presto-cli/src/main/java/io/prestosql/cli/Console.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public class Console
public boolean run()
{
ClientSession session = clientOptions.toClientSession();
boolean hasQuery = !isNullOrEmpty(clientOptions.execute);
boolean hasQuery = clientOptions.execute != null;
boolean isFromFile = !isNullOrEmpty(clientOptions.file);

if (!hasQuery && !isFromFile) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import static java.util.stream.Collectors.toList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.testng.Assert.assertTrue;

public class PrestoCliTests
extends PrestoCliLauncher
Expand Down Expand Up @@ -125,6 +126,15 @@ public void shouldRunBatchQuery()
presto.waitForWithTimeoutAndKill();
}

@Test(groups = CLI, timeOut = TIMEOUT)
public void shouldExecuteEmptyListOfStatements()
throws Exception
{
launchPrestoCliWithServerArgument("--execute", "");
assertTrue(trimLines(presto.readRemainingOutputLines()).isEmpty());
presto.waitForWithTimeoutAndKill();
}

@Test(groups = CLI, timeOut = TIMEOUT)
public void shouldUseCatalogAndSchemaOptions()
throws Exception
Expand Down

0 comments on commit 5d2c2f7

Please sign in to comment.