This is an automated email from the ASF dual-hosted git repository.
dlych pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git
The following commit(s) were added to refs/heads/master by this push:
new 2256e4c [NO ISSUE] Bug Fixes for Interval Joins and Spilling Tests
2256e4c is described below
commit 2256e4cf9157e0ae30ff4c6c1af2ed1fa8ea4fd7
Author: Caleb Herbel <[email protected]>
AuthorDate: Tue Aug 25 11:43:06 2020 -0600
[NO ISSUE] Bug Fixes for Interval Joins and Spilling Tests
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
-Adds bug fixes for interval joins
-Includes spilling tests for optimized interval joins: after, before,
covers, co
vered_by, overlaps, overlapping, overlapped_by.
-Refactored naming in interval join utils and factories to be more cohesive.
Change-Id: I1c6a3b96c04b9cef576cbc66b20c34a82450d792
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/7645
Reviewed-by: Preston Carman <[email protected]>
Reviewed-by: Dmitry Lychagin <[email protected]>
Integration-Tests: Jenkins <[email protected]>
Tested-by: Dmitry Lychagin <[email protected]>
---
.../physical/IntervalMergeJoinPOperator.java | 12 +--
.../optimizer/rules/util/AsterixJoinUtils.java | 6 +-
.../queries_sqlpp/temporal/TemporalQueries.xml | 67 ++++++++++++----
.../interval_after/interval_after.1.ddl.sqlpp} | 24 +++---
.../interval_after/interval_after.2.update.sqlpp} | 41 +++++++---
.../interval_after/interval_after.3.query.sqlpp} | 27 +++----
.../interval_before/interval_before.1.ddl.sqlpp} | 24 +++---
.../interval_before.2.update.sqlpp} | 41 +++++++---
.../interval_before/interval_before.3.query.sqlpp} | 27 +++----
.../interval_covered_by.1.ddl.sqlpp} | 24 +++---
.../interval_covered_by.2.update.sqlpp} | 41 +++++++---
.../interval_covered_by.3.query.sqlpp} | 27 +++----
.../interval_covers/interval_covers.1.ddl.sqlpp} | 24 +++---
.../interval_covers.2.update.sqlpp} | 41 +++++++---
.../interval_covers/interval_covers.3.query.sqlpp} | 27 +++----
.../interval_overlapped_by.1.ddl.sqlpp} | 24 +++---
.../interval_overlapped_by.2.update.sqlpp | 49 ++++++++++++
.../interval_overlapped_by.3.query.sqlpp} | 27 +++----
.../interval_overlapping.1.ddl.sqlpp} | 24 +++---
.../interval_overlapping.2.update.sqlpp | 49 ++++++++++++
.../interval_overlapping.3.query.sqlpp} | 27 +++----
.../interval_overlaps.1.ddl.sqlpp} | 24 +++---
.../interval_overlaps.2.update.sqlpp} | 42 ++++++----
.../interval_overlaps.3.query.sqlpp} | 26 +++---
.../interval_after/interval_after.3.adm | 1 +
.../interval_before/interval_before.3.adm | 1 +
.../interval_covered_by/interval_covered_by.3.adm | 1 +
.../interval_covers/interval_covers.3.adm | 1 +
.../interval_overlapped_by.3.adm | 1 +
.../interval_overlapping.3.adm | 1 +
.../interval_overlaps/interval_overlaps.3.adm | 1 +
.../IntervalMergeJoinOperatorDescriptor.java | 20 ++---
.../joins/interval/IntervalMergeJoiner.java | 24 ++++--
.../utils/AbstractIntervalInverseJoinUtil.java | 32 +++++---
.../interval/utils/AbstractIntervalJoinUtil.java | 92 ++++++++--------------
.../interval/utils/AfterIntervalJoinUtil.java | 32 ++++----
.../utils/AfterIntervalJoinUtilFactory.java | 4 +-
.../interval/utils/BeforeIntervalJoinUtil.java | 34 ++++----
.../utils/BeforeIntervalJoinUtilFactory.java | 4 +-
.../interval/utils/CoveredByIntervalJoinUtil.java | 28 +++----
.../utils/CoveredByIntervalJoinUtilFactory.java | 4 +-
.../interval/utils/CoversIntervalJoinUtil.java | 8 +-
.../utils/CoversIntervalJoinUtilFactory.java | 4 +-
.../joins/interval/utils/IIntervalJoinUtil.java | 66 ++++++++--------
.../interval/utils/IIntervalJoinUtilFactory.java | 2 +-
.../utils/OverlappedByIntervalJoinUtil.java | 8 +-
.../utils/OverlappedByIntervalJoinUtilFactory.java | 4 +-
.../utils/OverlappingIntervalJoinUtil.java | 55 ++++++-------
.../utils/OverlappingIntervalJoinUtilFactory.java | 4 +-
.../interval/utils/OverlapsIntervalJoinUtil.java | 8 +-
.../utils/OverlapsIntervalJoinUtilFactory.java | 4 +-
.../interval/utils/memory/IntervalSideTuple.java | 14 +---
52 files changed, 715 insertions(+), 488 deletions(-)
diff --git
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/IntervalMergeJoinPOperator.java
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/IntervalMergeJoinPOperator.java
index 4815349..2b96176 100644
---
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/IntervalMergeJoinPOperator.java
+++
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/IntervalMergeJoinPOperator.java
@@ -171,14 +171,14 @@ public class IntervalMergeJoinPOperator extends
AbstractJoinPOperator {
public void contributeRuntimeOperator(IHyracksJobBuilder builder,
JobGenContext context, ILogicalOperator op,
IOperatorSchema opSchema, IOperatorSchema[] inputSchemas,
IOperatorSchema outerPlanSchema)
throws AlgebricksException {
- int[] keysLeft = JobGenHelper.variablesToFieldIndexes(keysLeftBranch,
inputSchemas[0]);
- int[] keysRight =
JobGenHelper.variablesToFieldIndexes(keysRightBranch, inputSchemas[1]);
+ int[] keysBuild = JobGenHelper.variablesToFieldIndexes(keysLeftBranch,
inputSchemas[0]);
+ int[] keysProbe =
JobGenHelper.variablesToFieldIndexes(keysRightBranch, inputSchemas[1]);
IOperatorDescriptorRegistry spec = builder.getJobSpec();
RecordDescriptor recordDescriptor =
JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), opSchema,
context);
- IOperatorDescriptor opDesc = getIntervalOperatorDescriptor(keysLeft,
keysRight, spec, recordDescriptor, mjcf);
+ IOperatorDescriptor opDesc = getIntervalOperatorDescriptor(keysBuild,
keysProbe, spec, recordDescriptor, mjcf);
contributeOpDesc(builder, (AbstractLogicalOperator) op, opDesc);
ILogicalOperator src1 = op.getInputs().get(0).getValue();
@@ -187,9 +187,9 @@ public class IntervalMergeJoinPOperator extends
AbstractJoinPOperator {
builder.contributeGraphEdge(src2, 0, op, 1);
}
- IOperatorDescriptor getIntervalOperatorDescriptor(int[] keysLeft, int[]
keysRight, IOperatorDescriptorRegistry spec,
- RecordDescriptor recordDescriptor, IIntervalJoinUtilFactory mjcf) {
- return new IntervalMergeJoinOperatorDescriptor(spec, memSizeInFrames,
keysLeft, keysRight, recordDescriptor,
+ IOperatorDescriptor getIntervalOperatorDescriptor(int[] keysBuild, int[]
keysProbe,
+ IOperatorDescriptorRegistry spec, RecordDescriptor
recordDescriptor, IIntervalJoinUtilFactory mjcf) {
+ return new IntervalMergeJoinOperatorDescriptor(spec, memSizeInFrames,
keysBuild, keysProbe, recordDescriptor,
mjcf);
}
}
diff --git
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/util/AsterixJoinUtils.java
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/util/AsterixJoinUtils.java
index 45b8b07..3a07e10 100644
---
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/util/AsterixJoinUtils.java
+++
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/util/AsterixJoinUtils.java
@@ -72,8 +72,10 @@ public class AsterixJoinUtils {
if (rangeMap.getTag(0, 0) != ATypeTag.DATETIME.serialize() &&
rangeMap.getTag(0, 0) != ATypeTag.DATE.serialize()
&& rangeMap.getTag(0, 0) != ATypeTag.TIME.serialize()) {
IWarningCollector warningCollector = context.getWarningCollector();
- warningCollector.warn(Warning.forHyracks(op.getSourceLocation(),
ErrorCode.INAPPLICABLE_HINT,
- "Date, DateTime, and Time are only range hints types
supported for interval joins"));
+ if (warningCollector.shouldWarn()) {
+
warningCollector.warn(Warning.forHyracks(op.getSourceLocation(),
ErrorCode.INAPPLICABLE_HINT,
+ "Date, DateTime, and Time are only range hints types
supported for interval joins"));
+ }
return;
}
IntervalPartitions intervalPartitions =
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/TemporalQueries.xml
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/TemporalQueries.xml
index 2df6acb..4ec2303 100644
---
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/TemporalQueries.xml
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/TemporalQueries.xml
@@ -155,8 +155,8 @@
</compilation-unit>
</test-case>
<test-case FilePath="temporal/interval_joins">
- <compilation-unit name="interval_overlapping">
- <output-dir compare="Text">interval_overlapping</output-dir>
+ <compilation-unit name="interval_after">
+ <output-dir compare="Text">interval_after</output-dir>
</compilation-unit>
</test-case>
<test-case FilePath="temporal/interval_joins">
@@ -165,11 +165,21 @@
</compilation-unit>
</test-case>
<test-case FilePath="temporal/interval_joins">
+ <compilation-unit name="interval_covered_by">
+ <output-dir compare="Text">interval_covered_by</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="temporal/interval_joins">
<compilation-unit name="interval_covers">
<output-dir compare="Text">interval_covers</output-dir>
</compilation-unit>
</test-case>
<test-case FilePath="temporal/interval_joins">
+ <compilation-unit name="interval_ended_by">
+ <output-dir compare="Text">interval_ended_by</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="temporal/interval_joins">
<compilation-unit name="interval_ends">
<output-dir compare="Text">interval_ends</output-dir>
</compilation-unit>
@@ -180,43 +190,68 @@
</compilation-unit>
</test-case>
<test-case FilePath="temporal/interval_joins">
+ <compilation-unit name="interval_met_by">
+ <output-dir compare="Text">interval_met_by</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="temporal/interval_joins">
+ <compilation-unit name="interval_overlapped_by">
+ <output-dir compare="Text">interval_overlapped_by</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="temporal/interval_joins">
+ <compilation-unit name="interval_overlapping">
+ <output-dir compare="Text">interval_overlapping</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="temporal/interval_joins">
<compilation-unit name="interval_overlaps">
<output-dir compare="Text">interval_overlaps</output-dir>
</compilation-unit>
</test-case>
<test-case FilePath="temporal/interval_joins">
+ <compilation-unit name="interval_started_by">
+ <output-dir compare="Text">interval_started_by</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="temporal/interval_joins">
<compilation-unit name="interval_starts">
<output-dir compare="Text">interval_starts</output-dir>
</compilation-unit>
</test-case>
- <test-case FilePath="temporal/interval_joins">
+ <test-case FilePath="temporal/interval_joins_spilling">
<compilation-unit name="interval_after">
<output-dir compare="Text">interval_after</output-dir>
</compilation-unit>
</test-case>
- <test-case FilePath="temporal/interval_joins">
- <compilation-unit name="interval_covered_by">
- <output-dir compare="Text">interval_covered_by</output-dir>
+ <test-case FilePath="temporal/interval_joins_spilling">
+ <compilation-unit name="interval_before">
+ <output-dir compare="Text">interval_before</output-dir>
</compilation-unit>
</test-case>
- <test-case FilePath="temporal/interval_joins">
- <compilation-unit name="interval_ended_by">
- <output-dir compare="Text">interval_ended_by</output-dir>
+ <test-case FilePath="temporal/interval_joins_spilling">
+ <compilation-unit name="interval_covered_by">
+ <output-dir compare="Text">interval_covered_by</output-dir>
</compilation-unit>
</test-case>
- <test-case FilePath="temporal/interval_joins">
- <compilation-unit name="interval_met_by">
- <output-dir compare="Text">interval_met_by</output-dir>
+ <test-case FilePath="temporal/interval_joins_spilling">
+ <compilation-unit name="interval_covers">
+ <output-dir compare="Text">interval_covers</output-dir>
</compilation-unit>
</test-case>
- <test-case FilePath="temporal/interval_joins">
+ <test-case FilePath="temporal/interval_joins_spilling">
<compilation-unit name="interval_overlapped_by">
<output-dir compare="Text">interval_overlapped_by</output-dir>
</compilation-unit>
</test-case>
- <test-case FilePath="temporal/interval_joins">
- <compilation-unit name="interval_started_by">
- <output-dir compare="Text">interval_started_by</output-dir>
+ <test-case FilePath="temporal/interval_joins_spilling">
+ <compilation-unit name="interval_overlapping">
+ <output-dir compare="Text">interval_overlapping</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="temporal/interval_joins_spilling">
+ <compilation-unit name="interval_overlaps">
+ <output-dir compare="Text">interval_overlaps</output-dir>
</compilation-unit>
</test-case>
</test-group>
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_after/interval_after.1.ddl.sqlpp
similarity index 64%
copy from
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
copy to
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_after/interval_after.1.ddl.sqlpp
index b5f0bba..7ae3a6c 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_after/interval_after.1.ddl.sqlpp
@@ -16,15 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.operators.joins.interval.utils;
-
-import java.io.Serializable;
+/*
+ * Description : Check temporal join functionality for interval
+ * Expected Result : Success
+ * Date : 10th Aug, 2020
+ */
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
+drop dataverse IntervalTest if exists;
+create dataverse IntervalTest;
+use IntervalTest;
-public interface IIntervalJoinUtilFactory extends Serializable {
+create type IntervalType as open {
+id: int64,
+interval: interval,
+filler: string
+};
- IIntervalJoinUtil createIntervalMergeJoinChecker(int[] keys0, int[] keys1,
IHyracksTaskContext ctx, int nPartitions)
- throws HyracksDataException;
-}
+create dataset DataSet1(IntervalType) primary key id;
+create dataset DataSet2(IntervalType) primary key id;
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_after/interval_after.2.update.sqlpp
similarity index 50%
copy from
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
copy to
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_after/interval_after.2.update.sqlpp
index cdfaafd..3b79eb5 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_after/interval_after.2.update.sqlpp
@@ -16,19 +16,34 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.operators.joins.interval.utils;
-
-import org.apache.asterix.om.pointables.nonvisitor.AIntervalPointable;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
+/*
+ * Description : Check temporal join spilling functionality for
interval after
+ * Expected Result : Success
+ * Date : 13th Aug, 2020
+ */
-public class CoversIntervalJoinUtil extends AbstractIntervalJoinUtil {
+use IntervalTest;
- public CoversIntervalJoinUtil(int[] keysLeft, int[] keysRight) {
- super(keysLeft[0], keysRight[0]);
- }
+insert into DataSet1
+from range(1, 100) s at srow,
+ range(1, 1) l at lrow
+let filler = repeat("i", 10000),
+ lambda = 1, d = 2,
+ id = (srow-1) * lambda + lrow
+select value {
+"id": id,
+"interval": interval(datetime_from_unix_time_in_secs(s),
datetime_from_unix_time_in_secs(s + d)),
+"filler": filler
+};
- @Override
- public boolean compareInterval(AIntervalPointable ipLeft,
AIntervalPointable ipRight) throws HyracksDataException {
- return il.covers(ipLeft, ipRight);
- }
-}
+insert into DataSet2
+from range(1, 100) s at srow,
+ range(1, 1) l at lrow
+let filler = repeat("i", 10000),
+ lambda = 1, d = 2,
+ id = (srow-1) * lambda + lrow
+select value {
+"id": id,
+"interval": interval(datetime_from_unix_time_in_secs(s),
datetime_from_unix_time_in_secs(s + d)),
+"filler": filler
+};
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_after/interval_after.3.query.sqlpp
similarity index 57%
copy from
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
copy to
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_after/interval_after.3.query.sqlpp
index cdfaafd..4bd3a38 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_after/interval_after.3.query.sqlpp
@@ -16,19 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.operators.joins.interval.utils;
-
-import org.apache.asterix.om.pointables.nonvisitor.AIntervalPointable;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class CoversIntervalJoinUtil extends AbstractIntervalJoinUtil {
+/*
+ * Description : Check temporal join spilling functionality for
interval after
+ * Expected Result : Success
+ * Date : 13th Aug, 2020
+ */
- public CoversIntervalJoinUtil(int[] keysLeft, int[] keysRight) {
- super(keysLeft[0], keysRight[0]);
- }
+use IntervalTest;
- @Override
- public boolean compareInterval(AIntervalPointable ipLeft,
AIntervalPointable ipRight) throws HyracksDataException {
- return il.covers(ipLeft, ipRight);
- }
-}
+select count(*)
+from (select element { "id1" : ds1.id, "id2" : ds2.id, "spill" :
length(ds1.filler || ds2.filler)}
+ from DataSet1 as ds1, DataSet2 as ds2
+ where
+ /*+ range [datetime("1970-01-01T00:00:05.000Z"),
datetime("1970-01-01T00:00:10.000Z"), datetime("1970-01-01T00:00:15.000Z")] */
+ interval_after(ds1.interval, ds2.interval)) as results0
+where results0.id1 > 1 or results0.filler = 1;
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_before/interval_before.1.ddl.sqlpp
similarity index 64%
copy from
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
copy to
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_before/interval_before.1.ddl.sqlpp
index b5f0bba..928f3b1 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_before/interval_before.1.ddl.sqlpp
@@ -16,15 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.operators.joins.interval.utils;
-
-import java.io.Serializable;
+/*
+ * Description : Check temporal join spilling functionality for
interval before
+ * Expected Result : Success
+ * Date : 13th Aug, 2020
+ */
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
+drop dataverse IntervalTest if exists;
+create dataverse IntervalTest;
+use IntervalTest;
-public interface IIntervalJoinUtilFactory extends Serializable {
+create type IntervalType as open {
+id: int64,
+interval: interval,
+filler: string
+};
- IIntervalJoinUtil createIntervalMergeJoinChecker(int[] keys0, int[] keys1,
IHyracksTaskContext ctx, int nPartitions)
- throws HyracksDataException;
-}
+create dataset DataSet1(IntervalType) primary key id;
+create dataset DataSet2(IntervalType) primary key id;
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_before/interval_before.2.update.sqlpp
similarity index 50%
copy from
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
copy to
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_before/interval_before.2.update.sqlpp
index cdfaafd..68fc545 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_before/interval_before.2.update.sqlpp
@@ -16,19 +16,34 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.operators.joins.interval.utils;
-
-import org.apache.asterix.om.pointables.nonvisitor.AIntervalPointable;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
+/*
+ * Description : Check temporal join spilling functionality for
interval before
+ * Expected Result : Success
+ * Date : 13th Aug, 2020
+ */
-public class CoversIntervalJoinUtil extends AbstractIntervalJoinUtil {
+use IntervalTest;
- public CoversIntervalJoinUtil(int[] keysLeft, int[] keysRight) {
- super(keysLeft[0], keysRight[0]);
- }
+insert into DataSet1
+from range(1, 100) s at srow,
+ range(1, 1) l at lrow
+let filler = repeat("i", 10000),
+ lambda = 1, d = 2,
+ id = (srow-1) * lambda + lrow
+select value {
+"id": id,
+"interval": interval(datetime_from_unix_time_in_secs(s),
datetime_from_unix_time_in_secs(s + d)),
+"filler": filler
+};
- @Override
- public boolean compareInterval(AIntervalPointable ipLeft,
AIntervalPointable ipRight) throws HyracksDataException {
- return il.covers(ipLeft, ipRight);
- }
-}
+insert into DataSet2
+from range(1, 100) s at srow,
+ range(1, 1) l at lrow
+let filler = repeat("i", 10000),
+ lambda = 1, d = 2,
+ id = (srow-1) * lambda + lrow
+select value {
+"id": id,
+"interval": interval(datetime_from_unix_time_in_secs(s),
datetime_from_unix_time_in_secs(s + d)),
+"filler": filler
+};
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_before/interval_before.3.query.sqlpp
similarity index 57%
copy from
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
copy to
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_before/interval_before.3.query.sqlpp
index cdfaafd..b363137 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_before/interval_before.3.query.sqlpp
@@ -16,19 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.operators.joins.interval.utils;
-
-import org.apache.asterix.om.pointables.nonvisitor.AIntervalPointable;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class CoversIntervalJoinUtil extends AbstractIntervalJoinUtil {
+/*
+ * Description : Check temporal join spilling functionality for
interval before
+ * Expected Result : Success
+ * Date : 13th Aug, 2020
+ */
- public CoversIntervalJoinUtil(int[] keysLeft, int[] keysRight) {
- super(keysLeft[0], keysRight[0]);
- }
+use IntervalTest;
- @Override
- public boolean compareInterval(AIntervalPointable ipLeft,
AIntervalPointable ipRight) throws HyracksDataException {
- return il.covers(ipLeft, ipRight);
- }
-}
+select count(*)
+from (select element { "id1" : ds1.id, "id2" : ds2.id, "spill" :
length(ds1.filler || ds2.filler)}
+ from DataSet1 as ds1, DataSet2 as ds2
+ where
+ /*+ range [datetime("1970-01-01T00:00:05.000Z"),
datetime("1970-01-01T00:00:10.000Z"), datetime("1970-01-01T00:00:15.000Z")] */
+ interval_before(ds1.interval, ds2.interval)) as results0
+where results0.id1 > 1 or results0.filler = 1;
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_covered_by/interval_covered_by.1.ddl.sqlpp
similarity index 64%
copy from
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
copy to
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_covered_by/interval_covered_by.1.ddl.sqlpp
index b5f0bba..6e0fb3d 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_covered_by/interval_covered_by.1.ddl.sqlpp
@@ -16,15 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.operators.joins.interval.utils;
-
-import java.io.Serializable;
+/*
+ * Description : Check temporal join spilling functionality for
interval covered_by
+ * Expected Result : Success
+ * Date : 13th Aug, 2020
+ */
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
+drop dataverse IntervalTest if exists;
+create dataverse IntervalTest;
+use IntervalTest;
-public interface IIntervalJoinUtilFactory extends Serializable {
+create type IntervalType as open {
+id: int64,
+interval: interval,
+filler: string
+};
- IIntervalJoinUtil createIntervalMergeJoinChecker(int[] keys0, int[] keys1,
IHyracksTaskContext ctx, int nPartitions)
- throws HyracksDataException;
-}
+create dataset DataSet1(IntervalType) primary key id;
+create dataset DataSet2(IntervalType) primary key id;
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_covered_by/interval_covered_by.2.update.sqlpp
similarity index 50%
copy from
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
copy to
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_covered_by/interval_covered_by.2.update.sqlpp
index cdfaafd..750e5e0 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_covered_by/interval_covered_by.2.update.sqlpp
@@ -16,19 +16,34 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.operators.joins.interval.utils;
-
-import org.apache.asterix.om.pointables.nonvisitor.AIntervalPointable;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
+/*
+ * Description : Check temporal join spilling functionality for
interval covered_by
+ * Expected Result : Success
+ * Date : 13th Aug, 2020
+ */
-public class CoversIntervalJoinUtil extends AbstractIntervalJoinUtil {
+use IntervalTest;
- public CoversIntervalJoinUtil(int[] keysLeft, int[] keysRight) {
- super(keysLeft[0], keysRight[0]);
- }
+insert into DataSet1
+from range(1, 100) s at srow,
+ range(1, 1) l at lrow
+let filler = repeat("i", 10000),
+ lambda = 1, d = 2,
+ id = (srow-1) * lambda + lrow
+select value {
+"id": id,
+"interval": interval(datetime_from_unix_time_in_secs(s),
datetime_from_unix_time_in_secs(s + d)),
+"filler": filler
+};
- @Override
- public boolean compareInterval(AIntervalPointable ipLeft,
AIntervalPointable ipRight) throws HyracksDataException {
- return il.covers(ipLeft, ipRight);
- }
-}
+insert into DataSet2
+from range(1, 100) s at srow,
+ range(1, 1) l at lrow
+let filler = repeat("i", 10000),
+ lambda = 1, d = 20,
+ id = (srow-1) * lambda + lrow
+select value {
+"id": id,
+"interval": interval(datetime_from_unix_time_in_secs(s),
datetime_from_unix_time_in_secs(s + d)),
+"filler": filler
+};
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_covered_by/interval_covered_by.3.query.sqlpp
similarity index 57%
copy from
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
copy to
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_covered_by/interval_covered_by.3.query.sqlpp
index cdfaafd..66d2747 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_covered_by/interval_covered_by.3.query.sqlpp
@@ -16,19 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.operators.joins.interval.utils;
-
-import org.apache.asterix.om.pointables.nonvisitor.AIntervalPointable;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class CoversIntervalJoinUtil extends AbstractIntervalJoinUtil {
+/*
+ * Description : Check temporal join spilling functionality for
interval covered_by
+ * Expected Result : Success
+ * Date : 13th Aug, 2020
+ */
- public CoversIntervalJoinUtil(int[] keysLeft, int[] keysRight) {
- super(keysLeft[0], keysRight[0]);
- }
+use IntervalTest;
- @Override
- public boolean compareInterval(AIntervalPointable ipLeft,
AIntervalPointable ipRight) throws HyracksDataException {
- return il.covers(ipLeft, ipRight);
- }
-}
+select count(*)
+from (select element { "id1" : ds1.id, "id2" : ds2.id, "spill" :
length(ds1.filler || ds2.filler)}
+ from DataSet1 as ds1, DataSet2 as ds2
+ where
+ /*+ range [datetime("1970-01-01T00:00:05.000Z"),
datetime("1970-01-01T00:00:10.000Z"), datetime("1970-01-01T00:00:15.000Z")] */
+ interval_covered_by(ds1.interval, ds2.interval)) as results0
+where results0.id1 > 1 or results0.filler = 1;
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_covers/interval_covers.1.ddl.sqlpp
similarity index 64%
copy from
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
copy to
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_covers/interval_covers.1.ddl.sqlpp
index b5f0bba..1561f8a 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_covers/interval_covers.1.ddl.sqlpp
@@ -16,15 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.operators.joins.interval.utils;
-
-import java.io.Serializable;
+/*
+ * Description : Check temporal join spilling functionality for
interval covers
+ * Expected Result : Success
+ * Date : 13th Aug, 2020
+ */
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
+drop dataverse IntervalTest if exists;
+create dataverse IntervalTest;
+use IntervalTest;
-public interface IIntervalJoinUtilFactory extends Serializable {
+create type IntervalType as open {
+id: int64,
+interval: interval,
+filler: string
+};
- IIntervalJoinUtil createIntervalMergeJoinChecker(int[] keys0, int[] keys1,
IHyracksTaskContext ctx, int nPartitions)
- throws HyracksDataException;
-}
+create dataset DataSet1(IntervalType) primary key id;
+create dataset DataSet2(IntervalType) primary key id;
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_covers/interval_covers.2.update.sqlpp
similarity index 50%
copy from
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
copy to
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_covers/interval_covers.2.update.sqlpp
index cdfaafd..2ac8eda 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_covers/interval_covers.2.update.sqlpp
@@ -16,19 +16,34 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.operators.joins.interval.utils;
-
-import org.apache.asterix.om.pointables.nonvisitor.AIntervalPointable;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
+/*
+ * Description : Check temporal join spilling functionality for
interval covers
+ * Expected Result : Success
+ * Date : 13th Aug, 2020
+ */
-public class CoversIntervalJoinUtil extends AbstractIntervalJoinUtil {
+use IntervalTest;
- public CoversIntervalJoinUtil(int[] keysLeft, int[] keysRight) {
- super(keysLeft[0], keysRight[0]);
- }
+insert into DataSet1
+from range(1, 100) s at srow,
+ range(1, 1) l at lrow
+let filler = repeat("i", 10000),
+ lambda = 1, d = 20,
+ id = (srow-1) * lambda + lrow
+select value {
+"id": id,
+"interval": interval(datetime_from_unix_time_in_secs(s),
datetime_from_unix_time_in_secs(s + d)),
+"filler": filler
+};
- @Override
- public boolean compareInterval(AIntervalPointable ipLeft,
AIntervalPointable ipRight) throws HyracksDataException {
- return il.covers(ipLeft, ipRight);
- }
-}
+insert into DataSet2
+from range(1, 100) s at srow,
+ range(1, 1) l at lrow
+let filler = repeat("i", 10000),
+ lambda = 1, d = 2,
+ id = (srow-1) * lambda + lrow
+select value {
+"id": id,
+"interval": interval(datetime_from_unix_time_in_secs(s),
datetime_from_unix_time_in_secs(s + d)),
+"filler": filler
+};
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_covers/interval_covers.3.query.sqlpp
similarity index 57%
copy from
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
copy to
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_covers/interval_covers.3.query.sqlpp
index cdfaafd..a7bbc96 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_covers/interval_covers.3.query.sqlpp
@@ -16,19 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.operators.joins.interval.utils;
-
-import org.apache.asterix.om.pointables.nonvisitor.AIntervalPointable;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class CoversIntervalJoinUtil extends AbstractIntervalJoinUtil {
+/*
+ * Description : Check temporal join spilling functionality for
interval covers
+ * Expected Result : Success
+ * Date : 13th Aug, 2020
+ */
- public CoversIntervalJoinUtil(int[] keysLeft, int[] keysRight) {
- super(keysLeft[0], keysRight[0]);
- }
+use IntervalTest;
- @Override
- public boolean compareInterval(AIntervalPointable ipLeft,
AIntervalPointable ipRight) throws HyracksDataException {
- return il.covers(ipLeft, ipRight);
- }
-}
+select count(*)
+from (select element { "id1" : ds1.id, "id2" : ds2.id, "spill" :
length(ds1.filler || ds2.filler)}
+ from DataSet1 as ds1, DataSet2 as ds2
+ where
+ /*+ range [datetime("1970-01-01T00:00:05.000Z"),
datetime("1970-01-01T00:00:10.000Z"), datetime("1970-01-01T00:00:15.000Z")] */
+ interval_covers(ds1.interval, ds2.interval)) as results0
+where results0.id1 > 1 or results0.filler = 1;
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlapped_by/interval_overlapped_by.1.ddl.sqlpp
similarity index 64%
copy from
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
copy to
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlapped_by/interval_overlapped_by.1.ddl.sqlpp
index b5f0bba..67561d6 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlapped_by/interval_overlapped_by.1.ddl.sqlpp
@@ -16,15 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.operators.joins.interval.utils;
-
-import java.io.Serializable;
+/*
+ * Description : Check temporal join spilling functionality for
interval overlapped_by
+ * Expected Result : Success
+ * Date : 13th Aug, 2020
+ */
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
+drop dataverse IntervalTest if exists;
+create dataverse IntervalTest;
+use IntervalTest;
-public interface IIntervalJoinUtilFactory extends Serializable {
+create type IntervalType as open {
+id: int64,
+interval: interval,
+filler: string
+};
- IIntervalJoinUtil createIntervalMergeJoinChecker(int[] keys0, int[] keys1,
IHyracksTaskContext ctx, int nPartitions)
- throws HyracksDataException;
-}
+create dataset DataSet1(IntervalType) primary key id;
+create dataset DataSet2(IntervalType) primary key id;
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlapped_by/interval_overlapped_by.2.update.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlapped_by/interval_overlapped_by.2.update.sqlpp
new file mode 100644
index 0000000..a4f25c3
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlapped_by/interval_overlapped_by.2.update.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+/*
+ * Description : Check temporal join spilling functionality for
interval overlapped_by
+ * Expected Result : Success
+ * Date : 13th Aug, 2020
+ */
+
+use IntervalTest;
+
+insert into DataSet1
+from range(1, 100) s at srow,
+ range(1, 1) l at lrow
+let filler = repeat("i", 10000),
+ lambda = 1, d = 20,
+ id = (srow-1) * lambda + lrow
+select value {
+"id": id,
+"interval": interval(datetime_from_unix_time_in_secs(s),
datetime_from_unix_time_in_secs(s + d)),
+"filler": filler
+};
+
+insert into DataSet2
+from range(1, 100) s at srow,
+ range(1, 1) l at lrow
+let filler = repeat("i", 10000),
+ lambda = 1, d = 20,
+ id = (srow-1) * lambda + lrow
+select value {
+"id": id,
+"interval": interval(datetime_from_unix_time_in_secs(s),
datetime_from_unix_time_in_secs(s + d)),
+"filler": filler
+};
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlapped_by/interval_overlapped_by.3.query.sqlpp
similarity index 57%
copy from
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
copy to
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlapped_by/interval_overlapped_by.3.query.sqlpp
index cdfaafd..93c810a 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlapped_by/interval_overlapped_by.3.query.sqlpp
@@ -16,19 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.operators.joins.interval.utils;
-
-import org.apache.asterix.om.pointables.nonvisitor.AIntervalPointable;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class CoversIntervalJoinUtil extends AbstractIntervalJoinUtil {
+/*
+ * Description : Check temporal join spilling functionality for
interval overlapped_by
+ * Expected Result : Success
+ * Date : 13th Aug, 2020
+ */
- public CoversIntervalJoinUtil(int[] keysLeft, int[] keysRight) {
- super(keysLeft[0], keysRight[0]);
- }
+use IntervalTest;
- @Override
- public boolean compareInterval(AIntervalPointable ipLeft,
AIntervalPointable ipRight) throws HyracksDataException {
- return il.covers(ipLeft, ipRight);
- }
-}
+select count(*)
+from (select element { "id1" : ds1.id, "id2" : ds2.id, "spill" :
length(ds1.filler || ds2.filler)}
+ from DataSet1 as ds1, DataSet2 as ds2
+ where
+ /*+ range [datetime("1970-01-01T00:00:05.000Z"),
datetime("1970-01-01T00:00:10.000Z"), datetime("1970-01-01T00:00:15.000Z")] */
+ interval_overlapped_by(ds1.interval, ds2.interval)) as results0
+where results0.id1 > 1 or results0.filler = 1;
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlapping/interval_overlapping.1.ddl.sqlpp
similarity index 64%
copy from
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
copy to
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlapping/interval_overlapping.1.ddl.sqlpp
index b5f0bba..e55fad7 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlapping/interval_overlapping.1.ddl.sqlpp
@@ -16,15 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.operators.joins.interval.utils;
-
-import java.io.Serializable;
+/*
+ * Description : Check temporal join spilling functionality for
interval overlapping
+ * Expected Result : Success
+ * Date : 13th Aug, 2020
+ */
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
+drop dataverse IntervalTest if exists;
+create dataverse IntervalTest;
+use IntervalTest;
-public interface IIntervalJoinUtilFactory extends Serializable {
+create type IntervalType as open {
+id: int64,
+interval: interval,
+filler: string
+};
- IIntervalJoinUtil createIntervalMergeJoinChecker(int[] keys0, int[] keys1,
IHyracksTaskContext ctx, int nPartitions)
- throws HyracksDataException;
-}
+create dataset DataSet1(IntervalType) primary key id;
+create dataset DataSet2(IntervalType) primary key id;
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlapping/interval_overlapping.2.update.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlapping/interval_overlapping.2.update.sqlpp
new file mode 100644
index 0000000..b0c6139
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlapping/interval_overlapping.2.update.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+/*
+ * Description : Check temporal join spilling functionality for
interval overlapping
+ * Expected Result : Success
+ * Date : 13th Aug, 2020
+ */
+
+use IntervalTest;
+
+insert into DataSet1
+from range(1, 100) s at srow,
+ range(1, 1) l at lrow
+let filler = repeat("i", 10000),
+ lambda = 1, d = 10,
+ id = (srow-1) * lambda + lrow
+select value {
+"id": id,
+"interval": interval(datetime_from_unix_time_in_secs(s),
datetime_from_unix_time_in_secs(s + d)),
+"filler": filler
+};
+
+insert into DataSet2
+from range(1, 100) s at srow,
+ range(1, 1) l at lrow
+let filler = repeat("i", 10000),
+ lambda = 1, d = 10,
+ id = (srow-1) * lambda + lrow
+select value {
+"id": id,
+"interval": interval(datetime_from_unix_time_in_secs(s),
datetime_from_unix_time_in_secs(s + d)),
+"filler": filler
+};
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlapping/interval_overlapping.3.query.sqlpp
similarity index 57%
copy from
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
copy to
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlapping/interval_overlapping.3.query.sqlpp
index cdfaafd..243b4ec 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlapping/interval_overlapping.3.query.sqlpp
@@ -16,19 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.operators.joins.interval.utils;
-
-import org.apache.asterix.om.pointables.nonvisitor.AIntervalPointable;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class CoversIntervalJoinUtil extends AbstractIntervalJoinUtil {
+/*
+ * Description : Check temporal join spilling functionality for
interval overlapping
+ * Expected Result : Success
+ * Date : 13th Aug, 2020
+ */
- public CoversIntervalJoinUtil(int[] keysLeft, int[] keysRight) {
- super(keysLeft[0], keysRight[0]);
- }
+use IntervalTest;
- @Override
- public boolean compareInterval(AIntervalPointable ipLeft,
AIntervalPointable ipRight) throws HyracksDataException {
- return il.covers(ipLeft, ipRight);
- }
-}
+select count(*)
+from (select element { "id1" : ds1.id, "id2" : ds2.id, "spill" :
length(ds1.filler || ds2.filler)}
+ from DataSet1 as ds1, DataSet2 as ds2
+ where
+ /*+ range [datetime("1970-01-01T00:00:05.000Z"),
datetime("1970-01-01T00:00:10.000Z"), datetime("1970-01-01T00:00:15.000Z")] */
+ interval_overlapping(ds1.interval, ds2.interval)) as results0
+where results0.id1 > 1 or results0.filler = 1;
\ No newline at end of file
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlaps/interval_overlaps.1.ddl.sqlpp
similarity index 64%
copy from
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
copy to
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlaps/interval_overlaps.1.ddl.sqlpp
index b5f0bba..ab7c0cd 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlaps/interval_overlaps.1.ddl.sqlpp
@@ -16,15 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.operators.joins.interval.utils;
-
-import java.io.Serializable;
+/*
+ * Description : Check temporal join spilling functionality for
interval overlaps
+ * Expected Result : Success
+ * Date : 13th Aug, 2020
+ */
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
+drop dataverse IntervalTest if exists;
+create dataverse IntervalTest;
+use IntervalTest;
-public interface IIntervalJoinUtilFactory extends Serializable {
+create type IntervalType as open {
+id: int64,
+interval: interval,
+filler: string
+};
- IIntervalJoinUtil createIntervalMergeJoinChecker(int[] keys0, int[] keys1,
IHyracksTaskContext ctx, int nPartitions)
- throws HyracksDataException;
-}
+create dataset DataSet1(IntervalType) primary key id;
+create dataset DataSet2(IntervalType) primary key id;
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlaps/interval_overlaps.2.update.sqlpp
similarity index 50%
copy from
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
copy to
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlaps/interval_overlaps.2.update.sqlpp
index cdfaafd..de06fde 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlaps/interval_overlaps.2.update.sqlpp
@@ -16,19 +16,33 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.operators.joins.interval.utils;
-
-import org.apache.asterix.om.pointables.nonvisitor.AIntervalPointable;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class CoversIntervalJoinUtil extends AbstractIntervalJoinUtil {
+/*
+ * Description : Check temporal join spilling functionality for
interval overlaps
+ * Expected Result : Success
+ * Date : 13th Aug, 2020
+ */
+use IntervalTest;
- public CoversIntervalJoinUtil(int[] keysLeft, int[] keysRight) {
- super(keysLeft[0], keysRight[0]);
- }
+insert into DataSet1
+from range(1, 100) s at srow,
+ range(1, 1) l at lrow
+let filler = repeat("i", 10000),
+ lambda = 1, d = 20,
+ id = (srow-1) * lambda + lrow
+select value {
+"id": id,
+"interval": interval(datetime_from_unix_time_in_secs(s),
datetime_from_unix_time_in_secs(s + d)),
+"filler": filler
+};
- @Override
- public boolean compareInterval(AIntervalPointable ipLeft,
AIntervalPointable ipRight) throws HyracksDataException {
- return il.covers(ipLeft, ipRight);
- }
-}
+insert into DataSet2
+from range(1, 100) s at srow,
+ range(1, 1) l at lrow
+let filler = repeat("i", 10000),
+ lambda = 1, d = 20,
+ id = (srow-1) * lambda + lrow
+select value {
+"id": id,
+"interval": interval(datetime_from_unix_time_in_secs(s),
datetime_from_unix_time_in_secs(s + d)),
+"filler": filler
+};
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlaps/interval_overlaps.3.query.sqlpp
similarity index 57%
copy from
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
copy to
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlaps/interval_overlaps.3.query.sqlpp
index cdfaafd..becc9e7 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/temporal/interval_joins_spilling/interval_overlaps/interval_overlaps.3.query.sqlpp
@@ -16,19 +16,19 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.operators.joins.interval.utils;
-
-import org.apache.asterix.om.pointables.nonvisitor.AIntervalPointable;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
+/*
+ * Description : Check temporal join spilling functionality for
interval overlaps
+ * Expected Result : Success
+ * Date : 13th Aug, 2020
+ */
-public class CoversIntervalJoinUtil extends AbstractIntervalJoinUtil {
+use IntervalTest;
- public CoversIntervalJoinUtil(int[] keysLeft, int[] keysRight) {
- super(keysLeft[0], keysRight[0]);
- }
+select count(*)
+from (select element { "id1" : ds1.id, "id2" : ds2.id, "spill" :
length(ds1.filler || ds2.filler)}
+ from DataSet1 as ds1, DataSet2 as ds2
+ where
+ /*+ range [datetime("1970-01-01T00:00:05.000Z"),
datetime("1970-01-01T00:00:10.000Z"), datetime("1970-01-01T00:00:15.000Z")] */
+ interval_overlaps(ds1.interval, ds2.interval)) as results0
+where results0.id1 > 1 or results0.filler = 1;
- @Override
- public boolean compareInterval(AIntervalPointable ipLeft,
AIntervalPointable ipRight) throws HyracksDataException {
- return il.covers(ipLeft, ipRight);
- }
-}
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_after/interval_after.3.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_after/interval_after.3.adm
new file mode 100644
index 0000000..393d858
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_after/interval_after.3.adm
@@ -0,0 +1 @@
+{ "$1": 4753 }
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_before/interval_before.3.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_before/interval_before.3.adm
new file mode 100644
index 0000000..c114617
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_before/interval_before.3.adm
@@ -0,0 +1 @@
+{ "$1": 4656 }
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_covered_by/interval_covered_by.3.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_covered_by/interval_covered_by.3.adm
new file mode 100644
index 0000000..b3d2794
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_covered_by/interval_covered_by.3.adm
@@ -0,0 +1 @@
+{ "$1": 1728 }
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_covers/interval_covers.3.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_covers/interval_covers.3.adm
new file mode 100644
index 0000000..81026fe
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_covers/interval_covers.3.adm
@@ -0,0 +1 @@
+{ "$1": 1710 }
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_overlapped_by/interval_overlapped_by.3.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_overlapped_by/interval_overlapped_by.3.adm
new file mode 100644
index 0000000..81026fe
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_overlapped_by/interval_overlapped_by.3.adm
@@ -0,0 +1 @@
+{ "$1": 1710 }
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_overlapping/interval_overlapping.3.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_overlapping/interval_overlapping.3.adm
new file mode 100644
index 0000000..5e118ee
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_overlapping/interval_overlapping.3.adm
@@ -0,0 +1 @@
+{ "$1": 1800 }
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_overlaps/interval_overlaps.3.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_overlaps/interval_overlaps.3.adm
new file mode 100644
index 0000000..2dfe912
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins_spilling/interval_overlaps/interval_overlaps.3.adm
@@ -0,0 +1 @@
+{ "$1": 1691 }
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/IntervalMergeJoinOperatorDescriptor.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/IntervalMergeJoinOperatorDescriptor.java
index f28faf1..0417ee0 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/IntervalMergeJoinOperatorDescriptor.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/IntervalMergeJoinOperatorDescriptor.java
@@ -46,22 +46,17 @@ public class IntervalMergeJoinOperatorDescriptor extends
AbstractOperatorDescrip
private static final int JOIN_BUILD_ACTIVITY_ID = 0;
private static final int JOIN_PROBE_ACTIVITY_ID = 1;
- private final int[] leftKeys;
- private final int[] rightKeys;
+ private final int buildKey;
+ private final int probeKey;
private final int memoryForJoin;
private final IIntervalJoinUtilFactory imjcf;
- private final int probeKey;
- private final int buildKey;
-
- public IntervalMergeJoinOperatorDescriptor(IOperatorDescriptorRegistry
spec, int memoryForJoin, int[] leftKeys,
- int[] rightKeys, RecordDescriptor recordDescriptor,
IIntervalJoinUtilFactory imjcf) {
+ public IntervalMergeJoinOperatorDescriptor(IOperatorDescriptorRegistry
spec, int memoryForJoin, int[] buildKey,
+ int[] probeKeys, RecordDescriptor recordDescriptor,
IIntervalJoinUtilFactory imjcf) {
super(spec, 2, 1);
outRecDescs[0] = recordDescriptor;
- this.buildKey = leftKeys[0];
- this.probeKey = rightKeys[0];
- this.leftKeys = leftKeys;
- this.rightKeys = rightKeys;
+ this.buildKey = buildKey[0];
+ this.probeKey = probeKeys[0];
this.memoryForJoin = memoryForJoin;
this.imjcf = imjcf;
}
@@ -115,8 +110,7 @@ public class IntervalMergeJoinOperatorDescriptor extends
AbstractOperatorDescrip
state = new
JoinCacheTaskState(ctx.getJobletContext().getJobId(),
new TaskId(getActivityId(), partition));
- IIntervalJoinUtil imjc =
- imjcf.createIntervalMergeJoinChecker(leftKeys,
rightKeys, ctx, nPartitions);
+ IIntervalJoinUtil imjc =
imjcf.createIntervalMergeJoinUtil(buildKey, probeKey, ctx, nPartitions);
state.joiner = new IntervalMergeJoiner(ctx, memoryForJoin,
imjc, buildKey, probeKey, rd0, rd1);
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/IntervalMergeJoiner.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/IntervalMergeJoiner.java
index 13d8c25..d1d2310 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/IntervalMergeJoiner.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/IntervalMergeJoiner.java
@@ -86,17 +86,14 @@ public class IntervalMergeJoiner {
protected final FrameTupleAppender resultAppender;
protected final ITupleAccessor[] inputAccessor;
- protected long[] frameCounts = { 0, 0 };
- protected long[] tupleCounts = { 0, 0 };
-
public IntervalMergeJoiner(IHyracksTaskContext ctx, int memorySize,
IIntervalJoinUtil mjc, int buildKeys,
int probeKeys, RecordDescriptor buildRd, RecordDescriptor probeRd)
throws HyracksDataException {
this.mjc = mjc;
// Memory (probe buffer)
- if (memorySize < 1) {
+ if (memorySize < 5) {
throw new HyracksDataException(
- "MergeJoiner does not have enough memory (needs > 0, got "
+ memorySize + ").");
+ "MergeJoiner does not have enough memory (needs > 4, got "
+ memorySize + ").");
}
inputAccessor = new TupleAccessor[JOIN_PARTITIONS];
@@ -107,7 +104,8 @@ public class IntervalMergeJoiner {
inputBuffer[BUILD_PARTITION] = new VSizeFrame(ctx);
inputBuffer[PROBE_PARTITION] = new VSizeFrame(ctx);
- framePool = new DeallocatableFramePool(ctx, (memorySize) *
ctx.getInitialFrameSize());
+ //Two frames are used for the runfile stream, and one frame for each
input (2 outputs).
+ framePool = new DeallocatableFramePool(ctx, (memorySize - 4) *
ctx.getInitialFrameSize());
bufferManager = new
IntervalVariableDeletableTupleMemoryManager(framePool, probeRd);
memoryAccessor = ((IntervalVariableDeletableTupleMemoryManager)
bufferManager).createTupleAccessor();
@@ -145,8 +143,10 @@ public class IntervalMergeJoiner {
TupleStatus buildTs = loadBuildTuple();
TupleStatus probeTs = loadProbeTuple();
- while (buildTs.isLoaded() && (probeTs.isLoaded() ||
memoryHasTuples())) {
- if (probeTs.isLoaded()) {
+ while (buildTs.isLoaded() && probeTs.isLoaded()) {
+ if (probeTs.isLoaded() &&
mjc.checkToLoadNextProbeTuple(inputAccessor[BUILD_PARTITION],
+ inputAccessor[BUILD_PARTITION].getTupleId(),
inputAccessor[PROBE_PARTITION],
+ inputAccessor[PROBE_PARTITION].getTupleId())) {
// Right side from stream
processProbeTuple(writer);
probeTs = loadProbeTuple();
@@ -159,6 +159,14 @@ public class IntervalMergeJoiner {
}
public void processProbeClose(IFrameWriter writer) throws
HyracksDataException {
+
+ TupleStatus buildTs = loadBuildTuple();
+ while (buildTs.isLoaded() && memoryHasTuples()) {
+ // Left side from stream
+ processBuildTuple(writer);
+ buildTs = loadBuildTuple();
+ }
+
resultAppender.write(writer, true);
runFileStream.close();
runFileStream.removeRunFile();
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/AbstractIntervalInverseJoinUtil.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/AbstractIntervalInverseJoinUtil.java
index 7830b0c..b45dd98 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/AbstractIntervalInverseJoinUtil.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/AbstractIntervalInverseJoinUtil.java
@@ -23,30 +23,38 @@ import org.apache.hyracks.api.comm.IFrameTupleAccessor;
public abstract class AbstractIntervalInverseJoinUtil extends
AbstractIntervalJoinUtil {
- public AbstractIntervalInverseJoinUtil(int idLeft, int idRight) {
- super(idLeft, idRight);
+ public AbstractIntervalInverseJoinUtil(int idBuild, int idProbe) {
+ super(idBuild, idProbe);
}
/**
* Right (second argument) interval starts before left (first argument)
interval ends.
*/
@Override
- public boolean checkToSaveInMemory(IFrameTupleAccessor accessorLeft, int
leftTupleIndex,
- IFrameTupleAccessor accessorRight, int rightTupleIndex) {
- long start0 = IntervalJoinUtil.getIntervalStart(accessorLeft,
leftTupleIndex, idLeft);
- long end1 = IntervalJoinUtil.getIntervalEnd(accessorRight,
rightTupleIndex, idRight);
- return start0 < end1;
+ public boolean checkToSaveInMemory(IFrameTupleAccessor buildAccessor, int
buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) {
+ long buildStart = IntervalJoinUtil.getIntervalStart(buildAccessor,
buildTupleIndex, idBuild);
+ long probeEnd = IntervalJoinUtil.getIntervalEnd(probeAccessor,
probeTupleIndex, idProbe);
+ return buildStart < probeEnd;
}
/**
* Left (first argument) interval starts after the Right (second argument)
interval ends.
*/
@Override
- public boolean checkToRemoveInMemory(IFrameTupleAccessor accessorLeft, int
leftTupleIndex,
- IFrameTupleAccessor accessorRight, int rightTupleIndex) {
- long start0 = IntervalJoinUtil.getIntervalStart(accessorLeft,
leftTupleIndex, idLeft);
- long end1 = IntervalJoinUtil.getIntervalEnd(accessorRight,
rightTupleIndex, idRight);
- return start0 >= end1;
+ public boolean checkToRemoveInMemory(IFrameTupleAccessor buildAccessor,
int buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) {
+ long buildStart = IntervalJoinUtil.getIntervalStart(buildAccessor,
buildTupleIndex, idBuild);
+ long probeEnd = IntervalJoinUtil.getIntervalEnd(probeAccessor,
probeTupleIndex, idProbe);
+ return buildStart >= probeEnd;
+ }
+
+ @Override
+ public boolean checkToLoadNextProbeTuple(IFrameTupleAccessor
buildAccessor, int buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) {
+ long buildStart = IntervalJoinUtil.getIntervalStart(buildAccessor,
buildTupleIndex, idBuild);
+ long probeStart = IntervalJoinUtil.getIntervalStart(probeAccessor,
probeTupleIndex, idProbe);
+ return buildStart >= probeStart;
}
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/AbstractIntervalJoinUtil.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/AbstractIntervalJoinUtil.java
index da50ab2..80d791c 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/AbstractIntervalJoinUtil.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/AbstractIntervalJoinUtil.java
@@ -18,98 +18,76 @@
*/
package org.apache.asterix.runtime.operators.joins.interval.utils;
-import org.apache.asterix.formats.nontagged.BinaryComparatorFactoryProvider;
import org.apache.asterix.om.pointables.nonvisitor.AIntervalPointable;
-import org.apache.asterix.om.types.BuiltinType;
import org.apache.asterix.runtime.evaluators.functions.temporal.IntervalLogic;
import
org.apache.asterix.runtime.operators.joins.interval.utils.memory.IntervalJoinUtil;
import org.apache.hyracks.api.comm.IFrameTupleAccessor;
-import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.TaggedValuePointable;
-import org.apache.hyracks.data.std.primitive.VoidPointable;
public abstract class AbstractIntervalJoinUtil implements IIntervalJoinUtil {
- protected final int idLeft;
- protected final int idRight;
+ protected final int idBuild;
+ protected final int idProbe;
protected final IntervalLogic il = new IntervalLogic();
+ protected final AIntervalPointable ipBuild = (AIntervalPointable)
AIntervalPointable.FACTORY.createPointable();
+ protected final AIntervalPointable ipProbe = (AIntervalPointable)
AIntervalPointable.FACTORY.createPointable();
- protected final TaggedValuePointable tvp =
TaggedValuePointable.FACTORY.createPointable();
- protected final AIntervalPointable ipLeft = (AIntervalPointable)
AIntervalPointable.FACTORY.createPointable();
- protected final AIntervalPointable ipRight = (AIntervalPointable)
AIntervalPointable.FACTORY.createPointable();
-
- protected final IBinaryComparator ch =
BinaryComparatorFactoryProvider.INSTANCE
- .getBinaryComparatorFactory(BuiltinType.ANY, BuiltinType.ANY,
true).createBinaryComparator();
- protected final IPointable startLeft =
VoidPointable.FACTORY.createPointable();
- protected final IPointable startRight =
VoidPointable.FACTORY.createPointable();
-
- public AbstractIntervalJoinUtil(int idLeft, int idRight) {
- this.idLeft = idLeft;
- this.idRight = idRight;
+ public AbstractIntervalJoinUtil(int idBuild, int idProbe) {
+ this.idBuild = idBuild;
+ this.idProbe = idProbe;
}
/**
* Right (second argument) interval starts before left (first argument)
interval ends.
*/
@Override
- public boolean checkToSaveInMemory(IFrameTupleAccessor accessorLeft, int
leftTupleIndex,
- IFrameTupleAccessor accessorRight, int rightTupleIndex) {
- long start1 = IntervalJoinUtil.getIntervalStart(accessorRight,
rightTupleIndex, idRight);
- long start0 = IntervalJoinUtil.getIntervalStart(accessorLeft,
leftTupleIndex, idLeft);
- return start0 <= start1;
- }
-
- /**
- * Left (first argument) interval starts after the Right (second argument)
interval ends.
- */
- @Override
- public boolean checkToRemoveInMemory(IFrameTupleAccessor accessorLeft, int
leftTupleIndex,
- IFrameTupleAccessor accessorRight, int rightTupleIndex) {
- long start0 = IntervalJoinUtil.getIntervalStart(accessorLeft,
leftTupleIndex, idLeft);
- long start1 = IntervalJoinUtil.getIntervalStart(accessorRight,
rightTupleIndex, idRight);
- return start0 > start1;
+ public boolean checkToSaveInMemory(IFrameTupleAccessor buildAccessor, int
buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) {
+ long buildStart = IntervalJoinUtil.getIntervalStart(buildAccessor,
buildTupleIndex, idBuild);
+ long probeStart = IntervalJoinUtil.getIntervalStart(probeAccessor,
probeTupleIndex, idProbe);
+ return buildStart <= probeStart;
}
/**
* Left (first argument) interval starts after the Right (second argument)
interval ends.
*/
@Override
- public boolean checkIfMoreMatches(IFrameTupleAccessor accessorLeft, int
leftTupleIndex,
- IFrameTupleAccessor accessorRight, int rightTupleIndex) {
- long start1 = IntervalJoinUtil.getIntervalStart(accessorRight,
rightTupleIndex, idRight);
- long end0 = IntervalJoinUtil.getIntervalEnd(accessorLeft,
leftTupleIndex, idLeft);
- return end0 > start1;
+ public boolean checkToRemoveInMemory(IFrameTupleAccessor buildAccessor,
int buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) {
+ long buildStart = IntervalJoinUtil.getIntervalStart(buildAccessor,
buildTupleIndex, idBuild);
+ long probeStart = IntervalJoinUtil.getIntervalStart(probeAccessor,
probeTupleIndex, idProbe);
+ return buildStart > probeStart;
}
@Override
- public boolean checkToSaveInResult(IFrameTupleAccessor accessorLeft, int
leftTupleIndex,
- IFrameTupleAccessor accessorRight, int rightTupleIndex, boolean
reversed) throws HyracksDataException {
- if (reversed) {
- IntervalJoinUtil.getIntervalPointable(accessorLeft,
leftTupleIndex, idLeft, ipRight);
- IntervalJoinUtil.getIntervalPointable(accessorRight,
rightTupleIndex, idRight, ipLeft);
- } else {
- IntervalJoinUtil.getIntervalPointable(accessorLeft,
leftTupleIndex, idLeft, ipLeft);
- IntervalJoinUtil.getIntervalPointable(accessorRight,
rightTupleIndex, idRight, ipRight);
- }
- return compareInterval(ipLeft, ipRight);
+ public boolean checkToSaveInResult(IFrameTupleAccessor buildAccessor, int
buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) throws
HyracksDataException {
+ IntervalJoinUtil.getIntervalPointable(buildAccessor, buildTupleIndex,
idBuild, ipBuild);
+ IntervalJoinUtil.getIntervalPointable(probeAccessor, probeTupleIndex,
idProbe, ipProbe);
+ return compareInterval(ipBuild, ipProbe);
}
/**
* Right (second argument) interval starts before left (first argument)
interval ends.
*/
@Override
- public boolean checkForEarlyExit(IFrameTupleAccessor accessorLeft, int
leftTupleIndex,
- IFrameTupleAccessor accessorRight, int rightTupleIndex) {
- long start1 = IntervalJoinUtil.getIntervalStart(accessorRight,
rightTupleIndex, idRight);
- long end0 = IntervalJoinUtil.getIntervalEnd(accessorLeft,
leftTupleIndex, idLeft);
- return end0 < start1;
+ public boolean checkForEarlyExit(IFrameTupleAccessor buildAccessor, int
buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) {
+ long buildEnd = IntervalJoinUtil.getIntervalEnd(buildAccessor,
buildTupleIndex, idBuild);
+ long probeStart = IntervalJoinUtil.getIntervalStart(probeAccessor,
probeTupleIndex, idProbe);
+ return buildEnd < probeStart;
}
@Override
- public abstract boolean compareInterval(AIntervalPointable ipLeft,
AIntervalPointable ipRight)
+ public abstract boolean compareInterval(AIntervalPointable ipBuild,
AIntervalPointable ipProbe)
throws HyracksDataException;
+ @Override
+ public boolean checkToLoadNextProbeTuple(IFrameTupleAccessor
buildAccessor, int buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) {
+ long buildEnd = IntervalJoinUtil.getIntervalEnd(buildAccessor,
buildTupleIndex, idBuild);
+ long probeStart = IntervalJoinUtil.getIntervalStart(probeAccessor,
probeTupleIndex, idProbe);
+ return buildEnd > probeStart;
+ }
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/AfterIntervalJoinUtil.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/AfterIntervalJoinUtil.java
index e192943..5dd4c44 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/AfterIntervalJoinUtil.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/AfterIntervalJoinUtil.java
@@ -25,38 +25,38 @@ import
org.apache.hyracks.api.exceptions.HyracksDataException;
public class AfterIntervalJoinUtil extends AbstractIntervalJoinUtil {
- public AfterIntervalJoinUtil(int[] keysLeft, int[] keysRight) {
- super(keysLeft[0], keysRight[0]);
+ public AfterIntervalJoinUtil(int buildKey, int probeKey) {
+ super(buildKey, probeKey);
}
@Override
- public boolean checkToSaveInMemory(IFrameTupleAccessor accessorLeft, int
leftTupleID,
- IFrameTupleAccessor accessorRight, int rightTupleID) {
- long start0 = IntervalJoinUtil.getIntervalStart(accessorLeft,
leftTupleID, idRight);
- long start1 = IntervalJoinUtil.getIntervalStart(accessorRight,
rightTupleID, idRight);
- return start0 >= start1;
+ public boolean checkToSaveInMemory(IFrameTupleAccessor buildAccessor, int
buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) {
+ return true;
}
@Override
- public boolean checkToRemoveInMemory(IFrameTupleAccessor accessorLeft, int
leftTupleIndex,
- IFrameTupleAccessor accessorRight, int rightTupleIndex) {
+ public boolean checkToRemoveInMemory(IFrameTupleAccessor buildAccessor,
int buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) {
return false;
}
@Override
- public boolean checkForEarlyExit(IFrameTupleAccessor accessorLeft, int
leftTupleIndex,
- IFrameTupleAccessor accessorRight, int rightTupleIndex) {
+ public boolean checkForEarlyExit(IFrameTupleAccessor buildAccessor, int
buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) {
return false;
}
@Override
- public boolean checkIfMoreMatches(IFrameTupleAccessor accessorLeft, int
leftTupleIndex,
- IFrameTupleAccessor accessorRight, int rightTupleIndex) {
- return true;
+ public boolean compareInterval(AIntervalPointable ipBuild,
AIntervalPointable ipProbe) throws HyracksDataException {
+ return il.after(ipBuild, ipProbe);
}
@Override
- public boolean compareInterval(AIntervalPointable ipLeft,
AIntervalPointable ipRight) throws HyracksDataException {
- return il.after(ipLeft, ipRight);
+ public boolean checkToLoadNextProbeTuple(IFrameTupleAccessor
buildAccessor, int buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) {
+ long buildEnd = IntervalJoinUtil.getIntervalEnd(buildAccessor,
buildTupleIndex, idBuild);
+ long probeStart = IntervalJoinUtil.getIntervalStart(probeAccessor,
probeTupleIndex, idProbe);
+ return probeStart <= buildEnd;
}
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/AfterIntervalJoinUtilFactory.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/AfterIntervalJoinUtilFactory.java
index b54edf8..9fe4e9d 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/AfterIntervalJoinUtilFactory.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/AfterIntervalJoinUtilFactory.java
@@ -24,8 +24,8 @@ public class AfterIntervalJoinUtilFactory implements
IIntervalJoinUtilFactory {
private static final long serialVersionUID = 1L;
@Override
- public IIntervalJoinUtil createIntervalMergeJoinChecker(int[] keys0, int[]
keys1, IHyracksTaskContext ctx,
+ public IIntervalJoinUtil createIntervalMergeJoinUtil(int buildKey, int
probeKey, IHyracksTaskContext ctx,
int nPartitions) {
- return new AfterIntervalJoinUtil(keys0, keys1);
+ return new AfterIntervalJoinUtil(buildKey, probeKey);
}
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/BeforeIntervalJoinUtil.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/BeforeIntervalJoinUtil.java
index 304775c..5212a4d 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/BeforeIntervalJoinUtil.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/BeforeIntervalJoinUtil.java
@@ -25,38 +25,38 @@ import
org.apache.hyracks.api.exceptions.HyracksDataException;
public class BeforeIntervalJoinUtil extends AbstractIntervalJoinUtil {
- public BeforeIntervalJoinUtil(int[] keysLeft, int[] keysRight) {
- super(keysLeft[0], keysRight[0]);
+ public BeforeIntervalJoinUtil(int buildKey, int probeKey) {
+ super(buildKey, probeKey);
}
@Override
- public boolean checkToSaveInMemory(IFrameTupleAccessor accessorLeft, int
leftTupleID,
- IFrameTupleAccessor accessorRight, int rightTupleID) {
- long start0 = IntervalJoinUtil.getIntervalStart(accessorLeft,
leftTupleID, idRight);
- long start1 = IntervalJoinUtil.getIntervalStart(accessorRight,
rightTupleID, idRight);
- return start0 <= start1;
+ public boolean checkToSaveInMemory(IFrameTupleAccessor buildAccessor, int
buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) {
+ long buildStart = IntervalJoinUtil.getIntervalStart(buildAccessor,
buildTupleIndex, idBuild);
+ long probeStart = IntervalJoinUtil.getIntervalStart(probeAccessor,
probeTupleIndex, idProbe);
+ return buildStart < probeStart;
}
@Override
- public boolean checkToRemoveInMemory(IFrameTupleAccessor accessorLeft, int
leftTupleIndex,
- IFrameTupleAccessor accessorRight, int rightTupleIndex) {
- return false;
+ public boolean checkToRemoveInMemory(IFrameTupleAccessor buildAccessor,
int buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) {
+ return !checkToSaveInMemory(buildAccessor, buildTupleIndex,
probeAccessor, probeTupleIndex);
}
@Override
- public boolean checkForEarlyExit(IFrameTupleAccessor accessorLeft, int
leftTupleIndex,
- IFrameTupleAccessor accessorRight, int rightTupleIndex) {
+ public boolean checkForEarlyExit(IFrameTupleAccessor buildAccessor, int
buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) {
return false;
}
@Override
- public boolean checkIfMoreMatches(IFrameTupleAccessor accessorLeft, int
leftTupleIndex,
- IFrameTupleAccessor accessorRight, int rightTupleIndex) {
- return true;
+ public boolean compareInterval(AIntervalPointable ipBuild,
AIntervalPointable ipProbe) throws HyracksDataException {
+ return il.before(ipBuild, ipProbe);
}
@Override
- public boolean compareInterval(AIntervalPointable ipLeft,
AIntervalPointable ipRight) throws HyracksDataException {
- return il.before(ipLeft, ipRight);
+ public boolean checkToLoadNextProbeTuple(IFrameTupleAccessor
buildAccessor, int buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) {
+ return true;
}
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/BeforeIntervalJoinUtilFactory.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/BeforeIntervalJoinUtilFactory.java
index a653ff9..1984caf 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/BeforeIntervalJoinUtilFactory.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/BeforeIntervalJoinUtilFactory.java
@@ -24,8 +24,8 @@ public class BeforeIntervalJoinUtilFactory implements
IIntervalJoinUtilFactory {
private static final long serialVersionUID = 1L;
@Override
- public IIntervalJoinUtil createIntervalMergeJoinChecker(int[] keys0, int[]
keys1, IHyracksTaskContext ctx,
+ public IIntervalJoinUtil createIntervalMergeJoinUtil(int buildKey, int
probeKey, IHyracksTaskContext ctx,
int nPartitions) {
- return new BeforeIntervalJoinUtil(keys0, keys1);
+ return new BeforeIntervalJoinUtil(buildKey, probeKey);
}
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoveredByIntervalJoinUtil.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoveredByIntervalJoinUtil.java
index a8e8177..91dfc66 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoveredByIntervalJoinUtil.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoveredByIntervalJoinUtil.java
@@ -25,35 +25,35 @@ import
org.apache.hyracks.api.exceptions.HyracksDataException;
public class CoveredByIntervalJoinUtil extends AbstractIntervalInverseJoinUtil
{
- public CoveredByIntervalJoinUtil(int[] keysLeft, int[] keysRight) {
- super(keysLeft[0], keysRight[0]);
+ public CoveredByIntervalJoinUtil(int buildKey, int probeKey) {
+ super(buildKey, probeKey);
}
/**
* Right (second argument) interval starts before left (first argument)
interval ends.
*/
@Override
- public boolean checkToSaveInMemory(IFrameTupleAccessor accessorLeft, int
leftTupleIndex,
- IFrameTupleAccessor accessorRight, int rightTupleIndex) {
- long start0 = IntervalJoinUtil.getIntervalStart(accessorLeft,
leftTupleIndex, idLeft);
- long end1 = IntervalJoinUtil.getIntervalEnd(accessorRight,
rightTupleIndex, idRight);
- return start0 <= end1;
+ public boolean checkToSaveInMemory(IFrameTupleAccessor buildAccessor, int
buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) {
+ long buildStart = IntervalJoinUtil.getIntervalStart(buildAccessor,
buildTupleIndex, idBuild);
+ long probeEnd = IntervalJoinUtil.getIntervalEnd(probeAccessor,
probeTupleIndex, idProbe);
+ return buildStart <= probeEnd;
}
/**
* Left (first argument) interval starts after the Right (second argument)
interval ends.
*/
@Override
- public boolean checkToRemoveInMemory(IFrameTupleAccessor accessorLeft, int
leftTupleIndex,
- IFrameTupleAccessor accessorRight, int rightTupleIndex) {
- long start0 = IntervalJoinUtil.getIntervalStart(accessorLeft,
leftTupleIndex, idLeft);
- long end1 = IntervalJoinUtil.getIntervalEnd(accessorRight,
rightTupleIndex, idRight);
- return start0 > end1;
+ public boolean checkToRemoveInMemory(IFrameTupleAccessor buildAccessor,
int buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) {
+ long buildStart = IntervalJoinUtil.getIntervalStart(buildAccessor,
buildTupleIndex, idBuild);
+ long probeEnd = IntervalJoinUtil.getIntervalEnd(probeAccessor,
probeTupleIndex, idProbe);
+ return buildStart > probeEnd;
}
@Override
- public boolean compareInterval(AIntervalPointable ipLeft,
AIntervalPointable ipRight) throws HyracksDataException {
- return il.coveredBy(ipLeft, ipRight);
+ public boolean compareInterval(AIntervalPointable ipBuild,
AIntervalPointable ipProbe) throws HyracksDataException {
+ return il.coveredBy(ipBuild, ipProbe);
}
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoveredByIntervalJoinUtilFactory.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoveredByIntervalJoinUtilFactory.java
index 7f52c11..4b21ae8 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoveredByIntervalJoinUtilFactory.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoveredByIntervalJoinUtilFactory.java
@@ -24,8 +24,8 @@ public class CoveredByIntervalJoinUtilFactory implements
IIntervalJoinUtilFactor
private static final long serialVersionUID = 1L;
@Override
- public IIntervalJoinUtil createIntervalMergeJoinChecker(int[] keys0, int[]
keys1, IHyracksTaskContext ctx,
+ public IIntervalJoinUtil createIntervalMergeJoinUtil(int buildKey, int
probeKey, IHyracksTaskContext ctx,
int nPartitions) {
- return new CoveredByIntervalJoinUtil(keys0, keys1);
+ return new CoveredByIntervalJoinUtil(buildKey, probeKey);
}
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
index cdfaafd..41c8c34 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtil.java
@@ -23,12 +23,12 @@ import
org.apache.hyracks.api.exceptions.HyracksDataException;
public class CoversIntervalJoinUtil extends AbstractIntervalJoinUtil {
- public CoversIntervalJoinUtil(int[] keysLeft, int[] keysRight) {
- super(keysLeft[0], keysRight[0]);
+ public CoversIntervalJoinUtil(int buildKey, int probeKey) {
+ super(buildKey, probeKey);
}
@Override
- public boolean compareInterval(AIntervalPointable ipLeft,
AIntervalPointable ipRight) throws HyracksDataException {
- return il.covers(ipLeft, ipRight);
+ public boolean compareInterval(AIntervalPointable ipBuild,
AIntervalPointable ipProbe) throws HyracksDataException {
+ return il.covers(ipBuild, ipProbe);
}
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtilFactory.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtilFactory.java
index 9b7481e..862aebe 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtilFactory.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/CoversIntervalJoinUtilFactory.java
@@ -24,8 +24,8 @@ public class CoversIntervalJoinUtilFactory implements
IIntervalJoinUtilFactory {
private static final long serialVersionUID = 1L;
@Override
- public IIntervalJoinUtil createIntervalMergeJoinChecker(int[] keys0, int[]
keys1, IHyracksTaskContext ctx,
+ public IIntervalJoinUtil createIntervalMergeJoinUtil(int buildKey, int
probeKey, IHyracksTaskContext ctx,
int nPartitions) {
- return new CoversIntervalJoinUtil(keys0, keys1);
+ return new CoversIntervalJoinUtil(buildKey, probeKey);
}
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtil.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtil.java
index 91c14b0..79eb2d7 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtil.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtil.java
@@ -29,74 +29,74 @@ public interface IIntervalJoinUtil {
* The memory is used to check the right tuple with the remaining left
tuples.
* The check is true if the next left tuple could still match with this
right tuple.
*
- * @param accessorLeft
- * @param accessorRight
+ * @param buildAccessor
+ * @param probeAccessor
* @return boolean
* @throws HyracksDataException
*/
- boolean checkToSaveInMemory(IFrameTupleAccessor accessorLeft, int
leftTupleIndex, IFrameTupleAccessor accessorRight,
- int rightTupleIndex) throws HyracksDataException;
+ boolean checkToSaveInMemory(IFrameTupleAccessor buildAccessor, int
buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex);
/**
* Check to see if the right tuple should be removed from memory during
the merge join.
* The memory is used to check the right tuple with the remaining left
tuples.
* The check is true if the next left tuple is NOT able match with this
right tuple.
*
- * @param accessorLeft
- * @param accessorRight
+ * @param buildAccessor
+ * @param probeAccessor
* @return boolean
* @throws HyracksDataException
*/
- boolean checkToRemoveInMemory(IFrameTupleAccessor accessorLeft, int
leftTupleIndex,
- IFrameTupleAccessor accessorRight, int rightTupleIndex) throws
HyracksDataException;
-
- /**
- * Check to see if the left tuple should continue checking for matches.
- * The check is true if the next left tuple is NOT able match with this
right tuple.
- *
- * @param accessorLeft
- * @param accessorRight
- * @return boolean
- * @throws HyracksDataException
- */
- boolean checkIfMoreMatches(IFrameTupleAccessor accessorLeft, int
leftTupleIndex, IFrameTupleAccessor accessorRight,
- int rightTupleIndex) throws HyracksDataException;
+ boolean checkToRemoveInMemory(IFrameTupleAccessor buildAccessor, int
buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex);
/**
* Check to see if tuples match join condition
* The check is true if they match.
*
- * @param accessorLeft
- * @param leftTupleIndex
- * @param accessorRight
- * @param rightTupleIndex
+ * @param buildAccessor
+ * @param buildTupleIndex
+ * @param probeAccessor
+ * @param probeTupleIndex
* @return boolean
* @throws HyracksDataException
*/
- boolean checkToSaveInResult(IFrameTupleAccessor accessorLeft, int
leftTupleIndex, IFrameTupleAccessor accessorRight,
- int rightTupleIndex, boolean reversed) throws HyracksDataException;
+ boolean checkToSaveInResult(IFrameTupleAccessor buildAccessor, int
buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) throws
HyracksDataException;
/**
* Check to see if the interval matches the join condition.
* The check is true if it matches.
*
- * @param ipLeft
- * @param ipRight
+ * @param ipBuild
+ * @param ipProbe
* @return boolean
* @throws HyracksDataException
*/
- boolean compareInterval(AIntervalPointable ipLeft, AIntervalPointable
ipRight) throws HyracksDataException;
+ boolean compareInterval(AIntervalPointable ipBuild, AIntervalPointable
ipProbe) throws HyracksDataException;
/**
* Check to see if the left tuple should stop checking for matches.
* The check is true if there can be no more matches
*
- * @param accessorLeft
- * @param accessorRight
+ * @param buildAccessor
+ * @param probeAccessor
+ * @return boolean
+ * @throws HyracksDataException
+ */
+ boolean checkForEarlyExit(IFrameTupleAccessor buildAccessor, int
buildTupleIndex, IFrameTupleAccessor probeAccessor,
+ int probeTupleIndex);
+
+ /**
+ * Check if next tuple should be loaded into memory.
+ * The check is true if there are more tuples
+ *
+ * @param buildAccessor
+ * @param probeAccessor
* @return boolean
* @throws HyracksDataException
*/
- boolean checkForEarlyExit(IFrameTupleAccessor accessorLeft, int
leftTupleIndex, IFrameTupleAccessor accessorRight,
- int rightTupleIndex) throws HyracksDataException;
+ boolean checkToLoadNextProbeTuple(IFrameTupleAccessor buildAccessor, int
buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex);
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
index b5f0bba..e9c2957 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/IIntervalJoinUtilFactory.java
@@ -25,6 +25,6 @@ import org.apache.hyracks.api.exceptions.HyracksDataException;
public interface IIntervalJoinUtilFactory extends Serializable {
- IIntervalJoinUtil createIntervalMergeJoinChecker(int[] keys0, int[] keys1,
IHyracksTaskContext ctx, int nPartitions)
+ IIntervalJoinUtil createIntervalMergeJoinUtil(int buildKey, int probeKey,
IHyracksTaskContext ctx, int nPartitions)
throws HyracksDataException;
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlappedByIntervalJoinUtil.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlappedByIntervalJoinUtil.java
index e2e79f9..2bd03a2 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlappedByIntervalJoinUtil.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlappedByIntervalJoinUtil.java
@@ -23,12 +23,12 @@ import
org.apache.hyracks.api.exceptions.HyracksDataException;
public class OverlappedByIntervalJoinUtil extends
AbstractIntervalInverseJoinUtil {
- public OverlappedByIntervalJoinUtil(int[] keysLeft, int[] keysRight) {
- super(keysLeft[0], keysRight[0]);
+ public OverlappedByIntervalJoinUtil(int buildKey, int probeKey) {
+ super(buildKey, probeKey);
}
@Override
- public boolean compareInterval(AIntervalPointable ipLeft,
AIntervalPointable ipRight) throws HyracksDataException {
- return il.overlappedBy(ipLeft, ipRight);
+ public boolean compareInterval(AIntervalPointable ipBuild,
AIntervalPointable ipProbe) throws HyracksDataException {
+ return il.overlappedBy(ipBuild, ipProbe);
}
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlappedByIntervalJoinUtilFactory.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlappedByIntervalJoinUtilFactory.java
index 74de359..d54982a 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlappedByIntervalJoinUtilFactory.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlappedByIntervalJoinUtilFactory.java
@@ -24,8 +24,8 @@ public class OverlappedByIntervalJoinUtilFactory implements
IIntervalJoinUtilFac
private static final long serialVersionUID = 1L;
@Override
- public IIntervalJoinUtil createIntervalMergeJoinChecker(int[] keys0, int[]
keys1, IHyracksTaskContext ctx,
+ public IIntervalJoinUtil createIntervalMergeJoinUtil(int buildKey, int
probeKey, IHyracksTaskContext ctx,
int nPartitions) {
- return new OverlappedByIntervalJoinUtil(keys0, keys1);
+ return new OverlappedByIntervalJoinUtil(buildKey, probeKey);
}
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlappingIntervalJoinUtil.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlappingIntervalJoinUtil.java
index 10a182c..9aeb09b 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlappingIntervalJoinUtil.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlappingIntervalJoinUtil.java
@@ -26,8 +26,8 @@ import org.apache.hyracks.api.exceptions.HyracksDataException;
public class OverlappingIntervalJoinUtil extends AbstractIntervalJoinUtil {
private final long partitionStart;
- public OverlappingIntervalJoinUtil(int[] keysLeft, int[] keysRight, long
partitionStart) {
- super(keysLeft[0], keysRight[0]);
+ public OverlappingIntervalJoinUtil(int buildKey, int probeKey, long
partitionStart) {
+ super(buildKey, probeKey);
this.partitionStart = partitionStart;
}
@@ -35,54 +35,49 @@ public class OverlappingIntervalJoinUtil extends
AbstractIntervalJoinUtil {
* Right (second argument) interval starts before left (first argument)
interval ends.
*/
@Override
- public boolean checkToSaveInMemory(IFrameTupleAccessor accessorLeft, int
leftTupleIndex,
- IFrameTupleAccessor accessorRight, int rightTupleIndex) {
- long start0 = IntervalJoinUtil.getIntervalStart(accessorLeft,
leftTupleIndex, idLeft);
- long end1 = IntervalJoinUtil.getIntervalEnd(accessorRight,
rightTupleIndex, idRight);
- return start0 < end1;
+ public boolean checkToSaveInMemory(IFrameTupleAccessor buildAccessor, int
buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) {
+ long buildStart = IntervalJoinUtil.getIntervalStart(buildAccessor,
buildTupleIndex, idBuild);
+ long probeEnd = IntervalJoinUtil.getIntervalEnd(probeAccessor,
probeTupleIndex, idProbe);
+ return buildStart < probeEnd;
}
/**
* Right (second argument) interval starts before left (first argument)
interval ends.
*/
@Override
- public boolean checkForEarlyExit(IFrameTupleAccessor accessorLeft, int
leftTupleIndex,
- IFrameTupleAccessor accessorRight, int rightTupleIndex) {
- long start1 = IntervalJoinUtil.getIntervalStart(accessorRight,
rightTupleIndex, idRight);
- long end0 = IntervalJoinUtil.getIntervalEnd(accessorLeft,
leftTupleIndex, idLeft);
- return end0 <= start1;
+ public boolean checkForEarlyExit(IFrameTupleAccessor buildAccessor, int
buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) {
+ long probeStart = IntervalJoinUtil.getIntervalStart(probeAccessor,
probeTupleIndex, idProbe);
+ long buildEnd = IntervalJoinUtil.getIntervalEnd(buildAccessor,
buildTupleIndex, idBuild);
+ return buildEnd <= probeStart;
}
/**
* Left (first argument) interval starts after the Right (second argument)
interval ends.
*/
@Override
- public boolean checkToRemoveInMemory(IFrameTupleAccessor accessorLeft, int
leftTupleIndex,
- IFrameTupleAccessor accessorRight, int rightTupleIndex) {
- long start0 = IntervalJoinUtil.getIntervalStart(accessorLeft,
leftTupleIndex, idLeft);
- long end1 = IntervalJoinUtil.getIntervalEnd(accessorRight,
rightTupleIndex, idRight);
- return start0 >= end1;
+ public boolean checkToRemoveInMemory(IFrameTupleAccessor buildAccessor,
int buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) {
+ long buildStart = IntervalJoinUtil.getIntervalStart(buildAccessor,
buildTupleIndex, idBuild);
+ long probeEnd = IntervalJoinUtil.getIntervalEnd(probeAccessor,
probeTupleIndex, idProbe);
+ return buildStart >= probeEnd;
}
@Override
- public boolean checkToSaveInResult(IFrameTupleAccessor accessorLeft, int
leftTupleIndex,
- IFrameTupleAccessor accessorRight, int rightTupleIndex, boolean
reversed) throws HyracksDataException {
- if (reversed) {
- IntervalJoinUtil.getIntervalPointable(accessorLeft,
leftTupleIndex, idLeft, ipRight);
- IntervalJoinUtil.getIntervalPointable(accessorRight,
rightTupleIndex, idRight, ipLeft);
- } else {
- IntervalJoinUtil.getIntervalPointable(accessorLeft,
leftTupleIndex, idLeft, ipLeft);
- IntervalJoinUtil.getIntervalPointable(accessorRight,
rightTupleIndex, idRight, ipRight);
- }
- if (ipLeft.getStartValue() < partitionStart && ipRight.getStartValue()
< partitionStart) {
+ public boolean checkToSaveInResult(IFrameTupleAccessor buildAccessor, int
buildTupleIndex,
+ IFrameTupleAccessor probeAccessor, int probeTupleIndex) throws
HyracksDataException {
+ IntervalJoinUtil.getIntervalPointable(buildAccessor, buildTupleIndex,
idBuild, ipBuild);
+ IntervalJoinUtil.getIntervalPointable(probeAccessor, probeTupleIndex,
idProbe, ipProbe);
+ if (ipBuild.getStartValue() < partitionStart &&
ipProbe.getStartValue() < partitionStart) {
// These tuples match in a different partition
return false;
}
- return compareInterval(ipLeft, ipRight);
+ return compareInterval(ipBuild, ipProbe);
}
@Override
- public boolean compareInterval(AIntervalPointable ipLeft,
AIntervalPointable ipRight) throws HyracksDataException {
- return il.overlapping(ipLeft, ipRight);
+ public boolean compareInterval(AIntervalPointable ipBuild,
AIntervalPointable ipProbe) throws HyracksDataException {
+ return il.overlapping(ipBuild, ipProbe);
}
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlappingIntervalJoinUtilFactory.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlappingIntervalJoinUtilFactory.java
index a1f3203..a77ceb2 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlappingIntervalJoinUtilFactory.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlappingIntervalJoinUtilFactory.java
@@ -35,7 +35,7 @@ public class OverlappingIntervalJoinUtilFactory implements
IIntervalJoinUtilFact
}
@Override
- public IIntervalJoinUtil createIntervalMergeJoinChecker(int[] keys0, int[]
keys1, IHyracksTaskContext ctx,
+ public IIntervalJoinUtil createIntervalMergeJoinUtil(int buildKey, int
probeKey, IHyracksTaskContext ctx,
int nPartitions) throws HyracksDataException {
int fieldIndex = 0;
int partition = ctx.getTaskAttemptId().getTaskId().getPartition();
@@ -66,6 +66,6 @@ public class OverlappingIntervalJoinUtilFactory implements
IIntervalJoinUtilFact
throw new HyracksDataException("RangeMap type is not
supported");
}
}
- return new OverlappingIntervalJoinUtil(keys0, keys1, partitionStart);
+ return new OverlappingIntervalJoinUtil(buildKey, probeKey,
partitionStart);
}
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlapsIntervalJoinUtil.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlapsIntervalJoinUtil.java
index 392c0cf..933c565 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlapsIntervalJoinUtil.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlapsIntervalJoinUtil.java
@@ -23,12 +23,12 @@ import
org.apache.hyracks.api.exceptions.HyracksDataException;
public class OverlapsIntervalJoinUtil extends AbstractIntervalJoinUtil {
- public OverlapsIntervalJoinUtil(int[] keysLeft, int[] keysRight) {
- super(keysLeft[0], keysRight[0]);
+ public OverlapsIntervalJoinUtil(int buildKey, int probeKey) {
+ super(buildKey, probeKey);
}
@Override
- public boolean compareInterval(AIntervalPointable ipLeft,
AIntervalPointable ipRight) throws HyracksDataException {
- return il.overlaps(ipLeft, ipRight);
+ public boolean compareInterval(AIntervalPointable ipBuild,
AIntervalPointable ipProbe) throws HyracksDataException {
+ return il.overlaps(ipBuild, ipProbe);
}
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlapsIntervalJoinUtilFactory.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlapsIntervalJoinUtilFactory.java
index fb8be0b..22dc816 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlapsIntervalJoinUtilFactory.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/OverlapsIntervalJoinUtilFactory.java
@@ -24,8 +24,8 @@ public class OverlapsIntervalJoinUtilFactory implements
IIntervalJoinUtilFactory
private static final long serialVersionUID = 1L;
@Override
- public IIntervalJoinUtil createIntervalMergeJoinChecker(int[] keys0, int[]
keys1, IHyracksTaskContext ctx,
+ public IIntervalJoinUtil createIntervalMergeJoinUtil(int buildKey, int
probeKey, IHyracksTaskContext ctx,
int nPartitions) {
- return new OverlapsIntervalJoinUtil(keys0, keys1);
+ return new OverlapsIntervalJoinUtil(buildKey, probeKey);
}
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/memory/IntervalSideTuple.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/memory/IntervalSideTuple.java
index cffc491..34c1e0e 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/memory/IntervalSideTuple.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/interval/utils/memory/IntervalSideTuple.java
@@ -77,23 +77,15 @@ public class IntervalSideTuple {
return end;
}
- public boolean hasMoreMatches(IntervalSideTuple ist) throws
HyracksDataException {
- return imjc.checkIfMoreMatches(accessor, tupleIndex, ist.accessor,
ist.tupleIndex);
- }
-
public boolean compareJoin(IntervalSideTuple ist) throws
HyracksDataException {
- return imjc.checkToSaveInResult(accessor, tupleIndex, ist.accessor,
ist.tupleIndex, false);
+ return imjc.checkToSaveInResult(accessor, tupleIndex, ist.accessor,
ist.tupleIndex);
}
- public boolean removeFromMemory(IntervalSideTuple ist) throws
HyracksDataException {
+ public boolean removeFromMemory(IntervalSideTuple ist) {
return imjc.checkToRemoveInMemory(accessor, tupleIndex, ist.accessor,
ist.tupleIndex);
}
- public boolean checkForEarlyExit(IntervalSideTuple ist) throws
HyracksDataException {
+ public boolean checkForEarlyExit(IntervalSideTuple ist) {
return imjc.checkForEarlyExit(accessor, tupleIndex, ist.accessor,
ist.tupleIndex);
}
-
- public boolean startsBefore(IntervalSideTuple ist) {
- return start <= ist.start;
- }
}