Package org.apache.hadoop.hive.ql.exec.persistence

Examples of org.apache.hadoop.hive.ql.exec.persistence.MapJoinObjectKey


          return;
        }
         

        HashMapWrapper<MapJoinObjectKey, MapJoinObjectValue> hashTable =  mapJoinTables.get(alias);
        MapJoinObjectKey keyMap = new MapJoinObjectKey(metadataKeyTag, key);
        MapJoinObjectValue o = hashTable.get(keyMap);
        RowContainer res = null;

        boolean needNewKey = true;
        if (o == null) {
          int bucketSize = HiveConf.getIntVar(hconf, HiveConf.ConfVars.HIVEMAPJOINBUCKETCACHESIZE);
          res = new RowContainer(bucketSize);
          res.add(value);
        } else {
          res = o.getObj();
          res.add(value);
          // If key already exists, HashMapWrapper.get() guarantees it is already in main memory HashMap
          // cache. So just replacing the object value should update the HashMapWrapper. This will save
          // the cost of constructing the new key/object and deleting old one and inserting the new one.
          if ( hashTable.cacheSize() > 0) {
            o.setObj(res);
            needNewKey = false;
          }
        }
       
       
        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, valueTableDesc, hconf));
        }
       
        // Construct externalizable objects for key and value
        if ( needNewKey ) {
          MapJoinObjectKey keyObj = new MapJoinObjectKey(metadataKeyTag, key);
          MapJoinObjectValue valueObj = new MapJoinObjectValue(metadataValueTag[tag], res);
          valueObj.setConf(hconf);
         
          // This may potentially increase the size of the hashmap on the mapper
          if (res.size() > mapJoinRowsKey) {
            if ( res.size() % 100 == 0 ) {
              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);

      for (Byte pos : order) {
        if (pos.intValue() != tag) {
          MapJoinObjectKey keyMap = new MapJoinObjectKey(metadataKeyTag, key);
          MapJoinObjectValue o = (MapJoinObjectValue)mapJoinTables.get(pos).get(keyMap);

          if (o == null) {
            storage.put(pos, dummyObjVectors[pos.intValue()]);
          }
View Full Code Here


        nr[i] = (ObjectInspectorUtils.copyToStandardObject(keyFields.get(i)
            .evaluate(row), keyFieldsOI.get(i),
            ObjectInspectorCopyOption.WRITABLE));
      }
      MapJoinObjectKey key = new MapJoinObjectKey(nr);
      return key;
      }
  }
View Full Code Here

        nr[i] = (ObjectInspectorUtils.copyToStandardObject(keyFields.get(i)
            .evaluate(row), keyFieldsOI.get(i),
            ObjectInspectorCopyOption.WRITABLE));
      }
      MapJoinObjectKey key = new MapJoinObjectKey(nr);
      return key;
      }
  }
View Full Code Here

        nr[i] = (ObjectInspectorUtils.copyToStandardObject(keyFields.get(i)
            .evaluate(row), keyFieldsOI.get(i),
            ObjectInspectorCopyOption.WRITABLE));
      }
      MapJoinObjectKey key = new MapJoinObjectKey(nr);
      return key;
      }
  }
View Full Code Here

        nr[i] = (ObjectInspectorUtils.copyToStandardObject(keyFields.get(i)
            .evaluate(row), keyFieldsOI.get(i),
            ObjectInspectorCopyOption.WRITABLE));
      }
      MapJoinObjectKey key = new MapJoinObjectKey(nr);
      return key;
      }
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.ql.exec.persistence.MapJoinObjectKey

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.