spark-cassandra-connector icon indicating copy to clipboard operation
spark-cassandra-connector copied to clipboard

SPARKC-403: Add CLUSTERING ORDER in cql statement

Open skp33 opened this issue 8 years ago • 6 comments

I added code for Clustering Order support for table creation. Please review the code.

skp33 avatar May 17 '16 11:05 skp33

I think this is a good addition but I have two major requests.

  1. We need a Jira for tracking
  2. I don't like just having a String "option". I think we are slowly approaching fully redoing the Java Driver TableMetadata so I think we should have it be a copy of that object. We don't have to necessarily expose all the parameters right now but I'd feel more comfortable with TableDef just having a list of ClusteringOrders.

https://docs.datastax.com/en/drivers/java/2.0/com/datastax/driver/core/TableMetadata.html

ClusteringOrder is represented by a list of Orderings so very close to what you currently have.

RussellSpitzer avatar Jul 18 '16 20:07 RussellSpitzer

@RussellSpitzer based on your suggestion i changed the code. Do i need to add & change anything else?

skp33 avatar Jul 27 '16 13:07 skp33

Make a jira https://datastax-oss.atlassian.net/projects/SPARKC/ For tracking (this is how we catch everything up in release notes and track versioning)

RussellSpitzer avatar Jul 27 '16 16:07 RussellSpitzer

@RussellSpitzer , Jira is already there, this is the Link.

According to discussion, we need to have list of ClusteringOrders inside TableDef, correct me if i miss understood.

And for property part, it depends on use case, i don't have better project knowledge, so let me know what should be there?

skp33 avatar Jul 28 '16 13:07 skp33

It looks to me like the information about ClusteringOrders is in two places within the TableDef.

  1. Available as an indexedSequence clusteringOrder: Option[Seq[ClusteringOrder]] = None,
  2. Available within the clusteringColumn objects themselves + clusteringOrder: ClusteringOrder = ClusteringOrder.ASC) extends FieldDef {

I think only 2 is neccessary? Having both 1 and 2 gives us the possibility of having them not matching which seems like a bit of a hole in the implementation. I think it would be find to have a function on tableDef

def clusterOrder: Seq[ClusteringOrder] = clusteringColumns.map(_.clusteringOrder

If we want it exposed at that level.

RussellSpitzer avatar Aug 01 '16 01:08 RussellSpitzer

I changed according to you, Please verify. And do we need to add some functionality for this method also DataFrameFunctions.createCassandraTable?

skp33 avatar Aug 01 '16 10:08 skp33