[ 
https://issues.apache.org/jira/browse/FLINK-8655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16467252#comment-16467252
 ] 

ASF GitHub Bot commented on FLINK-8655:
---------------------------------------

Github user ctamisier commented on the issue:

    https://github.com/apache/flink/pull/5964
  
    > The keyspace field in the sink isn't used anywhere
    
    It is used in CassandraPojoSinkBuilder.createSink(), the keyspace is an 
argument of `new CassandraPojoSink<>(...);`
    ```
    @Override
    public CassandraSink<IN> createSink() throws Exception {
        return new CassandraSink<>(input.addSink(new 
CassandraPojoSink<>(typeInfo.getTypeClass(), builder, mapperOptions, 
keyspace)).name("Cassandra Sink"));
    }
    ```
    
    > and the configuration operations don't have any effect either
    
    the keyspace is set in the configuration in the `"keyspace"` key.
    ```
    if (keyspace != null && !keyspace.isEmpty()) {
        configuration.setString("keyspace", keyspace);
    }
    ```
    which is then used to connect to cassandra with this keyspace:
    `cluster.connect(configuration.getString("keyspace", null));`
    
    Am I missing something ?
    
    PS:
    Instead of using the configuration object maybe we can just use `session` 
that is just created to execute a `session.executeAsync("USE " + keyspace);` 
like in Cluster.connectAsync(final String keyspace) ?



> Add a default keyspace to CassandraSink
> ---------------------------------------
>
>                 Key: FLINK-8655
>                 URL: https://issues.apache.org/jira/browse/FLINK-8655
>             Project: Flink
>          Issue Type: Improvement
>          Components: Cassandra Connector
>    Affects Versions: 1.4.0
>            Reporter: Christopher Hughes
>            Priority: Minor
>              Labels: features
>             Fix For: 1.6.0
>
>
> Currently, to use the CassandraPojoSink, it is necessary for a user to 
> provide keyspace information on the desired POJOs using datastax annotations. 
>  This allows various POJOs to be written to multiple keyspaces while sinking 
> messages, but prevent runtime flexibility.
> For many developers, non-production environments may all share a single 
> Cassandra instance differentiated by keyspace names.  I propose adding a 
> `defaultKeyspace(String keyspace)` to the ClusterBuilder.  POJOs lacking a 
> definitive keyspace would attempt to be loaded to the provided default.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to