| 1 | package DBIO::ResultSource::RowParser; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Build row-inflating parsers from result source metadata | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 383 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 383 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 379 | our $VERSION = '0.900007'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 383 | ▶ | use base 'DBIO::Base'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 380 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 380 | ▶ | use DBIO::ResultSource::RowParser::Util qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | assemble_simple_parser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | assemble_collapsing_parser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 380 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 380 | ▶ | use DBIO::Util qw(stresstest_utf8_upgrade_generated_collapser_source); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 379 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | # Accepts one or more relationships for the current source and returns an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | # array of column names for each of those relationships. Column names are | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # prefixed relative to the current source, in accordance with where they appear | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # in the supplied relationships. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 122 | ▶ | sub _resolve_prefetch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_resolve_prefetch: called CC=12 SCAR=25.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 122 | my ($self, $pre, $alias, $alias_map, $order, $pref_path) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 122 | ▶ | $pref_path ||= []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$pref_path ||= []
MC/DC100%1/1
$pref_path ||= []
$pref_path
Truth table100%2/2
A
A= $pref_path
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 122 | ▶ | if (not defined $pre or not length $pre) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition66%2/3
defined $pre && length $pre
MC/DC50%1/2
defined $pre && length $pre
defined $pre
length $pre
Truth table66%2/3
A && B
A= defined $preB= length $pre
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | return (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | elsif( ref $pre eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 50 | map { $self->_resolve_prefetch( $_, $alias, $alias_map, $order, [ @$pref_path ] ) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | @$pre; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | elsif( ref $pre eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | my @ret = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 9 | $self->_resolve_prefetch($_, $alias, $alias_map, $order, [ @$pref_path ] ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | $self->related_source($_)->_resolve_prefetch( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 8 | $pre->{$_}, "${alias}.$_", $alias_map, $order, [ @$pref_path, $_] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } keys %$pre; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 9 | return @ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | elsif( ref $pre ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | $self->throw_exception( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | "don't know how to resolve prefetch reftype ".ref($pre)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 62 | my $p = $alias_map; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 62 | $p = $p->{$_} for (@$pref_path, $pre); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | $self->throw_exception ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | "Unable to resolve prefetch '$pre' - join alias map does not contain an entry for path: " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | . join (' -> ', @$pref_path, $pre) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 62 | ▶ | ) if (ref $p->{-join_aliases} ne 'ARRAY' or not @{$p->{-join_aliases}} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $p->{"-join_aliases"} ne "ARRAY" or not @{$p->{"-join_aliases"};}
MC/DC0%0/2
ref $p->{"-join_aliases"} ne "ARRAY" or not @{$p->{"-join_aliases"};}
ref $p->{"-join_aliases"} ne "ARRAY"
not @{$p->{"-join_aliases"};}
Truth table33%1/3
A or not(B)
A= ref $p->{"-join_aliases"} ne "ARRAY"B= not @{$p->{"-join_aliases"};}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 62 | my $as = shift @{$p->{-join_aliases}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 62 | my $rel_info = $self->relationship_info( $pre ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 62 | ▶ | $self->throw_exception( $self->source_name . " has no such relationship '$pre'" ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | unless $rel_info; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 62 | ▶ | my $as_prefix = ($alias =~ /^.*?\.(.+)$/ ? $1.'.' : ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 62 | return map { [ "${as}.$_", "${as_prefix}${pre}.$_", ] } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | $self->related_source($pre)->columns; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | # Takes an arrayref of {as} dbic column aliases and the collapse and select | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | # attributes from the same $rs (the selector requirement is a temporary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | # workaround... I hope), and returns a coderef capable of: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | # my $me_pref_clps = $coderef->([$rs->cursor->next/all]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | # Where the $me_pref_clps arrayref is the future argument to inflate_result() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | # For an example of this coderef in action (and to see its guts) look at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | # t/resultset/rowparser_internals.t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # This is a huge performance win, as we call the same code for every row | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | # returned from the db, thus avoiding repeated method lookups when traversing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # relationships | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # Also since the coderef is completely stateless (the returned structure is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | # always fresh on every new invocation) this is a very good opportunity for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | # memoization if further speed improvements are needed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | # The way we construct this coderef is somewhat fugly, although the result is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | # really worth it. The final coderef does not perform any kind of recursion - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | # the entire nested structure constructor is rolled out into a single scope. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | # In any case - the output of this thing is meticulously micro-tested, so | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | # any sort of adjustment/rewrite should be relatively easy (fsvo relatively) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 23 | ▶ | sub _mk_row_parser { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mk_row_parser: called CC=9 SCAR=22.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # $args and $attrs are separated to delineate what is core collapser stuff and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | # what is dbic $rs specific | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 23 | my ($self, $args, $attrs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | die "HRI without pruning makes zero sense" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 23 | ▶ | if ( $args->{hri_style} && ! $args->{prune_null_branches} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$args->{"hri_style"} and not $args->{"prune_null_branches"}
MC/DC0%0/2
$args->{"hri_style"} and not $args->{"prune_null_branches"}
$args->{"hri_style"}
not $args->{"prune_null_branches"}
Truth table66%2/3
A and not(B)
A= $args->{"hri_style"}B= not $args->{"prune_null_branches"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | my %common = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | hri_style => $args->{hri_style}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | prune_null_branches => $args->{prune_null_branches}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | val_index => { map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 200 | { $args->{inflate_map}[$_] => $_ } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 23 | ( 0 .. $#{$args->{inflate_map}} ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 23 | my $check_null_columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 23 | ▶ | my $src = (! $args->{collapse} ) ? assemble_simple_parser(\%common) : do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | my $collapse_map = $self->_resolve_collapse ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | # FIXME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | # only consider real columns (not functions) during collapse resolution | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | # this check shouldn't really be here, as fucktards are not supposed to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | # alias random crap to existing column names anyway, but still - just in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | # case | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | # FIXME !!!! - this does not yet deal with unbalanced selectors correctly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | # (it is now trivial as the attrs specify where things go out of sync | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | # needs MOAR tests) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | as => { map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 152 | ▶ | { ref $attrs->{select}[$common{val_index}{$_}] ? () : ( $_ => $common{val_index}{$_} ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 16 | keys %{$common{val_index}} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | premultiplied => $args->{premultiplied}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 16 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | $check_null_columns = $collapse_map->{-identifying_columns} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 16 | ▶ | if @{$collapse_map->{-identifying_columns}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 16 | assemble_collapsing_parser({ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | %common, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | collapse_map => $collapse_map, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 23 | ▶ | utf8::upgrade($src) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | if stresstest_utf8_upgrade_generated_collapser_source; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 23 | ▶ | $args->{eval} ? ( eval "sub $src" || die $@ ) : $src, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
Condition50%1/2
eval "sub $src" or die $@
MC/DC0%0/1
eval "sub $src" or die $@
eval "sub $src"
Truth table50%1/2
A
A= eval "sub $src"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | $check_null_columns, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | # Takes an arrayref selection list and generates a collapse-map representing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | # row-object fold-points. Every relationship is assigned a set of unique, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | # non-nullable columns (which may *not even be* from the same resultset) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | # and the collapser will use this information to correctly distinguish | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | # data of individual to-be-row-objects. See t/resultset/rowparser_internals.t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | # for extensive RV examples | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 107 | ▶ | sub _resolve_collapse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_resolve_collapse: called CC=67 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 107 | my ($self, $args, $common_args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | # for comprehensible error messages put ourselves at the head of the relationship chain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 107 | ▶ | $args->{_rel_chain} ||= [ $self->source_name ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args->{"_rel_chain"} ||= [$self->source_name]
MC/DC100%1/1
$args->{"_rel_chain"} ||= [$self->source_name]
$args->{"_rel_chain"}
Truth table100%2/2
A
A= $args->{"_rel_chain"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | # record top-level fully-qualified column index, signify toplevelness | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 107 | ▶ | unless ($common_args->{_as_fq_idx}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 19 | $common_args->{_as_fq_idx} = { %{$args->{as}} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 19 | $args->{_is_top_level} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 107 | my ($my_cols, $rel_cols); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 107 | for (keys %{$args->{as}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 511 | ▶ | if ($_ =~ /^ ([^\.]+) \. (.+) /x) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 318 | $rel_cols->{$1}{$2} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 193 | $my_cols->{$_} = {}; # important for ||='s below | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 107 | my $relinfo; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | # run through relationships, collect metadata | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 107 | for my $rel (keys %$rel_cols) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 85 | my $inf = $self->relationship_info ($rel); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | $relinfo->{$rel} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | is_single => ( $inf->{attrs}{accessor} && $inf->{attrs}{accessor} ne 'multi' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 85 | ▶ | is_inner => ( ( $inf->{attrs}{join_type} || '' ) !~ /^left/i), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition80%4/5
$inf->{'attrs'}{'accessor'} && $inf->{'attrs'}{'accessor'} ne 'multi'
$inf->{'attrs'}{'join_type'} || ''
MC/DC50%1/2
$inf->{'attrs'}{'accessor'} && $inf->{'attrs'}{'accessor'} ne 'multi'
$inf->{'attrs'}{'accessor'}
$inf->{'attrs'}{'accessor'} ne 'multi'
MC/DC100%1/1
$inf->{'attrs'}{'join_type'} || ''
$inf->{'attrs'}{'join_type'}
Truth table66%2/3
A && B
A= $inf->{'attrs'}{'accessor'}B= $inf->{'attrs'}{'accessor'} ne 'multi'
Truth table100%2/2
A
A= $inf->{'attrs'}{'join_type'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | rsrc => $self->related_source($rel), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | # FIME - need to use _resolve_cond here instead | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 85 | my $cond = $inf->{cond}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 85 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
ref $cond eq "HASH" and keys %$cond and not grep({not $_ =~ /^foreign\./;} keys %$cond) and not grep({not $_ =~ /^self\./;} values %$cond)
ref $cond eq "HASH" and keys %$cond and not grep({not $_ =~ /^foreign\./;} keys %$cond)
ref $cond eq "HASH" and keys %$cond
MC/DC0%0/4
ref $cond eq "HASH" and keys %$cond and not grep({not $_ =~ /^foreign\./;} keys %$cond) and not grep({not $_ =~ /^self\./;} values %$cond)
ref $cond eq "HASH"
keys %$cond
not grep({not $_ =~ /^foreign\./;} keys %$cond)
not grep({not $_ =~ /^self\./;} values %$cond)
Truth table20%1/5
A and B and not(C) and not(D)
A= ref $cond eq "HASH"B= keys %$condC= not grep({not $_ =~ /^foreign\./;} keys %$cond)D= not grep({not $_ =~ /^self\./;} values %$cond)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | ref $cond eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | keys %$cond | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 85 | ! grep { $_ !~ /^foreign\./ } (keys %$cond) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 85 | ! grep { $_ !~ /^self\./ } (values %$cond) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 85 | for my $f (keys %$cond) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 85 | my $s = $cond->{$f}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 85 | $_ =~ s/^ (?: foreign | self ) \.//x for ($f, $s); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 85 | $relinfo->{$rel}{fk_map}{$s} = $f; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | # inject non-left fk-bridges from *INNER-JOINED* children (if any) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 107 | for my $rel (grep { $relinfo->{$_}{is_inner} } keys %$relinfo) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 36 | my $ri = $relinfo->{$rel}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 36 | for (keys %{$ri->{fk_map}} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | # need to know source from *our* pov, hence $rel.col | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | $my_cols->{$_} ||= { via_fk => "$rel.$ri->{fk_map}{$_}" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 36 | ▶ | if defined $rel_cols->{$rel}{$ri->{fk_map}{$_}} # in fact selected | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$my_cols->{$_} ||= {"via_fk", qq[$rel.$ri->{"fk_map"}{$_}]}
MC/DC0%0/1
$my_cols->{$_} ||= {"via_fk", qq[$rel.$ri->{"fk_map"}{$_}]}
$my_cols->{$_}
Truth table50%1/2
A
A= $my_cols->{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | # if the parent is already defined *AND* we have an inner reverse relationship | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | # (i.e. do not exist without it) , assume all of its related FKs are selected | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | # (even if they in fact are NOT in the select list). Keep a record of what we | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | # assumed, and if any such phantom-column becomes part of our own collapser, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | # throw everything assumed-from-parent away and replace with the collapser of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | # the parent (whatever it may be) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 107 | my $assumed_from_parent; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 107 | ▶ | if ( ! $args->{_parent_info}{underdefined} and ! $args->{_parent_info}{rev_rel_is_optional} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$args->{"_parent_info"}{"underdefined"} or $args->{"_parent_info"}{"rev_rel_is_optional"}
MC/DC100%2/2
$args->{"_parent_info"}{"underdefined"} or $args->{"_parent_info"}{"rev_rel_is_optional"}
$args->{"_parent_info"}{"underdefined"}
$args->{"_parent_info"}{"rev_rel_is_optional"}
Truth table100%3/3
A or B
A= $args->{"_parent_info"}{"underdefined"}B= $args->{"_parent_info"}{"rev_rel_is_optional"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 59 | ▶ | for my $col ( values %{$args->{_parent_info}{rel_condition} || {}} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args->{'_parent_info'}{'rel_condition'} || {}
MC/DC100%1/1
$args->{'_parent_info'}{'rel_condition'} || {}
$args->{'_parent_info'}{'rel_condition'}
Truth table100%2/2
A
A= $args->{'_parent_info'}{'rel_condition'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 40 | ▶ | next if exists $my_cols->{$col}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 24 | $my_cols->{$col} = { via_collapse => $args->{_parent_info}{collapse_on_idcols} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 24 | $assumed_from_parent->{columns}{$col}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | # get colinfo for everything | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 107 | ▶ | if ($my_cols) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 98 | my $ci = $self->columns_info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 98 | $my_cols->{$_}{colinfo} = $ci->{$_} for keys %$my_cols; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 107 | my $collapse_map; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | # first try to reuse the parent's collapser (i.e. reuse collapser over 1:1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | # (makes for a leaner coderef later) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 107 | ▶ | unless ($collapse_map->{-identifying_columns}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | $collapse_map->{-identifying_columns} = $args->{_parent_info}{collapse_on_idcols} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 107 | ▶ | if $args->{_parent_info}{collapser_reusable}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | # Still don't know how to collapse - try to resolve based on our columns (plus already inserted FK bridges) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 107 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
not $collapse_map->{"-identifying_columns"} and $my_cols and my $idset = $self->_identifying_column_set({map({$_, $my_cols->{$_}{"colinfo"};} keys %$my_cols)})
not $collapse_map->{"-identifying_columns"} and $my_cols
MC/DC100%3/3
not $collapse_map->{"-identifying_columns"} and $my_cols and my $idset = $self->_identifying_column_set({map({$_, $my_cols->{$_}{"colinfo"};} keys %$my_cols)})
not $collapse_map->{"-identifying_columns"}
$my_cols
my $idset = $self->_identifying_column_set({map({$_, $my_cols->{$_}{"colinfo"};} keys %$my_cols)})
Truth table100%4/4
not(A) and B and C
A= not $collapse_map->{"-identifying_columns"}B= $my_colsC= my $idset = $self->_identifying_column_set({map({$_, $my_cols->{$_}{"colinfo"};} keys %$my_cols)})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | ! $collapse_map->{-identifying_columns} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | $my_cols | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 217 | my $idset = $self->_identifying_column_set ({map { $_ => $my_cols->{$_}{colinfo} } keys %$my_cols}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | # see if the resulting collapser relies on any implied columns, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | # and fix stuff up if this is the case | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 68 | my @reduced_set = grep { ! $assumed_from_parent->{columns}{$_} } @$idset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | $collapse_map->{-identifying_columns} = [ __unique_numlist( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 68 | ▶ | @{ $args->{_parent_info}{collapse_on_idcols}||[] }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args->{'_parent_info'}{'collapse_on_idcols'} || []
MC/DC100%1/1
$args->{'_parent_info'}{'collapse_on_idcols'} || []
$args->{'_parent_info'}{'collapse_on_idcols'}
Truth table100%2/2
A
A= $args->{'_parent_info'}{'collapse_on_idcols'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | (map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 68 | my $fqc = join ('.', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 80 | ▶ | @{$args->{_rel_chain}}[1 .. $#{$args->{_rel_chain}}], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$my_cols->{$_}{'via_fk'} || $_
MC/DC0%0/2
$my_cols->{$_}{'via_fk'} || $_
$my_cols->{$_}{'via_fk'}
$_
Truth table66%2/3
A || B
A= $my_cols->{$_}{'via_fk'}B= $_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 80 | ( $my_cols->{$_}{via_fk} || $_ ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 80 | $common_args->{_as_fq_idx}->{$fqc}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | @reduced_set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | )]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | # Stil don't know how to collapse - keep descending down 1:1 chains - if | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | # a related non-LEFT 1:1 is resolvable - its condition will collapse us | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | # too | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 107 | ▶ | unless ($collapse_map->{-identifying_columns}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 18 | my @candidates; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 18 | for my $rel (keys %$relinfo) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 24 | ▶ | next unless ($relinfo->{$rel}{is_single} && $relinfo->{$rel}{is_inner}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$relinfo->{$rel}{"is_single"} and $relinfo->{$rel}{"is_inner"}
MC/DC100%2/2
$relinfo->{$rel}{"is_single"} and $relinfo->{$rel}{"is_inner"}
$relinfo->{$rel}{"is_single"}
$relinfo->{$rel}{"is_inner"}
Truth table100%3/3
A and B
A= $relinfo->{$rel}{"is_single"}B= $relinfo->{$rel}{"is_inner"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 15 | ▶ | if ( my $rel_collapse = $relinfo->{$rel}{rsrc}->_resolve_collapse ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | as => $rel_cols->{$rel}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 15 | _rel_chain => [ @{$args->{_rel_chain}}, $rel ], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | _parent_info => { underdefined => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | }, $common_args)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 15 | push @candidates, $rel_collapse->{-identifying_columns}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | # get the set with least amount of columns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | # FIXME - maybe need to implement a data type order as well (i.e. prefer several ints | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | # to a single varchar) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 18 | ▶ | if (@candidates) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | ($collapse_map->{-identifying_columns}) = sort { scalar @$a <=> scalar @$b } (@candidates); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | # Stil don't know how to collapse, and we are the root node. Last ditch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | # effort in case we are *NOT* premultiplied. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | # Run through *each multi* all the way down, left or not, and all | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | # *left* singles (a single may become a multi underneath) . When everything | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | # gets back see if all the rels link to us definitively. If this is the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | # case we are good - either one of them will define us, or if all are NULLs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | # we know we are "unique" due to the "non-premultiplied" check | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 107 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
not $collapse_map->{"-identifying_columns"} || $args->{"premultiplied"} and $args->{"_is_top_level"}
$collapse_map->{'-identifying_columns'} || $args->{'premultiplied'}
MC/DC33%1/3
not $collapse_map->{"-identifying_columns"} || $args->{"premultiplied"} and $args->{"_is_top_level"}
$collapse_map->{'-identifying_columns'}
$args->{'premultiplied'}
$args->{"_is_top_level"}
Truth table50%2/4
not(A || B) and C
A= $collapse_map->{'-identifying_columns'}B= $args->{'premultiplied'}C= $args->{"_is_top_level"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | ! $collapse_map->{-identifying_columns} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | ! $args->{premultiplied} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | $args->{_is_top_level} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 3 | my (@collapse_sets, $uncollapsible_chain); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 3 | for my $rel (keys %$relinfo) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | # we already looked at these higher up | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 6 | ▶ | next if ($relinfo->{$rel}{is_single} && $relinfo->{$rel}{is_inner}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$relinfo->{$rel}{"is_single"} and $relinfo->{$rel}{"is_inner"}
MC/DC0%0/2
$relinfo->{$rel}{"is_single"} and $relinfo->{$rel}{"is_inner"}
$relinfo->{$rel}{"is_single"}
$relinfo->{$rel}{"is_inner"}
Truth table66%2/3
A and B
A= $relinfo->{$rel}{"is_single"}B= $relinfo->{$rel}{"is_inner"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 6 | ▶ | if (my $clps = $relinfo->{$rel}{rsrc}->_resolve_collapse ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | as => $rel_cols->{$rel}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 6 | _rel_chain => [ @{$args->{_rel_chain}}, $rel ], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | _parent_info => { underdefined => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | }, $common_args) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | # for singles use the idcols wholesale (either there or not) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 6 | ▶ | if ($relinfo->{$rel}{is_single}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 3 | push @collapse_sets, $clps->{-identifying_columns}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | elsif (! $relinfo->{$rel}{fk_map}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | $uncollapsible_chain = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 3 | my $defined_cols_parent_side; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 3 | for my $fq_col ( grep { /^$rel\.[^\.]+$/ } keys %{$args->{as}} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 6 | my ($col) = $fq_col =~ /([^\.]+)$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 6 | $defined_cols_parent_side->{$_} = $args->{as}{$fq_col} for grep | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 6 | { $relinfo->{$rel}{fk_map}{$_} eq $col } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 6 | keys %{$relinfo->{$rel}{fk_map}} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 3 | ▶ | if (my $set = $self->_identifying_column_set([ keys %$defined_cols_parent_side ]) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 3 | push @collapse_sets, [ sort map { $defined_cols_parent_side->{$_} } @$set ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | $uncollapsible_chain = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | $uncollapsible_chain = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 3 | ▶ | unless ($uncollapsible_chain) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | # if we got here - we are good to go, but the construction is tricky | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | # since our children will want to include our collapse criteria - we | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | # don't give them anything (safe, since they are all collapsible on their own) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | # in addition we record the individual collapse possibilities | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | # of all left children node collapsers, and merge them in the rowparser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | # coderef later | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 3 | $collapse_map->{-identifying_columns} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | $collapse_map->{-identifying_columns_variants} = [ sort { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 3 | (scalar @$a) <=> (scalar @$b) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | # Poor man's max() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ( sort { $b <=> $a } @$a )[0] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | <=> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | ▶ | ( sort { $b <=> $a } @$b )[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
scalar @$a <=> scalar @$b || (sort {$b <=> $a;} @$a)[0] <=> (sort {$b <=> $a;} @$b)[0]
MC/DC0%0/2
scalar @$a <=> scalar @$b || (sort {$b <=> $a;} @$a)[0] <=> (sort {$b <=> $a;} @$b)[0]
scalar @$a <=> scalar @$b
(sort {$b <=> $a;} @$a)[0] <=> (sort {$b <=> $a;} @$b)[0]
Truth table33%1/3
A || B
A= scalar @$a <=> scalar @$bB= (sort {$b <=> $a;} @$a)[0] <=> (sort {$b <=> $a;} @$b)[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } @collapse_sets ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | # stop descending into children if we were called by a parent for first-pass | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | # and don't despair if nothing was found (there may be other parallel branches | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | # to dive into) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 107 | ▶ | if ($args->{_parent_info}{underdefined}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 21 | ▶ | return $collapse_map->{-identifying_columns} ? $collapse_map : undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | # nothing down the chain resolved - can't calculate a collapse-map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | elsif (! $collapse_map->{-identifying_columns}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | $self->throw_exception ( sprintf | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | "Unable to calculate a definitive collapse column set for %s%s: fetch more unique non-nullable columns", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | $self->source_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | @{$args->{_rel_chain}} > 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | ▶ | ? sprintf (' (last member of the %s chain)', join ' -> ', @{$args->{_rel_chain}} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | : '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | # If we got that far - we are collapsable - GREAT! Now go down all children | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | # a second time, and fill in the rest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | $collapse_map->{-identifying_columns} = [ __unique_numlist( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 86 | ▶ | @{ $args->{_parent_info}{collapse_on_idcols}||[] }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args->{'_parent_info'}{'collapse_on_idcols'} || []
MC/DC100%1/1
$args->{'_parent_info'}{'collapse_on_idcols'} || []
$args->{'_parent_info'}{'collapse_on_idcols'}
Truth table100%2/2
A
A= $args->{'_parent_info'}{'collapse_on_idcols'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 86 | @{ $collapse_map->{-identifying_columns} }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | )]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 86 | my @id_sets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 86 | for my $rel (sort keys %$relinfo) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | $collapse_map->{$rel} = $relinfo->{$rel}{rsrc}->_resolve_collapse ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 246 | as => { map { $_ => 1 } ( keys %{$rel_cols->{$rel}} ) }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 67 | _rel_chain => [ @{$args->{_rel_chain}}, $rel], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | _parent_info => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | # shallow copy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 67 | ▶ | collapse_on_idcols => [ @{$collapse_map->{-identifying_columns}} ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | rel_condition => $relinfo->{$rel}{fk_map}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | is_optional => ! $relinfo->{$rel}{is_inner}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | # if there is at least one *inner* reverse relationship which is HASH-based (equality only) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | # we can safely assume that the child can not exist without us | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | rev_rel_is_optional => ( grep | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 119 | ▶ | { ref $_->{cond} eq 'HASH' and ($_->{attrs}{join_type}||'') !~ /^left/i } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition80%4/5
ref $_->{'cond'} eq 'HASH' && !(($_->{'attrs'}{'join_type'} || '') =~ /^left/i)
$_->{'attrs'}{'join_type'} || ''
MC/DC50%1/2
ref $_->{'cond'} eq 'HASH' && !(($_->{'attrs'}{'join_type'} || '') =~ /^left/i)
ref $_->{'cond'} eq 'HASH'
$_->{'attrs'}{'join_type'}
Truth table66%2/3
A && not(B)
A= ref $_->{'cond'} eq 'HASH'B= $_->{'attrs'}{'join_type'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 67 | ▶ | values %{ $self->reverse_relationship_info($rel) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$relinfo->{$rel}{"is_single"} and $relinfo->{$rel}{"is_inner"} and @{$collapse_map->{"-identifying_columns"};}
$relinfo->{$rel}{"is_single"} and $relinfo->{$rel}{"is_inner"}
MC/DC66%2/3
$relinfo->{$rel}{"is_single"} and $relinfo->{$rel}{"is_inner"} and @{$collapse_map->{"-identifying_columns"};}
$relinfo->{$rel}{"is_single"}
$relinfo->{$rel}{"is_inner"}
@{$collapse_map->{"-identifying_columns"};}
Truth table75%3/4
A and B and C
A= $relinfo->{$rel}{"is_single"}B= $relinfo->{$rel}{"is_inner"}C= @{$collapse_map->{"-identifying_columns"};}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | ) ? 0 : 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | # if this is a 1:1 our own collapser can be used as a collapse-map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | # (regardless of left or not) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | collapser_reusable => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | $relinfo->{$rel}{is_single} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | $relinfo->{$rel}{is_inner} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 67 | @{$collapse_map->{-identifying_columns}} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | ) ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | }, $common_args ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 67 | ▶ | $collapse_map->{$rel}{-is_single} = 1 if $relinfo->{$rel}{is_single}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 67 | ▶ | $collapse_map->{$rel}{-is_optional} ||= 1 unless $relinfo->{$rel}{is_inner}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$collapse_map->{$rel}{"-is_optional"} ||= 1
MC/DC0%0/1
$collapse_map->{$rel}{"-is_optional"} ||= 1
$collapse_map->{$rel}{"-is_optional"}
Truth table50%1/2
A
A= $collapse_map->{$rel}{"-is_optional"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 86 | return $collapse_map; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | # adding a dep on MoreUtils *just* for this is retarded | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 154 | ▶ | sub __unique_numlist { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__unique_numlist: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 154 | sort { $a <=> $b } keys %{ {map { $_ => 1 } @_ }} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 379 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||