Example #1
0
 // private void createQryJob(String dataNode,int batchSize) {
 private void createQryJob(int batchSize) {
   int count = 0;
   Map<String, byte[]> batchRows = new ConcurrentHashMap<String, byte[]>();
   String theId = null;
   StringBuilder sb = new StringBuilder().append('(');
   String svalue = "";
   for (Map.Entry<String, String> e : ids.entrySet()) {
     theId = e.getKey();
     batchRows.put(theId, rows.remove(theId));
     if (!svalue.equals(e.getValue())) {
       sb.append(e.getValue()).append(',');
     }
     svalue = e.getValue();
     if (count++ > batchSize) {
       break;
     }
   }
   /*
   while ((theId = ids.poll()) != null) {
   	batchRows.put(theId, rows.remove(theId));
   	sb.append(theId).append(',');
   	if (count++ > batchSize) {
   		break;
   	}
   }
   */
   if (count == 0) {
     return;
   }
   jointTableIsData = true;
   sb.deleteCharAt(sb.length() - 1).append(')');
   String sql = String.format(joinParser.getChildSQL(), sb);
   // if (!childRoute){
   getRoute(sql);
   // childRoute=true;
   // }
   ctx.executeNativeSQLParallJob(
       getDataNodes(),
       sql,
       new ShareRowOutPutDataHandler(
           this, fields, joinindex, joinParser.getJoinRkey(), batchRows));
   EngineCtx.LOGGER.info("SQLParallJob:" + getDataNode(getDataNodes()) + " sql:" + sql);
 }