ain::StringAnonymizer;
use Pg::Explain::FromText;
use Pg::Explain::FromYAML;
use Pg::Explain::FromJSON;
use Pg::Explain::FromXML;
=head1 NAME
Pg::Explain - Object approach at reading explain analyze
=head1 FUNCTIONS
=head2 source_format
What is the detected format of source plan. One of: TEXT, JSON, YAML, OR XML.
=head2 planning_time
How much time PostgreSQL spent planning the query. In milli
parse_source
Internally (from ->BUILD()) called function which checks which parser to use
(text, json, xml, yaml), runs appropriate function, and stores top level
node in $self->top_node.
=cut
sub
ng (conforming
to text version of EXPLAIN ANALYZE output) or a structure, containing keys like
in JSON/YAML/XML formats of the explain:
use Pg::Explain::Buffers;
my $from_string = Pg::Explai
mings' } = $T;
}
return;
}
=head2 _build_timing_info
Based on data from structure from json/yaml/xml, build I/O Timings: info line for textual representation of explain.
=cut
sub _build_t
new
Object constructor. Should get one of:
=over
=item * struct - hashref based on parsing of JSON/YAML/XML plans
=item * lines - arrayref of strings containling lines describing JIT from text pl
;
}
=head1 INTERNAL METHODS
=head2 _parse_struct
Parses given struct, as returned from parsing JSON/YAML/XML formats.
=cut
sub _parse_struct {
my $self = shift;
my $struct = shift;
ms;
# Make sure boolean variables will be properly marked if/for exporting to JSON
$YAML::XS::Boolean = "JSON::PP";
my $struct = Load( $source )->[ 0 ];
my $top_node = $self->make_no
package Pg::Explain::FromJSON;
# UTF8 boilerplace, per http://stackoverflow.com/questions/6162484/why-does-modern-perl-avoid-utf-8-by-default/
use v5.18;
use strict;
use warnings;
use warnings qw( FA
e qw( Pg::Explain::From );
use JSON::MaybeXS;
use Carp;
use Pg::Explain::JIT;
use Pg::Explain::Buffers;
=head1 NAME
Pg::Explain::FromJSON - Parser for explains in JSON format
=head1 VERSION
Versio
$source = join( "\n", @use_lines );
}
}
# And now parse the json...
my $struct = decode_json( $source );
if ( ( 'ARRAY' eq ref $struct )
&& ( defined $struct->[
nd not directly.
=head1 FUNCTIONS
=head2 normalize_node_struct
XML structure is different than JSON/YAML (after parsing), so we need to normalize it.
=cut
sub normalize_node_struct {
my $self