-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String column: distinguish between empty string and nil #91
Comments
@pesterhazy thank you for the detailed report. We'll take a look what the Java client returns. |
Here's the java test I used to verify that the Java driver properly returns null: import com.datastax.driver.core.*;
public class GettingStarted {
public static void main(String[] args) {
Cluster cluster;
Session session;
// Connect to the cluster and keyspace "demo"
cluster = Cluster.builder().addContactPoint("127.0.0.1").build();
session = cluster.connect("tst");
ResultSet results = session.execute("SELECT * FROM people");
for (Row row : results) {
System.out.format("%s *%s*\n",
row.getString("name") == null ? "NULL" : row.getString("name"),
row.getString("country") == null ? "NULL" : row.getString("country"));
}
// Clean up the connection by closing it
cluster.close();
}
} Run with this driver: http://downloads.datastax.com/java-driver/cassandra-java-driver-2.0.2.tar.gz like this (I'm obviously not a Java dev):
|
Git HEAD fixes things for me, thanks! |
When doing a SELECT on a column family with a
VARCHAR
column, empty strings are returned asnil
. AFAICT this is not the expected behavior with C*, and certainly surprising.The short test program below prints:
but the following output would be expected:
I'm using the current 2.0 release candidate of cassaforte (dependencies below). I tried to reproduce the problematic behavior using just the Java driver, but wasn't able to. When running the
SELECT
from Java, one row has null, while the other has "".The text was updated successfully, but these errors were encountered: