| 1 | 9 | ▶ | use 5.010001; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 2 | 9 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 9 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | |||||||||||||
| 5 | |||||||||||||
| 6 | package AtteanX::QueryPlanner::Cache::LDF; | ||||||||||||
| 7 | |||||||||||||
| 8 | 9 | our $AUTHORITY = 'cpan:KJETILK'; | |||||||||||
| 9 | 9 | our $VERSION = '0.002'; | |||||||||||
| 10 | |||||||||||||
| 11 | 9 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 12 | 9 | ▶ | use AtteanX::Query::AccessPlan::PrefetchLDF; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 13 | |||||||||||||
| 14 | 9 | extends 'AtteanX::QueryPlanner::Cache'; | |||||||||||
| 15 | 9 | with 'AtteanX::Query::AccessPlan::PrefetchLDF'; | |||||||||||
| 16 | |||||||||||||
| 17 | # Only allow rotation on joins who have one child matching: - Either a | ||||||||||||
| 18 | # Attean::Plan::Quad, AtteanX::Plan::SPARQLBGP, or | ||||||||||||
| 19 | # AtteanX::Plan::LDF::Triple and the other child being a join | ||||||||||||
| 20 | |||||||||||||
| 21 | 0 | ▶ | sub allow_join_rotation { | ||||||||||
|
Subroutine
allow_join_rotation: not called CC=14 SCAR=53.5
Pod
undocumented
| |||||||||||||
| 22 | 0 | my $self = shift; | |||||||||||
| 23 | 0 | my $join = shift; | |||||||||||
| 24 | 0 | ▶ | my $quads = shift // 0; | ||||||||||
|
Condition0%0/2
shift() // 0
MC/DC0%0/1
shift() // 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||
| 25 | 0 | my $joins = 0; | |||||||||||
| 26 | 0 | my @grandchildren; | |||||||||||
| 27 | 0 | $self->log->trace("Seeking to rotate:\n" . $join->as_string); | |||||||||||
| 28 | 0 | foreach my $p (@{ $join->children }) { | |||||||||||
| 29 | 0 | ▶ | $quads++ if ($p->isa('Attean::Plan::Quad')); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 30 | 0 | ▶ | $quads++ if ($p->isa('AtteanX::Plan::LDF::Triple')); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 31 | 0 | ▶ | $quads++ if ($p->isa('AtteanX::Plan::SPARQLBGP')); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 32 | 0 | ▶ | if ($p->does('Attean::API::Plan::Join')) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 33 | 0 | $joins++; | |||||||||||
| 34 | 0 | push(@grandchildren, @{ $p->children }); | |||||||||||
| 35 | } | ||||||||||||
| 36 | } | ||||||||||||
| 37 | 0 | ▶ | return 0 unless ($joins == 1); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 38 | 0 | ▶ | return 0 unless ($quads == 1); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 39 | 0 | foreach my $p (@grandchildren) { | |||||||||||
| 40 | 0 | ▶ | $quads++ if ($p->isa('Attean::Plan::Quad')); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 41 | 0 | ▶ | $quads++ if ($p->isa('AtteanX::Plan::LDF::Triple')); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 42 | 0 | ▶ | $quads++ if ($p->isa('AtteanX::Plan::SPARQLBGP')); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 43 | } | ||||||||||||
| 44 | |||||||||||||
| 45 | 0 | ▶ | if ($quads >= 2) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 46 | 0 | $self->log->debug("Allowing rotation for $quads quads."); | |||||||||||
| 47 | 0 | return 1; | |||||||||||
| 48 | } else { | ||||||||||||
| 49 | 0 | $self->log->debug("Disallowing rotation, just $quads quad."); | |||||||||||
| 50 | 0 | return 0; | |||||||||||
| 51 | } | ||||||||||||
| 52 | } | ||||||||||||
| 53 | |||||||||||||
| 54 | |||||||||||||
| 55 | 9 | 1; | |||||||||||