Re: Empty cqlsh cells vs. null

2014-10-27 Thread Jens Rantil
Tyler,




I see. That explains it. Any chance you might know how the Datastax Java driver 
behaves for this (odd) case?




Cheers,

Jens



———
Jens Rantil
Backend engineer
Tink AB

Email: jens.ran...@tink.se
Phone: +46 708 84 18 32
Web: www.tink.se

Facebook Linkedin Twitter





On Friday, Oct 24, 2014 at 6:24 pm, Tyler Hobbs ty...@datastax.com, wrote:



On Fri, Oct 24, 2014 at 6:38 AM, Jens Rantil jens.ran...@tink.se wrote:




Just to clarify, I am seeing three types of output for an int field. It’s 
either:

 * Empty output. Nothing. Nil. Also ‘’.

 * An integer written in green. Regexp: [0-9]+

 * Explicitly ‘null’ written in red letters.







Some types (including ints) accept an empty string/ByteBuffer as a valid value. 
 This is distinct from null, or no cell being present.  This behavior is 
primarily a legacy from the Thrift days.

-- 
Tyler Hobbs
DataStax

Re: Empty cqlsh cells vs. null

2014-10-27 Thread Sylvain Lebresne
On Mon, Oct 27, 2014 at 11:05 AM, Jens Rantil jens.ran...@tink.se wrote:

  Tyler,

 I see. That explains it. Any chance you might know how the Datastax Java
 driver behaves for this (odd) case?


The Row.getInt() method will do as for nulls and return 0 (though of
course, the Row.isNull() method will return false). If you want to
explicitely check if it's an empty value, you'll have to use
getBytesUnsafe(). Long story short, unless you like suffering for no
reason, don't insert empty values for types for which it doesn't make sense.

--
Sylvain




 Cheers,
 Jens

 ——— Jens Rantil Backend engineer Tink AB Email: jens.ran...@tink.se
 Phone: +46 708 84 18 32 Web: www.tink.se Facebook Linkedin Twitter

 On Friday, Oct 24, 2014 at 6:24 pm, Tyler Hobbs ty...@datastax.com,
 wrote:


 On Fri, Oct 24, 2014 at 6:38 AM, Jens Rantil jens.ran...@tink.se wrote:


 Just to clarify, I am seeing three types of output for an int field.
 It’s either:
  * Empty output. Nothing. Nil. Also ‘’.
  * An integer written in green. Regexp: [0-9]+
  * Explicitly ‘null’ written in red letters.


  Some types (including ints) accept an empty string/ByteBuffer as a
 valid value.  This is distinct from null, or no cell being present.  This
 behavior is primarily a legacy from the Thrift days.

 --
 Tyler Hobbs
 DataStax http://datastax.com/




Re: Empty cqlsh cells vs. null

2014-10-24 Thread Jens Rantil
This is interesting, because I am definitely seeing three different types of 
values. See attached screenshot and link.




Link: https://gist.github.com/JensRantil/d162801812ca48ad3f75

Image/screenshot: https://www.dropbox.com/s/vczzgrf0vk9adzk/cqlsh-int.png?dl=0


Cheers,

Jens


———
Jens Rantil
Backend engineer
Tink AB

Email: jens.ran...@tink.se
Phone: +46 708 84 18 32
Web: www.tink.se

Facebook Linkedin Twitter

On Thu, Oct 23, 2014 at 4:40 PM, Adam Holmberg adam.holmb...@datastax.com
wrote:

 'null' is how cqlsh displays empty cells:
 https://github.com/apache/cassandra/blob/trunk/pylib/cqlshlib/formatting.py#L47-L58
 On Thu, Oct 23, 2014 at 9:36 AM, DuyHai Doan doanduy...@gmail.com wrote:
 Hello Jens

 What do you mean by cqlsh explicitely writes 'null' in those cells ?
 Are you seing textual value null written in the cells ?


  Null in CQL can have 2 meanings:

 1. the column did not exist (or more precisely, has never been created)
 2. the column did exist sometimes in the past (has been created) but then
 has been deleted (tombstones)



 On Thu, Oct 23, 2014 at 8:37 AM, Jens Rantil jens.ran...@tink.se wrote:

  Hi,

 Not sure this is a Datastax specific question to be asked elsewhere. In
 that case, let me know.

 Anyway, I have populated a Cassandra table from DSE Hive. When I fire up
 cqlsh and execute a SELECT against the table I have columns of INT type
 that are empty. At first I thought these were null, but it turns out that
 cqlsh explicitly writes null in those cells. What can I make of this? A
 bug in Hive serialization to Cassandra?

 Cheers,
 Jens

 —
 Sent from Mailbox https://www.dropbox.com/mailbox




Re: Empty cqlsh cells vs. null

2014-10-24 Thread Jens Rantil
 What do you mean by “cqlsh explicitely writes ‘null’ in those cells” ?  Are 
 you seing textual value “null” written in the cells ?




Just to clarify, I am seeing three types of output for an int field. It’s 
either:

 * Empty output. Nothing. Nil. Also ‘’.

 * An integer written in green. Regexp: [0-9]+

 * Explicitly ‘null’ written in red letters.




My question concerns what the difference between Empty output and ‘null’ is. 
I’m also curious how my Datastax Java driver will handle this, but that’ll be 
my next quest, I guess.




Thanks,

Jens


———
Jens Rantil
Backend engineer
Tink AB

Email: jens.ran...@tink.se
Phone: +46 708 84 18 32
Web: www.tink.se

Facebook Linkedin Twitter

On Thu, Oct 23, 2014 at 4:36 PM, DuyHai Doan doanduy...@gmail.com wrote:

 Hello Jens
 What do you mean by cqlsh explicitely writes 'null' in those cells ?  Are
 you seing textual value null written in the cells ?
  Null in CQL can have 2 meanings:
 1. the column did not exist (or more precisely, has never been created)
 2. the column did exist sometimes in the past (has been created) but then
 has been deleted (tombstones)
 On Thu, Oct 23, 2014 at 8:37 AM, Jens Rantil jens.ran...@tink.se wrote:
  Hi,

 Not sure this is a Datastax specific question to be asked elsewhere. In
 that case, let me know.

 Anyway, I have populated a Cassandra table from DSE Hive. When I fire up
 cqlsh and execute a SELECT against the table I have columns of INT type
 that are empty. At first I thought these were null, but it turns out that
 cqlsh explicitly writes null in those cells. What can I make of this? A
 bug in Hive serialization to Cassandra?

 Cheers,
 Jens

 —
 Sent from Mailbox https://www.dropbox.com/mailbox


Re: Empty cqlsh cells vs. null

2014-10-24 Thread Tyler Hobbs
On Fri, Oct 24, 2014 at 6:38 AM, Jens Rantil jens.ran...@tink.se wrote:


 Just to clarify, I am seeing three types of output for an int field. It’s
 either:
  * Empty output. Nothing. Nil. Also ‘’.
  * An integer written in green. Regexp: [0-9]+
  * Explicitly ‘null’ written in red letters.


Some types (including ints) accept an empty string/ByteBuffer as a valid
value.  This is distinct from null, or no cell being present.  This
behavior is primarily a legacy from the Thrift days.

-- 
Tyler Hobbs
DataStax http://datastax.com/


Empty cqlsh cells vs. null

2014-10-23 Thread Jens Rantil
Hi,

Not sure this is a Datastax specific question to be asked elsewhere. In that 
case, let me know.


Anyway, I have populated a Cassandra table from DSE Hive. When I fire up cqlsh 
and execute a SELECT against the table I have columns of INT type that are 
empty. At first I thought these were null, but it turns out that cqlsh 
explicitly writes null in those cells. What can I make of this? A bug in Hive 
serialization to Cassandra?


Cheers,
Jens

—
Sent from Mailbox

Re: Empty cqlsh cells vs. null

2014-10-23 Thread DuyHai Doan
Hello Jens

What do you mean by cqlsh explicitely writes 'null' in those cells ?  Are
you seing textual value null written in the cells ?


 Null in CQL can have 2 meanings:

1. the column did not exist (or more precisely, has never been created)
2. the column did exist sometimes in the past (has been created) but then
has been deleted (tombstones)



On Thu, Oct 23, 2014 at 8:37 AM, Jens Rantil jens.ran...@tink.se wrote:

  Hi,

 Not sure this is a Datastax specific question to be asked elsewhere. In
 that case, let me know.

 Anyway, I have populated a Cassandra table from DSE Hive. When I fire up
 cqlsh and execute a SELECT against the table I have columns of INT type
 that are empty. At first I thought these were null, but it turns out that
 cqlsh explicitly writes null in those cells. What can I make of this? A
 bug in Hive serialization to Cassandra?

 Cheers,
 Jens

 —
 Sent from Mailbox https://www.dropbox.com/mailbox



Re: Empty cqlsh cells vs. null

2014-10-23 Thread Adam Holmberg
'null' is how cqlsh displays empty cells:
https://github.com/apache/cassandra/blob/trunk/pylib/cqlshlib/formatting.py#L47-L58

On Thu, Oct 23, 2014 at 9:36 AM, DuyHai Doan doanduy...@gmail.com wrote:

 Hello Jens

 What do you mean by cqlsh explicitely writes 'null' in those cells ?
 Are you seing textual value null written in the cells ?


  Null in CQL can have 2 meanings:

 1. the column did not exist (or more precisely, has never been created)
 2. the column did exist sometimes in the past (has been created) but then
 has been deleted (tombstones)



 On Thu, Oct 23, 2014 at 8:37 AM, Jens Rantil jens.ran...@tink.se wrote:

  Hi,

 Not sure this is a Datastax specific question to be asked elsewhere. In
 that case, let me know.

 Anyway, I have populated a Cassandra table from DSE Hive. When I fire up
 cqlsh and execute a SELECT against the table I have columns of INT type
 that are empty. At first I thought these were null, but it turns out that
 cqlsh explicitly writes null in those cells. What can I make of this? A
 bug in Hive serialization to Cassandra?

 Cheers,
 Jens

 —
 Sent from Mailbox https://www.dropbox.com/mailbox