int object has no attribute replace when trying to run a CQL command in cassandra - cassandra

I have a counter column family in cassandra. When i try to view the data from CQL i get an error even though there is data in the column family.
SELECT * from userstats;
Generates the following error:
'int' object has no attribute 'replace'
I can confirm that the data is in the column family and is working properly since I can view the data with the Datastax Opscenter data explorer.

It sounds like you're using an older version of cqlsh. Upgrading it (just copying the bin/cqlsh file from the Cassandra 1.1 branch head, along with everything under the pylib directory, into place) ought to solve this.
If it doesn't, running cqlsh with --debug would help a lot in diagnosing the problem.

Related

Push in existing local table failure (windows): InvalidRegionNumberException then IllegalArgumentException

I want to push data into an already existing table, single column family, no records.
I am using shc-core:1.1.1-2.1-s_2.11 on a windows machine. I have hbase 1.2.6 installed and use scala 2.11.8.
When I try to push data I got first the following error: org.apache.spark.sql.execution.datasources.hbase.InvalidRegionNumberException: Number of regions specified for new table must be greater than 3.
After following the advice of this link https://github.com/hortonworks-spark/shc/issues/249#issue-318285217, I added: HBaseTableCatalog.newTable -> "5" to my options.
It still failed but with: java.lang.IllegalArgumentException: Can not create a Path from a null string.
Following this link: https://github.com/hortonworks-spark/shc/issues/151#issuecomment-313800739, I added to my catalog: , "tableCoder":"PrimitiveType".
Still facing the same error.
I saw people are expecting some clarification about this issue (https://github.com/hortonworks-spark/shc/issues/249#issuecomment-463528032).
It is known issue and apparently it seems fixed (https://github.com/hortonworks-spark/shc/issues/155#issuecomment-315236736).
I do not know what to do next.
Is there a solution about this?

DevCenter reports syntax error but same CQL runs on cqlsh

I was trying to create a User Defined Function using Devcenter.
http://docs.datastax.com/en/cql/3.3/cql/cql_using/useCreateUDF.html
The following example was taken from the above link.
CREATE OR REPLACE FUNCTION fLog (input double) CALLED ON NULL INPUT RETURNS double LANGUAGE java AS 'return Double.valueOf(Math.log(input.doubleValue()));';
It works in cqlsh but fails in DevCenter with the following error. Based on how fast I get the response, I think DevCenter does a local syntax check and aborts execution as it thinks the query is wrong.
I am using Cassandra 2.2.3 and DevCenter 1.4.1
DevCenter does perform it's own grammar syntax checking as well as semantic validation.
This is a DevCenter bug - the column name "input" is not being allowed by the grammar in this context because it's also a CQL keyword that's incorrectly not being allowed here.
A suggested workaround until a fix is available is to change the name of the column, e.g. "inputvalue".
As it says "No viable alternative at input 'input'"
It seems like 'input' is a reserved keyword in Devcenter and not in the CQLSH.
Try using another name for the variable.

InvalidRequestException Keyspace keyspace1 does not exist

I'm trying to connect to a Datastax Community Edition server 2.1.2 via JDBC but I keep getting the following error no matter what I try to do, even when issuing a very basic command like select * from system_traces.events;
InvalidRequestException(why:Keyspace 'keyspace1' does not exist)
Issuing that same command via cqlsh works properly, so it seems to be a JDBC issue.
InvalidRequestException(why:Keyspace 'keyspace1' does not exist)
at org.apache.cassandra.cql.jdbc.CassandraConnection.<init>(CassandraConnection.java:229):229
at org.apache.cassandra.cql.jdbc.CassandraDriver.connect(CassandraDriver.java:92):92
at java.sql.DriverManager.getConnection(DriverManager.java:664):664
at java.sql.DriverManager.getConnection(DriverManager.java:270):270
at railo.commons.db.DBUtil.getConnection(DBUtil.java:109):109
at railo.runtime.db.DatasourceConnectionPool.loadDatasourceConnection(DatasourceConnectionPool.java:89):89
at railo.runtime.db.DatasourceConnectionPool.getDatasourceConnection(DatasourceConnectionPool.java:81):81
at railo.runtime.db.DatasourceManagerImpl.getConnection(DatasourceManagerImpl.java:65):65
at railo.runtime.tag.Query.executeDatasoure(Query.java:696):696 ...
Any ideas? TIA!
InvalidRequestException(why:Keyspace 'keyspace1' does not exist)
This exception means you are trying to query for a keyspace (in this case "Keyspace1") that hasn't yet been added to Cassandra. Try creating the keyspace before querying it.
You're probably doing a select (SELECT * FROM "Keyspace1"."Standard1") that you're not seeing or passing initialisation parameters to JDBC telling it to connect to Keyspace1. Verify that your code isn't looking for the non-existent keyspace by searching through the queries you have, specifically looking for Keyspace1 (or "Keyspace1" since in this case the keyspace name is case-sensitive).
On a side-note, "Keyspace1"."Standard1" tend to be the standard ks.cf pair used for cassandra examples so it would be good to scan your code for them to make sure that they are created before they are queried.

Create table using cqlsh does not return to prompt

I am trying to create a table using cqlsh with composite primary key but it doesn't return to the cqlsh prompt. The cqlsh and cassandra versions are cqlsh 3.1.7 | Cassandra 1.2.13.2. Can we not create composite primary key using cqlsh? Have tried Dbeaver but that also fails reporting mismatched input ',' expecting EOF. Are there any other clients that allow to create?
Any suggestions would be helpful.
I tried your CREATE TABLE command on the same version of Cassandra using cql 3 and it just worked. It failed using cql 2.
If you're still using cql 2, that's likely the source of your problem.

Cassandra: No column definition found for column error

I'm a newbie to Cassandra. I tried to insert a log file into Cassandra using the GUI tool Spoon, by Pentaho Data Integration. The file has the following fields. Timestamp, process_id, IP, child_id, dev_id, filter_level_id, uh, URL. The log file did not have a header. So i typed in these column names in the file and loaded it to Cassandra using the tool. But when i tried to create an index for the field IP using cql3, I got the following error.
No column definition found for column ip
Am I doing something wrong? How can this be resolved?
Thanks in advance for any help.

Resources