@@ -429,9 +429,10 @@ public YdbPreparedQuery findOrPrepareParams(YdbQuery query, YdbPrepareMode mode)
429429 }
430430
431431 QueryType type = query .getType ();
432+ YqlBatcher batcher = query .getYqlBatcher ();
432433
433434 if (type == QueryType .BULK_QUERY ) {
434- if (query . getYqlBatcher () == null || query . getYqlBatcher () .getCommand () != YqlBatcher .Cmd .UPSERT ) {
435+ if (batcher == null || batcher .getCommand () != YqlBatcher .Cmd .UPSERT ) {
435436 throw new SQLException (YdbConst .BULKS_UNSUPPORTED );
436437 }
437438 }
@@ -441,8 +442,8 @@ public YdbPreparedQuery findOrPrepareParams(YdbQuery query, YdbPrepareMode mode)
441442 return new InMemoryQuery (query , queryOptions .isDeclareJdbcParameters ());
442443 }
443444
444- if (query . getYqlBatcher () != null && (mode == YdbPrepareMode .AUTO || type == QueryType .BULK_QUERY )) {
445- String tablePath = joined (getPrefixPath (), query . getYqlBatcher () .getTableName ());
445+ if (batcher != null && (mode == YdbPrepareMode .AUTO || type == QueryType .BULK_QUERY )) {
446+ String tablePath = joined (getPrefixPath (), batcher .getTableName ());
446447 TableDescription description = tableDescribeCache .getIfPresent (tablePath );
447448 if (description == null ) {
448449 YdbTracer tracer = getTracer ();
@@ -469,7 +470,7 @@ public YdbPreparedQuery findOrPrepareParams(YdbQuery query, YdbPrepareMode mode)
469470 if (query .getReturning () != null ) {
470471 throw new SQLException (YdbConst .BULK_NOT_SUPPORT_RETURNING );
471472 }
472- return BulkUpsertQuery .build (types , tablePath , query . getYqlBatcher () .getColumns (), description );
473+ return BulkUpsertQuery .build (types , tablePath , batcher .getColumns (), description );
473474 }
474475
475476 if (description != null ) {
0 commit comments