You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Jaume M (JIRA)" <ji...@apache.org> on 2017/05/09 19:12:11 UTC

[jira] [Updated] (CASSANDRA-13516) Message error for Duration types is confusing

     [ https://issues.apache.org/jira/browse/CASSANDRA-13516?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jaume M updated CASSANDRA-13516:
--------------------------------
    Description: 
{code}
from cassandra.util import Duration
from cassandra.cluster import Cluster

cluster = Cluster(['127.0.0.1'])
session = cluster.connect()

# Assume table was created earlier like this:
# CREATE TABLE simplex.t1 (f1 int primary key, f2 duration);
prepared = session.prepare("""
     INSERT INTO simplex.t1 (f1, f2)
     VALUES (?, ?)
     """)

d = Duration(int("7FFFFFFF", 16), int("8FFFFFF0", 16), 0)
session.execute(prepared, (1, d))
results = session.execute("SELECT * FROM simplex.t1")
assert d == results[0][1]
{code}

I this example I get the error: cassandra.InvalidRequest: Error from server: code=2200 [Invalid query] message="The duration months, days and nanoseconds must be all of the same sign (2147483647, -1879048208, 0)"
 , but maybe it should be something about the number being too big? Also if we use the Duration value:
{code}
d = Duration(int("8FFFFFF0", 16), int("8FFFFFF0", 16), 0)
{code}
the script ends fine and there is no AssertionError, so not sure why the sign is different in the first example.

  was:
{code}
from cassandra.util import Duration
from cassandra.cluster import Cluster

cluster = Cluster(['127.0.0.1'])
session = cluster.connect()

# Assume table was created earlier like this:
# CREATE TABLE simplex.t1 (f1 int primary key, f2 duration);
prepared = session.prepare("""
     INSERT INTO simplex.t1 (f1, f2)
     VALUES (?, ?)
     """)

d = Duration(int("7FFFFFFF", 16), int("8FFFFFF0", 16), 0)
session.execute(prepared, (1, d))
results = session.execute("SELECT * FROM simplex.t1")
assert d == results[0][1]
{code}

I this example I get the error {{cassandra.InvalidRequest: Error from server: code=2200 [Invalid query] message="The duration months, days and nanoseconds must be all of the same sign (2147483647, -1879048208, 0)"
}} , but maybe it should be something about the number being too big? Also if we use the Duration value:
{code}
d = Duration(int("8FFFFFF0", 16), int("8FFFFFF0", 16), 0)
{code}
the script ends fine and there is no AssertionError, so not sure why the sign is different in the first example.


> Message error for Duration types is confusing
> ---------------------------------------------
>
>                 Key: CASSANDRA-13516
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13516
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: C* 3.11
>            Reporter: Jaume M
>
> {code}
> from cassandra.util import Duration
> from cassandra.cluster import Cluster
> cluster = Cluster(['127.0.0.1'])
> session = cluster.connect()
> # Assume table was created earlier like this:
> # CREATE TABLE simplex.t1 (f1 int primary key, f2 duration);
> prepared = session.prepare("""
>      INSERT INTO simplex.t1 (f1, f2)
>      VALUES (?, ?)
>      """)
> d = Duration(int("7FFFFFFF", 16), int("8FFFFFF0", 16), 0)
> session.execute(prepared, (1, d))
> results = session.execute("SELECT * FROM simplex.t1")
> assert d == results[0][1]
> {code}
> I this example I get the error: cassandra.InvalidRequest: Error from server: code=2200 [Invalid query] message="The duration months, days and nanoseconds must be all of the same sign (2147483647, -1879048208, 0)"
>  , but maybe it should be something about the number being too big? Also if we use the Duration value:
> {code}
> d = Duration(int("8FFFFFF0", 16), int("8FFFFFF0", 16), 0)
> {code}
> the script ends fine and there is no AssertionError, so not sure why the sign is different in the first example.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org