|
|
-
making Scanner iterate through different version of cell
Sami Omer 2012-10-18, 17:25
Hello everyone,
Is there a way to programmatically iterate through the different version of a cell (cells that have identical row id, column family, and column qualifier but different timestamps) in Accumulo 1.3.6?
I was looking over the documentation and saw that those settings can be applied per table through the command line, but is it doable via the API?
Thank you.
-
RE: making Scanner iterate through different version of cell
Bob.Thorman@... 2012-10-18, 17:35
You can use the VersioningIterator within your scanner and specify the number of versions (i.e. timestamps) you want. Or you can use the TimeStampFilter and specify the time range for the rows you want. Or use no iterators at all and let the scanner give you ALL rows.
From: Sami Omer [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 18, 2012 12:25 To: [EMAIL PROTECTED] Subject: making Scanner iterate through different version of cell
Hello everyone,
Is there a way to programmatically iterate through the different version of a cell (cells that have identical row id, column family, and column qualifier but different timestamps) in Accumulo 1.3.6?
I was looking over the documentation and saw that those settings can be applied per table through the command line, but is it doable via the API?
Thank you.
-
Re: making Scanner iterate through different version of cell
Eric Newton 2012-10-18, 17:38
You just need to remove the Versioning iterator that is put on the table by default:
$ ./bin/accumulo shell --fake Enter current password for 'ecn'@'mock-instance':
Shell - Apache Accumulo Interactive Shell - - version: 1.4.3-SNAPSHOT - instance name: mock-instance - instance id: mock-instance-id - - type 'help' for a list of available commands - ecn@mock-instance> createtable test ecn@mock-instance test> deleteiter -scan -majc -minc -n vers ecn@mock-instance test> insert a b c d ecn@mock-instance test> insert a b c e ecn@mock-instance test> insert a b c f ecn@mock-instance test> scan -st a b:c [] 1350581608126 f a b:c [] 1350581607086 e a b:c [] 1350581605986 d ecn@mock-instance test> On Thu, Oct 18, 2012 at 1:25 PM, Sami Omer <[EMAIL PROTECTED]> wrote: > Hello everyone, > > > > Is there a way to programmatically iterate through the different version of > a cell (cells that have identical row id, column family, and column > qualifier but different timestamps) in Accumulo 1.3.6? > > > > I was looking over the documentation and saw that those settings can be > applied per table through the command line, but is it doable via the API? > > > > Thank you.
-
Re: making Scanner iterate through different version of cell
William Slacum 2012-10-18, 17:43
I think you'll probably have to have modify the table configuration since the VersioningIterator is applied by default at level 20.
On Thu, Oct 18, 2012 at 10:35 AM, <[EMAIL PROTECTED]> wrote:
> You can use the VersioningIterator within your scanner and specify the > number of versions (i.e. timestamps) you want. Or you can use the > TimeStampFilter and specify the time range for the rows you want. Or use > no iterators at all and let the scanner give you ALL rows. **** > > ** ** > > *From:* Sami Omer [mailto:[EMAIL PROTECTED]] > *Sent:* Thursday, October 18, 2012 12:25 > *To:* [EMAIL PROTECTED] > *Subject:* making Scanner iterate through different version of cell**** > > ** ** > > Hello everyone,**** > > ** ** > > Is there a way to programmatically iterate through the different version > of a cell (cells that have identical row id, column family, and column > qualifier but different timestamps) in Accumulo 1.3.6?**** > > ** ** > > I was looking over the documentation and saw that those settings can be > applied per table through the command line, but is it doable via the API?* > *** > > ** ** > > Thank you.**** >
-
Re: making Scanner iterate through different version of cell
John Stoneham 2012-10-18, 18:28
Here's some Java code to do just that:
public void removeVersioningIterator(String tableName) throws TableNotFoundException, CBSecurityException, CBException { Iterable<Map.Entry<String, String>> properties connector.tableOperations().getProperties(tableName); List<String> versioningIteratorPropertyNames = Arrays.asList( "table.iterator.majc.vers", "table.iterator.majc.vers.opt.maxVersions", "table.iterator.minc.vers", "table.iterator.minc.vers.opt.maxVersions", "table.iterator.scan.vers", "table.iterator.scan.vers.opt.maxVersions" ); for (String propertyName : versioningIteratorPropertyNames) { for (Map.Entry<String, String> tableProperty : properties) { if (tableProperty.getKey().equals(propertyName)) { connector.tableOperations().removeProperty(tableName, propertyName); break; } } } } On Thu, Oct 18, 2012 at 1:43 PM, William Slacum < [EMAIL PROTECTED]> wrote:
> I think you'll probably have to have modify the table configuration since > the VersioningIterator is applied by default at level 20. > > > On Thu, Oct 18, 2012 at 10:35 AM, <[EMAIL PROTECTED]> wrote: > >> You can use the VersioningIterator within your scanner and specify the >> number of versions (i.e. timestamps) you want. Or you can use the >> TimeStampFilter and specify the time range for the rows you want. Or use >> no iterators at all and let the scanner give you ALL rows. **** >> >> ** ** >> >> *From:* Sami Omer [mailto:[EMAIL PROTECTED]] >> *Sent:* Thursday, October 18, 2012 12:25 >> *To:* [EMAIL PROTECTED] >> *Subject:* making Scanner iterate through different version of cell**** >> >> ** ** >> >> Hello everyone,**** >> >> ** ** >> >> Is there a way to programmatically iterate through the different version >> of a cell (cells that have identical row id, column family, and column >> qualifier but different timestamps) in Accumulo 1.3.6?**** >> >> ** ** >> >> I was looking over the documentation and saw that those settings can be >> applied per table through the command line, but is it doable via the API? >> **** >> >> ** ** >> >> Thank you.**** >> > > -- John Stoneham [EMAIL PROTECTED]
-
Re: making Scanner iterate through different version of cell
Billie Rinaldi 2012-10-18, 19:03
On Thu, Oct 18, 2012 at 11:28 AM, John Stoneham <[EMAIL PROTECTED]> wrote:
> Here's some Java code to do just that: > > public void removeVersioningIterator(String tableName) throws > TableNotFoundException, CBSecurityException, CBException { > Iterable<Map.Entry<String, String>> properties > connector.tableOperations().getProperties(tableName); > List<String> versioningIteratorPropertyNames = Arrays.asList( > "table.iterator.majc.vers", > "table.iterator.majc.vers.opt.maxVersions", > "table.iterator.minc.vers", > "table.iterator.minc.vers.opt.maxVersions", > "table.iterator.scan.vers", > "table.iterator.scan.vers.opt.maxVersions" > ); > for (String propertyName : versioningIteratorPropertyNames) { > for (Map.Entry<String, String> tableProperty : properties) { > if (tableProperty.getKey().equals(propertyName)) { > connector.tableOperations().removeProperty(tableName, > propertyName); > break; > } > } > } > } >
You should be able to accomplish the same thing with this in 1.4: conn.tableOperations().removeIterator(tableName, "vers", EnumSet.allOf(IteratorScope.class));
Billie
-
Re: making Scanner iterate through different version of cell
John Stoneham 2012-10-18, 19:32
Thanks, Billie - I'm working on a 1.4 upgrade right now so that will be helpful to include. (Obviously my code was written against 1.3.)
On Thu, Oct 18, 2012 at 3:03 PM, Billie Rinaldi <[EMAIL PROTECTED]> wrote:
> On Thu, Oct 18, 2012 at 11:28 AM, John Stoneham <[EMAIL PROTECTED]>wrote: > >> Here's some Java code to do just that: >> >> public void removeVersioningIterator(String tableName) throws >> TableNotFoundException, CBSecurityException, CBException { >> Iterable<Map.Entry<String, String>> properties >> connector.tableOperations().getProperties(tableName); >> List<String> versioningIteratorPropertyNames = Arrays.asList( >> "table.iterator.majc.vers", >> "table.iterator.majc.vers.opt.maxVersions", >> "table.iterator.minc.vers", >> "table.iterator.minc.vers.opt.maxVersions", >> "table.iterator.scan.vers", >> "table.iterator.scan.vers.opt.maxVersions" >> ); >> for (String propertyName : versioningIteratorPropertyNames) { >> for (Map.Entry<String, String> tableProperty : properties) { >> if (tableProperty.getKey().equals(propertyName)) { >> connector.tableOperations().removeProperty(tableName, >> propertyName); >> break; >> } >> } >> } >> } >> > > You should be able to accomplish the same thing with this in 1.4: > conn.tableOperations().removeIterator(tableName, "vers", > EnumSet.allOf(IteratorScope.class)); > > Billie >
-- John Stoneham [EMAIL PROTECTED]
|
|