Log ad hoc batch info
@param batch  planned statement batch
172257
private void logBatch(final CatalogContext context,
                          final AdHocPlannedStmtBatch batch,
                          final Object[] userParams)
    {
        final int numStmts = batch.getPlannedStatementCount();
        final int numParams = userParams == null ? 0 : userParams.length;
        final String readOnly = batch.readOnly ? "yes" : "no";
        final String singlePartition = batch.isSinglePartitionCompatible() ? "yes" : "no";
        final String user = getUsername();
        final String[] groupNames = context.authSystem.getGroupNamesForUser(user);
        final String groupList = StringUtils.join(groupNames, ',');

        //String[] stmtArray = batch.stmts.stream().map(s -> new String(s.sql, Charsets.UTF_8)).toArray(String[]::new);

        adhocLog.debug(String.format(
            "=== statements=%d parameters=%d read-only=%s single-partition=%s user=%s groups=[%s]",
            numStmts, numParams, readOnly, singlePartition, user, groupList));
        for (int i = 0; i < batch.getPlannedStatementCount(); i++) {
            AdHocPlannedStatement stmt = batch.getPlannedStatement(i);
            String sql = stmt.sql == null ? "SQL_UNKNOWN" : new String(stmt.sql, Charsets.UTF_8);
            adhocLog.debug(String.format("Statement #%d: %s", i + 1, sql));
        }
        if (userParams != null) {
            for (int i = 0; i < userParams.length; ++i) {
                Object value = userParams[i];
                final String valueString = (value != null ? value.toString() : "NULL");
                adhocLog.debug(String.format("Parameter #%d: %s", i + 1, valueString));
            }
        }
    }
1352410
public void updateBatch(V batch) {

        if (intervalCheck.check()) {
            rolling();
        }
        synchronized (this) {
            unflushed = updater.updateBatch(batch, unflushed);
        }

    }
507778
public static String batchQueryGenerator(List<String> statements) {
        StringBuilder sb = new StringBuilder("BEGIN BATCH \n");

        for (String statement : statements) {
            sb.append(statement).append("\n");
        }

        sb.append(" APPLY BATCH;");

        return sb.toString();
    }
173043
static void log(ArrayList<PrintWriter> writers, RecordTypes recordType, 
                  Keys[] keys, String[] values) {
    StringBuffer buf = new StringBuffer(recordType.name()); 
    buf.append(DELIMITER); 
    for(int i =0; i< keys.length; i++){
      buf.append(keys[i]);
      buf.append("=\"");
      values[i] = escapeString(values[i]);
      buf.append(values[i]);
      buf.append("\"");
      buf.append(DELIMITER); 
    }
    buf.append(LINE_DELIMITER_CHAR);
    
    for (PrintWriter out : writers) {
      LogTask task = new LogTask(out, buf.toString());
      fileManager.addWriteTask(task);
    }
  }
1273622
public static void printBatchTaskLog(int batchId, int taskId, Logger logger, String message) {
        logger.info("[Rebalance batch/task id " + batchId + "/" + taskId + "] " + message);
    }
499456
@Override
  public void processEvent(QueryBatch batch) {
    try {
      batch.getClient().newDocumentManager().delete( batch.getItems() );
    } catch (Throwable t) {
      for ( BatchFailureListener<Batch<String>> listener : failureListeners ) {
        try {
          listener.processFailure(batch, t);
        } catch (Throwable t2) {
          logger.error("Exception thrown by an onBatchFailure listener", t2);
        }
      }
      for ( BatchFailureListener<QueryBatch> queryBatchFailureListener : queryBatchFailureListeners ) {
        try {
          queryBatchFailureListener.processFailure(batch, t);
        } catch (Throwable t2) {
          logger.error("Exception thrown by an onFailure listener", t2);
        }
      }
    }
  }
508502
private void signalBatch() {
        writer.execute(new Runnable() {
            @Override
            public void run() {
                // Wait for other threads writing on the same journal to finish:
                while (writing.compareAndSet(false, true) == false) {
                    try {
                        Thread.sleep(SPIN_BACKOFF);
                    } catch (Exception ex) {
                    }
                }
                // TODO: Improve by employing different spinning strategies?
                WriteBatch wb = batchQueue.poll();
                try {
                    while (wb != null) {
                        if (!wb.isEmpty()) {
                            boolean newOrRotated = lastAppendDataFile != wb.getDataFile();
                            if (newOrRotated) {
                                if (lastAppendRaf != null) {
                                    lastAppendRaf.close();
                                }
                                lastAppendDataFile = wb.getDataFile();
                                lastAppendRaf = lastAppendDataFile.openRandomAccessFile();
                            }

                            // Perform batch:
                            Location batchLocation = wb.perform(lastAppendRaf, journal.isChecksum(), journal.isPhysicalSync(), journal.getReplicationTarget());

                            // Add batch location as hint:
                            journal.getHints().put(batchLocation, batchLocation.getThisFilePosition());

                            // Adjust journal length:
                            journal.addToTotalLength(wb.getSize());

                            // Now that the data is on disk, notify callbacks and remove the writes from the in-flight cache:
                            for (WriteCommand current : wb.getWrites()) {
                                try {
                                    current.getLocation().getWriteCallback().onSync(current.getLocation());
                                } catch (Throwable ex) {
                                    warn(ex, ex.getMessage());
                                }
                                journal.getInflightWrites().remove(current.getLocation());
                            }

                            // Finally signal any waiting threads that the write is on disk.
                            wb.getLatch().countDown();
                        }
                        // Poll next batch:
                        wb = batchQueue.poll();
                    }
                } catch (Exception ex) {
                    // Put back latest batch:
                    batchQueue.offer(wb);
                    // Notify error to all locations of all batches, and signal waiting threads:
                    for (WriteBatch currentBatch : batchQueue) {
                        for (WriteCommand currentWrite : currentBatch.getWrites()) {
                            try {
                                currentWrite.getLocation().getWriteCallback().onError(currentWrite.getLocation(), ex);
                            } catch (Throwable innerEx) {
                                warn(innerEx, innerEx.getMessage());
                            }
                        }
                        currentBatch.getLatch().countDown();
                    }
                    // Propagate exception:
                    asyncException.compareAndSet(null, ex);
                } finally {
                    writing.set(false);
                }
            }
        });
    }
723899
def write_batch(self, batch):
        
        for item in batch:
            for key in item:
                self.aggregated_info['occurrences'][key] += 1
            self.increment_written_items()
            if self.items_limit and self.items_limit == self.get_metadata('items_count'):
                raise ItemsLimitReached('Finishing job after items_limit reached: {} items written.'
                                        .format(self.get_metadata('items_count')))
        self.logger.debug('Wrote items')
1260658
private boolean nextBatch() throws IOException {
    recordReader.nextBatch(wrap.batch());
    int batchSize = wrap.batch().size;
    if (batchSize == 0) {
      return false;
    }
    columnarBatch.setNumRows(batchSize);

    for (int i = 0; i < requiredFields.length; i++) {
      if (requestedDataColIds[i] != -1) {
        ((OrcColumnVector) orcVectorWrappers[i]).setBatchSize(batchSize);
      }
    }
    return true;
  }
1105340
void onSealExclusive(Batch batch)
  {
    buffersToEmit.add(batch);
    wakeUpEmittingThread();
    if (!isTerminated()) {
      int nextBatchNumber = EmittedBatchCounter.nextBatchNumber(batch.batchNumber);
      if (!concurrentBatch.compareAndSet(batch, new Batch(this, acquireBuffer(), nextBatchNumber))) {
        // If compareAndSet failed, the service is closed concurrently.
        Preconditions.checkState(isTerminated());
      }
    }
  }
981885
protected void writeBatchSizeEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) {
        sb.append("\"batchSize\":");
        sb.append(execInfo.getBatchSize());
        sb.append(", ");
    }
883902
private void execute(Map<Key, List<TableOperation>> batches)
    {
        if (batches != null && !batches.isEmpty())
        {
            try
            {
                for (List<TableOperation> batch : batches.values())
                {
                    tableAPI.execute(batch, null);
                }
            }
            catch (DurabilityException e)
            {
                log.error("Error while executing operations in OracleNOSQL, Caused by:" + e + ".");
                throw new PersistenceException("Error while Persisting data using batch", e);
            }
            catch (TableOpExecutionException e)
            {
                log.error("Error while executing operations in OracleNOSQL, Caused by:" + e + ".");
                throw new PersistenceException("Error while Persisting data using batch", e);
            }
            catch (FaultException e)
            {
                log.error("Error while executing operations in OracleNOSQL, Caused by:" + e + ".");
                throw new PersistenceException("Error while Persisting data using batch", e);
            }
            finally
            {
                batches.clear();
            }
        }
    }
492434
@Override
    public void batchProcess(Map<String, List<Row>> batchData)
    {
        for (String tableName : batchData.keySet())
        {
            List<Row> actions = batchData.get(tableName);
            try
            {
                Table hTable = gethTable(tableName);
                hTable.batch(actions, new Object[actions.size()]);
            }
            catch (IOException | InterruptedException e)
            {
                logger.error("Error while batch processing on HTable: " + tableName);
                throw new PersistenceException(e);
            }

        }

    }
569789
private void doBatchEnd(final JsonObject message) {
    if (currentBatch != null) {
      Object args = deserializer.deserialize(message);
      if (log.isDebugEnabled()) {
        log.debug(String.format("%s - Batch ended: Batch[batch=%s, args=%s]", this, currentBatch.id(), args));
      }
      currentBatch.handleEnd(args);
      currentBatch = null;
    }
  }
437140
function (batch, xhr) {
                for (var i = 0, requestId; i < batch.length; i++) {
                    requestId = this._getRequestId(batch[i].method, batch[i].params);
                    this._rejectPromise(this._deferreds[requestId], xhr);
                    delete this._deferreds[requestId];
                }
            }
342446
private <T extends IEntity> IntuitMessage prepareBatch(BatchOperation batchOperation) throws FMSException {
        IntuitMessage intuitMessage = new IntuitMessage();
        RequestElements requestElements = intuitMessage.getRequestElements();

        //set the request params
        Map<String, String> requestParameters = requestElements.getRequestParameters();
        requestParameters.put(RequestElements.REQ_PARAM_METHOD_TYPE, MethodType.POST.toString());

        IntuitBatchRequest intuitBatchRequest = new IntuitBatchRequest();
        intuitBatchRequest.setBatchItemRequest(batchOperation.getBatchItemRequests());
        
        requestElements.setAction(OperationType.BATCH.toString());
        requestElements.setContext(context);
        requestElements.setObjectToSerialize(getSerializableRequestObject(intuitBatchRequest));
        requestElements.setBatchOperation(batchOperation);

        return intuitMessage;
    }
518701
public void executeBatch() throws OJBBatchUpdateException
    {
        if (batchCon != null)
        {
            try
            {
                batchCon.executeBatch();
            }
            catch (Throwable th)
            {
                throw new OJBBatchUpdateException(th);
            }
        }
    }