Skip to content

Commit

Permalink
implement sort merge join as a YProjector
Browse files Browse the repository at this point in the history
with 2 separate upstream projectors to be used form different threads
  • Loading branch information
msbt committed Mar 2, 2015
1 parent 895cb12 commit 3aefab4
Show file tree
Hide file tree
Showing 4 changed files with 1,002 additions and 0 deletions.
39 changes: 39 additions & 0 deletions sql/src/main/java/io/crate/operation/projectors/YProjector.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
* license agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership. Crate 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.
*
* However, if you have executed another commercial license agreement
* with Crate these terms will supersede the license and you may use the
* software solely pursuant to the terms of the relevant commercial agreement.
*/

package io.crate.operation.projectors;

/**
* Projector combining results from two sources, exposed via
* {@linkplain #leftProjector()} and {@linkplain #rightProjector()}.
*/
public interface YProjector {

/**
* initialize stuff here
*/
public void startProjection();

public Projector leftProjector();

public Projector rightProjector();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
* license agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership. Crate 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.
*
* However, if you have executed another commercial license agreement
* with Crate these terms will supersede the license and you may use the
* software solely pursuant to the terms of the relevant commercial agreement.
*/

package io.crate.operation.projectors.join;

public class RowCombinator {

public static Object[] combineRow(Object[] innerRow, Object[] outerRow) {
Object[] newRow = new Object[outerRow.length + innerRow.length];
System.arraycopy(outerRow, 0, newRow, 0, outerRow.length);
System.arraycopy(innerRow, 0, newRow, outerRow.length, innerRow.length);
return newRow;
}
}
Loading

0 comments on commit 3aefab4

Please sign in to comment.