accumulo
accumulo copied to clipboard
Show few option does not work with commands that extend ScanCommand
Describe the bug
Original ticket: https://issues.apache.org/jira/browse/ACCUMULO-814. Several commands that extend the ScanCommand
do not properly implement the show few option. It is possible other options behave similarly.
To Reproduce Steps to demonstrate. Also can follow the example given below.
- Launch an accumulo instance and create a table in the accumulo-shell.
- Insert a row into the table. E.x:
insert foo person name bob
- Run a scan on the table with the -f or --show-few option added
- Do the same step but with a command that extends
ScanCommand
, like theGrepCommand
.
Expected behavior For the output of any command with the show few option to be truncated to the size specified.
Screenshots
Example output of how the option works with scan
root@uno test> scan
foo person:name [] jeff
root@uno test> scan -t test -f 4
foo pers:name [] jeff
and it not working properly with grep
.
root@uno test> grep foo
foo person:name [] jeff
root@uno test> grep foo -f 1
foo person:name [] jeff
Additional context Alternate solutions/enhancements were proposed in the original Jira ticket. It was also suggested that the show-few option should utilize the user formatter.
Commands that seem to have this issue:
GrepCommand
EGrepCommand
MaxRowCommand
DeleteManyCommand
does extend ScanCommand
but overwrites the '-f' arg with a force option. If the usefulness of the --show-few option is low for these commands then a solution might be to just remove it so it doesn't show up as an option in the shell.
Going from memory, does show few does work with scan (and is useful)? I seem to think it does, but maybe I'm thinking of something else. grep and egrep would seem to similar to a scan that it should apply, but I don't recall using those commands as frequently as scan during development and troubleshooting.
It does work for scan. It might be useful in some applications but I do not know what they are. Just the commands that extend ScanCommand it does not work. I could see grep/egrep being useful in the same vein. MaxRow is one I am unsure of since it will only return the row name. It also doesn't currently utilize a formatter like the other commands do.
Can you assign this to me? I can work on this. Thx
Are you still looking at this, @harjitdotsingh ? If not, I may take a stab
Please feel free. I have been busy with some other things
On Thu, May 12, 2022 at 7:34 PM nikita @.***> wrote:
Are you still looking at this, @harjitdotsingh https://github.com/harjitdotsingh ? If not, I may take a stab
— Reply to this email directly, view it on GitHub https://github.com/apache/accumulo/issues/2264#issuecomment-1125510376, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAASJ7VHXS5NCEARPNAAZJLVJWIO5ANCNFSM5DVO5REQ . You are receiving this because you were mentioned.Message ID: @.***>
It looks like there are 3 separate tasks for this:
- Make sure
-f, --show-few
stops showing up in the MaxRowCommand's help - Make sure GrepCommand (and by extension, EGrepCommand) make use of the
showFewOpt
in a similar way as in ScanCommand - Make sure
--show-few
is not documented and does not function in the DeleteManyCommand (the corresponding shortname-f
is already clobbered for--force
in this command)
The much cleaner solution is to just get rid of the -f, --show-few
option entirely. It's an edge case for formatting output that is probably just not needed, as it adds too much complexity and is poorly documented.
Another option is to split out the construction of the ScanCommand options into those without the -f, --show-few
option and those with it. The ScanCommand itself could use the version with it, but subclasses could use the set of options without it. That way, it still works on the ScanCommand where it's documented and working already, but is removed from the help for any subclasses. The only issue with this is that you really have to be careful to get the correct set of options in all of ScanCommand's subclasses. This option would be suitable as a fix for 2.1, whether or not we decide to remove it later.
I created a pull request https://github.com/apache/accumulo/pull/3905 but I am still testing it.