Package com.yahoo.ycsb

Examples of com.yahoo.ycsb.StringByteIterator


        return 1;
      }
      if (result != null && fields != null) {
        for (String field : fields) {
          String value = resultSet.getString(field);
          result.put(field, new StringByteIterator(value));
        }
      }
      resultSet.close();
      return SUCCESS;
    } catch (SQLException e) {
View Full Code Here


      for (int i = 0; i < recordcount && resultSet.next(); i++) {
        if (result != null && fields != null) {
          HashMap<String, ByteIterator> values = new HashMap<String, ByteIterator>();
          for (String field : fields) {
            String value = resultSet.getString(field);
            values.put(field, new StringByteIterator(value));
          }
          result.add(values);
        }
      }
      resultSet.close();
View Full Code Here

         if (row != null) {
            result.clear();
            if (fields == null || fields.isEmpty()) {
    StringByteIterator.putAllAsByteIterators(result, row);
            } else {
         for (String field : fields) result.put(field, new StringByteIterator(row.get(field)));
            }
         }
         return OK;
      } catch (Exception e) {
         return ERROR;
View Full Code Here

        if(tok.length == 0) { throw new IllegalStateException("split returned empty array!"); }
        for(int i = 0; i < tok.length; i+=2) {
            if(fields == null || fields.contains(tok[i])) {
                if(tok.length < i+2) { throw new IllegalStateException("Couldn't parse tuple <" + tups + "> at index " + i); }
                if(tok[i] == null || tok[i+1] == null) throw new NullPointerException("Key is " + tok[i] + " val is + " + tok[i+1]);
                tup.put(tok[i], new StringByteIterator(tok[i+1]));
            }
        }
        if(tok.length == 0) {
            System.err.println("Empty tuple: " + tups);
        }
View Full Code Here

                for(Record r : res.records) {
                    HashMap<String, ByteIterator> tuple = new HashMap<String, ByteIterator>();
                    // Note: r.getKey() and r.getValue() call special helper methods that trim the buffer
                    // to an appropriate length, and memcpy it to a byte[].  Trying to manipulate the ByteBuffer
                    // directly leads to trouble.
                    tuple.put("key", new StringByteIterator(new String(r.getKey())));
                    decode(fields, new String(r.getValue())/*strBuf(r.bufferForValue())*/, tuple);
                    result.add(tuple);
                }
            }
            return ret;
View Full Code Here

   
    if ( fields != null ) {
      for (String field : fields) {
        String val = versionedValue.getValue().get(field);
        if ( val != null )
            result.put(field, new StringByteIterator(val));
      }
    } else {
      StringByteIterator.putAllAsByteIterators(result, versionedValue.getValue());
    }
    return OK;
View Full Code Here

                    .actionGet();

            if (response.isExists()) {
                if (fields != null) {
                    for (String field : fields) {
                        result.put(field, new StringByteIterator((String) response.getSource().get(field)));
                    }
                } else {
                    for (String field : response.getSource().keySet()) {
                        result.put(field, new StringByteIterator((String) response.getSource().get(field)));
                    }
                }
                return 0;
            }
        } catch (Exception e) {
View Full Code Here

            for (SearchHit hit : response.getHits()) {
                entry = new HashMap<String, ByteIterator>(fields.size());

                for (String field : fields) {
                    entry.put(field, new StringByteIterator((String) hit.getSource().get(field)));
                }

                result.add(entry);
            }
View Full Code Here

            return null;
        HashMap<String, ByteIterator> rItems = new HashMap<String, ByteIterator>(item.size());

        for (Entry<String, AttributeValue> attr : item.entrySet()) {
            logger.debug(String.format("Result- key: %s, value: %s", attr.getKey(), attr.getValue()) );
            rItems.put(attr.getKey(), new StringByteIterator(attr.getValue().getS()));
        }
        return rItems;
    }
View Full Code Here

            Iterator<String> fieldIterator = fields.iterator();
            Iterator<String> valueIterator = values.iterator();

            while (fieldIterator.hasNext() && valueIterator.hasNext()) {
                result.put(fieldIterator.next(),
         new StringByteIterator(valueIterator.next()));
            }
            assert !fieldIterator.hasNext() && !valueIterator.hasNext();
        }
        return result.isEmpty() ? 1 : 0;
    }
View Full Code Here

TOP

Related Classes of com.yahoo.ycsb.StringByteIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.