Review Board 1.7.22


HIVE-6174: Beeline "set varible" doesn't show the value of the variable as Hive CLI

Review Request #16807 - Created Jan. 12, 2014 and updated

Xuefu Zhang
trunk
HIVE-6174
Reviewers
hive
hive-git
Fix the issue, which is found at HiveServer2 side.
Added HiveServer2 test and Beeline test.
itests/hive-unit/src/test/java/org/apache/hive/beeline/TestBeeLineWithArgs.java
Revision 539ebdb New Change
[20] 15 lines
[+20]
16
 * limitations under the License.
16
 * limitations under the License.
17
 */
17
 */
18

    
   
18

   
19
package org.apache.hive.beeline;
19
package org.apache.hive.beeline;
20

    
   
20

   

    
   
21
import static org.junit.Assert.assertFalse;

    
   
22
import static org.junit.Assert.assertNotNull;

    
   
23
import static org.junit.Assert.fail;

    
   
24

   
21
import java.io.ByteArrayOutputStream;
25
import java.io.ByteArrayOutputStream;
22
import java.io.File;
26
import java.io.File;
23
import java.io.FileOutputStream;
27
import java.io.FileOutputStream;
24
import java.io.PrintStream;
28
import java.io.PrintStream;
25
import java.io.UnsupportedEncodingException;
29
import java.io.UnsupportedEncodingException;
[+20] [20] 4 lines
[+20]
30
import java.util.ArrayList;
34
import java.util.ArrayList;
31
import java.util.List;
35
import java.util.List;
32

    
   
36

   
33
import org.apache.hadoop.fs.Path;
37
import org.apache.hadoop.fs.Path;
34
import org.apache.hadoop.hive.conf.HiveConf;
38
import org.apache.hadoop.hive.conf.HiveConf;
35
import org.apache.hive.beeline.BeeLine;

   
36
import org.apache.hive.service.server.HiveServer2;
39
import org.apache.hive.service.server.HiveServer2;
37
import org.junit.AfterClass;
40
import org.junit.AfterClass;
38
import org.junit.Assert;
41
import org.junit.Assert;
39
import org.junit.BeforeClass;
42
import org.junit.BeforeClass;
40
import org.junit.Test;
43
import org.junit.Test;
41

    
   
44

   
42
import static org.junit.Assert.*;

   
43

    
   

   
44
/**
45
/**
45
 * TestBeeLineWithArgs - executes tests of the command-line arguments to BeeLine
46
 * TestBeeLineWithArgs - executes tests of the command-line arguments to BeeLine
46
 *
47
 *
47
 */
48
 */
48
//public class TestBeeLineWithArgs extends TestCase {
49
//public class TestBeeLineWithArgs extends TestCase {
[+20] [20] 231 lines
[+20] [+] public void testNullNonEmpty() throws Throwable {
280
        "!set nullemptystring false\n select null from " + tableName + " limit 1 ;\n";
281
        "!set nullemptystring false\n select null from " + tableName + " limit 1 ;\n";
281
    final String EXPECTED_PATTERN = "NULL";
282
    final String EXPECTED_PATTERN = "NULL";
282
    testScriptFile(TEST_NAME, SCRIPT_TEXT, EXPECTED_PATTERN, true, getBaseArgs(JDBC_URL));
283
    testScriptFile(TEST_NAME, SCRIPT_TEXT, EXPECTED_PATTERN, true, getBaseArgs(JDBC_URL));
283
  }
284
  }
284

    
   
285

   

    
   
286
  @Test

    
   
287
  public void testGetVariableValue() throws Throwable {

    
   
288
    final String TEST_NAME = "testGetVariableValue";

    
   
289
    final String SCRIPT_TEXT = "set env:TERM;";

    
   
290
    final String EXPECTED_PATTERN = "env:TERM";

    
   
291
    testScriptFile(TEST_NAME, SCRIPT_TEXT, EXPECTED_PATTERN, true, getBaseArgs(JDBC_URL));

    
   
292
  }

    
   
293

   
285
  /**
294
  /**
286
   * Select null from table , check if setting null to empty string works.
295
   * Select null from table , check if setting null to empty string works.
287
   * Original beeline/sqlline used to print nulls as empty strings
296
   * Original beeline/sqlline used to print nulls as empty strings
288
   * Print PASSED or FAILED
297
   * Print PASSED or FAILED
289
   */
298
   */
[+20] [20] 118 lines
itests/hive-unit/src/test/java/org/apache/hive/jdbc/miniHS2/TestHiveServer2.java
Revision f3ea07c New Change
 
ql/src/java/org/apache/hadoop/hive/ql/processors/SetProcessor.java
Revision c27b689 New Change
 
  1. itests/hive-unit/src/test/java/org/apache/hive/beeline/TestBeeLineWithArgs.java: Loading...
  2. itests/hive-unit/src/test/java/org/apache/hive/jdbc/miniHS2/TestHiveServer2.java: Loading...
  3. ql/src/java/org/apache/hadoop/hive/ql/processors/SetProcessor.java: Loading...