hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From khorg...@apache.org
Subject svn commit: r1664171 - in /hive/trunk: itests/hcatalog-unit/src/test/java/org/apache/hive/hcatalog/listener/TestDbNotificationListener.java ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
Date Wed, 04 Mar 2015 22:26:07 GMT
Author: khorgath
Date: Wed Mar  4 22:26:06 2015
New Revision: 1664171

URL: http://svn.apache.org/r1664171
Log:
HIVE-9826 : Firing insert event fails on temporary table

Modified:
    hive/trunk/itests/hcatalog-unit/src/test/java/org/apache/hive/hcatalog/listener/TestDbNotificationListener.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java

Modified: hive/trunk/itests/hcatalog-unit/src/test/java/org/apache/hive/hcatalog/listener/TestDbNotificationListener.java
URL: http://svn.apache.org/viewvc/hive/trunk/itests/hcatalog-unit/src/test/java/org/apache/hive/hcatalog/listener/TestDbNotificationListener.java?rev=1664171&r1=1664170&r2=1664171&view=diff
==============================================================================
--- hive/trunk/itests/hcatalog-unit/src/test/java/org/apache/hive/hcatalog/listener/TestDbNotificationListener.java
(original)
+++ hive/trunk/itests/hcatalog-unit/src/test/java/org/apache/hive/hcatalog/listener/TestDbNotificationListener.java
Wed Mar  4 22:26:06 2015
@@ -438,6 +438,41 @@ public class TestDbNotificationListener
   }
 
   @Test
+  public void sqlCTAS() throws Exception {
+
+    driver.run("create table ctas_source (c int)");
+    driver.run("insert into table ctas_source values (1)");
+    driver.run("create table ctas_target as select c from ctas_source");
+
+    NotificationEventResponse rsp = msClient.getNextNotification(firstEventId, 0, null);
+
+    assertEquals(6, rsp.getEventsSize());
+    NotificationEvent event = rsp.getEvents().get(0);
+    assertEquals(firstEventId + 1, event.getEventId());
+    assertEquals(HCatConstants.HCAT_CREATE_TABLE_EVENT, event.getEventType());
+    event = rsp.getEvents().get(2);
+    assertEquals(firstEventId + 3, event.getEventId());
+    assertEquals(HCatConstants.HCAT_INSERT_EVENT, event.getEventType());
+    // Make sure the files are listed in the insert
+    assertTrue(event.getMessage().matches(".*\"files\":\\[\"pfile.*"));
+    event = rsp.getEvents().get(4);
+    assertEquals(firstEventId + 5, event.getEventId());
+    assertEquals(HCatConstants.HCAT_CREATE_TABLE_EVENT, event.getEventType());
+  }
+
+  @Test
+  public void sqlTempTable() throws Exception {
+
+    LOG.info("XXX Starting temp table");
+    driver.run("create temporary table tmp1 (c int)");
+    driver.run("insert into table tmp1 values (1)");
+
+    NotificationEventResponse rsp = msClient.getNextNotification(firstEventId, 0, null);
+
+    assertEquals(0, rsp.getEventsSize());
+  }
+
+  @Test
   public void sqlDb() throws Exception {
 
     driver.run("create database sd");

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java?rev=1664171&r1=1664170&r2=1664171&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java Wed Mar  4 22:26:06
2015
@@ -1887,6 +1887,10 @@ private void constructOneLBLocationMap(F
       throws HiveException {
     if (conf.getBoolVar(ConfVars.FIRE_EVENTS_FOR_DML)) {
       LOG.debug("Firing dml insert event");
+      if (tbl.isTemporary()) {
+        LOG.debug("Not firing dml insert event as " + tbl.getTableName() + " is temporary");
+        return;
+      }
       FireEventRequestData data = new FireEventRequestData();
       InsertEventRequestData insertData = new InsertEventRequestData();
       data.setInsertData(insertData);



Mime
View raw message