Examples of HTree


Examples of jdbm.htree.HTree

   *
   * @param handle
   * @return
   */
  private HTree getHashtableForHandle(String handle) {
    HTree hashtable = metrics.get(handle);
    if (null == hashtable) {
      try {
        long recid = recman.getNamedObject(handle);
        if (recid != 0) {
          hashtable = HTree.load(recman, recid);
        } else {
          hashtable = HTree.createInstance(recman);
          recman.setNamedObject(handle, hashtable.getRecid());
        }
        metrics.put(handle, hashtable);
      } catch (Throwable e) {
        logger.log(Level.SEVERE, "Counld not get cached value for "
            + handle, e);
View Full Code Here

Examples of jdbm.htree.HTree

  void setStat( Stat update ) throws IOException {
    db.update( stat, update );
  }

  HTree getData() throws IOException {
    HTree tree;
    long recid = db.getNamedObject( DATA_TREE );
    if ( recid != 0 ) {
      tree = HTree.load( db, recid );
    } else {
      tree = HTree.createInstance( db );
      db.setNamedObject( DATA_TREE, tree.getRecid() );
    }
    return tree;
  }
View Full Code Here

Examples of jdbm.htree.HTree

    test this issue
    http://code.google.com/p/jdbm2/issues/detail?id=2
     */
    public void testHTreeClear() throws IOException {
        final RecordManager recman = newRecordManager();
        final HTree tree = HTree.createInstance(recman);
        recman.setNamedObject("test", tree.getRecid());
        final HTreeMap<String,String> treeMap = tree.asMap();

        for (int i = 0; i < 1001; i++) {
            treeMap.put(String.valueOf(i),String.valueOf(i));
        }
        recman.commit();
View Full Code Here

Examples of org.apache.hadoop.hive.ql.util.jdbm.htree.HTree

          }
          newDir = new File("/tmp" + rand.nextInt());
        }
       
        RecordManager recman = RecordManagerFactory.createRecordManager(newDirName + "/" + pos, props );
        HTree hashTable = HTree.createInstance(recman);
       
        mapJoinTables.put(Byte.valueOf((byte)pos), hashTable);
      }

      storage.put((byte)posBigTable, new ArrayList<ArrayList<Object>>());
View Full Code Here

Examples of org.apache.hadoop.hive.ql.util.jdbm.htree.HTree

        // Send some status perodically
        numMapRowsRead++;
        if (((numMapRowsRead % heartbeatInterval) == 0) && (reporter != null))
          reporter.progress();

        HTree hashTable = mapJoinTables.get(alias);
        MapJoinObjectKey keyMap = new MapJoinObjectKey(metadataKeyTag, key);
        MapJoinObjectValue o = (MapJoinObjectValue)hashTable.get(keyMap);
        ArrayList<ArrayList<Object>> res = null;
       
        if (o == null) {
          res = new ArrayList<ArrayList<Object>>();
        }
        else {
          res = o.getObj();
        }
       
        res.add(value);
 
        if (metadataValueTag[tag] == -1) {
          metadataValueTag[tag] = nextVal++;
                   
          tableDesc valueTableDesc = conf.getValueTblDescs().get(tag);
          SerDe valueSerDe = (SerDe)ReflectionUtils.newInstance(valueTableDesc.getDeserializerClass(), null);
          valueSerDe.initialize(null, valueTableDesc.getProperties());
          mapMetadata.put(Integer.valueOf(metadataValueTag[tag]),
              new MapJoinObjectCtx(
                  ObjectInspectorUtils.getStandardObjectInspector(valueSerDe.getObjectInspector(),
                      ObjectInspectorCopyOption.WRITABLE),
              valueSerDe));
        }
       
        // Construct externalizable objects for key and value
        MapJoinObjectKey keyObj = new MapJoinObjectKey(metadataKeyTag, key);
        MapJoinObjectValue valueObj = new MapJoinObjectValue(metadataValueTag[tag], res);

        if (res.size() > 1)
          hashTable.remove(keyObj);

        // This may potentially increase the size of the hashmap on the mapper
        if (res.size() > mapJoinRowsKey) {
          LOG.warn("Number of values for a given key " + keyObj + " are " + res.size());
          LOG.warn("used memory " + Runtime.getRuntime().totalMemory());
        }
       
        hashTable.put(keyObj, valueObj);
        return;
      }

      // Add the value to the ArrayList
      storage.get(alias).add(value);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.