0
votes

I am using Datastax Cassandra3.0 while creating table in cassandra using cqlsh schema is changing column names are arranging into alphabetaical order. Please see below.

This is the structure when creating a table..

cqlsh> CREATE TABLE tutorialspoint.SupplierItemData_input15(partnumber BIGINT PRIMARY KEY,

... supplier text,

... monthyear varchar,

... allocation int,

... evdate date,

... paymentterms int,

... actualdays int,

... percentageofpayment int,

... variation int,

... paymenttermsummary text,

... copq int,

... year int,

... month int,

... postingdate date);

But while i check the DESCRIBE TABLE NAME the structure is changing

cqlsh> DESCRIBE tutorialspoint.SupplierItemData_input15;

CREATE TABLE tutorialspoint.supplieritemdata_input15 (

partnumber bigint PRIMARY KEY,

actualdays int,

allocation int,

copq int,

evdate date,

month int,

monthyear text,

paymentterms int,

paymenttermsummary text,

percentageofpayment int,

postingdate date,

supplier text,

variation int,

year int

)

WITH bloom_filter_fp_chance = 0.01

AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'} AND comment = '' AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'} AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'} AND crc_check_chance = 1.0 AND dclocal_read_repair_chance = 0.1 AND default_time_to_live = 0 AND gc_grace_seconds = 864000 AND max_index_interval = 2048 AND memtable_flush_period_in_ms = 0 AND min_index_interval = 128 AND read_repair_chance = 0.0 AND speculative_retry = '99PERCENTILE';

Please help me on this.

Thankyou Ravi

1
Rearranging the view of your schema is not the same thing of changing the schema... And by the way Cassandra stores its columns (after the clustering key) in alphabetical order...xmas79
depending on the csv file i have created a table structure, if it stores in alphabetical order means while loading the csv file into the table the datatypes will mismatch and it is showing the errorravi
You should never use indexes. You should always use column names...xmas79

1 Answers

0
votes

If you want to import data using cqlsh COPY from a csv file then you should add your column names as a header at the top of the csv file. That way it doesn't matter what order they are by default.