birschick-bq commented on code in PR #2312:
URL: https://github.com/apache/arrow-adbc/pull/2312#discussion_r1868291492
##########
csharp/src/Drivers/Apache/Spark/SparkConnection.cs:
##########
@@ -420,26 +419,42 @@ public override IArrowArrayStream GetTableTypes()
SessionHandle = SessionHandle ?? throw new
InvalidOperationException("session not created"),
GetDirectResults = sparkGetDirectResults
};
- TGetTableTypesResp resp = Client.GetTableTypes(req).Result;
- if (resp.Status.StatusCode == TStatusCode.ERROR_STATUS)
+
+ CancellationToken cancellationToken =
ApacheUtility.GetCancellationToken(QueryTimeoutSeconds,
ApacheUtility.TimeUnit.Seconds);
+ try
{
- throw new HiveServer2Exception(resp.Status.ErrorMessage)
- .SetNativeError(resp.Status.ErrorCode)
- .SetSqlState(resp.Status.SqlState);
- }
+ TGetTableTypesResp resp = Client.GetTableTypes(req,
cancellationToken).Result;
- TRowSet rowSet = GetRowSetAsync(resp).Result;
- StringArray tableTypes = rowSet.Columns[0].StringVal.Values;
+ if (resp.Status.StatusCode == TStatusCode.ERROR_STATUS)
+ {
+ throw new HiveServer2Exception(resp.Status.ErrorMessage)
+ .SetNativeError(resp.Status.ErrorCode)
+ .SetSqlState(resp.Status.SqlState);
+ }
- StringArray.Builder tableTypesBuilder = new StringArray.Builder();
- tableTypesBuilder.AppendRange(tableTypes);
+ TRowSet rowSet = GetRowSetAsync(resp,
cancellationToken).Result;
+ StringArray tableTypes = rowSet.Columns[0].StringVal.Values;
- IArrowArray[] dataArrays = new IArrowArray[]
- {
+ StringArray.Builder tableTypesBuilder = new
StringArray.Builder();
+ tableTypesBuilder.AppendRange(tableTypes);
+
+ IArrowArray[] dataArrays = new IArrowArray[]
+ {
tableTypesBuilder.Build()
- };
+ };
- return new SparkInfoArrowStream(StandardSchemas.TableTypesSchema,
dataArrays);
+ return new
SparkInfoArrowStream(StandardSchemas.TableTypesSchema, dataArrays);
+ }
+ catch (Exception ex)
+ when (ApacheUtility.ContainsException(ex, out
OperationCanceledException? _) ||
+ (ApacheUtility.ContainsException(ex, out
TTransportException? _) && cancellationToken.IsCancellationRequested))
+ {
+ throw new TimeoutException("The metadata query execution timed
out. Consider increasing the query timeout value.", ex);
+ }
+ catch (Exception ex) when (ex is not HiveServer2Exception)
+ {
+ throw new HiveServer2Exception($"An unexpected error occurred
while running metadata query. '{ex.Message}'", ex);
+ }
Review Comment:
So, actually, this one is in a metadata call. I believe I've corrected the
context for non-metadata calls. Thanks for find those.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]