4646import org .apache .iotdb .db .mpp .plan .statement .metadata .template .ShowNodesInSchemaTemplateStatement ;
4747import org .apache .iotdb .db .mpp .plan .statement .metadata .template .ShowPathSetTemplateStatement ;
4848import org .apache .iotdb .db .mpp .plan .statement .metadata .template .ShowSchemaTemplateStatement ;
49- import org .apache .iotdb .rpc .RpcUtils ;
50- import org .apache .iotdb .rpc .StatementExecutionException ;
5149import org .apache .iotdb .rpc .TSStatusCode ;
5250
5351import com .google .common .util .concurrent .SettableFuture ;
@@ -154,9 +152,7 @@ public SettableFuture<ConfigTaskResult> createFunction(
154152 udfName , className , uris , e .getMessage ());
155153 LOGGER .error (message , e );
156154 future .setException (
157- new StatementExecutionException (
158- new TSStatus (TSStatusCode .EXECUTE_STATEMENT_ERROR .getStatusCode ())
159- .setMessage (message )));
155+ new IoTDBException (message , TSStatusCode .EXECUTE_STATEMENT_ERROR .getStatusCode ()));
160156 }
161157 return future ;
162158 }
@@ -202,9 +198,7 @@ public SettableFuture<ConfigTaskResult> dropFunction(String udfName) {
202198 String .format ("Failed to drop function %s, because %s." , udfName , e .getMessage ());
203199 LOGGER .error (message , e );
204200 future .setException (
205- new StatementExecutionException (
206- new TSStatus (TSStatusCode .EXECUTE_STATEMENT_ERROR .getStatusCode ())
207- .setMessage (message )));
201+ new IoTDBException (message , TSStatusCode .EXECUTE_STATEMENT_ERROR .getStatusCode ()));
208202 }
209203 return future ;
210204 }
@@ -229,7 +223,7 @@ public SettableFuture<ConfigTaskResult> merge(boolean isCluster) {
229223 if (tsStatus .getCode () == TSStatusCode .SUCCESS_STATUS .getStatusCode ()) {
230224 future .set (new ConfigTaskResult (TSStatusCode .SUCCESS_STATUS ));
231225 } else {
232- future .setException (new StatementExecutionException (tsStatus ));
226+ future .setException (new IoTDBException (tsStatus . message , tsStatus . code ));
233227 }
234228 return future ;
235229 }
@@ -241,7 +235,7 @@ public SettableFuture<ConfigTaskResult> flush(TFlushReq tFlushReq, boolean isClu
241235 if (tsStatus .getCode () == TSStatusCode .SUCCESS_STATUS .getStatusCode ()) {
242236 future .set (new ConfigTaskResult (TSStatusCode .SUCCESS_STATUS ));
243237 } else {
244- future .setException (new StatementExecutionException (tsStatus ));
238+ future .setException (new IoTDBException (tsStatus . message , tsStatus . code ));
245239 }
246240 return future ;
247241 }
@@ -253,7 +247,7 @@ public SettableFuture<ConfigTaskResult> clearCache(boolean isCluster) {
253247 if (tsStatus .getCode () == TSStatusCode .SUCCESS_STATUS .getStatusCode ()) {
254248 future .set (new ConfigTaskResult (TSStatusCode .SUCCESS_STATUS ));
255249 } else {
256- future .setException (new StatementExecutionException (tsStatus ));
250+ future .setException (new IoTDBException (tsStatus . message , tsStatus . code ));
257251 }
258252 return future ;
259253 }
@@ -262,10 +256,9 @@ public SettableFuture<ConfigTaskResult> clearCache(boolean isCluster) {
262256 public SettableFuture <ConfigTaskResult > showCluster () {
263257 SettableFuture <ConfigTaskResult > future = SettableFuture .create ();
264258 future .setException (
265- new StatementExecutionException (
266- RpcUtils .getStatus (
267- TSStatusCode .EXECUTE_STATEMENT_ERROR ,
268- "Executing show cluster in standalone mode is not supported" )));
259+ new IoTDBException (
260+ "Executing show cluster in standalone mode is not supported" ,
261+ TSStatusCode .EXECUTE_STATEMENT_ERROR .getStatusCode ()));
269262 return future ;
270263 }
271264
@@ -308,10 +301,9 @@ public SettableFuture<ConfigTaskResult> showTTL(ShowTTLStatement showTTLStatemen
308301 public SettableFuture <ConfigTaskResult > showRegion (ShowRegionStatement showRegionStatement ) {
309302 SettableFuture <ConfigTaskResult > future = SettableFuture .create ();
310303 future .setException (
311- new StatementExecutionException (
312- RpcUtils .getStatus (
313- TSStatusCode .EXECUTE_STATEMENT_ERROR ,
314- "Executing show regions in standalone mode is not supported" )));
304+ new IoTDBException (
305+ "Executing show regions in standalone mode is not supported" ,
306+ TSStatusCode .EXECUTE_STATEMENT_ERROR .getStatusCode ()));
315307 return future ;
316308 }
317309
@@ -320,21 +312,19 @@ public SettableFuture<ConfigTaskResult> showDataNodes(
320312 ShowDataNodesStatement showDataNodesStatement ) {
321313 SettableFuture <ConfigTaskResult > future = SettableFuture .create ();
322314 future .setException (
323- new StatementExecutionException (
324- RpcUtils .getStatus (
325- TSStatusCode .EXECUTE_STATEMENT_ERROR ,
326- "Executing show datanodes in standalone mode is not supported" )));
315+ new IoTDBException (
316+ "Executing show datanodes in standalone mode is not supported" ,
317+ TSStatusCode .EXECUTE_STATEMENT_ERROR .getStatusCode ()));
327318 return future ;
328319 }
329320
330321 @ Override
331322 public SettableFuture <ConfigTaskResult > showConfigNodes () {
332323 SettableFuture <ConfigTaskResult > future = SettableFuture .create ();
333324 future .setException (
334- new StatementExecutionException (
335- RpcUtils .getStatus (
336- TSStatusCode .EXECUTE_STATEMENT_ERROR ,
337- "Executing show confignodes in standalone mode is not supported" )));
325+ new IoTDBException (
326+ "Executing show confignodes in standalone mode is not supported" ,
327+ TSStatusCode .EXECUTE_STATEMENT_ERROR .getStatusCode ()));
338328 return future ;
339329 }
340330
@@ -343,10 +333,9 @@ public SettableFuture<ConfigTaskResult> createSchemaTemplate(
343333 CreateSchemaTemplateStatement createSchemaTemplateStatement ) {
344334 SettableFuture <ConfigTaskResult > future = SettableFuture .create ();
345335 future .setException (
346- new StatementExecutionException (
347- RpcUtils .getStatus (
348- TSStatusCode .EXECUTE_STATEMENT_ERROR ,
349- "Executing create schema template is not supported" )));
336+ new IoTDBException (
337+ "Executing create schema template is not supported" ,
338+ TSStatusCode .EXECUTE_STATEMENT_ERROR .getStatusCode ()));
350339 return future ;
351340 }
352341
@@ -355,10 +344,9 @@ public SettableFuture<ConfigTaskResult> showSchemaTemplate(
355344 ShowSchemaTemplateStatement showSchemaTemplateStatement ) {
356345 SettableFuture <ConfigTaskResult > future = SettableFuture .create ();
357346 future .setException (
358- new StatementExecutionException (
359- RpcUtils .getStatus (
360- TSStatusCode .EXECUTE_STATEMENT_ERROR ,
361- "Executing show schema template is not supported" )));
347+ new IoTDBException (
348+ "Executing show schema template is not supported" ,
349+ TSStatusCode .EXECUTE_STATEMENT_ERROR .getStatusCode ()));
362350 return future ;
363351 }
364352
@@ -367,10 +355,9 @@ public SettableFuture<ConfigTaskResult> showNodesInSchemaTemplate(
367355 ShowNodesInSchemaTemplateStatement showNodesInSchemaTemplateStatement ) {
368356 SettableFuture <ConfigTaskResult > future = SettableFuture .create ();
369357 future .setException (
370- new StatementExecutionException (
371- RpcUtils .getStatus (
372- TSStatusCode .EXECUTE_STATEMENT_ERROR ,
373- "Executing show nodes in schema template is not supported" )));
358+ new IoTDBException (
359+ "Executing show nodes in schema template is not supported" ,
360+ TSStatusCode .EXECUTE_STATEMENT_ERROR .getStatusCode ()));
374361 return future ;
375362 }
376363
@@ -379,10 +366,9 @@ public SettableFuture<ConfigTaskResult> setSchemaTemplate(
379366 SetSchemaTemplateStatement setSchemaTemplateStatement ) {
380367 SettableFuture <ConfigTaskResult > future = SettableFuture .create ();
381368 future .setException (
382- new StatementExecutionException (
383- RpcUtils .getStatus (
384- TSStatusCode .EXECUTE_STATEMENT_ERROR ,
385- "Executing set schema template is not supported" )));
369+ new IoTDBException (
370+ "Executing set schema template is not supported" ,
371+ TSStatusCode .EXECUTE_STATEMENT_ERROR .getStatusCode ()));
386372 return future ;
387373 }
388374
@@ -391,10 +377,9 @@ public SettableFuture<ConfigTaskResult> showPathSetTemplate(
391377 ShowPathSetTemplateStatement showPathSetTemplateStatement ) {
392378 SettableFuture <ConfigTaskResult > future = SettableFuture .create ();
393379 future .setException (
394- new StatementExecutionException (
395- RpcUtils .getStatus (
396- TSStatusCode .EXECUTE_STATEMENT_ERROR ,
397- "Executing show path set template is not supported" )));
380+ new IoTDBException (
381+ "Executing show path set template is not supported" ,
382+ TSStatusCode .EXECUTE_STATEMENT_ERROR .getStatusCode ()));
398383 return future ;
399384 }
400385}
0 commit comments