Miguel Valdes
Miguel Valdes

Reputation: 11

Cassandra is changing the position of timestamp column

I'm new in Cassandra and when I was copying a CSV in Cassandra I found a problem with the position of my timestamp column. I'm using cqlsh 5.0.1 | Cassandra 2.1.2 | CQL spec 3.2.0 | Native protocol v3

CREATE TABLE events (
  id int,
  type int,
  eventdate timestamp,
  PRIMARY KEY (id)
);

select * from events;

 id | eventdata | type
----+-----------+------

Why is Cassandra changing the position of the timestamp column?

Thanks.

Upvotes: 1

Views: 102

Answers (1)

Aaron
Aaron

Reputation: 57748

When you SELECT * the columns come back ordered with keys first, and then the remaining fields in alpha-numeric (might be ascii-betical or ascii-numeric...not exactly sure) order. If you want your columns returned in a specific order, you'll need to specify them (in that order) in your SELECT like this:

SELECT id, type, eventdate FROM events;

Upvotes: 2

Related Questions