@@ -117,9 +117,6 @@ func (c *conn) ExecContext(ctx context.Context, query string, args []driver.Name
117117 }
118118 }
119119 if err != nil {
120- // TODO: are there error situations in which the operation still needs to be closed?
121- // Currently if there is an error we never get back a TExecuteStatementResponse so
122- // can't try to close.
123120 log .Err (err ).Msgf ("databricks: failed to execute query: query %s" , query )
124121 return nil , wrapErrf (err , "failed to execute query" )
125122 }
@@ -153,7 +150,6 @@ func (c *conn) QueryContext(ctx context.Context, query string, args []driver.Nam
153150 defer log .Duration (msg , start )
154151
155152 if err != nil {
156- // gotta also think about close operation here
157153 log .Err (err ).Msgf ("databricks: failed to run query: query %s" , query )
158154 return nil , wrapErrf (err , "failed to run query" )
159155 }
@@ -175,7 +171,6 @@ func (c *conn) runQuery(ctx context.Context, query string, args []driver.NamedVa
175171 if err != nil {
176172 return exStmtResp , nil , err
177173 }
178- // hold on to the operation handle
179174 opHandle := exStmtResp .OperationHandle
180175 if opHandle != nil && opHandle .OperationId != nil {
181176 log = logger .WithContext (
@@ -191,14 +186,12 @@ func (c *conn) runQuery(ctx context.Context, query string, args []driver.NamedVa
191186 // terminal states
192187 // good
193188 case cli_service .TOperationState_FINISHED_STATE :
194- // return results
195189 return exStmtResp , opStatus , nil
196190 // bad
197191 case cli_service .TOperationState_CANCELED_STATE ,
198192 cli_service .TOperationState_CLOSED_STATE ,
199193 cli_service .TOperationState_ERROR_STATE ,
200194 cli_service .TOperationState_TIMEDOUT_STATE :
201- // do we need to close the operation in these cases?
202195 logBadQueryState (log , opStatus )
203196 return exStmtResp , opStatus , errors .New (opStatus .GetDisplayMessage ())
204197 // live states
@@ -213,7 +206,6 @@ func (c *conn) runQuery(ctx context.Context, query string, args []driver.NamedVa
213206 // terminal states
214207 // good
215208 case cli_service .TOperationState_FINISHED_STATE :
216- // return handle to fetch results later
217209 return exStmtResp , statusResp , nil
218210 // bad
219211 case cli_service .TOperationState_CANCELED_STATE ,
@@ -242,7 +234,6 @@ func (c *conn) runQuery(ctx context.Context, query string, args []driver.NamedVa
242234 // terminal states
243235 // good
244236 case cli_service .TOperationState_FINISHED_STATE :
245- // return handle to fetch results later
246237 return exStmtResp , statusResp , nil
247238 // bad
248239 case cli_service .TOperationState_CANCELED_STATE ,
@@ -273,13 +264,9 @@ func (c *conn) executeStatement(ctx context.Context, query string, args []driver
273264 Statement : query ,
274265 RunAsync : c .cfg .RunAsync ,
275266 QueryTimeout : int64 (c .cfg .QueryTimeout / time .Second ),
276- // this is specific for databricks. It shortcuts server round trips
277267 GetDirectResults : & cli_service.TSparkGetDirectResults {
278268 MaxRows : int64 (c .cfg .MaxRows ),
279269 },
280- // CanReadArrowResult_: &t,
281- // CanDecompressLZ4Result_: &f,
282- // CanDownloadResult_: &t,
283270 }
284271
285272 ctx = driverctx .NewContextWithConnId (ctx , c .id )
@@ -339,7 +326,6 @@ func (c *conn) pollOperation(ctx context.Context, opHandle *cli_service.TOperati
339326 log .Debug ().Msgf ("databricks: status %s" , statusResp .GetOperationState ().String ())
340327 }
341328 return func () bool {
342- // which other states?
343329 if err != nil {
344330 return true
345331 }
0 commit comments