pt-align truncates the first and last lines

Reported by Tianshi Wang on 2012-07-23
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Percona Toolkit
Undecided
Unassigned

Bug Description

From percona_tookit 2.1.2
pt-align truncates the first and last line.

[root@ tmp]# cat result.txt
1 grape grade D 4.99
2 apple limber 1.79
3 orange valencia 2.59
4 grape grade B 3.99
5 pear bartlett 2.19
6 apple fuji 0.23
7 pear bradford 1.69
8 cherry bing 3.99
9 orange navel 5.99
10 apple gala 2.33
11 grape grade A 7.99
12 apple delicious 0.79
13 grape grade C 8.99
14 orange sunlight 0.89
15 grape grade E 5.99
[root@ tmp]# pt-align result.txt
 2 apple limber 1.79
 3 orange valencia 2.59
 5 pear bartlett 2.19
 6 apple fuji 0.23
 7 pear bradford 1.69
 8 cherry bing 3.99
 9 orange navel 5.99
10 apple gala 2.33
12 apple delicious 0.79
14 orange sunlight 0.89

tags: added: pt-align wrong-output
Changed in percona-toolkit:
status: New → Triaged
Brian Fraser (fraserbn) wrote :

This isn't a bug; the tool is working as expected. From the docs:

It counts how many words each line has, and if there is one number that predominates, it assumes this is the number of words in each line. Then it discards all lines that don't have that many words, and looks at the 2nd line that does.

Changed in percona-toolkit:
status: Triaged → Invalid
Michael Will (mrmichaelwill) wrote :

This is still a bug, either a documentation bug or a drawback in the implementation. The description attached to 'NAME' is:

        pt-align - Align output from other tools to columns.

The risks section does not mention that it will silently suppress lines that don't have the same number of columns.

The description then has the details that make it clear, but honestly I missed that too, as it is just unexpected, and all the rest just sounds like it is an awesome tool that does what the description in the NAME section suggests.

If you don't want to change that, I would at the minimum add a one line warning to the risks section.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers