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 347D31022E for ; Mon, 24 Feb 2014 19:50:48 +0000 (UTC) Received: (qmail 38298 invoked by uid 500); 24 Feb 2014 19:50:45 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 38268 invoked by uid 500); 24 Feb 2014 19:50:45 -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 38254 invoked by uid 99); 24 Feb 2014 19:50:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Feb 2014 19:50:44 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [209.85.220.182] (HELO mail-vc0-f182.google.com) (209.85.220.182) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Feb 2014 19:50:40 +0000 Received: by mail-vc0-f182.google.com with SMTP id id10so6355817vcb.27 for ; Mon, 24 Feb 2014 11:50:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=zf4xyxB7Z0AgNk+9pY47fmiQLQr164F1Qb7tQ6zwLMI=; b=nI74T+hQeHzOkw4djS9F56LlZAl/ez/zZTmIHjr0mtCYYCDBj//9wN86OX5QMxcspF jhNPZHQLjQLRpOC/OWRuJwrrpO4rovPBqsFi1ps/IXrpXMcEVOB/E5QQjN9vqEdlaHuL spCB92SeAknn7jEauMBLaO3K8FcwphfSbTSMIduQdvCHd5dO+epDqOeVr1TX8zwks7b2 hmGVzAK3ZLcOF2FXQw/c38rvdh+AEOsRFroKL9nECgLHHBJohM6vhmc7bWgPvmNhBPOd Y6fQkv2+iwsFBpX349NII9Hkr8/Xt7nI1SjEAMVDL0xTLpvnKwcnO/Kc+Kd+gdIVnZRs yG8g== X-Gm-Message-State: ALoCoQnnnUHE/z1JPavQOrMdGgIcqWg1e58ZbaDKbC1U3HyDiBKbKJNBdpoHh+84L8g0CSTK+uxN MIME-Version: 1.0 X-Received: by 10.220.99.72 with SMTP id t8mr13932624vcn.10.1393271419256; Mon, 24 Feb 2014 11:50:19 -0800 (PST) Received: by 10.58.57.201 with HTTP; Mon, 24 Feb 2014 11:50:19 -0800 (PST) In-Reply-To: <20140224194307.7ad256cd@shy.leonerd.org.uk> References: <20140224184009.58518b29@shy.leonerd.org.uk> <20140224190214.009083a4@shy.leonerd.org.uk> <20140224194307.7ad256cd@shy.leonerd.org.uk> Date: Mon, 24 Feb 2014 20:50:19 +0100 Message-ID: Subject: Re: CQL decimal encoding From: Theo Hultberg To: user@cassandra.apache.org Cc: 0x6e6562@gmail.com, woolfel@gmail.com Content-Type: multipart/alternative; boundary=001a11c1d71c05584b04f32c48f7 X-Virus-Checked: Checked by ClamAV on apache.org --001a11c1d71c05584b04f32c48f7 Content-Type: text/plain; charset=ISO-8859-1 I don't know if it's by design or if it's by oversight that the data types aren't part of the binary protocol specification. I had to reverse engineer how to encode and decode all of them for the Ruby driver. There were definitely a few bugs in the first few versions that could have been avoided if there was a specification available. T# On Mon, Feb 24, 2014 at 8:43 PM, Paul "LeoNerd" Evans < leonerd@leonerd.org.uk> wrote: > On Mon, 24 Feb 2014 19:14:48 +0000 > Ben Hood <0x6e6562@gmail.com> wrote: > > > So I have a question about the encoding of 0: \x00\x00\x00\x00\x00. > > The first four octets are the decimal shift (0), and the remaining ones > (one in this case) encode a varint - 0 in this case. So it's > > 0 * 10**0 > > literally zero. > > Technically the decimal shift matters not for zero - any four bytes > could be given as the shift, ending in \x00, but 0 is the simplest. > > -- > Paul "LeoNerd" Evans > > leonerd@leonerd.org.uk > ICQ# 4135350 | Registered Linux# 179460 > http://www.leonerd.org.uk/ > --001a11c1d71c05584b04f32c48f7 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I don't know if it's by design or if it's by o= versight that the data types aren't part of the binary protocol specifi= cation. I had to reverse engineer how to encode and decode all of them for = the Ruby driver. There were definitely a few bugs in the first few versions= that could have been avoided if there was a specification available.

T#


=
On Mon, Feb 24, 2014 at 8:43 PM, Paul "LeoN= erd" Evans <leonerd@leonerd.org.uk> wrote:
On Mon, 24 Feb 2014 19:14:48= +0000
Ben Hood <0x6e6562@gmail.com&g= t; wrote:

> So I have a question about the encoding of 0: \x00\x00\x00\x00\x00.
The first four octets are the decimal shift (0), and the remaining on= es
(one in this case) encode a varint - 0 in this case. So it's

=A0 0 * 10**0

literally zero.

Technically the decimal shift matters not for zero - any four bytes
could be given as the shift, ending in \x00, but 0 is the simplest.

--
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk
ICQ# 4135350 =A0 =A0 =A0 | =A0Registered Linux# 179460
http://www.leonerd= .org.uk/

--001a11c1d71c05584b04f32c48f7--