-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tables: Initial Table commands and operations
Refactoring for tables, this adds the first read code for reading from a table and makes the schema cache handle Table objects. Using the janky FeatureFlags class. Builds and unit tests pass with the -Poffline profile. This is a squash of multiple commits from the ajm/tables branch, cherry picked into the ajm/tables-chunk-2 branch which is build on the ajm/tables-chunk-1 branch. The commits squashed here were: commit 045fe36 Author: Tatu Saloranta <tatu.saloranta@datastax.com> Date: Mon Jul 8 15:42:00 2024 -0700 Fix other 3 offline test failures too commit 791f2b2 Author: Tatu Saloranta <tatu.saloranta@datastax.com> Date: Mon Jul 8 15:39:11 2024 -0700 Fix 2 offline unit tests commit 284c6a8 Author: Tatu Saloranta <tatu.saloranta@datastax.com> Date: Mon Jul 8 15:30:31 2024 -0700 mvn fmt:format commit e50947d Author: Aaron Morton <aaron.morton@datastax.com> Date: Tue Jul 9 10:18:58 2024 +1200 Refactor to run with the offline profile and fixed all failing non integration tests -> Merge commit, not cherry picked <- commit ca476da Merge: a2dcaf2 138b372 Author: Tatu Saloranta <tatu.saloranta@datastax.com> Date: Mon Jul 8 14:06:15 2024 -0700 Merge branch 'main' into ajm/tables -> came from merge above, not cherry picked <- commit 138b372 Author: Tatu Saloranta <tatu.saloranta@datastax.com> Date: Mon Jul 8 13:29:16 2024 -0700 Add second link to Azure OpenAI docs -> Merge commit, not cherry picked <- commit a2dcaf2 Merge: 5350744 96b2839 Author: Tatu Saloranta <tatu.saloranta@datastax.com> Date: Mon Jul 8 12:18:00 2024 -0700 Merge branch 'main' into ajm/tables commit 5350744 Author: Tatu Saloranta <tatu.saloranta@datastax.com> Date: Mon Jul 8 12:14:11 2024 -0700 fmt:format for offline classes too -> came from merge above, not cheery picked <- commit 96b2839 Author: Tatu Saloranta <tatu.saloranta@datastax.com> Date: Mon Jul 8 11:31:52 2024 -0700 Fixes #1238: convert internal-only `ErrorCode`s into `ErrorCode.SERVER_INTERNAL_ERROR` (#1239) commit 8f0ea75 Author: Aaron Morton <aaron.morton@datastax.com> Date: Mon Jul 8 18:59:29 2024 +1200 Working to accept a command targeted at a table ! Will failed in the CommandResolver because resolveTableCommand is not implemented in subclasses. commit 607f0d8 Author: Aaron Morton <aaron.morton@datastax.com> Date: Mon Jul 8 13:32:09 2024 +1200 Expand Schema Cache to handle tables added flag in FeatureFlags to enable getting tables in the Namespace cache unit tests passing other than session cache tests commit 1296c55 Author: Aaron Morton <aaron.morton@datastax.com> Date: Mon Jul 8 11:32:29 2024 +1200 Refactor to add collection and table operations Existing operations are not CollectionOperations Added new TableOperations
- Loading branch information
Showing
150 changed files
with
1,074 additions
and
708 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...n/java/io/stargate/sgv2/jsonapi/api/model/command/clause/filter/ComparisonExpression.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/main/java/io/stargate/sgv2/jsonapi/service/FeatureFlags.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package io.stargate.sgv2.jsonapi.service; | ||
|
||
/** Hack / temp class to have run time checking for if Tables are supported */ | ||
public final class FeatureFlags { | ||
|
||
public static final boolean TABLES_SUPPORTED = Boolean.getBoolean("stargate.tables.supported"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/main/java/io/stargate/sgv2/jsonapi/service/cqldriver/executor/CollectionIndexUsage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package io.stargate.sgv2.jsonapi.service.cqldriver.executor; | ||
|
||
import com.google.common.base.Preconditions; | ||
import io.micrometer.core.instrument.Tag; | ||
import io.micrometer.core.instrument.Tags; | ||
|
||
/** | ||
* This class is used to track the usage of indexes in a query. It is used to generate metrics for | ||
* different commands by index column usage | ||
*/ | ||
public class CollectionIndexUsage implements IndexUsage { | ||
|
||
public boolean primaryKeyTag, | ||
existKeysIndexTag, | ||
arraySizeIndexTag, | ||
arrayContainsTag, | ||
booleanIndexTag, | ||
numberIndexTag, | ||
textIndexTag, | ||
timestampIndexTag, | ||
nullIndexTag, | ||
vectorIndexTag; | ||
|
||
/** | ||
* This method is used to generate the tags for the index usage | ||
* | ||
* @return | ||
*/ | ||
@Override | ||
public Tags getTags() { | ||
return Tags.of( | ||
Tag.of("key", String.valueOf(primaryKeyTag)), | ||
Tag.of("exist_keys", String.valueOf(existKeysIndexTag)), | ||
Tag.of("array_size", String.valueOf(arraySizeIndexTag)), | ||
Tag.of("array_contains", String.valueOf(arrayContainsTag)), | ||
Tag.of("query_bool_values", String.valueOf(booleanIndexTag)), | ||
Tag.of("query_dbl_values", String.valueOf(numberIndexTag)), | ||
Tag.of("query_text_values", String.valueOf(textIndexTag)), | ||
Tag.of("query_timestamp_values", String.valueOf(timestampIndexTag)), | ||
Tag.of("query_null_values", String.valueOf(nullIndexTag)), | ||
Tag.of("query_vector_value", String.valueOf(vectorIndexTag))); | ||
} | ||
|
||
/** | ||
* This method is used to merge the index usage of two different types for filters used in a query | ||
* | ||
* @param indexUsage | ||
*/ | ||
public void merge(IndexUsage indexUsage) { | ||
Preconditions.checkArgument( | ||
indexUsage instanceof CollectionIndexUsage, "Cannot merge different types of index usage"); | ||
var other = (CollectionIndexUsage) indexUsage; | ||
|
||
this.arrayContainsTag |= other.arrayContainsTag; | ||
this.primaryKeyTag |= other.primaryKeyTag; | ||
this.existKeysIndexTag |= other.existKeysIndexTag; | ||
this.arraySizeIndexTag |= other.arraySizeIndexTag; | ||
this.booleanIndexTag |= other.booleanIndexTag; | ||
this.numberIndexTag |= other.numberIndexTag; | ||
this.textIndexTag |= other.textIndexTag; | ||
this.timestampIndexTag |= other.timestampIndexTag; | ||
this.nullIndexTag |= other.nullIndexTag; | ||
this.vectorIndexTag |= other.vectorIndexTag; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/io/stargate/sgv2/jsonapi/service/cqldriver/executor/IndexUsage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package io.stargate.sgv2.jsonapi.service.cqldriver.executor; | ||
|
||
import io.micrometer.core.instrument.Tags; | ||
|
||
public interface IndexUsage { | ||
|
||
/** Default implementation when we are not tracking index usage for the schema object */ | ||
IndexUsage NO_OP = | ||
new IndexUsage() { | ||
@Override | ||
public Tags getTags() { | ||
return Tags.empty(); | ||
} | ||
|
||
@Override | ||
public void merge(IndexUsage indexUsage) { | ||
// NO-OP | ||
} | ||
}; | ||
|
||
/** | ||
* This method is used to generate the tags for the index usage | ||
* | ||
* @return | ||
*/ | ||
Tags getTags(); | ||
|
||
/** | ||
* This method is used to merge the index usage of two different types for filters used in a query | ||
* | ||
* @param indexUsage | ||
*/ | ||
void merge(IndexUsage indexUsage); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.