Review Board 1.7.22


HIVE-4252 - hiveserver2 string representation of complex types are inconsistent with cli

Review Request #10211 - Created March 31, 2013 and updated

Thejas Nair
HIVE-4252
Reviewers
hive
hive-git
HIVE-4252
unit test included
jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java
Revision 2e5c30e New Change
[20] 419 lines
[+20] [+] public void testDataTypes() throws Exception {
420
    assertEquals(-1.1d, res.getDouble(3));
420
    assertEquals(-1.1d, res.getDouble(3));
421
    assertEquals("", res.getString(4));
421
    assertEquals("", res.getString(4));
422
    assertEquals("[]", res.getString(5));
422
    assertEquals("[]", res.getString(5));
423
    assertEquals("{}", res.getString(6));
423
    assertEquals("{}", res.getString(6));
424
    assertEquals("{}", res.getString(7));
424
    assertEquals("{}", res.getString(7));
425
    assertEquals("[null, null, null]", res.getString(8));
425
    assertEquals("{\"r\":null,\"s\":null,\"t\":null}", res.getString(8));
426
    assertEquals(-1, res.getByte(9));
426
    assertEquals(-1, res.getByte(9));
427
    assertEquals(-1, res.getShort(10));
427
    assertEquals(-1, res.getShort(10));
428
    assertEquals(-1.0f, res.getFloat(11));
428
    assertEquals(-1.0f, res.getFloat(11));
429
    assertEquals(-1, res.getLong(12));
429
    assertEquals(-1, res.getLong(12));
430
    assertEquals("[]", res.getString(13));
430
    assertEquals("[]", res.getString(13));
431
    assertEquals("{}", res.getString(14));
431
    assertEquals("{}", res.getString(14));
432
    assertEquals("[null, null]", res.getString(15));
432
    assertEquals("{\"r\":null,\"s\":null}", res.getString(15));
433
    assertEquals("[]", res.getString(16));
433
    assertEquals("[]", res.getString(16));
434
    assertEquals(null, res.getString(17));
434
    assertEquals(null, res.getString(17));
435
    assertEquals(null, res.getTimestamp(17));
435
    assertEquals(null, res.getTimestamp(17));
436
    assertEquals(null, res.getBigDecimal(18));
436
    assertEquals(null, res.getBigDecimal(18));
437
    assertEquals(null, res.getString(19));
437
    assertEquals(null, res.getString(19));
438

    
   
438

   
439
    // row 3
439
    // row 3
440
    assertTrue(res.next());
440
    assertTrue(res.next());
441
    assertEquals(1, res.getInt(1));
441
    assertEquals(1, res.getInt(1));
442
    assertEquals(true, res.getBoolean(2));
442
    assertEquals(true, res.getBoolean(2));
443
    assertEquals(1.1d, res.getDouble(3));
443
    assertEquals(1.1d, res.getDouble(3));
444
    assertEquals("1", res.getString(4));
444
    assertEquals("1", res.getString(4));
445
    assertEquals("[1, 2]", res.getString(5));
445
    assertEquals("[1,2]", res.getString(5));
446
    assertEquals("{1=x, 2=y}", res.getString(6));
446
    assertEquals("{1:\"x\",2:\"y\"}", res.getString(6));
447
    assertEquals("{k=v}", res.getString(7));
447
    assertEquals("{\"k\":\"v\"}", res.getString(7));
448
    assertEquals("[a, 9, 2.2]", res.getString(8));
448
    assertEquals("{\"r\":\"a\",\"s\":9,\"t\":2.2}", res.getString(8));
449
    assertEquals(1, res.getByte(9));
449
    assertEquals(1, res.getByte(9));
450
    assertEquals(1, res.getShort(10));
450
    assertEquals(1, res.getShort(10));
451
    assertEquals(1.0f, res.getFloat(11));
451
    assertEquals(1.0f, res.getFloat(11));
452
    assertEquals(1, res.getLong(12));
452
    assertEquals(1, res.getLong(12));
453
    assertEquals("[[a, b], [c, d]]", res.getString(13));
453
    assertEquals("[[\"a\",\"b\"],[\"c\",\"d\"]]", res.getString(13));
454
    assertEquals("{1={11=12, 13=14}, 2={21=22}}", res.getString(14));
454
    assertEquals("{1:{11:12,13:14},2:{21:22}}", res.getString(14));
455
    assertEquals("[1, [2, x]]", res.getString(15));
455
    assertEquals("{\"r\":1,\"s\":{\"a\":2,\"b\":\"x\"}}", res.getString(15));
456
    assertEquals("[[{}, 1], [{c=d, a=b}, 2]]", res.getString(16));
456
    assertEquals("[{\"m\":{},\"n\":1},{\"m\":{\"a\":\"b\",\"c\":\"d\"},\"n\":2}]", res.getString(16));
457
    assertEquals("2012-04-22 09:00:00.123456789", res.getString(17));
457
    assertEquals("2012-04-22 09:00:00.123456789", res.getString(17));
458
    assertEquals("2012-04-22 09:00:00.123456789", res.getTimestamp(17).toString());
458
    assertEquals("2012-04-22 09:00:00.123456789", res.getTimestamp(17).toString());
459
    assertEquals("123456789.0123456", res.getBigDecimal(18).toString());
459
    assertEquals("123456789.0123456", res.getBigDecimal(18).toString());
460
    assertEquals("abcd", res.getString(19));
460
    assertEquals("abcd", res.getString(19));
461

    
   
461

   
[+20] [20] 802 lines
service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java
Revision 405f0c7 New Change
 
  1. jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java: Loading...
  2. service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java: Loading...