Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
import com.apple.foundationdb.record.query.plan.cascades.rules.RemoveProjectionRule;
import com.apple.foundationdb.record.query.plan.cascades.rules.RemoveSortRule;
import com.apple.foundationdb.record.query.plan.cascades.rules.SplitSelectExtractIndependentQuantifiersRule;
import com.apple.foundationdb.record.query.plan.cascades.rules.WithPrimaryKeyDataAccessRule;

Check notice on line 85 in fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/PlanningRuleSet.java

View workflow job for this annotation

GitHub Actions / coverage

File coverage: 100.0% (25/25 lines) | Changed lines: N/A (no executable lines)
import com.apple.foundationdb.record.query.plan.plans.RecordQueryInComparandJoinPlan;
import com.apple.foundationdb.record.query.plan.plans.RecordQueryInParameterJoinPlan;
import com.apple.foundationdb.record.query.plan.plans.RecordQueryInUnionOnValuesPlan;
import com.apple.foundationdb.record.query.plan.plans.RecordQueryInValuesJoinPlan;
Expand Down Expand Up @@ -150,6 +151,7 @@
new MergeFetchIntoCoveringIndexRule(),
new PushInJoinThroughFetchRule<>(RecordQueryInValuesJoinPlan.class),
new PushInJoinThroughFetchRule<>(RecordQueryInParameterJoinPlan.class),
new PushInJoinThroughFetchRule<>(RecordQueryInComparandJoinPlan.class),
new PushMapThroughFetchRule(),
new PushFilterThroughFetchRule(),
new PushDistinctThroughFetchRule(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
import com.apple.foundationdb.record.query.plan.cascades.matching.structure.PlannerBindings;
import com.apple.foundationdb.record.query.plan.cascades.matching.structure.RecordQueryPlanMatchers;
import com.apple.foundationdb.record.query.plan.cascades.typing.Type;
import com.apple.foundationdb.record.query.plan.plans.RecordQueryFetchFromPartialRecordPlan;

Check notice on line 32 in fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/rules/PushInJoinThroughFetchRule.java

View workflow job for this annotation

GitHub Actions / coverage

File coverage: 100.0% (19/19 lines) | Changed lines: N/A (no executable lines)
import com.apple.foundationdb.record.query.plan.plans.RecordQueryInComparandJoinPlan;
import com.apple.foundationdb.record.query.plan.plans.RecordQueryInJoinPlan;
import com.apple.foundationdb.record.query.plan.plans.RecordQueryInParameterJoinPlan;
import com.apple.foundationdb.record.query.plan.plans.RecordQueryInValuesJoinPlan;
Expand Down Expand Up @@ -77,8 +78,9 @@
* +-------------+
* }
* </pre>
* @param <P> the type parameter of the actual in-join plan to match. Currently, this rule is used for both
* {@link RecordQueryInValuesJoinPlan} and {@link RecordQueryInParameterJoinPlan}.
* @param <P> the type parameter of the actual in-join plan to match. Currently, this rule is used for
* {@link RecordQueryInValuesJoinPlan}, {@link RecordQueryInParameterJoinPlan} and
* {@link RecordQueryInComparandJoinPlan}.
*/
@API(API.Status.EXPERIMENTAL)
public class PushInJoinThroughFetchRule<P extends RecordQueryInJoinPlan> extends AbstractCascadesRule<P> implements ImplementationCascadesRule<P> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -888,14 +888,13 @@ void prepareInListOfTuple() throws Exception {
final var structB = ddl.getConnection().createStruct("na", new Object[]{2L, "basil & brawn"});
ps.setArray(1, ddl.getConnection().createArrayOf("STRUCT", new Object[]{structA, structB}));

final var restNos = new HashSet<Long>();
try (var rs = ps.executeQuery()) {
ResultSetAssert.assertThat(rs)
.hasNextRow()
.hasColumn("REST_NO", 2L)
.hasNextRow()
.hasColumn("REST_NO", 1L)
.hasNoNextRow();
while (rs.next()) {
Assertions.assertThat(restNos.add(rs.getLong("REST_NO"))).isTrue();
}
}
Assertions.assertThat(restNos).containsExactlyInAnyOrder(1L, 2L);
}
}
}
Expand Down
Binary file modified yaml-tests/src/test/resources/array-join-at.metrics.binpb
Binary file not shown.
18 changes: 9 additions & 9 deletions yaml-tests/src/test/resources/array-join-at.metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ array-join-at:
explain: EXPLODE array((@c11 AS id, array(@c14) AS arr), (@c19 AS id, array(@c22,
@c24, @c26) AS arr)) | FLATMAP q0 -> { EXPLODE q0.arr WITH ORDINALITY AS q1
RETURN (q0.id AS id, q1._0 AS val, q1._1 + 1 AS at) }
task_count: 236
task_count: 238
task_total_time_ms: 2
transform_count: 70
transform_time_ms: 0
Expand Down Expand Up @@ -181,26 +181,26 @@ array-join-at:
insert_reused_count: 0
- query: EXPLAIN SELECT "id", "val", "at" FROM T1, T1."arr1_nn" AS "val" AT "at"
WHERE T1."id" IN (1, 2)
ref: array-join-at.yamsql:308
ref: array-join-at.yamsql:311
explain: '[IN arrayDistinct(promote(@c21 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS
T1, EQUALS q0]) | FLATMAP q1 -> { EXPLODE q1.arr1_nn WITH ORDINALITY AS q2
RETURN (q1.id AS id, q2._0 AS val, q2._1 + 1 AS at) } }'
task_count: 1162
task_total_time_ms: 14
task_count: 1167
task_total_time_ms: 63
transform_count: 452
transform_time_ms: 5
transform_time_ms: 24
transform_yield_count: 68
insert_time_ms: 0
insert_time_ms: 4
insert_new_count: 140
insert_reused_count: 9
- query: EXPLAIN SELECT "id", "val", "at" FROM T1, T1."arr1_nn" AS "val" AT "at"
WHERE "at" IN (1, 2)
ref: array-join-at.yamsql:320
ref: array-join-at.yamsql:323
explain: SCAN([IS T1]) | FLATMAP q0 -> { EXPLODE q0.arr1_nn WITH ORDINALITY |
FILTER _._1 + 1 IN @c19 AS q1 RETURN (q0.id AS id, q1._0 AS val, q1._1 + 1
AS at) }
task_count: 1045
task_total_time_ms: 27
task_count: 1048
task_total_time_ms: 30
transform_count: 420
transform_time_ms: 10
transform_yield_count: 51
Expand Down
Loading
Loading