You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@accumulo.apache.org by mhd wrk <mh...@gmail.com> on 2019/07/16 18:50:26 UTC

scan ignores custom Formatter

I'm trying to use a custom formatter with scan command in Accumulo
shell, but seems that scan simply ignores the custom formatter and
uses the default one!

The steps I follow are:

1- Create custom Formatter by extending
org.apache.accumulo.core.util.format.Formatter

2- Copy the jar to ${ACCUMULO_HOME}/lib

3- Restart Accumulo to make sure everything is reloaded.

4- run `accumulo shell`

5- run `classpath` and confirm that the formatter jar is included in the path.

5- `scan -f 50 -fm com.example.MyFormatter -st -t mytable`


Accumulo version: 1.7.2


Any known issues?


Thanks,

Mohammad

Re: scan ignores custom Formatter

Posted by mhd wrk <mh...@gmail.com>.
Coping the jar into the lib or lib/ext  seems to be fine. Because if I
remove the jar and try the same scan command then I get

Formatter class could not be loaded.
> com.example.MyFormatter


Regardless I tried your CLASSPATH suggestion and got the following:

java.lang.ClassNotFoundException:
> org.apache.accumulo.core.util.format.Formatter




On Tue, Jul 16, 2019 at 3:30 PM Christopher <ct...@apache.org> wrote:

> It's possible that the shell itself doesn't have it on its class path.
> The output of the classpath command is probably the classpath of the
> tabletserver you've connected to, not the current local shell process.
>
> Try `export CLASSPATH=path/to/MyFormatter.jar; bin/accumulo shell ...`
>
> On Tue, Jul 16, 2019 at 6:01 PM mhd wrk <mh...@gmail.com> wrote:
> >
> > Yes the jar is on all the tservers and I tried `config`command and
> `formatter` commands as alternatives.
> > Unfortunately no luck yet.
> >
> > On Tue, Jul 16, 2019 at 1:30 PM Michael Wall <mj...@apache.org> wrote:
> >>
> >> Couple of thoughts
> >>
> >> 1 - Are you putting the jar on all the tservers and restarting
> everthing?
> >> 2 - Have you tried setting the formatter on the table as opposed to the
> scan command.  Something like
> >> 'config -t mytable -s table.formatter=com.example.MyFormatter'
> >>
> >> Mike
> >>
> >> On Tue, Jul 16, 2019 at 2:50 PM mhd wrk <mh...@gmail.com> wrote:
> >>>
> >>> I'm trying to use a custom formatter with scan command in Accumulo
> shell, but seems that scan simply ignores the custom formatter and uses the
> default one!
> >>>
> >>> The steps I follow are:
> >>>
> >>> 1- Create custom Formatter by extending
> org.apache.accumulo.core.util.format.Formatter
> >>>
> >>> 2- Copy the jar to ${ACCUMULO_HOME}/lib
> >>>
> >>> 3- Restart Accumulo to make sure everything is reloaded.
> >>>
> >>> 4- run `accumulo shell`
> >>>
> >>> 5- run `classpath` and confirm that the formatter jar is included in
> the path.
> >>>
> >>> 5- `scan -f 50 -fm com.example.MyFormatter -st -t mytable`
> >>>
> >>>
> >>> Accumulo version: 1.7.2
> >>>
> >>>
> >>> Any known issues?
> >>>
> >>>
> >>> Thanks,
> >>>
> >>> Mohammad
> >>>
> >>>
> >>>
>

Re: scan ignores custom Formatter

Posted by Michael Wall <mj...@apache.org>.
Did you ever get this working?

Mike

On Wed, Jul 17, 2019 at 12:16 PM mhd wrk <mh...@gmail.com> wrote:

> Basically the sample code (attached) is a copy of DefaultFormatter with
> some modifications to `formatEntry`
>
> On Tue, Jul 16, 2019 at 6:13 PM Michael Wall <mj...@apache.org> wrote:
>
>> If you are still having issues, can you share your code?
>>
>> Mike
>>
>> On Tue, Jul 16, 2019 at 6:30 PM Christopher <ct...@apache.org> wrote:
>>
>>> It's possible that the shell itself doesn't have it on its class path.
>>> The output of the classpath command is probably the classpath of the
>>> tabletserver you've connected to, not the current local shell process.
>>>
>>> Try `export CLASSPATH=path/to/MyFormatter.jar; bin/accumulo shell ...`
>>>
>>> On Tue, Jul 16, 2019 at 6:01 PM mhd wrk <mh...@gmail.com> wrote:
>>> >
>>> > Yes the jar is on all the tservers and I tried `config`command and
>>> `formatter` commands as alternatives.
>>> > Unfortunately no luck yet.
>>> >
>>> > On Tue, Jul 16, 2019 at 1:30 PM Michael Wall <mj...@apache.org>
>>> wrote:
>>> >>
>>> >> Couple of thoughts
>>> >>
>>> >> 1 - Are you putting the jar on all the tservers and restarting
>>> everthing?
>>> >> 2 - Have you tried setting the formatter on the table as opposed to
>>> the scan command.  Something like
>>> >> 'config -t mytable -s table.formatter=com.example.MyFormatter'
>>> >>
>>> >> Mike
>>> >>
>>> >> On Tue, Jul 16, 2019 at 2:50 PM mhd wrk <mh...@gmail.com>
>>> wrote:
>>> >>>
>>> >>> I'm trying to use a custom formatter with scan command in Accumulo
>>> shell, but seems that scan simply ignores the custom formatter and uses the
>>> default one!
>>> >>>
>>> >>> The steps I follow are:
>>> >>>
>>> >>> 1- Create custom Formatter by extending
>>> org.apache.accumulo.core.util.format.Formatter
>>> >>>
>>> >>> 2- Copy the jar to ${ACCUMULO_HOME}/lib
>>> >>>
>>> >>> 3- Restart Accumulo to make sure everything is reloaded.
>>> >>>
>>> >>> 4- run `accumulo shell`
>>> >>>
>>> >>> 5- run `classpath` and confirm that the formatter jar is included in
>>> the path.
>>> >>>
>>> >>> 5- `scan -f 50 -fm com.example.MyFormatter -st -t mytable`
>>> >>>
>>> >>>
>>> >>> Accumulo version: 1.7.2
>>> >>>
>>> >>>
>>> >>> Any known issues?
>>> >>>
>>> >>>
>>> >>> Thanks,
>>> >>>
>>> >>> Mohammad
>>> >>>
>>> >>>
>>> >>>
>>>
>>

Re: scan ignores custom Formatter

Posted by mhd wrk <mh...@gmail.com>.
Basically the sample code (attached) is a copy of DefaultFormatter with
some modifications to `formatEntry`

On Tue, Jul 16, 2019 at 6:13 PM Michael Wall <mj...@apache.org> wrote:

> If you are still having issues, can you share your code?
>
> Mike
>
> On Tue, Jul 16, 2019 at 6:30 PM Christopher <ct...@apache.org> wrote:
>
>> It's possible that the shell itself doesn't have it on its class path.
>> The output of the classpath command is probably the classpath of the
>> tabletserver you've connected to, not the current local shell process.
>>
>> Try `export CLASSPATH=path/to/MyFormatter.jar; bin/accumulo shell ...`
>>
>> On Tue, Jul 16, 2019 at 6:01 PM mhd wrk <mh...@gmail.com> wrote:
>> >
>> > Yes the jar is on all the tservers and I tried `config`command and
>> `formatter` commands as alternatives.
>> > Unfortunately no luck yet.
>> >
>> > On Tue, Jul 16, 2019 at 1:30 PM Michael Wall <mj...@apache.org> wrote:
>> >>
>> >> Couple of thoughts
>> >>
>> >> 1 - Are you putting the jar on all the tservers and restarting
>> everthing?
>> >> 2 - Have you tried setting the formatter on the table as opposed to
>> the scan command.  Something like
>> >> 'config -t mytable -s table.formatter=com.example.MyFormatter'
>> >>
>> >> Mike
>> >>
>> >> On Tue, Jul 16, 2019 at 2:50 PM mhd wrk <mh...@gmail.com>
>> wrote:
>> >>>
>> >>> I'm trying to use a custom formatter with scan command in Accumulo
>> shell, but seems that scan simply ignores the custom formatter and uses the
>> default one!
>> >>>
>> >>> The steps I follow are:
>> >>>
>> >>> 1- Create custom Formatter by extending
>> org.apache.accumulo.core.util.format.Formatter
>> >>>
>> >>> 2- Copy the jar to ${ACCUMULO_HOME}/lib
>> >>>
>> >>> 3- Restart Accumulo to make sure everything is reloaded.
>> >>>
>> >>> 4- run `accumulo shell`
>> >>>
>> >>> 5- run `classpath` and confirm that the formatter jar is included in
>> the path.
>> >>>
>> >>> 5- `scan -f 50 -fm com.example.MyFormatter -st -t mytable`
>> >>>
>> >>>
>> >>> Accumulo version: 1.7.2
>> >>>
>> >>>
>> >>> Any known issues?
>> >>>
>> >>>
>> >>> Thanks,
>> >>>
>> >>> Mohammad
>> >>>
>> >>>
>> >>>
>>
>

Re: scan ignores custom Formatter

Posted by Michael Wall <mj...@apache.org>.
If you are still having issues, can you share your code?

Mike

On Tue, Jul 16, 2019 at 6:30 PM Christopher <ct...@apache.org> wrote:

> It's possible that the shell itself doesn't have it on its class path.
> The output of the classpath command is probably the classpath of the
> tabletserver you've connected to, not the current local shell process.
>
> Try `export CLASSPATH=path/to/MyFormatter.jar; bin/accumulo shell ...`
>
> On Tue, Jul 16, 2019 at 6:01 PM mhd wrk <mh...@gmail.com> wrote:
> >
> > Yes the jar is on all the tservers and I tried `config`command and
> `formatter` commands as alternatives.
> > Unfortunately no luck yet.
> >
> > On Tue, Jul 16, 2019 at 1:30 PM Michael Wall <mj...@apache.org> wrote:
> >>
> >> Couple of thoughts
> >>
> >> 1 - Are you putting the jar on all the tservers and restarting
> everthing?
> >> 2 - Have you tried setting the formatter on the table as opposed to the
> scan command.  Something like
> >> 'config -t mytable -s table.formatter=com.example.MyFormatter'
> >>
> >> Mike
> >>
> >> On Tue, Jul 16, 2019 at 2:50 PM mhd wrk <mh...@gmail.com> wrote:
> >>>
> >>> I'm trying to use a custom formatter with scan command in Accumulo
> shell, but seems that scan simply ignores the custom formatter and uses the
> default one!
> >>>
> >>> The steps I follow are:
> >>>
> >>> 1- Create custom Formatter by extending
> org.apache.accumulo.core.util.format.Formatter
> >>>
> >>> 2- Copy the jar to ${ACCUMULO_HOME}/lib
> >>>
> >>> 3- Restart Accumulo to make sure everything is reloaded.
> >>>
> >>> 4- run `accumulo shell`
> >>>
> >>> 5- run `classpath` and confirm that the formatter jar is included in
> the path.
> >>>
> >>> 5- `scan -f 50 -fm com.example.MyFormatter -st -t mytable`
> >>>
> >>>
> >>> Accumulo version: 1.7.2
> >>>
> >>>
> >>> Any known issues?
> >>>
> >>>
> >>> Thanks,
> >>>
> >>> Mohammad
> >>>
> >>>
> >>>
>

Re: scan ignores custom Formatter

Posted by Christopher <ct...@apache.org>.
It's possible that the shell itself doesn't have it on its class path.
The output of the classpath command is probably the classpath of the
tabletserver you've connected to, not the current local shell process.

Try `export CLASSPATH=path/to/MyFormatter.jar; bin/accumulo shell ...`

On Tue, Jul 16, 2019 at 6:01 PM mhd wrk <mh...@gmail.com> wrote:
>
> Yes the jar is on all the tservers and I tried `config`command and `formatter` commands as alternatives.
> Unfortunately no luck yet.
>
> On Tue, Jul 16, 2019 at 1:30 PM Michael Wall <mj...@apache.org> wrote:
>>
>> Couple of thoughts
>>
>> 1 - Are you putting the jar on all the tservers and restarting everthing?
>> 2 - Have you tried setting the formatter on the table as opposed to the scan command.  Something like
>> 'config -t mytable -s table.formatter=com.example.MyFormatter'
>>
>> Mike
>>
>> On Tue, Jul 16, 2019 at 2:50 PM mhd wrk <mh...@gmail.com> wrote:
>>>
>>> I'm trying to use a custom formatter with scan command in Accumulo shell, but seems that scan simply ignores the custom formatter and uses the default one!
>>>
>>> The steps I follow are:
>>>
>>> 1- Create custom Formatter by extending org.apache.accumulo.core.util.format.Formatter
>>>
>>> 2- Copy the jar to ${ACCUMULO_HOME}/lib
>>>
>>> 3- Restart Accumulo to make sure everything is reloaded.
>>>
>>> 4- run `accumulo shell`
>>>
>>> 5- run `classpath` and confirm that the formatter jar is included in the path.
>>>
>>> 5- `scan -f 50 -fm com.example.MyFormatter -st -t mytable`
>>>
>>>
>>> Accumulo version: 1.7.2
>>>
>>>
>>> Any known issues?
>>>
>>>
>>> Thanks,
>>>
>>> Mohammad
>>>
>>>
>>>

Re: scan ignores custom Formatter

Posted by mhd wrk <mh...@gmail.com>.
Yes the jar is on all the tservers and I tried `config`command and
`formatter` commands as alternatives.
Unfortunately no luck yet.

On Tue, Jul 16, 2019 at 1:30 PM Michael Wall <mj...@apache.org> wrote:

> Couple of thoughts
>
> 1 - Are you putting the jar on all the tservers and restarting everthing?
> 2 - Have you tried setting the formatter on the table as opposed to the
> scan command.  Something like
> 'config -t mytable -s table.formatter=com.example.MyFormatter'
>
> Mike
>
> On Tue, Jul 16, 2019 at 2:50 PM mhd wrk <mh...@gmail.com> wrote:
>
>> I'm trying to use a custom formatter with scan command in Accumulo shell, but seems that scan simply ignores the custom formatter and uses the default one!
>>
>> The steps I follow are:
>>
>> 1- Create custom Formatter by extending org.apache.accumulo.core.util.format.Formatter
>>
>> 2- Copy the jar to ${ACCUMULO_HOME}/lib
>>
>> 3- Restart Accumulo to make sure everything is reloaded.
>>
>> 4- run `accumulo shell`
>>
>> 5- run `classpath` and confirm that the formatter jar is included in the path.
>>
>> 5- `scan -f 50 -fm com.example.MyFormatter -st -t mytable`
>>
>>
>> Accumulo version: 1.7.2
>>
>>
>> Any known issues?
>>
>>
>> Thanks,
>>
>> Mohammad
>>
>>
>>
>>

Re: scan ignores custom Formatter

Posted by Michael Wall <mj...@apache.org>.
Couple of thoughts

1 - Are you putting the jar on all the tservers and restarting everthing?
2 - Have you tried setting the formatter on the table as opposed to the
scan command.  Something like
'config -t mytable -s table.formatter=com.example.MyFormatter'

Mike

On Tue, Jul 16, 2019 at 2:50 PM mhd wrk <mh...@gmail.com> wrote:

> I'm trying to use a custom formatter with scan command in Accumulo shell, but seems that scan simply ignores the custom formatter and uses the default one!
>
> The steps I follow are:
>
> 1- Create custom Formatter by extending org.apache.accumulo.core.util.format.Formatter
>
> 2- Copy the jar to ${ACCUMULO_HOME}/lib
>
> 3- Restart Accumulo to make sure everything is reloaded.
>
> 4- run `accumulo shell`
>
> 5- run `classpath` and confirm that the formatter jar is included in the path.
>
> 5- `scan -f 50 -fm com.example.MyFormatter -st -t mytable`
>
>
> Accumulo version: 1.7.2
>
>
> Any known issues?
>
>
> Thanks,
>
> Mohammad
>
>
>
>