public String getDatabaseProductVersion() throws SQLException { if (dbVersion != null) { //lazy-caching of the version. return dbVersion; } TGetInfoResp resp = getServerInfo(GetInfoType.CLI_DBMS_VER.toTGetInfoType()); this.dbVersion = resp.getInfoValue().getStringValue(); return dbVersion; }
public static GetInfoType getGetInfoType(TGetInfoType tGetInfoType) { for (GetInfoType infoType : values()) { if (tGetInfoType.equals(infoType.tInfoType)) { return infoType; } } throw new IllegalArgumentException("Unrecognized Thrift TGetInfoType value: " + tGetInfoType); }
@Override public TGetInfoResp GetInfo(TGetInfoReq req) throws TException { TGetInfoResp resp = new TGetInfoResp(); try { GetInfoValue getInfoValue = cliService.getInfo(new SessionHandle(req.getSessionHandle()), GetInfoType.getGetInfoType(req.getInfoType())); resp.setInfoValue(getInfoValue.toTGetInfoValue()); resp.setStatus(OK_STATUS); } catch (Exception e) { LOG.warn("Error getting info: ", e); resp.setStatus(HiveSQLException.toTStatus(e)); } return resp; }
@Override public GetInfoValue getInfo(GetInfoType getInfoType) throws HiveSQLException { acquire(true, true); try { switch (getInfoType) { case CLI_SERVER_NAME: return new GetInfoValue("Hive"); case CLI_DBMS_NAME: return new GetInfoValue("Apache Hive"); case CLI_DBMS_VER: return new GetInfoValue(HiveVersionInfo.getVersion()); case CLI_MAX_COLUMN_NAME_LEN: return new GetInfoValue(128); case CLI_MAX_SCHEMA_NAME_LEN: return new GetInfoValue(128); case CLI_MAX_TABLE_NAME_LEN: return new GetInfoValue(128); case CLI_ODBC_KEYWORDS: return new GetInfoValue(ParseUtils.getKeywords(ODBC_KEYWORDS)); case CLI_TXN_CAPABLE: default: throw new HiveSQLException("Unrecognized GetInfoType value: " + getInfoType.toString()); } } finally { release(true, true); } }
@Override public GetInfoValue getInfo(GetInfoType getInfoType) throws HiveSQLException { acquire(true); try { switch (getInfoType) { case CLI_SERVER_NAME: return new GetInfoValue("Hive"); case CLI_DBMS_NAME: return new GetInfoValue("Apache Hive"); case CLI_DBMS_VER: return new GetInfoValue(HiveVersionInfo.getVersion()); case CLI_MAX_COLUMN_NAME_LEN: return new GetInfoValue(128); case CLI_MAX_SCHEMA_NAME_LEN: return new GetInfoValue(128); case CLI_MAX_TABLE_NAME_LEN: return new GetInfoValue(128); case CLI_TXN_CAPABLE: default: throw new HiveSQLException("Unrecognized GetInfoType value: " + getInfoType.toString()); } } finally { release(true); } }
public String getSQLKeywords() throws SQLException { // Note: the definitions of what ODBC and JDBC keywords exclude are different in different // places. For now, just return the ODBC version here; that excludes Hive keywords // that are also ODBC reserved keywords. We could also exclude SQL:2003. TGetInfoResp resp = getServerInfo(GetInfoType.CLI_ODBC_KEYWORDS.toTGetInfoType()); return resp.getInfoValue().getStringValue(); } public int getSQLStateType() throws SQLException {
public static GetInfoType getGetInfoType(TGetInfoType tGetInfoType) { for (GetInfoType infoType : values()) { if (tGetInfoType.equals(infoType.tInfoType)) { return infoType; } } throw new IllegalArgumentException("Unrecognized Thrift TGetInfoType value: " + tGetInfoType); }
@Override public TGetInfoResp GetInfo(TGetInfoReq req) throws TException { TGetInfoResp resp = new TGetInfoResp(); try { GetInfoValue getInfoValue = cliService.getInfo(new SessionHandle(req.getSessionHandle()), GetInfoType.getGetInfoType(req.getInfoType())); resp.setInfoValue(getInfoValue.toTGetInfoValue()); resp.setStatus(OK_STATUS); } catch (Exception e) { LOG.warn("Error getting info: ", e); resp.setStatus(HiveSQLException.toTStatus(e)); } return resp; }
@Override public GetInfoValue getInfo(GetInfoType getInfoType) throws HiveSQLException { acquire(true); try { switch (getInfoType) { case CLI_SERVER_NAME: return new GetInfoValue("Hive"); case CLI_DBMS_NAME: return new GetInfoValue("Apache Hive"); case CLI_DBMS_VER: return new GetInfoValue(HiveVersionInfo.getVersion()); case CLI_MAX_COLUMN_NAME_LEN: return new GetInfoValue(128); case CLI_MAX_SCHEMA_NAME_LEN: return new GetInfoValue(128); case CLI_MAX_TABLE_NAME_LEN: return new GetInfoValue(128); case CLI_TXN_CAPABLE: default: throw new HiveSQLException("Unrecognized GetInfoType value: " + getInfoType.toString()); } } finally { release(true); } }
public String getDatabaseProductName() throws SQLException { TGetInfoResp resp = getServerInfo(GetInfoType.CLI_DBMS_NAME.toTGetInfoType()); return resp.getInfoValue().getStringValue(); }
public static GetInfoType getGetInfoType(TGetInfoType tGetInfoType) { for (GetInfoType infoType : values()) { if (tGetInfoType.equals(infoType.tInfoType)) { return infoType; } } throw new IllegalArgumentException("Unrecognized Thrift TGetInfoType value: " + tGetInfoType); }
@Override public TGetInfoResp GetInfo(TGetInfoReq req) throws TException { TGetInfoResp resp = new TGetInfoResp(); try { GetInfoValue getInfoValue = cliService.getInfo(new SessionHandle(req.getSessionHandle()), GetInfoType.getGetInfoType(req.getInfoType())); resp.setInfoValue(getInfoValue.toTGetInfoValue()); resp.setStatus(OK_STATUS); } catch (Exception e) { LOG.warn("Error getting info: ", e); resp.setStatus(HiveSQLException.toTStatus(e)); } return resp; }
@Override public GetInfoValue getInfo(GetInfoType getInfoType) throws HiveSQLException { acquire(true); try { switch (getInfoType) { case CLI_SERVER_NAME: return new GetInfoValue("Hive"); case CLI_DBMS_NAME: return new GetInfoValue("Apache Hive"); case CLI_DBMS_VER: return new GetInfoValue(HiveVersionInfo.getVersion()); case CLI_MAX_COLUMN_NAME_LEN: return new GetInfoValue(128); case CLI_MAX_SCHEMA_NAME_LEN: return new GetInfoValue(128); case CLI_MAX_TABLE_NAME_LEN: return new GetInfoValue(128); case CLI_TXN_CAPABLE: default: throw new HiveSQLException("Unrecognized GetInfoType value: " + getInfoType.toString()); } } finally { release(true); } }
@Override public GetInfoValue getInfo(SessionHandle sessionHandle, GetInfoType infoType) throws HiveSQLException { try { // FIXME extract the right info type TGetInfoReq req = new TGetInfoReq(sessionHandle.toTSessionHandle(), infoType.toTGetInfoType()); TGetInfoResp resp = cliService.GetInfo(req); checkStatus(resp.getStatus()); return new GetInfoValue(resp.getInfoValue()); } catch (HiveSQLException e) { throw e; } catch (Exception e) { throw new HiveSQLException(e); } }
public static GetInfoType getGetInfoType(TGetInfoType tGetInfoType) { for (GetInfoType infoType : values()) { if (tGetInfoType.equals(infoType.tInfoType)) { return infoType; } } throw new IllegalArgumentException("Unrecognized Thrift TGetInfoType value: " + tGetInfoType); }
@Override public TGetInfoResp GetInfo(TGetInfoReq req) throws TException { TGetInfoResp resp = new TGetInfoResp(); try { GetInfoValue getInfoValue = cliService.getInfo(new SessionHandle(req.getSessionHandle()), GetInfoType.getGetInfoType(req.getInfoType())); resp.setInfoValue(getInfoValue.toTGetInfoValue()); resp.setStatus(OK_STATUS); } catch (Exception e) { LOG.warn("Error getting info: ", e); resp.setStatus(HiveSQLException.toTStatus(e)); } return resp; }
@Override public GetInfoValue getInfo(GetInfoType getInfoType) throws HiveSQLException { acquire(true); try { switch (getInfoType) { case CLI_SERVER_NAME: return new GetInfoValue("Hive"); case CLI_DBMS_NAME: return new GetInfoValue("Apache Hive"); case CLI_DBMS_VER: return new GetInfoValue(HiveVersionInfo.getVersion()); case CLI_MAX_COLUMN_NAME_LEN: return new GetInfoValue(128); case CLI_MAX_SCHEMA_NAME_LEN: return new GetInfoValue(128); case CLI_MAX_TABLE_NAME_LEN: return new GetInfoValue(128); case CLI_TXN_CAPABLE: default: throw new HiveSQLException("Unrecognized GetInfoType value: " + getInfoType.toString()); } } finally { release(true); } }
public String getSQLKeywords() throws SQLException { // Note: the definitions of what ODBC and JDBC keywords exclude are different in different // places. For now, just return the ODBC version here; that excludes Hive keywords // that are also ODBC reserved keywords. We could also exclude SQL:2003. TGetInfoResp resp = getServerInfo(GetInfoType.CLI_ODBC_KEYWORDS.toTGetInfoType()); return resp.getInfoValue().getStringValue(); } public int getSQLStateType() throws SQLException {