Пример #1
0
 /**
  * Close all temporary result set. This also deletes all temporary files held by the result sets.
  */
 public void closeTemporaryResults() {
   if (temporaryResults != null) {
     for (ResultInterface result : temporaryResults) {
       result.close();
     }
     temporaryResults = null;
   }
 }
Пример #2
0
 /**
  * Remember the result set and close it as soon as the transaction is committed (if it needs to be
  * closed). This is done to delete temporary files as soon as possible, and free object ids of
  * temporary tables.
  *
  * @param result the temporary result set
  */
 public void addTemporaryResult(ResultInterface result) {
   if (!result.needToClose()) {
     return;
   }
   if (temporaryResults == null) {
     temporaryResults = New.hashSet();
   }
   if (temporaryResults.size() < 100) {
     // reference at most 100 result sets to avoid memory problems
     temporaryResults.add(result);
   }
 }
Пример #3
0
 private static SimpleResultSet getSimpleResultSet(ResultInterface rs, int maxrows) {
   int columnCount = rs.getVisibleColumnCount();
   SimpleResultSet simple = new SimpleResultSet();
   for (int i = 0; i < columnCount; i++) {
     String name = rs.getColumnName(i);
     int sqlType = DataType.convertTypeToSQLType(rs.getColumnType(i));
     int precision = MathUtils.convertLongToInt(rs.getColumnPrecision(i));
     int scale = rs.getColumnScale(i);
     simple.addColumn(name, sqlType, precision, scale);
   }
   rs.reset();
   for (int i = 0; i < maxrows && rs.next(); i++) {
     Object[] list = new Object[columnCount];
     for (int j = 0; j < columnCount; j++) {
       list[j] = rs.currentRow()[j].getObject();
     }
     simple.addRow(list);
   }
   return simple;
 }
Пример #4
0
 @Override
 public boolean next() {
   return subqueryResult.next();
 }
Пример #5
0
 @Override
 public Row get() {
   return new HBaseRow(subqueryResult.currentRow(), Row.MEMORY_CALCULATE);
 }