cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Petrov (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-12606) CQLSSTableWriter unable to use blob conversion functions
Date Tue, 11 Oct 2016 12:28:20 GMT


Alex Petrov commented on CASSANDRA-12606:

Submitting a patch that would simply load {{system_schema}} and {{system}}, since that's pretty
much all is required to make the native functions work.

I've tried loading functinos to current keyspace, which might have reduced depending on {{system}}
keyspace, although the problem is that system keyspace is hardcoded in native function name.
We could refactor it to allow attaching them to any keyspace, although loading {{system}}
and {{system_schema}} doesn't create any additional directories and / or start other services,
so might be still a viable option.


({{3.0}} patch is slightly different because we've done some changes in {{3.x}}, also adds
a couple of tests that were missing in this branch)

> CQLSSTableWriter unable to use blob conversion functions
> --------------------------------------------------------
>                 Key: CASSANDRA-12606
>                 URL:
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL, Tools
>            Reporter: Mark Reddy
>            Assignee: Alex Petrov
>            Priority: Minor
> Attempting to use blob conversion functions e.g. textAsBlob, from 3.0 - 3.7 results in:
> {noformat}
> Exception in thread "main" org.apache.cassandra.exceptions.InvalidRequestException: Unknown
function textasblob called
> 	at org.apache.cassandra.cql3.functions.FunctionCall$Raw.prepare(
> 	at org.apache.cassandra.cql3.Operation$SetValue.prepare(
> 	at org.apache.cassandra.cql3.statements.UpdateStatement$ParsedInsert.prepareInternal(
> 	at org.apache.cassandra.cql3.statements.ModificationStatement$Parsed.prepare(
> 	at org.apache.cassandra.cql3.statements.ModificationStatement$Parsed.prepare(
> 	at$Builder.prepareInsert(
> 	at$
> {noformat}
> The following snippet will reproduce the issue
> {code}
> String table = String.format("%s.%s", "test_ks", "test_table");
> String schema = String.format("CREATE TABLE %s (test_text text, test_blob blob, PRIMARY
KEY(test_text));", table);
> String insertStatement = String.format("INSERT INTO %s (test_text, test_blob) VALUES
(?, textAsBlob(?))", table);
> File tempDir = Files.createTempDirectory("tempDir").toFile();
> CQLSSTableWriter sstableWriter = CQLSSTableWriter.builder()
>         .forTable(schema)
>         .using(insertStatement)
>         .inDirectory(tempDir)
>         .build();
> {code}
> This is caused in FunctionResolver.get(...) when candidates.addAll(Schema.instance.getFunctions(name.asNativeFunction()));
is called, as there is no system keyspace initialised.

This message was sent by Atlassian JIRA

View raw message