Skip to content
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

astyanax-cql support for collections set, list and map #592

Open
kontact-chan opened this issue Sep 1, 2015 · 1 comment
Open

astyanax-cql support for collections set, list and map #592

kontact-chan opened this issue Sep 1, 2015 · 1 comment

Comments

@kontact-chan
Copy link

Dear Engineers,

We are trying to read the SET using cql java driver. We are getting this exception:
datastax.driver.core.exceptions.InvalidTypeException: Value paths is of type set

Code here:

Column<String> column = columns.getColumnByName(LabelVerticesFieldEnum.PATHS.getFieldStr());
SetSerializer<String> serializer = new SetSerializer<>(UTF8Type.instance);
if (!CommonUtils.isNullOrBlank(column.getValue(serializer))) {
    labelVertices.setPaths(column.getValue(serializer));
}

The datastax row has a method to access the SET values, but there is no way from the CqlColumnImpl i could access it.

Here is the datastax row method:

public class Row { 
    public <T> Set<T> getSet(int i, Class<T> elementsClass) 
}

Instead the column.getValue(serializer) hits this method in the datastax driver:

 public ByteBuffer getBytes(int i) {
        metadata.checkType(i, DataType.Name.BLOB);
        return getBytesUnsafe(i);
    }

that throws this exception - datastax.driver.core.exceptions.InvalidTypeException: Value paths is of type set

Any idea when this would be supported?

Is there anything we are doing wrong? Please let me know.

We wanted to move away from ThriftFamilyFactory and use the CqlFamilyFactory.

Thanks,
Chandran.

@kontact-chan
Copy link
Author

I added a quick fix for astyanax-cql to work for collection set:

https://gist.github.com/7032ced375bedb9b81b3

If you like this, i would like to submit a patch for all the collections - set, list and map.

Please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant