<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>DataStax Support Forums &#187; Topic: integers inserted with cqlsh are not the same as integers inserted with hector</title>
		<link>http://www.datastax.com/support-forums/topic/integers-inserted-with-cqlsh-are-not-the-same-as-integers-inserted-with-hector</link>
		<description>Software, Support, and Training for Apache Cassandra</description>
		<language>en-US</language>
		<pubDate>Sat, 18 May 2013 16:09:50 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.3</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.datastax.com/support-forums/search.php</link>
		</textInput>
		<atom:link href="http://www.datastax.com/support-forums/rss/topic/integers-inserted-with-cqlsh-are-not-the-same-as-integers-inserted-with-hector" rel="self" type="application/rss+xml" />

		<item>
			<title>purblind on "integers inserted with cqlsh are not the same as integers inserted with hector"</title>
			<link>http://www.datastax.com/support-forums/topic/integers-inserted-with-cqlsh-are-not-the-same-as-integers-inserted-with-hector#post-1079</link>
			<pubDate>Wed, 01 Feb 2012 16:07:53 +0000</pubDate>
			<dc:creator>purblind</dc:creator>
			<guid isPermaLink="false">1079@http://www.datastax.com/support-forums/</guid>
			<description>&#60;p&#62;description:&#60;br /&#62;
setting integer column values with cqlsh does not return the same values when read back with Hector; &#60;/p&#62;
&#60;p&#62;cassandra version 1.0.7&#60;br /&#62;
hector version 1.0-2&#60;/p&#62;
&#60;p&#62;mycf: 1-row, multi-column CF with integer values:&#60;br /&#62;
ColumnFamily: mycf&#60;br /&#62;
      Key Validation Class: org.apache.cassandra.db.marshal.AsciiType&#60;br /&#62;
      Default column value validator: org.apache.cassandra.db.marshal.IntegerType&#60;br /&#62;
      Columns sorted by: org.apache.cassandra.db.marshal.UTF8Type&#60;br /&#62;
      Row cache size / save period in seconds / keys to save : 0.0/0/all&#60;br /&#62;
      Row Cache Provider: org.apache.cassandra.cache.SerializingCacheProvider&#60;br /&#62;
      Key cache size / save period in seconds: 200000.0/14400&#60;br /&#62;
      GC grace seconds: 864000&#60;br /&#62;
      Compaction min/max thresholds: 4/32&#60;br /&#62;
      Read repair chance: 1.0&#60;br /&#62;
      Replicate on write: true&#60;br /&#62;
      Bloom Filter FP chance: default&#60;br /&#62;
      Built indexes: []&#60;/p&#62;
&#60;p&#62;cqlsh:&#60;br /&#62;
update mycf set alt = 81001 where KEY = 'alt';&#60;/p&#62;
&#60;p&#62;java:&#60;br /&#62;
public void write(final String alt, final int hash) {&#60;br /&#62;
        final Mutator&#38;lt;String&#38;gt; mut = HFactory.createMutator(&#60;br /&#62;
                HFactory.createKeyspace(&#34;test&#34;, cluster),&#60;br /&#62;
                StringSerializer.get());&#60;br /&#62;
        mut.addInsertion(&#34;alt&#34;, &#34;mycf&#34;, HFactory.createColumn(alt, hash,&#60;br /&#62;
                StringSerializer.get(), IntegerSerializer.get()));&#60;br /&#62;
        mut.execute();&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62; public int read(final String alt) {&#60;br /&#62;
        final RangeSlicesQuery&#38;lt;String, String, Integer&#38;gt; query = HFactory&#60;br /&#62;
                .createRangeSlicesQuery(&#60;br /&#62;
                        HFactory.createKeyspace(&#34;test&#34;, cluster),&#60;br /&#62;
                        StringSerializer.get(), StringSerializer.get(),&#60;br /&#62;
                        IntegerSerializer.get()).setColumnFamily(&#34;mycf&#34;)&#60;br /&#62;
                .setRange(null, null, false, 13).setColumnNames(alt);&#60;/p&#62;
&#60;p&#62;        final ArrayList&#38;lt;Byte&#38;gt; arrayList = new ArrayList&#38;lt;Byte&#38;gt;();&#60;br /&#62;
        Integer result = null;&#60;br /&#62;
        for (final Row&#38;lt;String, String, Integer&#38;gt; item : query.setRowCount(10)&#60;br /&#62;
                .execute().get().getList()) {&#60;/p&#62;
&#60;p&#62;            final HColumn&#38;lt;String, Integer&#38;gt; i = item.getColumnSlice()&#60;br /&#62;
                    .getColumnByName(alt);&#60;br /&#62;
            log.debug(Arrays.toString(i.getValueBytes().array()));&#60;br /&#62;
            result = i.getValue();&#60;/p&#62;
&#60;p&#62;        }&#60;/p&#62;
&#60;p&#62;        return result;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;writing an integer with hector, and reading with hector:&#60;br /&#62;
[-128, 1, 0, 2, 0, 0, 0, 16, 103, 101, 116, 95, 114, 97, 110, 103, 101, 95, 115, 108, 105, 99, 101, 115, 0, 0, 0, 5, 15, 0, 0, 12, 0, 0, 0, 1, 11, 0, 1, 0, 0, 0, 3, 97, 108,&#60;br /&#62;
116, 15, 0, 2, 12, 0, 0, 0, 1, 12, 0, 1, 11, 0, 1, 0, 0, 0, 6, 68, 69, 78, 73, 83, 50, 11, 0, 2, 0, 0, 0, 4, 0, 1, 60, 105, 10, 0, 3, 0, 4, -73, -24, -127, -39, 107, -128, 0, 0, 0, 0]&#60;/p&#62;
&#60;p&#62;writing an integer with cqlsh, reading with hector:&#60;br /&#62;
[-128, 1, 0, 2, 0, 0, 0, 16, 103, 101, 116, 95, 114, 97, 110, 103, 101, 95, 115, 108, 105, 99, 101, 115, 0, 0, 0, 3, 15, 0, 0, 12, 0, 0, 0, 1, 11, 0, 1, 0, 0, 0, 3, 97, 108,&#60;br /&#62;
116, 15, 0, 2, 12, 0, 0, 0, 1, 12, 0, 1, 11, 0, 1, 0, 0, 0, 6, 68, 69, 78, 73, 83, 50, 11, 0, 2, 0, 0, 0, 3, 1, 60, 105, 10, 0, 3, 0, 4, -73, -24, -111, 104, 96, 56, 0, 0, 0, 0]
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
