Github user meiercaleb commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/156#discussion_r112560160
--- Diff:
extras/rya.pcj.fluo/pcj.fluo.app/src/main/java/org/apache/rya/indexing/pcj/fluo/app/QueryResultUpdater.java
---
@@ -53,32 +54,46 @@
* @param tx - The transaction all Fluo queries will use. (not null)
* @param childBindingSet - A binding set that the query's child node
has emmitted. (not null)
* @param queryMetadata - The metadata of the Query whose results will
be updated. (not null)
+ * @throws Exception A problem caused the update to fail.
*/
public void updateQueryResults(
final TransactionBase tx,
final VisibilityBindingSet childBindingSet,
- final QueryMetadata queryMetadata) {
+ final QueryMetadata queryMetadata) throws Exception {
checkNotNull(tx);
checkNotNull(childBindingSet);
checkNotNull(queryMetadata);
+ log.trace(
+ "Transaction ID: " + tx.getStartTimestamp() + "\n" +
+ "Join Node ID: " + queryMetadata.getNodeId() + "\n" +
+ "Child Node ID: " + queryMetadata.getChildNodeId() + "\n" +
+ "Child Binding Set:\n" + childBindingSet + "\n");
+
// Create the query's Binding Set from the child node's binding
set.
final VariableOrder queryVarOrder =
queryMetadata.getVariableOrder();
+ final BindingSet queryBindingSet =
BindingSetUtil.keepBindings(queryVarOrder, childBindingSet);
- final MapBindingSet queryBindingSet = new MapBindingSet();
- for(final String bindingName : queryVarOrder) {
- if(childBindingSet.hasBinding(bindingName)) {
- final Binding binding =
childBindingSet.getBinding(bindingName);
- queryBindingSet.addBinding(binding);
- }
+ // Create the Row Key for the result. If the child node groups
results, then the key must only contain the Group By variables.
+ final Bytes resultRow;
+
+ final String childNodeId = queryMetadata.getChildNodeId();
+ final boolean isGrouped = childNodeId.startsWith(
IncrementalUpdateConstants.AGGREGATION_PREFIX );
+ if(isGrouped) {
--- End diff --
Is this necessary? Can the names of the Projection variables actually
differ from the variables that appear in the group by clause? I thought that
the query parser prevented the projection variables from being different than
the group by/ aggregation variables.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---