Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BE25319C12 for ; Tue, 29 Mar 2016 20:57:25 +0000 (UTC) Received: (qmail 30666 invoked by uid 500); 29 Mar 2016 20:57:25 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 30635 invoked by uid 500); 29 Mar 2016 20:57:25 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 30624 invoked by uid 99); 29 Mar 2016 20:57:25 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Mar 2016 20:57:25 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 69EDB2C0452 for ; Tue, 29 Mar 2016 20:57:25 +0000 (UTC) Date: Tue, 29 Mar 2016 20:57:25 +0000 (UTC) From: "Henry Manasseh (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CASSANDRA-11458) Complete support for CustomExpression MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CASSANDRA-11458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Henry Manasseh updated CASSANDRA-11458: --------------------------------------- Attachment: addCustomIndexExpression change.png > Complete support for CustomExpression > ------------------------------------- > > Key: CASSANDRA-11458 > URL: https://issues.apache.org/jira/browse/CASSANDRA-11458 > Project: Cassandra > Issue Type: Improvement > Components: Core > Reporter: Henry Manasseh > Priority: Minor > Attachments: Custom-expression-Change.png, addCustomIndexExpression change.png > > > This is a proposal to complete the CustomExpression support first introduced as part of https://issues.apache.org/jira/browse/CASSANDRA-10217. > The current support for custom expressions is partial. There is no clean way to implement queries making use of the "exp('index', 'value)" syntax due to the fact CustomExpression is declared as final and there is no way to for developers to cleanly plug-in their own expressions. > https://github.com/apache/cassandra/blob/6e69c75900f3640195130085ad69daa1659184eb/src/java/org/apache/cassandra/db/filter/RowFilter.java#L869 > The proposal is to make CustomExpression not final so that developers can extend and create their own subclass and provide their own isSatisfiedBy operation (which currently always returns true). > Introducing a new custom expression would be done as follows: > 1. Developer would create a subclass of CustomExpression and override isSatisfiedBy method with their logic (public boolean isSatisfiedBy(CFMetaData metadata, DecoratedKey partitionKey, Row row)) > 2. This class would be packaged in a jar and copied to the cassandra lib directory along with a secondary index class which overrides Index.customExpressionValueType > 2. Create the custom index with an option which identifies the CustomExpression subclass (custom_expression_class). > CREATE CUSTOM INDEX ON keyspace.my_table(my_indexed_column) USING 'org.custom.MyCustomIndex' > WITH OPTIONS = { 'custom_expression_class': 'org.custom.MyCustomExpression' }; > I have prototyped the change and works as designed. In my case I do a type of "IN" query filter which will simplify my client logic significantly. > The default behavior of using the CustomExpression class would be maintained if the developer does not provide a custom class in the create index options. -- This message was sent by Atlassian JIRA (v6.3.4#6332)