diff --git a/beeline/src/java/org/apache/hive/beeline/BeeLine.java b/beeline/src/java/org/apache/hive/beeline/BeeLine.java index dc79712054..cb1401312c 100644 --- a/beeline/src/java/org/apache/hive/beeline/BeeLine.java +++ b/beeline/src/java/org/apache/hive/beeline/BeeLine.java @@ -2347,6 +2347,13 @@ Statement createStatement() throws SQLException { if (signalHandler != null) { signalHandler.setStatement(stmnt); } + + // If no fetch size is specified in beeline, let the driver figure it out + final int fetchSize = getOpts().getFetchSize(); + if (fetchSize >= 0) { + stmnt.setFetchSize(fetchSize); + } + return stmnt; } diff --git a/beeline/src/java/org/apache/hive/beeline/BeeLineOpts.java b/beeline/src/java/org/apache/hive/beeline/BeeLineOpts.java index 9fed81ea71..17af4e2cd7 100644 --- a/beeline/src/java/org/apache/hive/beeline/BeeLineOpts.java +++ b/beeline/src/java/org/apache/hive/beeline/BeeLineOpts.java @@ -97,6 +97,7 @@ private HiveConf conf; private boolean trimScripts = true; private boolean allowMultiLineCommand = true; + private int fetchSize = -1; //This can be set for old behavior of nulls printed as empty strings private boolean nullEmptyString = false; @@ -640,6 +641,14 @@ public void setAllowMultiLineCommand(boolean allowMultiLineCommand) { this.allowMultiLineCommand = allowMultiLineCommand; } + public int getFetchSize() { + return fetchSize; + } + + public void setFetchSize(int fetchSize) { + this.fetchSize = fetchSize; + } + /** * Use getNullString() to get the null string to be used. * @return true if null representation should be an empty string