Эх сурвалжийг харах

[impala] Refresh Thrift service

Fix return code of RefreshCatalog()
Refresh Calalog automatically when install examples
Romain Rigaux 12 жил өмнө
parent
commit
911b19c47b

+ 1 - 1
apps/beeswax/src/beeswax/tests.py

@@ -109,7 +109,7 @@ class TestBeeswaxWithHadoop(BeeswaxSampleProvider):
     assert_equal(beeswax.models.QueryHistory.STATE[last_state], state)
     return history.id
 
-  def test_beeswax_get_kerberos_security():
+  def test_beeswax_get_kerberos_security(self):
     principal = get_query_server_config('beeswax')['principal']
     assert_true(principal.startswith('hue/'), principal)
 

+ 8 - 1
apps/impala/gen-py/ImpalaService/ImpalaHiveServer2Service-remote

@@ -23,7 +23,8 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help':
   print 'Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] function [arg1 [arg2...]]'
   print ''
   print 'Functions:'
-  print '  TStatus ResetCatalog()'
+  print '  TResetCatalogResp ResetCatalog()'
+  print '  TResetTableResp ResetTable(TResetTableReq request)'
   print ''
   sys.exit(0)
 
@@ -81,6 +82,12 @@ if cmd == 'ResetCatalog':
     sys.exit(1)
   pp.pprint(client.ResetCatalog())
 
+elif cmd == 'ResetTable':
+  if len(args) != 1:
+    print 'ResetTable requires 1 args'
+    sys.exit(1)
+  pp.pprint(client.ResetTable(eval(args[0]),))
+
 else:
   print 'Unrecognized method %s' % cmd
   sys.exit(1)

+ 172 - 2
apps/impala/gen-py/ImpalaService/ImpalaHiveServer2Service.py

@@ -22,6 +22,13 @@ class Iface(cli_service.TCLIService.Iface):
   def ResetCatalog(self, ):
     pass
 
+  def ResetTable(self, request):
+    """
+    Parameters:
+     - request
+    """
+    pass
+
 
 class Client(cli_service.TCLIService.Client, Iface):
   def __init__(self, iprot, oprot=None):
@@ -52,11 +59,42 @@ class Client(cli_service.TCLIService.Client, Iface):
       return result.success
     raise TApplicationException(TApplicationException.MISSING_RESULT, "ResetCatalog failed: unknown result");
 
+  def ResetTable(self, request):
+    """
+    Parameters:
+     - request
+    """
+    self.send_ResetTable(request)
+    return self.recv_ResetTable()
+
+  def send_ResetTable(self, request):
+    self._oprot.writeMessageBegin('ResetTable', TMessageType.CALL, self._seqid)
+    args = ResetTable_args()
+    args.request = request
+    args.write(self._oprot)
+    self._oprot.writeMessageEnd()
+    self._oprot.trans.flush()
+
+  def recv_ResetTable(self, ):
+    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+    if mtype == TMessageType.EXCEPTION:
+      x = TApplicationException()
+      x.read(self._iprot)
+      self._iprot.readMessageEnd()
+      raise x
+    result = ResetTable_result()
+    result.read(self._iprot)
+    self._iprot.readMessageEnd()
+    if result.success is not None:
+      return result.success
+    raise TApplicationException(TApplicationException.MISSING_RESULT, "ResetTable failed: unknown result");
+
 
 class Processor(cli_service.TCLIService.Processor, Iface, TProcessor):
   def __init__(self, handler):
     cli_service.TCLIService.Processor.__init__(self, handler)
     self._processMap["ResetCatalog"] = Processor.process_ResetCatalog
+    self._processMap["ResetTable"] = Processor.process_ResetTable
 
   def process(self, iprot, oprot):
     (name, type, seqid) = iprot.readMessageBegin()
@@ -84,6 +122,17 @@ class Processor(cli_service.TCLIService.Processor, Iface, TProcessor):
     oprot.writeMessageEnd()
     oprot.trans.flush()
 
+  def process_ResetTable(self, seqid, iprot, oprot):
+    args = ResetTable_args()
+    args.read(iprot)
+    iprot.readMessageEnd()
+    result = ResetTable_result()
+    result.success = self._handler.ResetTable(args.request)
+    oprot.writeMessageBegin("ResetTable", TMessageType.REPLY, seqid)
+    result.write(oprot)
+    oprot.writeMessageEnd()
+    oprot.trans.flush()
+
 
 # HELPER FUNCTIONS AND STRUCTURES
 
@@ -136,7 +185,7 @@ class ResetCatalog_result(object):
   """
 
   thrift_spec = (
-    (0, TType.STRUCT, 'success', (Status.ttypes.TStatus, Status.ttypes.TStatus.thrift_spec), None, ), # 0
+    (0, TType.STRUCT, 'success', (TResetCatalogResp, TResetCatalogResp.thrift_spec), None, ), # 0
   )
 
   def __init__(self, success=None,):
@@ -153,7 +202,7 @@ class ResetCatalog_result(object):
         break
       if fid == 0:
         if ftype == TType.STRUCT:
-          self.success = Status.ttypes.TStatus()
+          self.success = TResetCatalogResp()
           self.success.read(iprot)
         else:
           iprot.skip(ftype)
@@ -178,6 +227,127 @@ class ResetCatalog_result(object):
     return
 
 
+  def __repr__(self):
+    L = ['%s=%r' % (key, value)
+      for key, value in self.__dict__.iteritems()]
+    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+  def __eq__(self, other):
+    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+  def __ne__(self, other):
+    return not (self == other)
+
+class ResetTable_args(object):
+  """
+  Attributes:
+   - request
+  """
+
+  thrift_spec = (
+    None, # 0
+    (1, TType.STRUCT, 'request', (TResetTableReq, TResetTableReq.thrift_spec), None, ), # 1
+  )
+
+  def __init__(self, request=None,):
+    self.request = request
+
+  def read(self, iprot):
+    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+      return
+    iprot.readStructBegin()
+    while True:
+      (fname, ftype, fid) = iprot.readFieldBegin()
+      if ftype == TType.STOP:
+        break
+      if fid == 1:
+        if ftype == TType.STRUCT:
+          self.request = TResetTableReq()
+          self.request.read(iprot)
+        else:
+          iprot.skip(ftype)
+      else:
+        iprot.skip(ftype)
+      iprot.readFieldEnd()
+    iprot.readStructEnd()
+
+  def write(self, oprot):
+    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+      return
+    oprot.writeStructBegin('ResetTable_args')
+    if self.request is not None:
+      oprot.writeFieldBegin('request', TType.STRUCT, 1)
+      self.request.write(oprot)
+      oprot.writeFieldEnd()
+    oprot.writeFieldStop()
+    oprot.writeStructEnd()
+
+  def validate(self):
+    return
+
+
+  def __repr__(self):
+    L = ['%s=%r' % (key, value)
+      for key, value in self.__dict__.iteritems()]
+    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+  def __eq__(self, other):
+    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+  def __ne__(self, other):
+    return not (self == other)
+
+class ResetTable_result(object):
+  """
+  Attributes:
+   - success
+  """
+
+  thrift_spec = (
+    (0, TType.STRUCT, 'success', (TResetTableResp, TResetTableResp.thrift_spec), None, ), # 0
+  )
+
+  def __init__(self, success=None,):
+    self.success = success
+
+  def read(self, iprot):
+    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+      return
+    iprot.readStructBegin()
+    while True:
+      (fname, ftype, fid) = iprot.readFieldBegin()
+      if ftype == TType.STOP:
+        break
+      if fid == 0:
+        if ftype == TType.STRUCT:
+          self.success = TResetTableResp()
+          self.success.read(iprot)
+        else:
+          iprot.skip(ftype)
+      else:
+        iprot.skip(ftype)
+      iprot.readFieldEnd()
+    iprot.readStructEnd()
+
+  def write(self, oprot):
+    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+      return
+    oprot.writeStructBegin('ResetTable_result')
+    if self.success is not None:
+      oprot.writeFieldBegin('success', TType.STRUCT, 0)
+      self.success.write(oprot)
+      oprot.writeFieldEnd()
+    oprot.writeFieldStop()
+    oprot.writeStructEnd()
+
+  def validate(self):
+    return
+
+
   def __repr__(self):
     L = ['%s=%r' % (key, value)
       for key, value in self.__dict__.iteritems()]

+ 15 - 1
apps/impala/gen-py/ImpalaService/ImpalaService-remote

@@ -25,8 +25,10 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help':
   print 'Functions:'
   print '  TStatus Cancel(QueryHandle query_id)'
   print '  TStatus ResetCatalog()'
+  print '  TStatus ResetTable(TResetTableReq request)'
+  print '  string GetRuntimeProfile(QueryHandle query_id)'
   print '  TInsertResult CloseInsert(QueryHandle handle)'
-  print '  void PingImpalaService()'
+  print '  TPingImpalaServiceResp PingImpalaService()'
   print ''
   sys.exit(0)
 
@@ -90,6 +92,18 @@ elif cmd == 'ResetCatalog':
     sys.exit(1)
   pp.pprint(client.ResetCatalog())
 
+elif cmd == 'ResetTable':
+  if len(args) != 1:
+    print 'ResetTable requires 1 args'
+    sys.exit(1)
+  pp.pprint(client.ResetTable(eval(args[0]),))
+
+elif cmd == 'GetRuntimeProfile':
+  if len(args) != 1:
+    print 'GetRuntimeProfile requires 1 args'
+    sys.exit(1)
+  pp.pprint(client.GetRuntimeProfile(eval(args[0]),))
+
 elif cmd == 'CloseInsert':
   if len(args) != 1:
     print 'CloseInsert requires 1 args'

+ 380 - 3
apps/impala/gen-py/ImpalaService/ImpalaService.py

@@ -29,6 +29,20 @@ class Iface(beeswaxd.BeeswaxService.Iface):
   def ResetCatalog(self, ):
     pass
 
+  def ResetTable(self, request):
+    """
+    Parameters:
+     - request
+    """
+    pass
+
+  def GetRuntimeProfile(self, query_id):
+    """
+    Parameters:
+     - query_id
+    """
+    pass
+
   def CloseInsert(self, handle):
     """
     Parameters:
@@ -101,6 +115,68 @@ class Client(beeswaxd.BeeswaxService.Client, Iface):
       return result.success
     raise TApplicationException(TApplicationException.MISSING_RESULT, "ResetCatalog failed: unknown result");
 
+  def ResetTable(self, request):
+    """
+    Parameters:
+     - request
+    """
+    self.send_ResetTable(request)
+    return self.recv_ResetTable()
+
+  def send_ResetTable(self, request):
+    self._oprot.writeMessageBegin('ResetTable', TMessageType.CALL, self._seqid)
+    args = ResetTable_args()
+    args.request = request
+    args.write(self._oprot)
+    self._oprot.writeMessageEnd()
+    self._oprot.trans.flush()
+
+  def recv_ResetTable(self, ):
+    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+    if mtype == TMessageType.EXCEPTION:
+      x = TApplicationException()
+      x.read(self._iprot)
+      self._iprot.readMessageEnd()
+      raise x
+    result = ResetTable_result()
+    result.read(self._iprot)
+    self._iprot.readMessageEnd()
+    if result.success is not None:
+      return result.success
+    raise TApplicationException(TApplicationException.MISSING_RESULT, "ResetTable failed: unknown result");
+
+  def GetRuntimeProfile(self, query_id):
+    """
+    Parameters:
+     - query_id
+    """
+    self.send_GetRuntimeProfile(query_id)
+    return self.recv_GetRuntimeProfile()
+
+  def send_GetRuntimeProfile(self, query_id):
+    self._oprot.writeMessageBegin('GetRuntimeProfile', TMessageType.CALL, self._seqid)
+    args = GetRuntimeProfile_args()
+    args.query_id = query_id
+    args.write(self._oprot)
+    self._oprot.writeMessageEnd()
+    self._oprot.trans.flush()
+
+  def recv_GetRuntimeProfile(self, ):
+    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+    if mtype == TMessageType.EXCEPTION:
+      x = TApplicationException()
+      x.read(self._iprot)
+      self._iprot.readMessageEnd()
+      raise x
+    result = GetRuntimeProfile_result()
+    result.read(self._iprot)
+    self._iprot.readMessageEnd()
+    if result.success is not None:
+      return result.success
+    if result.error is not None:
+      raise result.error
+    raise TApplicationException(TApplicationException.MISSING_RESULT, "GetRuntimeProfile failed: unknown result");
+
   def CloseInsert(self, handle):
     """
     Parameters:
@@ -137,7 +213,7 @@ class Client(beeswaxd.BeeswaxService.Client, Iface):
 
   def PingImpalaService(self, ):
     self.send_PingImpalaService()
-    self.recv_PingImpalaService()
+    return self.recv_PingImpalaService()
 
   def send_PingImpalaService(self, ):
     self._oprot.writeMessageBegin('PingImpalaService', TMessageType.CALL, self._seqid)
@@ -156,7 +232,9 @@ class Client(beeswaxd.BeeswaxService.Client, Iface):
     result = PingImpalaService_result()
     result.read(self._iprot)
     self._iprot.readMessageEnd()
-    return
+    if result.success is not None:
+      return result.success
+    raise TApplicationException(TApplicationException.MISSING_RESULT, "PingImpalaService failed: unknown result");
 
 
 class Processor(beeswaxd.BeeswaxService.Processor, Iface, TProcessor):
@@ -164,6 +242,8 @@ class Processor(beeswaxd.BeeswaxService.Processor, Iface, TProcessor):
     beeswaxd.BeeswaxService.Processor.__init__(self, handler)
     self._processMap["Cancel"] = Processor.process_Cancel
     self._processMap["ResetCatalog"] = Processor.process_ResetCatalog
+    self._processMap["ResetTable"] = Processor.process_ResetTable
+    self._processMap["GetRuntimeProfile"] = Processor.process_GetRuntimeProfile
     self._processMap["CloseInsert"] = Processor.process_CloseInsert
     self._processMap["PingImpalaService"] = Processor.process_PingImpalaService
 
@@ -207,6 +287,31 @@ class Processor(beeswaxd.BeeswaxService.Processor, Iface, TProcessor):
     oprot.writeMessageEnd()
     oprot.trans.flush()
 
+  def process_ResetTable(self, seqid, iprot, oprot):
+    args = ResetTable_args()
+    args.read(iprot)
+    iprot.readMessageEnd()
+    result = ResetTable_result()
+    result.success = self._handler.ResetTable(args.request)
+    oprot.writeMessageBegin("ResetTable", TMessageType.REPLY, seqid)
+    result.write(oprot)
+    oprot.writeMessageEnd()
+    oprot.trans.flush()
+
+  def process_GetRuntimeProfile(self, seqid, iprot, oprot):
+    args = GetRuntimeProfile_args()
+    args.read(iprot)
+    iprot.readMessageEnd()
+    result = GetRuntimeProfile_result()
+    try:
+      result.success = self._handler.GetRuntimeProfile(args.query_id)
+    except beeswaxd.ttypes.BeeswaxException as error:
+      result.error = error
+    oprot.writeMessageBegin("GetRuntimeProfile", TMessageType.REPLY, seqid)
+    result.write(oprot)
+    oprot.writeMessageEnd()
+    oprot.trans.flush()
+
   def process_CloseInsert(self, seqid, iprot, oprot):
     args = CloseInsert_args()
     args.read(iprot)
@@ -228,7 +333,7 @@ class Processor(beeswaxd.BeeswaxService.Processor, Iface, TProcessor):
     args.read(iprot)
     iprot.readMessageEnd()
     result = PingImpalaService_result()
-    self._handler.PingImpalaService()
+    result.success = self._handler.PingImpalaService()
     oprot.writeMessageBegin("PingImpalaService", TMessageType.REPLY, seqid)
     result.write(oprot)
     oprot.writeMessageEnd()
@@ -473,6 +578,260 @@ class ResetCatalog_result(object):
   def __ne__(self, other):
     return not (self == other)
 
+class ResetTable_args(object):
+  """
+  Attributes:
+   - request
+  """
+
+  thrift_spec = (
+    None, # 0
+    (1, TType.STRUCT, 'request', (TResetTableReq, TResetTableReq.thrift_spec), None, ), # 1
+  )
+
+  def __init__(self, request=None,):
+    self.request = request
+
+  def read(self, iprot):
+    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+      return
+    iprot.readStructBegin()
+    while True:
+      (fname, ftype, fid) = iprot.readFieldBegin()
+      if ftype == TType.STOP:
+        break
+      if fid == 1:
+        if ftype == TType.STRUCT:
+          self.request = TResetTableReq()
+          self.request.read(iprot)
+        else:
+          iprot.skip(ftype)
+      else:
+        iprot.skip(ftype)
+      iprot.readFieldEnd()
+    iprot.readStructEnd()
+
+  def write(self, oprot):
+    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+      return
+    oprot.writeStructBegin('ResetTable_args')
+    if self.request is not None:
+      oprot.writeFieldBegin('request', TType.STRUCT, 1)
+      self.request.write(oprot)
+      oprot.writeFieldEnd()
+    oprot.writeFieldStop()
+    oprot.writeStructEnd()
+
+  def validate(self):
+    return
+
+
+  def __repr__(self):
+    L = ['%s=%r' % (key, value)
+      for key, value in self.__dict__.iteritems()]
+    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+  def __eq__(self, other):
+    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+  def __ne__(self, other):
+    return not (self == other)
+
+class ResetTable_result(object):
+  """
+  Attributes:
+   - success
+  """
+
+  thrift_spec = (
+    (0, TType.STRUCT, 'success', (Status.ttypes.TStatus, Status.ttypes.TStatus.thrift_spec), None, ), # 0
+  )
+
+  def __init__(self, success=None,):
+    self.success = success
+
+  def read(self, iprot):
+    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+      return
+    iprot.readStructBegin()
+    while True:
+      (fname, ftype, fid) = iprot.readFieldBegin()
+      if ftype == TType.STOP:
+        break
+      if fid == 0:
+        if ftype == TType.STRUCT:
+          self.success = Status.ttypes.TStatus()
+          self.success.read(iprot)
+        else:
+          iprot.skip(ftype)
+      else:
+        iprot.skip(ftype)
+      iprot.readFieldEnd()
+    iprot.readStructEnd()
+
+  def write(self, oprot):
+    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+      return
+    oprot.writeStructBegin('ResetTable_result')
+    if self.success is not None:
+      oprot.writeFieldBegin('success', TType.STRUCT, 0)
+      self.success.write(oprot)
+      oprot.writeFieldEnd()
+    oprot.writeFieldStop()
+    oprot.writeStructEnd()
+
+  def validate(self):
+    return
+
+
+  def __repr__(self):
+    L = ['%s=%r' % (key, value)
+      for key, value in self.__dict__.iteritems()]
+    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+  def __eq__(self, other):
+    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+  def __ne__(self, other):
+    return not (self == other)
+
+class GetRuntimeProfile_args(object):
+  """
+  Attributes:
+   - query_id
+  """
+
+  thrift_spec = (
+    None, # 0
+    (1, TType.STRUCT, 'query_id', (beeswaxd.ttypes.QueryHandle, beeswaxd.ttypes.QueryHandle.thrift_spec), None, ), # 1
+  )
+
+  def __init__(self, query_id=None,):
+    self.query_id = query_id
+
+  def read(self, iprot):
+    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+      return
+    iprot.readStructBegin()
+    while True:
+      (fname, ftype, fid) = iprot.readFieldBegin()
+      if ftype == TType.STOP:
+        break
+      if fid == 1:
+        if ftype == TType.STRUCT:
+          self.query_id = beeswaxd.ttypes.QueryHandle()
+          self.query_id.read(iprot)
+        else:
+          iprot.skip(ftype)
+      else:
+        iprot.skip(ftype)
+      iprot.readFieldEnd()
+    iprot.readStructEnd()
+
+  def write(self, oprot):
+    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+      return
+    oprot.writeStructBegin('GetRuntimeProfile_args')
+    if self.query_id is not None:
+      oprot.writeFieldBegin('query_id', TType.STRUCT, 1)
+      self.query_id.write(oprot)
+      oprot.writeFieldEnd()
+    oprot.writeFieldStop()
+    oprot.writeStructEnd()
+
+  def validate(self):
+    return
+
+
+  def __repr__(self):
+    L = ['%s=%r' % (key, value)
+      for key, value in self.__dict__.iteritems()]
+    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+  def __eq__(self, other):
+    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+  def __ne__(self, other):
+    return not (self == other)
+
+class GetRuntimeProfile_result(object):
+  """
+  Attributes:
+   - success
+   - error
+  """
+
+  thrift_spec = (
+    (0, TType.STRING, 'success', None, None, ), # 0
+    (1, TType.STRUCT, 'error', (beeswaxd.ttypes.BeeswaxException, beeswaxd.ttypes.BeeswaxException.thrift_spec), None, ), # 1
+  )
+
+  def __init__(self, success=None, error=None,):
+    self.success = success
+    self.error = error
+
+  def read(self, iprot):
+    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+      return
+    iprot.readStructBegin()
+    while True:
+      (fname, ftype, fid) = iprot.readFieldBegin()
+      if ftype == TType.STOP:
+        break
+      if fid == 0:
+        if ftype == TType.STRING:
+          self.success = iprot.readString();
+        else:
+          iprot.skip(ftype)
+      elif fid == 1:
+        if ftype == TType.STRUCT:
+          self.error = beeswaxd.ttypes.BeeswaxException()
+          self.error.read(iprot)
+        else:
+          iprot.skip(ftype)
+      else:
+        iprot.skip(ftype)
+      iprot.readFieldEnd()
+    iprot.readStructEnd()
+
+  def write(self, oprot):
+    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+      return
+    oprot.writeStructBegin('GetRuntimeProfile_result')
+    if self.success is not None:
+      oprot.writeFieldBegin('success', TType.STRING, 0)
+      oprot.writeString(self.success)
+      oprot.writeFieldEnd()
+    if self.error is not None:
+      oprot.writeFieldBegin('error', TType.STRUCT, 1)
+      self.error.write(oprot)
+      oprot.writeFieldEnd()
+    oprot.writeFieldStop()
+    oprot.writeStructEnd()
+
+  def validate(self):
+    return
+
+
+  def __repr__(self):
+    L = ['%s=%r' % (key, value)
+      for key, value in self.__dict__.iteritems()]
+    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+  def __eq__(self, other):
+    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+  def __ne__(self, other):
+    return not (self == other)
+
 class CloseInsert_args(object):
   """
   Attributes:
@@ -663,10 +1022,18 @@ class PingImpalaService_args(object):
     return not (self == other)
 
 class PingImpalaService_result(object):
+  """
+  Attributes:
+   - success
+  """
 
   thrift_spec = (
+    (0, TType.STRUCT, 'success', (TPingImpalaServiceResp, TPingImpalaServiceResp.thrift_spec), None, ), # 0
   )
 
+  def __init__(self, success=None,):
+    self.success = success
+
   def read(self, iprot):
     if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
       fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
@@ -676,6 +1043,12 @@ class PingImpalaService_result(object):
       (fname, ftype, fid) = iprot.readFieldBegin()
       if ftype == TType.STOP:
         break
+      if fid == 0:
+        if ftype == TType.STRUCT:
+          self.success = TPingImpalaServiceResp()
+          self.success.read(iprot)
+        else:
+          iprot.skip(ftype)
       else:
         iprot.skip(ftype)
       iprot.readFieldEnd()
@@ -686,6 +1059,10 @@ class PingImpalaService_result(object):
       oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
       return
     oprot.writeStructBegin('PingImpalaService_result')
+    if self.success is not None:
+      oprot.writeFieldBegin('success', TType.STRUCT, 0)
+      self.success.write(oprot)
+      oprot.writeFieldEnd()
     oprot.writeFieldStop()
     oprot.writeStructEnd()
 

+ 265 - 0
apps/impala/gen-py/ImpalaService/ttypes.py

@@ -33,6 +33,7 @@ class TImpalaQueryOptions(object):
   ALLOW_UNSUPPORTED_FORMATS = 9
   DEFAULT_ORDER_BY_LIMIT = 10
   DEBUG_ACTION = 11
+  ABORT_ON_DEFAULT_LIMIT_EXCEEDED = 12
 
   _VALUES_TO_NAMES = {
     0: "ABORT_ON_ERROR",
@@ -47,6 +48,7 @@ class TImpalaQueryOptions(object):
     9: "ALLOW_UNSUPPORTED_FORMATS",
     10: "DEFAULT_ORDER_BY_LIMIT",
     11: "DEBUG_ACTION",
+    12: "ABORT_ON_DEFAULT_LIMIT_EXCEEDED",
   }
 
   _NAMES_TO_VALUES = {
@@ -62,6 +64,7 @@ class TImpalaQueryOptions(object):
     "ALLOW_UNSUPPORTED_FORMATS": 9,
     "DEFAULT_ORDER_BY_LIMIT": 10,
     "DEBUG_ACTION": 11,
+    "ABORT_ON_DEFAULT_LIMIT_EXCEEDED": 12,
   }
 
 
@@ -126,6 +129,268 @@ class TInsertResult(object):
     return
 
 
+  def __repr__(self):
+    L = ['%s=%r' % (key, value)
+      for key, value in self.__dict__.iteritems()]
+    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+  def __eq__(self, other):
+    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+  def __ne__(self, other):
+    return not (self == other)
+
+class TPingImpalaServiceResp(object):
+  """
+  Attributes:
+   - version
+  """
+
+  thrift_spec = (
+    None, # 0
+    (1, TType.STRING, 'version', None, None, ), # 1
+  )
+
+  def __init__(self, version=None,):
+    self.version = version
+
+  def read(self, iprot):
+    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+      return
+    iprot.readStructBegin()
+    while True:
+      (fname, ftype, fid) = iprot.readFieldBegin()
+      if ftype == TType.STOP:
+        break
+      if fid == 1:
+        if ftype == TType.STRING:
+          self.version = iprot.readString();
+        else:
+          iprot.skip(ftype)
+      else:
+        iprot.skip(ftype)
+      iprot.readFieldEnd()
+    iprot.readStructEnd()
+
+  def write(self, oprot):
+    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+      return
+    oprot.writeStructBegin('TPingImpalaServiceResp')
+    if self.version is not None:
+      oprot.writeFieldBegin('version', TType.STRING, 1)
+      oprot.writeString(self.version)
+      oprot.writeFieldEnd()
+    oprot.writeFieldStop()
+    oprot.writeStructEnd()
+
+  def validate(self):
+    return
+
+
+  def __repr__(self):
+    L = ['%s=%r' % (key, value)
+      for key, value in self.__dict__.iteritems()]
+    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+  def __eq__(self, other):
+    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+  def __ne__(self, other):
+    return not (self == other)
+
+class TResetTableReq(object):
+  """
+  Attributes:
+   - db_name
+   - table_name
+  """
+
+  thrift_spec = (
+    None, # 0
+    (1, TType.STRING, 'db_name', None, None, ), # 1
+    (2, TType.STRING, 'table_name', None, None, ), # 2
+  )
+
+  def __init__(self, db_name=None, table_name=None,):
+    self.db_name = db_name
+    self.table_name = table_name
+
+  def read(self, iprot):
+    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+      return
+    iprot.readStructBegin()
+    while True:
+      (fname, ftype, fid) = iprot.readFieldBegin()
+      if ftype == TType.STOP:
+        break
+      if fid == 1:
+        if ftype == TType.STRING:
+          self.db_name = iprot.readString();
+        else:
+          iprot.skip(ftype)
+      elif fid == 2:
+        if ftype == TType.STRING:
+          self.table_name = iprot.readString();
+        else:
+          iprot.skip(ftype)
+      else:
+        iprot.skip(ftype)
+      iprot.readFieldEnd()
+    iprot.readStructEnd()
+
+  def write(self, oprot):
+    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+      return
+    oprot.writeStructBegin('TResetTableReq')
+    if self.db_name is not None:
+      oprot.writeFieldBegin('db_name', TType.STRING, 1)
+      oprot.writeString(self.db_name)
+      oprot.writeFieldEnd()
+    if self.table_name is not None:
+      oprot.writeFieldBegin('table_name', TType.STRING, 2)
+      oprot.writeString(self.table_name)
+      oprot.writeFieldEnd()
+    oprot.writeFieldStop()
+    oprot.writeStructEnd()
+
+  def validate(self):
+    if self.db_name is None:
+      raise TProtocol.TProtocolException(message='Required field db_name is unset!')
+    if self.table_name is None:
+      raise TProtocol.TProtocolException(message='Required field table_name is unset!')
+    return
+
+
+  def __repr__(self):
+    L = ['%s=%r' % (key, value)
+      for key, value in self.__dict__.iteritems()]
+    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+  def __eq__(self, other):
+    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+  def __ne__(self, other):
+    return not (self == other)
+
+class TResetCatalogResp(object):
+  """
+  Attributes:
+   - status
+  """
+
+  thrift_spec = (
+    None, # 0
+    (1, TType.STRUCT, 'status', (Status.ttypes.TStatus, Status.ttypes.TStatus.thrift_spec), None, ), # 1
+  )
+
+  def __init__(self, status=None,):
+    self.status = status
+
+  def read(self, iprot):
+    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+      return
+    iprot.readStructBegin()
+    while True:
+      (fname, ftype, fid) = iprot.readFieldBegin()
+      if ftype == TType.STOP:
+        break
+      if fid == 1:
+        if ftype == TType.STRUCT:
+          self.status = Status.ttypes.TStatus()
+          self.status.read(iprot)
+        else:
+          iprot.skip(ftype)
+      else:
+        iprot.skip(ftype)
+      iprot.readFieldEnd()
+    iprot.readStructEnd()
+
+  def write(self, oprot):
+    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+      return
+    oprot.writeStructBegin('TResetCatalogResp')
+    if self.status is not None:
+      oprot.writeFieldBegin('status', TType.STRUCT, 1)
+      self.status.write(oprot)
+      oprot.writeFieldEnd()
+    oprot.writeFieldStop()
+    oprot.writeStructEnd()
+
+  def validate(self):
+    if self.status is None:
+      raise TProtocol.TProtocolException(message='Required field status is unset!')
+    return
+
+
+  def __repr__(self):
+    L = ['%s=%r' % (key, value)
+      for key, value in self.__dict__.iteritems()]
+    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+  def __eq__(self, other):
+    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+  def __ne__(self, other):
+    return not (self == other)
+
+class TResetTableResp(object):
+  """
+  Attributes:
+   - status
+  """
+
+  thrift_spec = (
+    None, # 0
+    (1, TType.STRUCT, 'status', (Status.ttypes.TStatus, Status.ttypes.TStatus.thrift_spec), None, ), # 1
+  )
+
+  def __init__(self, status=None,):
+    self.status = status
+
+  def read(self, iprot):
+    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+      return
+    iprot.readStructBegin()
+    while True:
+      (fname, ftype, fid) = iprot.readFieldBegin()
+      if ftype == TType.STOP:
+        break
+      if fid == 1:
+        if ftype == TType.STRUCT:
+          self.status = Status.ttypes.TStatus()
+          self.status.read(iprot)
+        else:
+          iprot.skip(ftype)
+      else:
+        iprot.skip(ftype)
+      iprot.readFieldEnd()
+    iprot.readStructEnd()
+
+  def write(self, oprot):
+    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+      return
+    oprot.writeStructBegin('TResetTableResp')
+    if self.status is not None:
+      oprot.writeFieldBegin('status', TType.STRUCT, 1)
+      self.status.write(oprot)
+      oprot.writeFieldEnd()
+    oprot.writeFieldStop()
+    oprot.writeStructEnd()
+
+  def validate(self):
+    if self.status is None:
+      raise TProtocol.TProtocolException(message='Required field status is unset!')
+    return
+
+
   def __repr__(self):
     L = ['%s=%r' % (key, value)
       for key, value in self.__dict__.iteritems()]

+ 9 - 8
apps/impala/src/impala/views.py

@@ -15,8 +15,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-## All the other views are inherited from Beeswax currently.
-
 try:
   import json
 except ImportError:
@@ -27,6 +25,8 @@ from django.utils.translation import ugettext as _
 from beeswax.views import install_examples as beeswax_install_examples
 from impala import server
 
+## Most of the views are inherited from Beeswax.
+
 
 def refresh_catalog(request):
   response = {'status': -1, 'message': ''}
@@ -37,11 +37,7 @@ def refresh_catalog(request):
     try:
       db = server.get(request.user)
       res = db.resetCatalog()
-      if res.status_code is None:
-        status = 0
-      else:
-        status = res.status_code
-      response = {'status': status, 'message': res.error_msgs}
+      response = {'status': res.status.status_code, 'message': res.status.error_msgs}
     except Exception, e:
       response = {'message': str(e)}
 
@@ -49,4 +45,9 @@ def refresh_catalog(request):
 
 
 def install_examples(request):
-  return beeswax_install_examples(request)
+  response = beeswax_install_examples(request)
+  catalog_response = json.loads(refresh_catalog(request).content)
+
+  if catalog_response['status'] != 0: # Simpler than aggregating the errors
+    request.error(catalog_response['message'])
+  return response

+ 53 - 15
apps/impala/thrift/ImpalaService.thrift

@@ -32,13 +32,13 @@ include "cli_service.thrift"
 enum TImpalaQueryOptions {
   // if true, abort execution on the first error
   ABORT_ON_ERROR,
-
+  
   // maximum # of errors to be reported; Unspecified or 0 indicates backend default
   MAX_ERRORS,
-
+  
   // if true, disable llvm codegen
   DISABLE_CODEGEN,
-
+  
   // batch size to be used by backend; Unspecified or a size of 0 indicates backend
   // default
   BATCH_SIZE,
@@ -49,7 +49,7 @@ enum TImpalaQueryOptions {
   // a) an int (= number of bytes);
   // b) a float followed by "M" (MB) or "G" (GB)
   MEM_LIMIT,
-
+   
   // specifies the degree of parallelism with which to execute the query;
   // 1: single-node execution
   // NUM_NODES_ALL: executes on all nodes that contain relevant data
@@ -59,11 +59,11 @@ enum TImpalaQueryOptions {
   //      numNodes would be active at any point in time)
   // Constants (NUM_NODES_ALL, NUM_NODES_ALL_RACKS) are defined in JavaConstants.thrift.
   NUM_NODES,
-
+  
   // maximum length of the scan range; only applicable to HDFS scan range; Unspecified or
-  // a length of 0 indicates backend default;
+  // a length of 0 indicates backend default;  
   MAX_SCAN_RANGE_LENGTH,
-
+  
   // Maximum number of io buffers (per disk)
   MAX_IO_BUFFERS,
 
@@ -86,8 +86,11 @@ enum TImpalaQueryOptions {
   // backend instance will perform the debug action, otherwise all backends will behave
   // in that way.
   // If the string doesn't have the required format or if any of its components is
-  // invalid, the option is ignored.
+  // invalid, the option is ignored. 
   DEBUG_ACTION,
+  
+  // If true, raise an error when the DEFAULT_ORDER_BY_LIMIT has been reached.
+  ABORT_ON_DEFAULT_LIMIT_EXCEEDED,
 }
 
 // Default values for each query option in ImpalaService.TImpalaQueryOptions
@@ -107,13 +110,38 @@ const map<TImpalaQueryOptions, string> DEFAULT_QUERY_OPTIONS = {
 }
 
 // The summary of an insert.
-struct TInsertResult {
+struct TInsertResult {  
   // Number of appended rows per modified partition. Only applies to HDFS tables.
-  // The keys represent partitions to create, coded as k1=v1/k2=v2/k3=v3..., with the
+  // The keys represent partitions to create, coded as k1=v1/k2=v2/k3=v3..., with the 
   // root in an unpartitioned table being the empty string.
   1: required map<string, i64> rows_appended
 }
 
+// Response from a call to PingImpalaService
+struct TPingImpalaServiceResp {
+  // The Impala service's version string.
+  1: string version
+}
+
+// Parameters for a ResetTable request which will invalidate a table's metadata.
+struct TResetTableReq {
+  // Name of the table's parent database.
+  1: required string db_name
+
+  // Name of the table.
+  2: required string table_name
+}
+
+// Response from call to ResetCatalog
+struct TResetCatalogResp {
+  1: required Status.TStatus status
+}
+
+// Response from call to ResetTable
+struct TResetTableResp {
+  1: required Status.TStatus status
+}
+
 // For all rpc that return a TStatus as part of their result type,
 // if the status_code field is set to anything other than OK, the contents
 // of the remainder of the result type is undefined (typically not set)
@@ -126,21 +154,31 @@ service ImpalaService extends beeswax.BeeswaxService {
   // necessarily indicate an error: the query might have finished).
   Status.TStatus Cancel(1:beeswax.QueryHandle query_id)
       throws(1:beeswax.BeeswaxException error);
-
+        
   // Invalidates all catalog metadata, forcing a reload
   Status.TStatus ResetCatalog();
 
+  // Invalidates a specific table's catalog metadata, forcing a reload on the next access
+  Status.TStatus ResetTable(1:TResetTableReq request)
+
+  // Returns the runtime profile string for the given query handle.
+  string GetRuntimeProfile(1:beeswax.QueryHandle query_id)
+      throws(1:beeswax.BeeswaxException error);
+  
   // Closes the query handle and return the result summary of the insert.
   TInsertResult CloseInsert(1:beeswax.QueryHandle handle)
       throws(1:beeswax.QueryNotFoundException error, 2:beeswax.BeeswaxException error2);
 
-  // Client calls this RPC to verify that the server is an ImpalaService.
-  void PingImpalaService();
+  // Client calls this RPC to verify that the server is an ImpalaService. Returns the
+  // server version.
+  TPingImpalaServiceResp PingImpalaService();
 }
 
 // Impala HiveServer2 service
 service ImpalaHiveServer2Service extends cli_service.TCLIService {
   // Invalidates all catalog metadata, forcing a reload
-  Status.TStatus ResetCatalog();
-}
+  TResetCatalogResp ResetCatalog();
 
+  // Invalidates a specific table's catalog metadata, forcing a reload on the next access
+  TResetTableResp ResetTable(1:TResetTableReq request);
+}