LP #1028159: pt-align truncates the first and last lines

Description

**Reported in Launchpad by Tianshi Wang last update 16-08-2012 18:01:54

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

Environment

None

Smart Checklist

Activity

lpjirasync January 24, 2018 at 6:49 PM

**Comment from Launchpad by: Michael Will on: 16-08-2012 18:01:17

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.

lpjirasync January 24, 2018 at 6:49 PM

**Comment from Launchpad by: Brian Fraser on: 10-08-2012 19:10:54

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.

Not a Bug

Details

Assignee

Reporter

Priority

Smart Checklist

Created January 24, 2018 at 6:49 PM
Updated February 3, 2018 at 11:15 PM
Resolved January 24, 2018 at 6:49 PM

Flag notifications