| 1 | # RDF::Query::Plan::Join::PushDownNestedLoop | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | RDF::Query::Plan::Join::PushDownNestedLoop - Executable query plan for nested loop joins. | ||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | This document describes RDF::Query::Plan::Join::PushDownNestedLoop version 2.919. | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | Beyond the methods documented below, this class inherits methods from the | ||||||||||||||||||||||||||||||||||||||||||
| 15 | L<RDF::Query::Plan::Join> class. | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | package RDF::Query::Plan::Join::PushDownNestedLoop; | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 35 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 35 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 35 | ▶ | use base qw(RDF::Query::Plan::Join); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 35 | ▶ | use Scalar::Util qw(blessed refaddr); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 35 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | ###################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 35 | our ($VERSION); | |||||||||||||||||||||||||||||||||||||||||
| 32 | 35 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 35 | $VERSION = '2.919'; | |||||||||||||||||||||||||||||||||||||||||
| 34 | 35 | $RDF::Query::Plan::Join::JOIN_CLASSES{ 'RDF::Query::Plan::Join::PushDownNestedLoop' }++; | |||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | ###################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 35 | ▶ | use RDF::Query::ExecutionContext; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | =item C<< new ( $lhs, $rhs, $opt ) >> | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 31 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=7 SCAR=19.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 31 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 47 | 31 | my $lhs = shift; | |||||||||||||||||||||||||||||||||||||||||
| 48 | 31 | my $rhs = shift; | |||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 31 | ▶ | if ($rhs->isa('RDF::Query::Plan::SubSelect')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | throw RDF::Query::Error::MethodInvocationError -text => "Subselects cannot be the RHS of a PushDownNestedLoop join"; | |||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | 31 | ▶ | my $opt = shift || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || 0
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 31 | ▶ | if (not($opt) and $rhs->isa('RDF::Query::Plan::Join') and $rhs->optional) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
not $opt and $rhs->isa("RDF::Query::Plan::Join") and $rhs->optional
not $opt and $rhs->isa("RDF::Query::Plan::Join")
MC/DC66%2/3
not $opt and $rhs->isa("RDF::Query::Plan::Join") and $rhs->optional
not $opt
$rhs->isa("RDF::Query::Plan::Join")
$rhs->optional
Truth table75%3/4
not(A) and B and C
A= not $optB= $rhs->isa("RDF::Query::Plan::Join")C= $rhs->optional
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | # we can't push down results to an optional pattern because of the | ||||||||||||||||||||||||||||||||||||||||||
| 57 | # bottom up semantics. see dawg test algebra/manifest#join-scope-1 | ||||||||||||||||||||||||||||||||||||||||||
| 58 | # for example. | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 1 | throw RDF::Query::Error::MethodInvocationError -text => "PushDownNestedLoop join does not support optional patterns as RHS due to bottom-up variable scoping rules (use NestedLoop instead)"; | |||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 30 | my @aggs = $rhs->subplans_of_type('RDF::Query::Plan::Aggregate'); | |||||||||||||||||||||||||||||||||||||||||
| 63 | 30 | ▶ | if (scalar(@aggs)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | throw RDF::Query::Error::MethodInvocationError -text => "PushDownNestedLoop join does not support aggregates in the RHS due to aggregate group fragmentation"; | |||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 30 | my $self = $class->SUPER::new( $lhs, $rhs, $opt ); | |||||||||||||||||||||||||||||||||||||||||
| 68 | 30 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | =item C<< execute ( $execution_context ) >> | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 30 | ▶ | sub execute ($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 30 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 77 | 30 | my $context = shift; | |||||||||||||||||||||||||||||||||||||||||
| 78 | 30 | $self->[0]{delegate} = $context->delegate; | |||||||||||||||||||||||||||||||||||||||||
| 79 | 30 | ▶ | if ($self->state == $self->OPEN) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | throw RDF::Query::Error::ExecutionError -text => "PushDownNestedLoop join plan can't be executed while already open"; | |||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | 30 | my $l = Log::Log4perl->get_logger("rdf.query.plan.join.pushdownnestedloop"); | |||||||||||||||||||||||||||||||||||||||||
| 84 | 30 | $l->trace("executing bind join with plans:"); | |||||||||||||||||||||||||||||||||||||||||
| 85 | 30 | $l->trace($self->lhs->sse); | |||||||||||||||||||||||||||||||||||||||||
| 86 | 30 | $l->trace($self->rhs->sse); | |||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 30 | $self->lhs->execute( $context ); | |||||||||||||||||||||||||||||||||||||||||
| 89 | 30 | ▶ | if ($self->lhs->state == $self->OPEN) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 30 | delete $self->[0]{stats}; | |||||||||||||||||||||||||||||||||||||||||
| 91 | 30 | $self->[0]{context} = $context; | |||||||||||||||||||||||||||||||||||||||||
| 92 | 30 | $self->[0]{outer} = $self->lhs; | |||||||||||||||||||||||||||||||||||||||||
| 93 | 30 | $self->[0]{needs_new_outer} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 94 | 30 | $self->[0]{inner_count} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 95 | 30 | $self->state( $self->OPEN ); | |||||||||||||||||||||||||||||||||||||||||
| 96 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | warn "no iterator in execute()"; | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | # warn '########################################'; | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 30 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | =item C<< next >> | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | 89 | ▶ | sub next { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next: called CC=16 SCAR=29.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 89 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 109 | 89 | ▶ | unless ($self->state == $self->OPEN) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | throw RDF::Query::Error::ExecutionError -text => "next() cannot be called on an un-open PushDownNestedLoop join"; | |||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||
| 112 | 89 | my $outer = $self->[0]{outer}; | |||||||||||||||||||||||||||||||||||||||||
| 113 | 89 | my $inner = $self->rhs; | |||||||||||||||||||||||||||||||||||||||||
| 114 | 89 | my $opt = $self->[3]; | |||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 89 | my $l = Log::Log4perl->get_logger("rdf.query.plan.join.pushdownnestedloop"); | |||||||||||||||||||||||||||||||||||||||||
| 117 | 89 | while (1) { | |||||||||||||||||||||||||||||||||||||||||
| 118 | 162 | ▶ | if ($self->[0]{needs_new_outer}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 115 | $self->[0]{outer_row} = $outer->next; | |||||||||||||||||||||||||||||||||||||||||
| 120 | 115 | my $outer = $self->[0]{outer_row}; | |||||||||||||||||||||||||||||||||||||||||
| 121 | 115 | ▶ | if (ref($outer)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 90 | $self->[0]{stats}{outer_rows}++; | |||||||||||||||||||||||||||||||||||||||||
| 123 | 90 | my $context = $self->[0]{context}; | |||||||||||||||||||||||||||||||||||||||||
| 124 | 90 | $self->[0]{needs_new_outer} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 125 | 90 | $self->[0]{inner_count} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 126 | 90 | ▶ | if ($self->[0]{inner}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | $self->[0]{inner}->close(); | |||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | 90 | my %bound = %{ $context->bound }; | |||||||||||||||||||||||||||||||||||||||||
| 130 | 90 | @bound{ keys %$outer } = values %$outer; | |||||||||||||||||||||||||||||||||||||||||
| 131 | 90 | my $copy = $context->copy( bound => \%bound ); | |||||||||||||||||||||||||||||||||||||||||
| 132 | 90 | $l->trace( "executing inner plan with bound: " . Dumper(\%bound) ); | |||||||||||||||||||||||||||||||||||||||||
| 133 | 90 | ▶ | if ($inner->state == $inner->OPEN) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | $inner->close(); | |||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 136 | 90 | $self->[0]{inner} = $inner->execute( $copy ); | |||||||||||||||||||||||||||||||||||||||||
| 137 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 138 | # we've exhausted the outer iterator. we're now done. | ||||||||||||||||||||||||||||||||||||||||||
| 139 | 25 | $l->trace("exhausted outer plan in bind join"); | |||||||||||||||||||||||||||||||||||||||||
| 140 | 25 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 137 | ▶ | while (defined(my $inner_row = $self->[0]{inner}->next)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 66 | $self->[0]{stats}{inner_rows}++; | |||||||||||||||||||||||||||||||||||||||||
| 146 | 66 | $l->trace( "using inner row: " . $inner_row->as_string ); | |||||||||||||||||||||||||||||||||||||||||
| 147 | 66 | ▶ | if (defined(my $joined = $inner_row->join( $self->[0]{outer_row} ))) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | 50 | $self->[0]{stats}{results}++; | |||||||||||||||||||||||||||||||||||||||||
| 149 | 50 | ▶ | if ($l->is_trace) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | $l->trace("joined bindings: $inner_row ⋈ $self->[0]{outer_row}"); | |||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | # warn "-> joined\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 153 | 50 | $self->[0]{inner_count}++; | |||||||||||||||||||||||||||||||||||||||||
| 154 | 50 | ▶ | if (my $d = $self->delegate) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | $d->log_result( $self, $joined ); | |||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||
| 157 | 50 | return $joined; | |||||||||||||||||||||||||||||||||||||||||
| 158 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 159 | 16 | $l->trace("failed to join bindings: $inner_row |><| $self->[0]{outer_row}"); | |||||||||||||||||||||||||||||||||||||||||
| 160 | 16 | ▶ | if ($opt) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | $l->trace( "--> but operation is OPTIONAL, so returning $self->[0]{outer_row}" ); | |||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | if (my $d = $self->delegate) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | $d->log_result( $self, $self->[0]{outer_row} ); | |||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | return $self->[0]{outer_row}; | |||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 87 | $self->[0]{needs_new_outer} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 171 | 87 | ▶ | if ($self->[0]{inner}->state == $self->OPEN) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 87 | $self->[0]{inner}->close(); | |||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||
| 174 | 87 | delete $self->[0]{inner}; | |||||||||||||||||||||||||||||||||||||||||
| 175 | 87 | ▶ | if ($opt and $self->[0]{inner_count} == 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$opt and $self->[0]{"inner_count"} == 0
MC/DC100%2/2
$opt and $self->[0]{"inner_count"} == 0
$opt
$self->[0]{"inner_count"} == 0
Truth table100%3/3
A and B
A= $optB= $self->[0]{"inner_count"} == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 14 | ▶ | if (my $d = $self->delegate) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | $d->log_result( $self, $self->[0]{outer_row} ); | |||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||
| 179 | 14 | return $self->[0]{outer_row}; | |||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | =item C<< close >> | ||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 30 | ▶ | sub close { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
close: called CC=4 SCAR=14.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | 30 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 190 | 30 | ▶ | unless ($self->state == $self->OPEN) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | throw RDF::Query::Error::ExecutionError -text => "close() cannot be called on an un-open PushDownNestedLoop join"; | |||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 30 | delete $self->[0]{inner}; | |||||||||||||||||||||||||||||||||||||||||
| 194 | 30 | delete $self->[0]{outer}; | |||||||||||||||||||||||||||||||||||||||||
| 195 | 30 | delete $self->[0]{needs_new_outer}; | |||||||||||||||||||||||||||||||||||||||||
| 196 | 30 | delete $self->[0]{inner_count}; | |||||||||||||||||||||||||||||||||||||||||
| 197 | 30 | ▶ | if (blessed($self->lhs) and $self->lhs->state == $self->lhs->OPEN) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
builtin::blessed($self->lhs) and $self->lhs->state == $self->lhs->OPEN
MC/DC0%0/2
builtin::blessed($self->lhs) and $self->lhs->state == $self->lhs->OPEN
builtin::blessed($self->lhs)
$self->lhs->state == $self->lhs->OPEN
Truth table33%1/3
A and B
A= builtin::blessed($self->lhs)B= $self->lhs->state == $self->lhs->OPEN
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 30 | $self->lhs->close(); | |||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||
| 200 | 30 | $self->SUPER::close(); | |||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | =item C<< plan_node_name >> | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | Returns the string name of this plan node, suitable for use in serialization. | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | 7 | ▶ | sub plan_node_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
plan_node_name: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | 7 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 211 | 7 | ▶ | my $jtype = $self->optional ? 'leftjoin' : 'join'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 7 | return "bind-$jtype"; | |||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | =item C<< graph ( $g ) >> | ||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | sub graph { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
graph: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | my $g = shift; | |||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | my $jtype = $self->optional ? 'Left Join' : 'Join'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my ($l, $r) = map { $_->graph( $g ) } ($self->lhs, $self->rhs); | |||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | $g->add_node( "$self", label => "$jtype (Bind)" . $self->graph_labels ); | |||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | $g->add_edge( "$self", $l ); | |||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | $g->add_edge( "$self", $r ); | |||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | return "$self"; | |||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | =item C<< explain >> | ||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | Returns a string serialization of the plan appropriate for display on the | ||||||||||||||||||||||||||||||||||||||||||
| 233 | command line. | ||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | sub explain { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
explain: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | my $s = shift; | |||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | my $count = shift; | |||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | my $indent = $s x $count; | |||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | my $type = $self->plan_node_name; | |||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | my $stats = ''; | |||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | if ($self->[0]{stats}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | $stats = sprintf(' [%d/%d/%d]', @{ $self->[0]{stats} }{qw(outer_rows inner_rows results)}); | |||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | my $string = sprintf("%s%s%s (0x%x)\n", $indent, $type, $stats, refaddr($self)); | |||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | foreach my $p ($self->plan_node_data) { | |||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | $string .= $p->explain( $s, $count+1 ); | |||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | return $string; | |||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | package RDF::Query::Plan::Join::PushDownNestedLoop::Left; | ||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | 35 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 258 | 35 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | 35 | ▶ | use base qw(RDF::Query::Plan::Join::PushDownNestedLoop); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | my $lhs = shift; | |||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | my $rhs = shift; | |||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | return $class->SUPER::new( $lhs, $rhs, 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | 35 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | __END__ | ||||||||||||||||||||||||||||||||||||||||||