Skip to content

Trace Cassandra Tables' Metadata - #1657

Open
gonzalotguerrero wants to merge 11 commits into
feature/cql-heuristics-calculatorfrom
feature/cassandra-tables-metadata
Open

Trace Cassandra Tables' Metadata#1657
gonzalotguerrero wants to merge 11 commits into
feature/cql-heuristics-calculatorfrom
feature/cassandra-tables-metadata

Conversation

@gonzalotguerrero

Copy link
Copy Markdown
Collaborator

No description provided.


public CassandraTableMetadata(String keyspaceName, String tableName, List<CassandraColumnMetadata> columns) {
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.

can tableName be null?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The keyspaceName might be null, but the tableName can't. Queries with a null tableName would not have their schema traced due to the condition in line 81 of CqlSessionClassReplacement

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.

therefore a Objects.requireNull for tableName is required, right?

this.keyspaceName = keyspaceName;
this.tableName = tableName;
this.columns = Collections.unmodifiableList(columns);
}

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.

should you check if column names are repeated?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

There should be no duplicate column names in a table

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.

Shouldn't you double check that when the list is copied?

return Objects.hash(keyspaceName, tableName, asSet(columns));
}

private static Set<CassandraColumnMetadata> asSet(List<CassandraColumnMetadata> columns) {

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.

this shouldn't be a method, right?

private static TableReference extractTableReference(String query) {
if (query == null) {
return new TableReference(null, null);
return new TableReference(null, null, null, 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 query is not supported it should throw an IllegalArgumentException, right?


public CassandraTableMetadata(String keyspaceName, String tableName, List<CassandraColumnMetadata> columns) {
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.

therefore a Objects.requireNull for tableName is required, right?

this.keyspaceName = keyspaceName;
this.tableName = tableName;
this.columns = Collections.unmodifiableList(columns);
}

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.

Shouldn't you double check that when the list is copied?

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