-
Notifications
You must be signed in to change notification settings - Fork 31
CASSANALYTICS-31 SAI index support in analytics #220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Changes from all commits
32f2c45
41020b0
80cc253
bf094e7
556ebe5
b45b60b
bb27eed
d3d583d
ef522a8
9a1ea11
bca6fdb
d80fca9
ebaf9d7
8030786
83c9084
e133bab
b32a824
8edd725
c800baa
dfb4662
e824458
591eb9d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,26 +58,17 @@ public class CqlTable implements Serializable | |
| private final List<CqlField> staticColumns; | ||
| private final List<CqlField> valueColumns; | ||
| private final transient Map<String, CqlField> columns; | ||
| private final int indexCount; | ||
|
|
||
| public CqlTable(@NotNull String keyspace, | ||
| @NotNull String table, | ||
| @NotNull String createStatement, | ||
| @NotNull ReplicationFactor replicationFactor, | ||
| @NotNull List<CqlField> fields) | ||
| { | ||
| this(keyspace, table, createStatement, replicationFactor, fields, Collections.emptySet(), 0); | ||
| } | ||
| private final Set<String> indexStatements; | ||
|
|
||
| public CqlTable(@NotNull String keyspace, | ||
| @NotNull String table, | ||
| @NotNull String createStatement, | ||
| @NotNull ReplicationFactor replicationFactor, | ||
| @NotNull List<CqlField> fields, | ||
| @NotNull Set<CqlField.CqlUdt> udts, | ||
| int indexCount) | ||
| @NotNull Set<String> indexStatements) | ||
| { | ||
| this(keyspace, table, createStatement, replicationFactor, fields, udts, indexCount, false); | ||
| this(keyspace, table, createStatement, replicationFactor, fields, udts, indexStatements, false); | ||
| } | ||
|
|
||
| public CqlTable(@NotNull String keyspace, | ||
|
|
@@ -86,7 +77,7 @@ public CqlTable(@NotNull String keyspace, | |
| @NotNull ReplicationFactor replicationFactor, | ||
| @NotNull List<CqlField> fields, | ||
| @NotNull Set<CqlField.CqlUdt> udts, | ||
| int indexCount, | ||
| @NotNull Set<String> indexStatements, | ||
| boolean cdc) | ||
| { | ||
| this.keyspace = keyspace; | ||
|
|
@@ -101,7 +92,7 @@ public CqlTable(@NotNull String keyspace, | |
| this.staticColumns = this.fields.stream().filter(CqlField::isStaticColumn).sorted().collect(Collectors.toList()); | ||
| this.valueColumns = this.fields.stream().filter(CqlField::isValueColumn).sorted().collect(Collectors.toList()); | ||
| this.udts = Collections.unmodifiableSet(udts); | ||
| this.indexCount = indexCount; | ||
| this.indexStatements = Collections.unmodifiableSet(indexStatements); | ||
|
|
||
| // We use a linked hashmap to guarantee ordering of a 'SELECT * FROM ...' | ||
| this.columns = new LinkedHashMap<>(); | ||
|
|
@@ -265,9 +256,9 @@ public boolean cdc() | |
| return cdc; | ||
| } | ||
|
|
||
| public int indexCount() | ||
| public Set<String> indexStatements() | ||
| { | ||
| return indexCount; | ||
| return indexStatements; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If our goal is to keep external consumers from mutating the contents of this set we should do something like: public Set<String> indexStatements() {
return Collections.unmodifiableSet(indexStatements);
}
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indexStatements is already created using Collections.unmodifiableSet above in constructor |
||
| } | ||
|
|
||
| /** | ||
|
|
@@ -407,9 +398,16 @@ public CqlTable read(Kryo kryo, Input input, Class type) | |
| { | ||
| udts.add((CqlField.CqlUdt) CqlField.CqlType.read(input, cassandraTypes)); | ||
| } | ||
| int indexCount = input.readInt(); | ||
|
|
||
| int numIndexStatements = input.readInt(); | ||
| Set<String> indexStatements = new LinkedHashSet<>(numIndexStatements); | ||
| for (int idx = 0; idx < numIndexStatements; idx++) | ||
| { | ||
| indexStatements.add(input.readString()); | ||
| } | ||
|
|
||
| boolean cdc = input.readBoolean(); | ||
| return new CqlTable(keyspace, table, createStatement, replicationFactor, fields, udts, indexCount, cdc); | ||
| return new CqlTable(keyspace, table, createStatement, replicationFactor, fields, udts, indexStatements, cdc); | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -431,7 +429,13 @@ public void write(Kryo kryo, Output output, CqlTable table) | |
| { | ||
| udt.write(output); | ||
| } | ||
| output.writeInt(table.indexCount()); | ||
|
|
||
| Set<String> indexStatements = table.indexStatements(); | ||
| output.writeInt(indexStatements.size()); | ||
| for (String stmt : indexStatements) | ||
| { | ||
| output.writeString(stmt); | ||
| } | ||
| output.writeBoolean(table.cdc()); | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.