amansinha100 commented on a change in pull request #1334: DRILL-6385: Support JPPD feature URL: https://github.com/apache/drill/pull/1334#discussion_r199336591
########## File path: exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinBatch.java ########## @@ -491,6 +508,50 @@ private void setupHashTable() throws SchemaChangeException { // Create the chained hash table baseHashTable = new ChainedHashTable(htConfig, context, allocator, buildBatch, probeBatch, null); + if (enableRuntimeFilter) { + setupHash64(htConfig); + } + } + + private void setupHash64(HashTableConfig htConfig) throws SchemaChangeException { + LogicalExpression[] keyExprsBuild = new LogicalExpression[htConfig.getKeyExprsBuild().size()]; + ErrorCollector collector = new ErrorCollectorImpl(); + int i = 0; + for (NamedExpression ne : htConfig.getKeyExprsBuild()) { + final LogicalExpression expr = ExpressionTreeMaterializer.materialize(ne.getExpr(), buildBatch, collector, context.getFunctionRegistry()); + if (collector.hasErrors()) { + throw new SchemaChangeException("Failure while materializing expression. " + collector.toErrorString()); + } + if (expr == null) { + continue; + } + keyExprsBuild[i] = expr; + i++; + } + i = 0; + boolean meetNotExistField = false; + TypedFieldId[] buildSideTypeFieldIds = new TypedFieldId[keyExprsBuild.length]; + for (NamedExpression ne : htConfig.getKeyExprsBuild()) { + SchemaPath schemaPath = (SchemaPath) ne.getExpr(); + TypedFieldId typedFieldId = buildBatch.getValueVectorId(schemaPath); + if (typedFieldId == null) { + meetNotExistField = true; + continue; + } + buildSideTypeFieldIds[i] = typedFieldId; + i++; + } + if (meetNotExistField) { + logger.info("as some build side key fileds not found, runtime filter was disabled"); + enableRuntimeFilter = false; + return; + } + ValueVectorHashHelper hashHelper = new ValueVectorHashHelper(buildBatch, context); + try { + hash64 = hashHelper.getHash64(keyExprsBuild, buildSideTypeFieldIds); + } catch (Exception e) { + throw new SchemaChangeException("fail to construct a field's hash64 dynamic codes", e); Review comment: 'fail' => 'failed' ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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 With regards, Apache Git Services