[ https://issues.apache.org/jira/browse/HIVE-25149?focusedWorklogId=601240&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-601240 ]
ASF GitHub Bot logged work on HIVE-25149: ----------------------------------------- Author: ASF GitHub Bot Created on: 24/May/21 15:45 Start Date: 24/May/21 15:45 Worklog Time Spent: 10m Work Description: pgaref commented on a change in pull request #2305: URL: https://github.com/apache/hive/pull/2305#discussion_r638064998 ########## File path: ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastStringHashSetContainer.java ########## @@ -0,0 +1,142 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.hive.ql.exec.vector.mapjoin.fast; + +import java.io.IOException; + +import org.apache.hadoop.hive.ql.exec.JoinUtil; +import org.apache.hadoop.hive.ql.exec.persistence.MatchTracker; +import org.apache.hadoop.hive.ql.exec.vector.mapjoin.hashtable.VectorMapJoinBytesHashSet; +import org.apache.hadoop.hive.ql.exec.vector.mapjoin.hashtable.VectorMapJoinHashSetResult; +import org.apache.hadoop.hive.ql.exec.vector.mapjoin.hashtable.VectorMapJoinNonMatchedIterator; +import org.apache.hadoop.hive.ql.metadata.HiveException; +import org.apache.hadoop.hive.ql.plan.TableDesc; +import org.apache.hadoop.hive.serde2.binarysortable.fast.BinarySortableDeserializeRead; +import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo; +import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory; +import org.apache.hadoop.io.BytesWritable; +import org.apache.hive.common.util.HashCodeUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/* + * An single STRING key hash set optimized for vector map join. + * + * The key will be deserialized and just the bytes will be stored. + */ +public class VectorMapJoinFastStringHashSetContainer extends VectorMapJoinFastHashTableContainerBase implements + VectorMapJoinBytesHashSet { + + private static final Logger LOG = LoggerFactory.getLogger(VectorMapJoinFastStringHashSetContainer.class); + + private final VectorMapJoinFastStringHashSet[] vectorMapJoinFastStringHashSets; + private final BinarySortableDeserializeRead keyBinarySortableDeserializeRead; + private final int numThreads; + + public VectorMapJoinFastStringHashSetContainer( + boolean isFullOuter, + int initialCapacity, float loadFactor, int writeBuffersSize, long estimatedKeyCount, TableDesc tableDesc, + int numThreads) { + this.vectorMapJoinFastStringHashSets = new VectorMapJoinFastStringHashSet[numThreads]; + for (int i=0; i<numThreads; ++i) { + LOG.info("HT Container {} ", i); + vectorMapJoinFastStringHashSets[i] = new VectorMapJoinFastStringHashSet( + isFullOuter, + initialCapacity, loadFactor, writeBuffersSize, estimatedKeyCount, tableDesc); + } + PrimitiveTypeInfo[] primitiveTypeInfos = { TypeInfoFactory.stringTypeInfo }; + this.keyBinarySortableDeserializeRead = + BinarySortableDeserializeRead.with(primitiveTypeInfos, false, tableDesc.getProperties()); + this.numThreads = numThreads; + } + + @Override + public void putRow(long hashCode, BytesWritable currentKey, BytesWritable currentValue) + throws HiveException, IOException { + vectorMapJoinFastStringHashSets[(int) ((numThreads - 1) & hashCode)].putRow(hashCode, currentKey, currentValue); + } + + @Override + public long getHashCode(BytesWritable currentKey) throws HiveException, IOException { + byte[] keyBytes = currentKey.getBytes(); + int keyLength = currentKey.getLength(); + keyBinarySortableDeserializeRead.set(keyBytes, 0, keyLength); + try { + if (!keyBinarySortableDeserializeRead.readNextField()) { + return 0; + } + } catch (Exception e) { + throw new HiveException("\nDeserializeRead details: " + + keyBinarySortableDeserializeRead.getDetailedReadPositionString() + "\nException: " + e); Review comment: sure -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 601240) Time Spent: 40m (was: 0.5h) > Support parallel load for Optimized HT implementations > ------------------------------------------------------ > > Key: HIVE-25149 > URL: https://issues.apache.org/jira/browse/HIVE-25149 > Project: Hive > Issue Type: Sub-task > Reporter: Panagiotis Garefalakis > Priority: Major > Labels: pull-request-available > Time Spent: 40m > Remaining Estimate: 0h > -- This message was sent by Atlassian Jira (v8.3.4#803005)