Skip Menu |

This queue is for tickets about the Data-Table CPAN distribution.

Report information
The Basics
Id: 78277
Status: resolved
Priority: 0/
Queue: Data-Table

People
Owner: Nobody in particular
Requestors: ra4720 [...] freescale.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.63
Fixed in: (no value)



I am upgrading from Data::Table v1.54 to v1.63 and I am seeing a new behavior in the pivot action. In v1.54, if I pivot a numeric column and have an undefined value, the new table would also have an undefiend value. However, in v1.63 the undefined value is now set to 0 (zero). This can and has caused some issues in my scripts since I expect the undefined value and testing against zero can lead to unintended behavior. Full Disclosure on Server Differences: v1.63 server runs Perl v5.12.2 on Linux 2.6.18-194.e15 V1.54 server runs Perl v5.8.8 on Linux 2.6.18-194.3.1.e15 I did not see the behavior change until I updated from Data::Table v1.54 to v1.63 on the first server. Here is a small example to highlight the issue. Original Table ($t) Site Month Cost A M201201 0.85 A M201202 0.50 B M201201 0.75 C M201202 0.60 Now the pivot action my $t_pivot = $t->pivot("Month",0,"Cost",["Site"]); In v1.54, $t_pivot is Site M201201 M201202 A 0.85 0.50 B 0.75 (null) C (null) 0.60 In v1.63, $t_pivot is Site M201201 M201202 A 0.85 0.50 B 0.75 0.00 C 0.00 0.60 I am hoping there is an option that I am overlooking in pivot that addresses this behavior. If not, can you provide an option to retain undefined values if the pivoting column is a numeric? I love this module and use it quite heavily, so thank you for your work so far and your future updates!
Subject: Fixed in 1.65, thanks
Glad to know that someone uses pivot(). In the new version, you might want to consider cast(). There is now a Perl Data::Table Cookbook, which could be useful for advanced users like you. Download link is below https://sites.google.com/site/easydatabase/ On Mon Jul 09 13:12:49 2012, kylehorton wrote: Show quoted text
> I am upgrading from Data::Table v1.54 to v1.63 and I am seeing a new > behavior in the pivot action. > > In v1.54, if I pivot a numeric column and have an undefined value,
the Show quoted text
> new table would also have an undefiend value. However, in v1.63 the > undefined value is now set to 0 (zero). This can and has caused some > issues in my scripts since I expect the undefined value and testing > against zero can lead to unintended behavior. > > Full Disclosure on Server Differences: > v1.63 server runs Perl v5.12.2 on Linux 2.6.18-194.e15 > V1.54 server runs Perl v5.8.8 on Linux 2.6.18-194.3.1.e15 > > I did not see the behavior change until I updated from Data::Table > v1.54 to v1.63 on the first server. > > Here is a small example to highlight the issue. > > Original Table ($t) > Site Month Cost > A M201201 0.85 > A M201202 0.50 > B M201201 0.75 > C M201202 0.60 > > Now the pivot action > my $t_pivot = $t->pivot("Month",0,"Cost",["Site"]); > > In v1.54, $t_pivot is > Site M201201 M201202 > A 0.85 0.50 > B 0.75 (null) > C (null) 0.60 > > In v1.63, $t_pivot is > Site M201201 M201202 > A 0.85 0.50 > B 0.75 0.00 > C 0.00 0.60 > > I am hoping there is an option that I am overlooking in pivot that > addresses this behavior. If not, can you provide an option to retain > undefined values if the pivoting column is a numeric? > > I love this module and use it quite heavily, so thank you for your
work Show quoted text
> so far and your future updates!