Package org.apache.hadoop.hive.service

Examples of org.apache.hadoop.hive.service.HiveServerException


      int rc = 0;
      // TODO: driver.run should either return int or throw exception, not both.
      try {
        rc = driver.run(query);
      } catch (Exception e) {
        throw new HiveServerException("Error running query: " + e.toString());
      }
      if (rc != 0) {
        throw new HiveServerException("Query returned non-zero code: " + rc);
      }
    }
View Full Code Here


    public String getSchema() throws HiveServerException, TException {
      try {
        return driver.getSchema();
      }
      catch (Exception e) {
        throw new HiveServerException("Unable to get schema: " + e.toString());
      }
    }
View Full Code Here

     *         row to fetch or numRows == 0.
     * @throws HiveServerException Invalid value for numRows (numRows < 0)
     */
    public List<String> fetchN(int numRows) throws HiveServerException, TException {
      if (numRows < 0) {
        throw new HiveServerException("Invalid argument for number of rows: " + numRows);
      }
      Vector<String> result = new Vector<String>();
      driver.setMaxRows(numRows);
      driver.getResults(result);
      return result;
View Full Code Here

          when(result.fetchN(anyInt())).thenReturn(fetchResult);
        } catch (HiveServerException e) {
        } catch (Exception e) {
        }
      } else if (ClientResult.RETURN_SERVER_EXCEPTION.equals(this.result)) {
        HiveServerException exception = new HiveServerException("test HiveServerException", 10,
            "sql state");
        try {
          when(result.fetchN(anyInt())).thenThrow(exception);

          when(result.fetchN(anyInt())).thenThrow(exception);
View Full Code Here

            isHiveQuery = false;
            ret = proc.run(cmd_1);
          }
        }
      } catch (Exception e) {
        HiveServerException ex = new HiveServerException();
        ex.setMessage("Error running query: " + e.toString());
        throw ex;
      }

      if (ret != 0) {
        throw new HiveServerException("Query returned non-zero code: " + ret +
                                      ", cause: " + errorMessage, ret, SQLState);
      }
    }
View Full Code Here

            state);
      }
      catch (Exception e) {
        LOG.error(e.toString());
        e.printStackTrace();
        HiveServerException ex = new HiveServerException();
        ex.setMessage("Unable to get cluster status: " + e.toString());
        throw ex;
      }
      return hcs;
    }
View Full Code Here

        return schema;
      }
      catch (Exception e) {
        LOG.error(e.toString());
        e.printStackTrace();
        HiveServerException ex = new HiveServerException();
        ex.setMessage("Unable to get schema: " + e.toString());
        throw ex;
      }
    }
View Full Code Here

        return schema;
      }
      catch (Exception e) {
        LOG.error(e.toString());
        e.printStackTrace();
        HiveServerException ex = new HiveServerException();
        ex.setMessage("Unable to get schema: " + e.toString());
        throw ex;
      }
    }
View Full Code Here

        // TODO: Cannot return null here because thrift cannot handle nulls
        // TODO: Returning empty string for now. Need to figure out how to
        // TODO: return null in some other way
        return "";
      } catch (IOException e) {
        HiveServerException ex = new HiveServerException();
        ex.setMessage(e.getMessage());
        throw ex;
      }
    }
View Full Code Here

     *         row to fetch or numRows == 0.
     * @throws HiveServerException Invalid value for numRows (numRows < 0)
     */
    public List<String> fetchN(int numRows) throws HiveServerException, TException {
      if (numRows < 0) {
        HiveServerException ex = new HiveServerException();
        ex.setMessage("Invalid argument for number of rows: " + numRows);
        throw ex;
      }
      if (!isHiveQuery)
        // Return no results if the last command was not a Hive query
        return new Vector<String>();

      Vector<String> result = new Vector<String>();
      driver.setMaxRows(numRows);
      try {
        driver.getResults(result);
      } catch (IOException e) {
        HiveServerException ex = new HiveServerException();
        ex.setMessage(e.getMessage());
        throw ex;
      }
      return result;
    }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.service.HiveServerException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.