cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joel Knighton (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-12606) CQLSSTableWriter unable to use blob conversion functions
Date Tue, 13 Jun 2017 14:18:00 GMT


Joel Knighton commented on CASSANDRA-12606:

Sorry - as you well know, it's 100% (200%?) my fault this sat for so long. This looks good
to me, but I'd like to rebase and rerun tests since the base branches have changed in the
meantime. I'll do so, and if the tests come back good, I'll +1.

Some minor nits:
* on all versions, {{testUpdateSatement}} -> {{testUpdateStatement}} in {{CQLSSTableWriterTest}}.
It looks like this typo already existed in later branches, so might as well fix there too.
* on 3.11/trunk, there seem to be some unused imports in {{CQLSSTableWriter}} (Collection,
Function, FunctionName).
* on 3.11/trunk, in the createTable docstring, the word types is duplicated.
* on 3.11/trunk, there's a bit of duplicate code in creating the types/tables down either
branch of KeyspaceMetadata existence in {{}}. You could move
this out of the conditional and then do a direct null check on {{ksm.tables.getNullable(...)}}.
That said, it only removes a few lines of duplicate code in a piece of code that isn't touched
often, so I'm fine either way on this.

> 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

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message