@@ -111,9 +111,6 @@ func (c *conn) ExecContext(ctx context.Context, query string, args []driver.Name
111111 }
112112 }
113113 if err != nil {
114- // TODO: are there error situations in which the operation still needs to be closed?
115- // Currently if there is an error we never get back a TExecuteStatementResponse so
116- // can't try to close.
117114 log .Err (err ).Msgf ("databricks: failed to execute query: query %s" , query )
118115 return nil , wrapErrf (err , "failed to execute query" )
119116 }
@@ -147,7 +144,6 @@ func (c *conn) QueryContext(ctx context.Context, query string, args []driver.Nam
147144 defer log .Duration (msg , start )
148145
149146 if err != nil {
150- // gotta also think about close operation here
151147 log .Err (err ).Msgf ("databricks: failed to run query: query %s" , query )
152148 return nil , wrapErrf (err , "failed to run query" )
153149 }
@@ -169,7 +165,6 @@ func (c *conn) runQuery(ctx context.Context, query string, args []driver.NamedVa
169165 if err != nil {
170166 return exStmtResp , nil , err
171167 }
172- // hold on to the operation handle
173168 opHandle := exStmtResp .OperationHandle
174169 if opHandle != nil && opHandle .OperationId != nil {
175170 log = logger .WithContext (
@@ -185,14 +180,12 @@ func (c *conn) runQuery(ctx context.Context, query string, args []driver.NamedVa
185180 // terminal states
186181 // good
187182 case cli_service .TOperationState_FINISHED_STATE :
188- // return results
189183 return exStmtResp , opStatus , nil
190184 // bad
191185 case cli_service .TOperationState_CANCELED_STATE ,
192186 cli_service .TOperationState_CLOSED_STATE ,
193187 cli_service .TOperationState_ERROR_STATE ,
194188 cli_service .TOperationState_TIMEDOUT_STATE :
195- // do we need to close the operation in these cases?
196189 logBadQueryState (log , opStatus )
197190 return exStmtResp , opStatus , errors .New (opStatus .GetDisplayMessage ())
198191 // live states
@@ -207,7 +200,6 @@ func (c *conn) runQuery(ctx context.Context, query string, args []driver.NamedVa
207200 // terminal states
208201 // good
209202 case cli_service .TOperationState_FINISHED_STATE :
210- // return handle to fetch results later
211203 return exStmtResp , statusResp , nil
212204 // bad
213205 case cli_service .TOperationState_CANCELED_STATE ,
@@ -236,7 +228,6 @@ func (c *conn) runQuery(ctx context.Context, query string, args []driver.NamedVa
236228 // terminal states
237229 // good
238230 case cli_service .TOperationState_FINISHED_STATE :
239- // return handle to fetch results later
240231 return exStmtResp , statusResp , nil
241232 // bad
242233 case cli_service .TOperationState_CANCELED_STATE ,
@@ -267,13 +258,9 @@ func (c *conn) executeStatement(ctx context.Context, query string, args []driver
267258 Statement : query ,
268259 RunAsync : c .cfg .RunAsync ,
269260 QueryTimeout : int64 (c .cfg .QueryTimeout / time .Second ),
270- // this is specific for databricks. It shortcuts server round trips
271261 GetDirectResults : & cli_service.TSparkGetDirectResults {
272262 MaxRows : int64 (c .cfg .MaxRows ),
273263 },
274- // CanReadArrowResult_: &t,
275- // CanDecompressLZ4Result_: &f,
276- // CanDownloadResult_: &t,
277264 }
278265
279266 ctx = driverctx .NewContextWithConnId (ctx , c .id )
@@ -333,7 +320,6 @@ func (c *conn) pollOperation(ctx context.Context, opHandle *cli_service.TOperati
333320 log .Debug ().Msgf ("databricks: status %s" , statusResp .GetOperationState ().String ())
334321 }
335322 return func () bool {
336- // which other states?
337323 if err != nil {
338324 return true
339325 }
0 commit comments