Unable to create nested collection datatype - cassandra

I am not able to create collection inside another collection in Cassandra. Please find error details below
cqlsh:TestKeyspace> create table users2(user_id text primary key, feeschedule map<text,set<text>>);
Bad Request: map type cannot contain another collection
Here I am trying to create column named feeschedule with type Map and Map have values which is of type List.
Could anybody suggest me how do I achieve it in Cassandra.
My Cassandra version details are given below:
cqlsh version- cqlsh 4.1.0
Cassandra version – 2.0.2
Thanks in advance,

You are correct, nested collections are not supported.
You will be able to do something similar with user-defined types, but not until 2.1: https://issues.apache.org/jira/browse/CASSANDRA-5590

Related

Getting the list of SQL select columns from JOOQ parser

I need to get the list of columns in a select using the JOOQ SQL parser. In the example below it would return the list with two entries: 'sk' and 'aa'. Debugging the program I can see in the Query.select field the list of columns, but I cannot find in the Query class a method to retrieve them. How to get the list of columns?
The Query object model returned by the jOOQ parser API does as of jOOQ 3.12 not provide any corresponding accessors. This feature is however planned for the next minor release (3.13).
The following answer gives you an example how you might be able to use the existing VisitListener SPI to achieve your goal: https://stackoverflow.com/a/54006668/1732086.

Equivalent of SHOW CREATE SCHEMA in Presto

Is there an equivalent of SHOW CREATE SCHEMA in presto? I just want to see the value of the location field.
Presto do not support SHOW CREATE SCHEMA. It only supports SHOW CREATE option for VIEW and TABLE.

Which Hybris D.B. Table contain product description

I need to get the Product description manually from database, so please suggest which table it contains.
My Finding
Productslp table contains p_dscription column but that is clob datatype and I am unable to get the data from that.
I would suggest, you raise a support ticket with SAP Product support, since it may be a matter of correct Oracle JDBC driver.
We use HANA DB and had the same issue, they provided me with an updated driver and that resolved the issue for me.
Alternatively you can check the description in backoffice/hmc if that is an acceptable solution.
You can get using the SQL tab in hac with this query.
Select ps.p_description,ps.p_summary from products as p join productslp as ps ON p.pk=ps.itempk where pk=8796158722049
See the image below for result

Cassandra List <frozen> data type

I want to display the list of fields in the Cassandra List data type.
If i use the command for a table: "DESC Tablename" It shows all the table structure.
Similarly i would like to know the command which will display list of fields under this List column
I am able to see the list of fields under the List data type.
In Dbeaver if i navigate to Keyspace-->Tables-->User Types-->Double click on the List field name.
Update:
I just realized that you want to see the data inside a list column which is frozen.
This isn't supported in DevCenter and cqlsh as of now.
Reason: They are serialized as single entity.
Hopefully, future versions will support it.
---------- This part is wrong.
When you see a frozen keyword, it means that a UDT (User defined Type) is used.
So to display the inner fields, you can use DESCRIBE TYPE type command.
Hope this helps!

Cassandra Custom Secondary Index

This seems to be a mystery in cassandra, According to official documentation, one can create index on a column by using a custom indexer class
CREATE CUSTOM INDEX ON users (email) USING 'path.to.the.IndexClass';
But I could not find any documentation regarding the interface/class to be implemented/extended to do this and how to configure cassandra to find the class?
I wanted to write a custom indexer which could skip indexing rows based on conditions/options.
Here what I've found https://issues.apache.org/jira/browse/CASSANDRA-6480
So you have to implement a subclass of org.apache.cassandra.db.index.SecondaryIndex and make sure that class is on the classpath for your Cassandra
Here you can find example of implementation:
http://tuplejump.github.io/stargate/
https://github.com/tuplejump/stargate-core
Stratio's Cassandra Lucene Index is a plugin which supports custom indexes in cassandra, you can find the required documentation on how to work with custom indexes.

Resources