Skip to content

Cassandra Handler - #1662

Open
gonzalotguerrero wants to merge 11 commits into
feature/cassandra-tables-metadatafrom
feature/cassandra-handler
Open

Cassandra Handler#1662
gonzalotguerrero wants to merge 11 commits into
feature/cassandra-tables-metadatafrom
feature/cassandra-handler

Conversation

@gonzalotguerrero

Copy link
Copy Markdown
Collaborator

No description provided.

*/
private String tableSchema;

public CassandraFailedQuery(String keyspaceName, String tableName, String tableSchema) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add Objects.requireNonNull for those fields that should be non-null


public CqlTableReference(String keyspaceName, String tableName) {
this.keyspaceName = keyspaceName;
this.tableName = tableName;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keyspaceName and tableName can be null? Otherwise add Objects.requireNonNull()

* a SELECT/UPDATE/DELETE)
*/
public static CqlTableReference getTableReference(CqlParser.RootContext root) {
CqlParser.CqlContext cql = root.cqls() != null ? root.cqls().cql(0) : null;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the command was not a SELECT/UPDATE/DELETE should this throw an IllegalArgumentException?

/*
Names of the driver methods invoked via reflection throughout this class.
*/
public static final String METHOD_EXECUTE = "execute";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why public? shouldn't these constants be private?

public static final String CLUSTERING_COLUMN_SUFFIX = " CLUSTERING";


public static final String SELECT_ALL_PREFIX = "SELECT * FROM ";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why public?

*/
public class CqlDistanceWithMetrics {

public final double cqlDistance;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace this with getters, change visibility to private


public final int numberOfEvaluatedRows;

public CqlDistanceWithMetrics(double cqlDistance, int numberOfEvaluatedRows) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can the arguments be null? Otherwise add Objects.requireNonNull()

}

private static CqlTableReference parseTableReference(String cql) {
return CqlParserUtils.getTableReference(CqlParserUtils.parseCqlCommand(cql));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactor CqlParserUtils.parseCqlCommand(cql) to a variable

private final String tableName;

public TableKey(String keyspaceName, String tableName) {
this.keyspaceName = keyspaceName;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can keyspaceName be null? can tableName be null? Add Objects.requireNull and Javadoc

return CassandraSchemaTracer.resolveKeyspaceName(cqlSession, null);
} catch (RuntimeException e) {
SimpleLogger.uniqueWarn("Failed to resolve Cassandra session's default keyspace");
return null;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why should this be failing? If it is not expected it must throw exception

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

Successfully merging this pull request may close these issues.

2 participants