Vijay2win / inverted-index

Cassandra inverted index using trigger, This project was created to show an example for CASSANDRA-1311
1 stars 0 forks source link

Inverted Index Example #1

Open marcusbb opened 11 years ago

marcusbb commented 11 years ago

Hi Vijay. I'm test driving the Cassandra trigger functionality, and have run into an issue in the arch-type example of InvertedIndex: I'm running 2.0.1 (released).

I cloned your class (called in LogAll).

Preconditions: cqlsh:test> create table behappy (id text, data text); cqlsh:test> create TRIGGER logtrigger ON behappy using 'triggers.rip.LogAll'; cqlsh:test> insert INTO behappy (id, data ) VALUES ( 'id5','somedata');

The code " update.getColumn(name).value()); " Throws and UnsupportedOperationException, as it's implementation is an UnSortedColumns.

I'm not sure if there is something special you need to add into the ColumnFamily definition to get this to work properly. I've fixed by iterating over the columns.

System log: java.lang.RuntimeException: Exception while creating trigger on CF with ID: 662f7c24-d2ee-33fa-9ef6-4c886b17e22a at org.apache.cassandra.triggers.TriggerExecutor.execute(TriggerExecutor.java:131) at org.apache.cassandra.triggers.TriggerExecutor.execute(TriggerExecutor.java:73) at org.apache.cassandra.service.StorageProxy.mutateWithTriggers(StorageProxy.java:547) at org.apache.cassandra.cql3.statements.ModificationStatement.executeWithoutCondition(ModificationStatement.java:379) at org.apache.cassandra.cql3.statements.ModificationStatement.execute(ModificationStatement.java:363) at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:101) at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:117) at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:108) at org.apache.cassandra.thrift.CassandraServer.execute_cql3_query(CassandraServer.java:1933) at org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4394) at org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4378) at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39) at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39) at org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:194) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724) Caused by: java.lang.UnsupportedOperationException at org.apache.cassandra.db.UnsortedColumns.getColumn(UnsortedColumns.java:105) at triggers.rip.LogAll.augment(LogAll.java:22) at org.apache.cassandra.triggers.TriggerExecutor.execute(TriggerExecutor.java:123)

Vijay2win commented 11 years ago

Hi, this project is deprecated can you try the Cassandra example and see if this issue persist? Or paste the code i can take a look at it. Thanks!

marcusbb commented 11 years ago

Hi Vijay: I first created a table from cqlsh: CREATE TABLE behappy ( id text, data text, PRIMARY KEY (id) ) ; Same for this definition: CREATE TABLE comp ( id text, type text, data text, PRIMARY KEY (id, type) ) ;

The method bolded throws an UnsupportedOperationException. I haven’t seen an update in the 2.0.0 branch in github, ie. it looks the same.

public Collection augment(ByteBuffer key, ColumnFamily update) { List mutations = new ArrayList(); for (ByteBuffer name : update.getColumnNames()) { RowMutation mutation = new RowMutation(properties.getProperty("keyspace"), update.getColumn(name).value()); mutation.add(properties.getProperty("columnfamily"), name, key, System.currentTimeMillis()); mutations.add(mutation); } return mutations; }

From: Vijay Parthasarathy [mailto:notifications@github.com] Sent: Monday, October 21, 2013 4:54 PM To: Vijay2win/inverted-index Cc: Marcus Simonsen Subject: Re: [inverted-index] Inverted Index Example (#1)

Hi, this project is deprecated can you try the Cassandra example and see if this issue persist? Or paste the code i can take a look at it. Thanks!

Reply to this email directly or view it on GitHubhttps://github.com/Vijay2win/inverted-index/issues/1#issuecomment-26755320.

This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

marcusbb commented 11 years ago

In addition I used the cql statement after the tables were created.

CREATE TRIGGER on behappy USING ‘classname’; CREATE TRIGGER on comp USING ‘classname’;

It appears that the ColumnFamily implementation “org.apache.cassandra.db.UnSortedColumns” doesn’t support this method. Column iteration on the ColumnFamily is fine though.

From: Marcus Simonsen Sent: Tuesday, October 22, 2013 2:03 PM To: 'Vijay2win/inverted-index' Subject: RE: [inverted-index] Inverted Index Example (#1)

Hi Vijay: I first created a table from cqlsh: CREATE TABLE behappy ( id text, data text, PRIMARY KEY (id) ) ; Same for this definition: CREATE TABLE comp ( id text, type text, data text, PRIMARY KEY (id, type) ) ;

The method bolded throws an UnsupportedOperationException. I haven’t seen an update in the 2.0.0 branch in github, ie. it looks the same.

public Collection augment(ByteBuffer key, ColumnFamily update) { List mutations = new ArrayList(); for (ByteBuffer name : update.getColumnNames()) { RowMutation mutation = new RowMutation(properties.getProperty("keyspace"), update.getColumn(name).value()); mutation.add(properties.getProperty("columnfamily"), name, key, System.currentTimeMillis()); mutations.add(mutation); } return mutations; }

From: Vijay Parthasarathy [mailto:notifications@github.com] Sent: Monday, October 21, 2013 4:54 PM To: Vijay2win/inverted-index Cc: Marcus Simonsen Subject: Re: [inverted-index] Inverted Index Example (#1)

Hi, this project is deprecated can you try the Cassandra example and see if this issue persist? Or paste the code i can take a look at it. Thanks!

Reply to this email directly or view it on GitHubhttps://github.com/Vijay2win/inverted-index/issues/1#issuecomment-26755320.

This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.