From user-return-36380-apmail-cassandra-user-archive=cassandra.apache.org@cassandra.apache.org Fri Sep 6 00:40:57 2013 Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2D7A310164 for ; Fri, 6 Sep 2013 00:40:57 +0000 (UTC) Received: (qmail 87491 invoked by uid 500); 6 Sep 2013 00:40:54 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 87451 invoked by uid 500); 6 Sep 2013 00:40:54 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 87443 invoked by uid 99); 6 Sep 2013 00:40:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Sep 2013 00:40:54 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE X-Spam-Check-By: apache.org Received-SPF: error (athena.apache.org: local policy) Received: from [72.35.23.34] (HELO smtp-out2.electric.net) (72.35.23.34) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Sep 2013 00:40:49 +0000 Received: from [10.86.10.84] (helo=fuseout2d.electric.net) by bean.electric.net with esmtps (TLSv1:AES256-SHA:256) (Exim 4.77) (envelope-from ) id 1VHk5h-0006j3-W0 for user@cassandra.apache.org; Thu, 05 Sep 2013 17:40:01 -0700 Received: from mailanyone.net by fuseout2d.electric.net with esmtpsa (TLSv1:DHE-RSA-CAMELLIA256-SHA:256) (MailAnyone extSMTP dbrosius@baybroadband.net) id 1VHk5D-0007bR-V5 for user@cassandra.apache.org; Thu, 05 Sep 2013 17:39:32 -0700 Message-ID: <5229240D.4010303@mebigfatguy.com> Date: Thu, 05 Sep 2013 20:38:37 -0400 From: Dave Brosius User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: user@cassandra.apache.org Subject: Re: Custom data type is not work at C* 2.0 References: In-Reply-To: Content-Type: multipart/alternative; boundary="------------020907040902090005070001" X-Virus-Checked: Checked by ClamAV on apache.org This is a multi-part message in MIME format. --------------020907040902090005070001 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit I think your class is missing a required public TypeSerializer getSerializer() {} method This is what you need to derive from https://git-wip-us.apache.org/repos/asf?p=cassandra.git;a=blob;f=src/java/org/apache/cassandra/db/marshal/AbstractType.java;h=74fe446319c199433b47d3ae60fc4d644e86b653;hb=03045ca22b11b0e5fc85c4fabd83ce6121b5709b On 09/04/2013 09:14 AM, Katsutoshi wrote: > package my.marshal; > > import java.nio.ByteBuffer; > > import org.apache.cassandra.db.marshal.AbstractType; > import org.apache.cassandra.db.marshal.MarshalException; > import org.apache.cassandra.utils.ByteBufferUtil; > > public class DummyType extends AbstractType { > > public static final DummyType instance = new DummyType(); > > private DummyType(){ > } > > public Void compose(ByteBuffer bytes){ > return null; > } > > public ByteBuffer decompose(Void value){ > return ByteBufferUtil.EMPTY_BYTE_BUFFER; > } > > public int compare(ByteBuffer o1, ByteBuffer o2){ > return 0; > } > > public String getString(ByteBuffer bytes){ > return ""; > } > > public ByteBuffer fromString(String source) throws MarshalException{ > if(!source.isEmpty()) throw new > MarshalException(String.format("'%s' is not empty", source)); > return ByteBufferUtil.EMPTY_BYTE_BUFFER; > } > > public void validate(ByteBuffer bytes) throws MarshalException{ > } > } --------------020907040902090005070001 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
I think your class is missing a required

public TypeSerializer<Void> getSerializer() {}

method


This is what you need to derive from

https://git-wip-us.apache.org/repos/asf?p=cassandra.git;a=blob;f=src/java/org/apache/cassandra/db/marshal/AbstractType.java;h=74fe446319c199433b47d3ae60fc4d644e86b653;hb=03045ca22b11b0e5fc85c4fabd83ce6121b5709b



On 09/04/2013 09:14 AM, Katsutoshi wrote:
package my.marshal;

import java.nio.ByteBuffer;

import org.apache.cassandra.db.marshal.AbstractType;
import org.apache.cassandra.db.marshal.MarshalException;
import org.apache.cassandra.utils.ByteBufferUtil;

public class DummyType extends AbstractType<Void> {

    public static final DummyType instance = new DummyType();

    private DummyType(){
    }

    public Void compose(ByteBuffer bytes){
        return null;
    }

    public ByteBuffer decompose(Void value){
        return ByteBufferUtil.EMPTY_BYTE_BUFFER;
    }

    public int compare(ByteBuffer o1, ByteBuffer o2){
        return 0;
    }

    public String getString(ByteBuffer bytes){
        return "";
    }

    public ByteBuffer fromString(String source) throws MarshalException{
        if(!source.isEmpty()) throw new MarshalException(String.format("'%s' is not empty", source));
        return ByteBufferUtil.EMPTY_BYTE_BUFFER;
    }

    public void validate(ByteBuffer bytes) throws MarshalException{
    }
}

--------------020907040902090005070001--