You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Aaron Ploetz (JIRA)" <ji...@apache.org> on 2015/09/25 16:51:04 UTC

[jira] [Comment Edited] (CASSANDRA-10000) Dates before 1970-01-01 are not formatted correctly on cqlsh\Windows

    [ https://issues.apache.org/jira/browse/CASSANDRA-10000?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14908108#comment-14908108 ] 

Aaron Ploetz edited comment on CASSANDRA-10000 at 9/25/15 2:50 PM:
-------------------------------------------------------------------

I have a feeling that this ticket may have a bug that is causing a bug with how timestamps are displayed in 'nix based systems.  I noticed yesterday that my 2.2.1 instance was showing times in UTC.  I was too busy to think much of it at the time.  But then this morning I ran across this question on StackOverflow (http://stackoverflow.com/questions/32778433/cassandra-cqlsh-not-displaying-correct-timezone) which basically confirms that this is happening in 2.2.1 and 2.1.9.

Note, times appear to be going in correctly, but are always displayed in UTC.

{{aploetz@cqlsh:stackoverflow> INSERT INTO timestamptest (userid,activetime,value) VALUES ('b','2015-09-25 09:40:11-0500','value1');}}
{{aploetz@cqlsh:stackoverflow> SELECT * FROM stackoverflow.timestamptest ;}}                                                
{{userid | activetime               | value}}
{{--------+--------------------------+--------}}
{{a       | 2015-09-25 11:30:17+0000 | value1}}
{{a       | 2015-09-25 11:30:17+0000 | value1}}
{{b       | 2015-09-25 14:40:11+0000 | value1}}
{{b       | 2015-09-25 14:40:11+0000 | value1}}
{{(4 rows)}}



was (Author: aploetz):
I have a feeling that this ticket may have a bug that is causing a bug with how timestamps are displayed in 'nix based systems.  I noticed yesterday that my 2.2.1 instance was showing times in UTC.  I was too busy to think much of it at the time.  But then this morning I ran across this question on StackOverflow (http://stackoverflow.com/questions/32778433/cassandra-cqlsh-not-displaying-correct-timezone) which basically confirms that this is happening in 2.2.1 and 1.2.9.

Note, times appear to be going in correctly, but are always displayed in UTC.

{{aploetz@cqlsh:stackoverflow> INSERT INTO timestamptest (userid,activetime,value) VALUES ('b','2015-09-25 09:40:11-0500','value1');}}
{{aploetz@cqlsh:stackoverflow> SELECT * FROM stackoverflow.timestamptest ;}}                                                
{{userid | activetime               | value}}
{{--------+--------------------------+--------}}
{{a       | 2015-09-25 11:30:17+0000 | value1}}
{{a       | 2015-09-25 11:30:17+0000 | value1}}
{{b       | 2015-09-25 14:40:11+0000 | value1}}
{{b       | 2015-09-25 14:40:11+0000 | value1}}
{{(4 rows)}}


> Dates before 1970-01-01 are not formatted correctly on cqlsh\Windows
> --------------------------------------------------------------------
>
>                 Key: CASSANDRA-10000
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10000
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: windows
>            Reporter: Paulo Motta
>            Assignee: Paulo Motta
>            Priority: Minor
>              Labels: cqlsh, windows
>             Fix For: 2.1.9, 2.2.1, 3.0 beta 1
>
>
> The following test fails on Windows:
> {code:none}
>     def test_past_and_future_dates(self):
>         self.cluster.populate(1)
>         self.cluster.start(wait_for_binary_proto=True)
>         node1, = self.cluster.nodelist()
>         node1.run_cqlsh(cmds="""
>             CREATE KEYSPACE simple WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
>             use simple;
>             create TABLE simpledate (id int PRIMARY KEY , value timestamp ) ;
>             insert into simpledate (id, value) VALUES (1, '2143-04-19T11:21:01+0000');
>             insert into simpledate (id, value) VALUES (2, '1943-04-19T11:21:01+0000')""")
>         session = self.patient_cql_connection(node1)
>         rows = session.execute("select id, value from simple.simpledate")
>         output, err = self.run_cqlsh(node1, 'use simple; SELECT * FROM simpledate')
>         self.assertIn("2143-04", output)
>         self.assertIn("1943-04", output)
> {code}
> With the following message:
> {noformat}
> AssertionError: '1943-04' not found in "\r\n id | value\r\n----+-------------------------------------------\r\n  1 |                 2143-04-19 08:21:01.-0300\r\n  2 | datetime.datetime(1943, 4, 19, 11, 21, 1)\r\n\r\n(2 rows)\r\nFailed to format value datetime.datetime(1943, 4, 19, 11, 21, 1) : (22, 'Invalid argument')\r\n"
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)