"Error deflating query string." when using CQL. #21

Closed
Smoles opened this Issue Apr 24, 2012 · 4 comments

Comments

Projects
None yet
2 participants

Smoles commented Apr 24, 2012

There seems to be an issue when you create an instance of CassandraContext() using a single ConnectionString parameter. After doing this if you call ExecuteQuery() passing in some CQL an error of "Error deflating query string." is returned. See example below.

        using (CassandraContext db = new CassandraContext("Keyspace=JeffSTest;Server=10.15.10.70"))
        {
            var rows = db.ExecuteQuery("SELECT * FROM TestCF");
        }

What's interesting is if you create a CassandraContext() passing in the Keyspace and Server as separate parameters then everything works as intended. See example below.

        using (CassandraContext db = new CassandraContext("JeffSTest", new Server("10.15.10.70")))
        {
            var rows = db.ExecuteQuery("SELECT * FROM TestCF");
        }

Smoles commented May 2, 2012

So I think I've figured out the reason for the difference in behavior. It looks like when you pass in a connection string to the CassandraContext it sets CompressCqlQueries to a different default value. In the ConnectionBuilder.InitializeConnectionString() method when it checks for "Compress CQL Queries", if it's not found it then defaults to true. However, the ConnectionBuilder() constructor that takes a series of parameters defaults this value to false. I would think that in all cases it should be defaulted to false when not specified.

        if (!pairs.ContainsKey("Compress CQL Queries"))
        {
            CompressCqlQueries = true;
        }
        else
        {
            string compressCqlQueriesValue = pairs["Compress CQL Queries"];

            // YES or TRUE is a positive response everything else is a negative response
            CompressCqlQueries = String.Equals("yes", compressCqlQueriesValue, StringComparison.OrdinalIgnoreCase) || String.Equals("true", compressCqlQueriesValue, StringComparison.OrdinalIgnoreCase);
        }

Smoles commented May 2, 2012

One other note. It looks like ConnectionBuilder.GetConnectionString() is not appending the "Compress CQL Queries" option to the connection string. Not sure if this was intentional but I would think that it should be included.

@ghost ghost assigned nberardi May 9, 2012

Contributor

nberardi commented May 9, 2012

Yeah I had an issue getting the compression to work. I must have just corrected the default constructor and not everything else. I will make this consistent in the next push.

nberardi added a commit that referenced this issue May 9, 2012

fixed consistancy in ConnectionBuilder regarding compressing CQL quer…
…ies,

it is now disabled by default, /cc issue #21

nberardi added a commit that referenced this issue May 9, 2012

Contributor

nberardi commented May 9, 2012

The latest code should reflect support for compression and normalization of ConnectionBuilder settings.

@nberardi nberardi closed this May 9, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment