You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by GitBox <gi...@apache.org> on 2022/12/13 04:16:47 UTC
[GitHub] [incubator-kyuubi] cfmcgrady commented on a diff in pull request #3916: [KYUUBI #3915] Client support detecting ResultSet codec
cfmcgrady commented on code in PR #3916:
URL: https://github.com/apache/incubator-kyuubi/pull/3916#discussion_r1046643728
##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiStatement.java:
##########
@@ -743,4 +763,57 @@ public String getQueryId() throws SQLException {
public void setInPlaceUpdateStream(InPlaceUpdateStream stream) {
this.inPlaceUpdateStream = stream;
}
+
+ private TGetResultSetMetadataResp getResultSetMetadata() throws SQLException {
+ try {
+ TGetResultSetMetadataReq metadataReq = new TGetResultSetMetadataReq(stmtHandle);
+ // TODO need session handle
+ TGetResultSetMetadataResp metadataResp;
+ metadataResp = client.GetResultSetMetadata(metadataReq);
+ Utils.verifySuccess(metadataResp.getStatus());
+ return metadataResp;
+ } catch (SQLException eS) {
+ throw eS; // rethrow the SQLException as is
+ } catch (Exception ex) {
+ throw new KyuubiSQLException("Could not create ResultSet: " + ex.getMessage(), ex);
+ }
+ }
+
+ private void parseMetadata(
+ TGetResultSetMetadataResp metadataResp,
+ List<String> columnNames,
+ List<TTypeId> columnTypes,
+ List<JdbcColumnAttributes> columnAttributes)
+ throws KyuubiSQLException {
+ TTableSchema schema = metadataResp.getSchema();
+ if (schema == null || !schema.isSetColumns()) {
+ throw new KyuubiSQLException("the result set schema is null");
+ }
+
+ // parse kyuubi hint
+ List<String> infoMessages = metadataResp.getStatus().getInfoMessages();
+ if (infoMessages != null) {
+ metadataResp
+ .getStatus()
+ .getInfoMessages()
+ .forEach(
+ line -> {
+ String[] keyValue = line.split("=");
+ String key = keyValue[0];
+ String value = keyValue[1];
Review Comment:
Log a warning message if the input does not contain "="
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org