diff --git a/README.MD b/README.MD
index 6bf11965..bfdba4e8 100644
--- a/README.MD
+++ b/README.MD
@@ -4,18 +4,6 @@
[](http://www.apache.org/licenses/LICENSE-2.0)
[](https://search.maven.org/artifact/com.datastax.astra/astra-db-java)
-[](https://sonarcloud.io/summary/new_code?id=clun_db-java)
-[](https://sonarcloud.io/summary/overall?id=clun_astra-db-java)
-[](https://sonarcloud.io/summary/new_code?id=clun_astra-db-java)
-
-[](https://sonarcloud.io/summary/new_code?id=clun_astra-db-java)
-[](https://sonarcloud.io/summary/overall?id=clun_astra-db-java)
-[](https://sonarcloud.io/summary/new_code?id=clun_astra-db-java)
-
-[](https://sonarcloud.io/summary/new_code?id=clun_astra-db-java)
-[](https://sonarcloud.io/summary/new_code?id=clun_astra-db-java)
-
-
This client library provides a simplified way to interact with Data API for AstraDB or local instances. For detailed documentation, each operation comes with a detailed description and examples.
- [`astra-db-ts`](https://github.com/datastax/astra-db-ts) is the equivalent for typescript
@@ -34,13 +22,8 @@ You can build it locally and install it in your local repository.
2. [Create a Database](#22-create-a-database)
3. [Get your credentials](#23-get-your-credentials)
4. [Create a new project and add the dependency](#24-create-a-new-project-and-add-the-dependency)
-3. [QuickStart with Local Instances]()
- 1. [Start Data Api with DSE](#31-start-data-api-with-dse)
- 2. [Start Data Api with HCD](#32-start-data-api-with-hcd)
- 3. [Datq Api Information](#33-datq-api-information)
- 4. [Using Java client with Local Instance](#34-using-java-client-with-local-instance)
+3. [QuickStart with Local Instances](#3-quickstart-with-local-instances)
4. [What's Next](#4-whats-next)
-
## 1. Installation
@@ -184,36 +167,36 @@ public class GettingStarted {
## 3. QuickStart with Local Instances
-### 3.1. Start Data Api with DSE
+> Prequisite. You need HCD, DSE or CASSANDRA running on your machine and listening on `9042`. One good way is to run HCD as a docker image following the instruction [here](https://github.com/stargate/data-api/tree/main/docker-compose).
-- Start the 2 containers with the following command:
-
-```console
-docker-compose up -d
-```
-
-### 3.2. Start Data Api with HCD
+### 3.1 Start Data API
+- Clone the repository
```
-docker-compose -f docker-compose-hcd.yml up -d
+git clone git@github.com:stargate/data-api.git
```
-- Check the status of the containers with the following command:
+- Access the folder and start the data API. Note that we position cassandra endpoint to `localhost` and datacenter to `dc1`.
-```console
-docker-compose ps
+```
+cd data-api
+
+STARGATE_DATA_STORE_SAI_ENABLED=true \
+STARGATE_DATA_STORE_VECTOR_SEARCH_ENABLED=true \
+STARGATE_JSONAPI_OPERATIONS_VECTORIZE_ENABLED=true \
+STARGATE_DATA_STORE_IGNORE_BRIDGE=true \
+STARGATE_JSONAPI_OPERATIONS_DATABASE_CONFIG_LOCAL_DATACENTER=dc1 \
+STARGATE_JSONAPI_OPERATIONS_DATABASE_CONFIG_CASSANDRA_END_POINTS=localhost \
+QUARKUS_HTTP_ACCESS_LOG_ENABLED=FALSE \
+QUARKUS_LOG_LEVEL=INFO \
+JAVA_MAX_MEM_RATIO=75 \
+JAVA_INITIAL_MEM_RATIO=50 \
+GC_CONTAINER_OPTIONS="-XX:+UseG1GC" \
+JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" \
+mvn quarkus:dev -Dstargate.data-store.ignore-bridge=true -Dstargate.jsonapi.operations.vectorize-enabled=true -Dstargate.jsonapi.operations.database-config.local-datacenter=dc1 -Dquarkus.log.console.darken=2 -Dstargate.feature.flags.tables=true -Dstargate.jsonapi.operations.extend-error=true -Dstargate.feature.flags.reranking=true
```
-### 3.3. Datq Api Information
-
-> _Output_
-> ```console
-> NAME IMAGE COMMAND
-> astra-db-java-coordinator-1 stargateio/coordinator-dse-next:v2.1.0-BETA-9 "./starctl"
-> astra-db-java-jsonapi-1 stargateio/jsonapi:v1.0.6
-> ```
-
-- Here are the information to connect to the local instance:
+- To check the Data API is running
| Field | Description |
|--------------------------------------------|-----------------------------------------------------------------------------------------|
@@ -231,22 +214,145 @@ docker-compose ps
| **Data API Endpoint** | `/v1/{namespace}` | Interact with collections of a namespace |
| **Token Header Key** | `/v1/{namespace}/{collection}` |Interact with documents of a collection |
-- Sample curl to create a namespace:
+- Create a keyspace called `default_keyspace`
```console
-curl -X 'POST' \
- 'http://localhost:8181/v1' \
- -H 'accept: application/json' \
- -H 'Token: Cassandra:Y2Fzc2FuZHJh:Y2Fzc2FuZHJh' \
- -H 'Content-Type: application/json' \
- -d '{
- "createNamespace": {
- "name": "default_keyspace"
+curl --location 'http://localhost:8181//v1' \
+--header 'token: Cassandra:Y2Fzc2FuZHJh:Y2Fzc2FuZHJh' \
+--header 'Content-Type: application/json' \
+--data '{"createKeyspace":{"name":"default_keyspace"}}'
+```
+
+- Create a collection `person` with CURL (indexing)
+
+```console
+curl --location 'http://localhost:8181//v1/default_keyspace' \
+--header 'token: Cassandra:Y2Fzc2FuZHJh:Y2Fzc2FuZHJh' \
+--header 'Content-Type: application/json' \
+--data '{
+ "createCollection": {
+ "name": "collection_person",
+ "options": {
+ "indexing": {
+ "allow": [
+ "firstname",
+ "lastname"
+ ]
+ }
+ }
}
}'
```
-### 3.4. Using Java client with Local Instance
+- List my collection it should be there
+
+```console
+curl --location 'http://localhost:8181//v1/default_keyspace' \
+--header 'token: Cassandra:Y2Fzc2FuZHJh:Y2Fzc2FuZHJh' \
+--header 'Content-Type: application/json' \
+--data '{
+ "findCollections": {}
+}'
+```
+- Inserts a few documents
+
+```console
+curl --location 'http://localhost:8181/v1/default_keyspace/collection_person' \
+--header 'token: Cassandra:Y2Fzc2FuZHJh:Y2Fzc2FuZHJh' \
+--header 'Content-Type: application/json' \
+--data-raw '{
+ "insertMany": {
+ "documents": [
+ {
+ "_id": 1,
+ "firstname": "Lucas",
+ "lastname": "Hernandez",
+ "age": 22
+ },
+ {
+ "_id": 2,
+ "firstname": "Antoine",
+ "lastname": "Griezmann",
+ "age": 25
+ },
+ {
+ "_id": 3,
+ "firstname": "N'\''Golo",
+ "lastname": "Kanté",
+ "age": 29
+ },
+ {
+ "_id": 4,
+ "firstname": "Tanguy",
+ "lastname": "Ndombele",
+ "age": 24
+ },
+ {
+ "_id": 5,
+ "firstname": "Raphaël",
+ "lastname": "Varane",
+ "age": 10
+ },
+ {
+ "_id": 6,
+ "firstname": "Hugo",
+ "lastname": "Lloris",
+ "age": 41
+ },
+ {
+ "_id": 7,
+ "firstname": "Olivier",
+ "lastname": "Giroud",
+ "age": 36
+ }
+ ]
+ }
+}'
+
+```
+
+- Search on Valid property
+
+```console
+curl --location 'http://localhost:8181/v1/default_keyspace/collection_person' \
+--header 'token: Cassandra:Y2Fzc2FuZHJh:Y2Fzc2FuZHJh' \
+--header 'Content-Type: application/json' \
+--data-raw '{
+ "find": {
+ "filter": {
+ "lastname": "Varane"
+ },
+ "projection": {
+ "lastname": true,
+ "firstname": true
+ },
+ "sort": {"lastname":-1}
+ }
+}'
+```
+
+- Search on inValid property (exception expected)
+
+```console
+curl --location 'http://localhost:8181/v1/default_keyspace/collection_person' \
+--header 'token: Cassandra:Y2Fzc2FuZHJh:Y2Fzc2FuZHJh' \
+--header 'Content-Type: application/json' \
+--data-raw '{
+ "find": {
+ "filter": {
+ "age": 24
+ },
+ "projection": {
+ "lastname": true,
+ "firstname": true
+ },
+ "sort": {"lastname":-1}
+ }
+}'
+```
+
+
+### Using Java client with Local Instance
```java
public class QuickStartLocal {
diff --git a/TEST.MD b/TEST.MD
index d001df69..f49ab110 100644
--- a/TEST.MD
+++ b/TEST.MD
@@ -1,3 +1,58 @@
+## Work with local HCD
+
+### Installation
+
+1. Prerequisites:
+
+- Docker
+- Docker Compose
+- Java 17+
+- Maven
+
+2. Make sure you have the `DATA_API_FOLDER` environment variable set to the root of your local Data API project.
+
+```
+export DATA_API_FOLDER=/Users/cedricklunven/dev/datastax/JAVA/data-api
+```
+
+### Start
+
+- Start HCD
+
+Locate the `docker-compose` folder and start with `-d`, you do not need the API
+
+```bash
+cd $DATA_API_FOLDER/docker-compose` && start_hcd.sh -d
+```
+
+- Start the Data API
+
+```bash
+cd $DATA_API_FOLDER
+STARGATE_DATA_STORE_SAI_ENABLED=true \
+STARGATE_DATA_STORE_VECTOR_SEARCH_ENABLED=true \
+STARGATE_JSONAPI_OPERATIONS_VECTORIZE_ENABLED=true \
+STARGATE_DATA_STORE_IGNORE_BRIDGE=true \
+STARGATE_JSONAPI_OPERATIONS_DATABASE_CONFIG_LOCAL_DATACENTER=dc1 \
+STARGATE_JSONAPI_OPERATIONS_DATABASE_CONFIG_CASSANDRA_END_POINTS=localhost \
+QUARKUS_HTTP_ACCESS_LOG_ENABLED=FALSE \
+QUARKUS_LOG_LEVEL=INFO \
+JAVA_MAX_MEM_RATIO=75 \
+JAVA_INITIAL_MEM_RATIO=50 \
+GC_CONTAINER_OPTIONS="-XX:+UseG1GC" \
+JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" \
+mvn quarkus:dev -Dstargate.data-store.ignore-bridge=true -Dstargate.jsonapi.operations.vectorize-enabled=true -Dstargate.jsonapi.operations.database-config.local-datacenter=dc1 -Dquarkus.log.console.darken=2 -Dstargate.feature.flags.tables=true -Dstargate.jsonapi.operations.extend-error=true -Dstargate.feature.flags.reranking=true
+```
+
+- Access HCD with cqlh
+
+```asciidoc
+docker run -it --rm --network container:$(docker ps | grep hcd | cut -b 1-12) cassandra:latest cqlsh -u cassandra -p cassandra
+```
+
+```asciidoc
+podman exec -it $(podman ps | grep hcd | cut -b 1-12) cqlsh -u cassandra -p cassandra
+```
## Run against Local HCD Instance
(_to run locally your must have the data api running locally on op of HCD or DSE_)
diff --git a/astra-db-java-tools/pom.xml b/astra-db-java-tools/pom.xml
index 05f99be7..a3d33f92 100644
--- a/astra-db-java-tools/pom.xml
+++ b/astra-db-java-tools/pom.xml
@@ -7,7 +7,7 @@
com.datastax.astraastra-db-java-parent
- 2.0.0
+ 2.1.0-SNAPSHOT
diff --git a/astra-db-java-tools/src/main/java/com/datastax/astra/tool/loader/rag/ingestion/RagIngestionConfig.java b/astra-db-java-tools/src/main/java/com/datastax/astra/tool/loader/rag/ingestion/RagIngestionConfig.java
index 2d47faa6..4c60de83 100644
--- a/astra-db-java-tools/src/main/java/com/datastax/astra/tool/loader/rag/ingestion/RagIngestionConfig.java
+++ b/astra-db-java-tools/src/main/java/com/datastax/astra/tool/loader/rag/ingestion/RagIngestionConfig.java
@@ -1,6 +1,6 @@
package com.datastax.astra.tool.loader.rag.ingestion;
-import com.datastax.astra.client.tables.definition.columns.ColumnTypes;
+import com.datastax.astra.client.tables.definition.columns.TableColumnTypes;
import com.datastax.astra.client.tables.mapping.Column;
import com.datastax.astra.client.tables.mapping.EntityTable;
import com.datastax.astra.client.tables.mapping.PartitionBy;
@@ -17,46 +17,46 @@ public class RagIngestionConfig {
@PartitionBy(0)
UUID uid = UUID.randomUUID();
- @Column(name = "name", type = ColumnTypes.TEXT)
+ @Column(name = "name", type = TableColumnTypes.TEXT)
String name;
- @Column(name = "description", type = ColumnTypes.TEXT)
+ @Column(name = "description", type = TableColumnTypes.TEXT)
String description;
// Splitting
- @Column(name = "splitter", type = ColumnTypes.TEXT)
+ @Column(name = "splitter", type = TableColumnTypes.TEXT)
String splitter;
- @Column(name = "chunk_size", type = ColumnTypes.INT)
+ @Column(name = "chunk_size", type = TableColumnTypes.INT)
Integer chunkSize;
- @Column(name = "chunk_overlap", type = ColumnTypes.INT)
+ @Column(name = "chunk_overlap", type = TableColumnTypes.INT)
Integer chunkOverlap;
// Embedding
- @Column(name = "embedding_model", type = ColumnTypes.TEXT)
+ @Column(name = "embedding_model", type = TableColumnTypes.TEXT)
String embeddingModel;
- @Column(name = "embedding_provider", type = ColumnTypes.TEXT)
+ @Column(name = "embedding_provider", type = TableColumnTypes.TEXT)
String embeddingProvider;
- @Column(name = "embedding_dimension", type = ColumnTypes.INT)
+ @Column(name = "embedding_dimension", type = TableColumnTypes.INT)
Integer embeddingDimension;
// Post Processing
- @Column(name = "context_before", type = ColumnTypes.INT)
+ @Column(name = "context_before", type = TableColumnTypes.INT)
Integer contextBefore = 1;
- @Column(name = "context_after", type = ColumnTypes.INT)
+ @Column(name = "context_after", type = TableColumnTypes.INT)
Integer contextAfter = 2;
- @Column(name = "enable_nlp_filter", type = ColumnTypes.BOOLEAN)
+ @Column(name = "enable_nlp_filter", type = TableColumnTypes.BOOLEAN)
boolean nlp;
- @Column(name = "enable_hyde", type = ColumnTypes.BOOLEAN)
+ @Column(name = "enable_hyde", type = TableColumnTypes.BOOLEAN)
boolean hyde;
public RagIngestionConfig withEmbedding(RagEmbeddingsModels model) {
diff --git a/astra-db-java-tools/src/main/java/com/datastax/astra/tool/loader/rag/ingestion/RagIngestionJob.java b/astra-db-java-tools/src/main/java/com/datastax/astra/tool/loader/rag/ingestion/RagIngestionJob.java
index 33db4fb5..af9eae0b 100644
--- a/astra-db-java-tools/src/main/java/com/datastax/astra/tool/loader/rag/ingestion/RagIngestionJob.java
+++ b/astra-db-java-tools/src/main/java/com/datastax/astra/tool/loader/rag/ingestion/RagIngestionJob.java
@@ -1,7 +1,7 @@
package com.datastax.astra.tool.loader.rag.ingestion;
import com.datastax.astra.client.core.query.SortOrder;
-import com.datastax.astra.client.tables.definition.columns.ColumnTypes;
+import com.datastax.astra.client.tables.definition.columns.TableColumnTypes;
import com.datastax.astra.client.tables.mapping.Column;
import com.datastax.astra.client.tables.mapping.EntityTable;
import com.datastax.astra.client.tables.mapping.PartitionBy;
@@ -18,29 +18,29 @@ public class RagIngestionJob {
public static final String TABLE_NAME = "rag_jobs";
@PartitionBy(0)
- @Column(name ="source_id", type=ColumnTypes.UUID)
+ @Column(name ="source_id", type= TableColumnTypes.UUID)
UUID sourceId;
@PartitionSort(position = 0, order=SortOrder.ASCENDING)
- @Column(name ="uid", type=ColumnTypes.UUID)
+ @Column(name ="uid", type= TableColumnTypes.UUID)
UUID uid = UUID.randomUUID();
- @Column(name ="config_id", type=ColumnTypes.UUID)
+ @Column(name ="config_id", type= TableColumnTypes.UUID)
UUID configId;
- @Column(name ="start", type=ColumnTypes.TIMESTAMP)
+ @Column(name ="start", type= TableColumnTypes.TIMESTAMP)
Instant start = Instant.now();
- @Column(name ="stop", type=ColumnTypes.TIMESTAMP)
+ @Column(name ="stop", type= TableColumnTypes.TIMESTAMP)
Instant stop;
- @Column(name ="elapsed", type=ColumnTypes.BIGINT)
+ @Column(name ="elapsed", type= TableColumnTypes.BIGINT)
Long elapsed;
- @Column(name ="chunk_count", type=ColumnTypes.INT)
+ @Column(name ="chunk_count", type= TableColumnTypes.INT)
Integer chunkCount = 0;
- @Column(name ="token_count", type=ColumnTypes.INT)
+ @Column(name ="token_count", type= TableColumnTypes.INT)
Integer tokenCount = 0;
}
diff --git a/astra-db-java-tools/src/main/java/com/datastax/astra/tool/loader/rag/sources/RagSource.java b/astra-db-java-tools/src/main/java/com/datastax/astra/tool/loader/rag/sources/RagSource.java
index 8a074541..2f92585b 100644
--- a/astra-db-java-tools/src/main/java/com/datastax/astra/tool/loader/rag/sources/RagSource.java
+++ b/astra-db-java-tools/src/main/java/com/datastax/astra/tool/loader/rag/sources/RagSource.java
@@ -1,6 +1,6 @@
package com.datastax.astra.tool.loader.rag.sources;
-import com.datastax.astra.client.tables.definition.columns.ColumnTypes;
+import com.datastax.astra.client.tables.definition.columns.TableColumnTypes;
import com.datastax.astra.client.tables.mapping.Column;
import com.datastax.astra.client.tables.mapping.EntityTable;
import com.datastax.astra.client.tables.mapping.PartitionBy;
@@ -12,9 +12,9 @@
import java.util.Map;
import java.util.UUID;
-import static com.datastax.astra.client.tables.definition.columns.ColumnTypes.BOOLEAN;
-import static com.datastax.astra.client.tables.definition.columns.ColumnTypes.MAP;
-import static com.datastax.astra.client.tables.definition.columns.ColumnTypes.TEXT;
+import static com.datastax.astra.client.tables.definition.columns.TableColumnTypes.BOOLEAN;
+import static com.datastax.astra.client.tables.definition.columns.TableColumnTypes.MAP;
+import static com.datastax.astra.client.tables.definition.columns.TableColumnTypes.TEXT;
@Data
@NoArgsConstructor
@@ -26,10 +26,10 @@ public class RagSource {
@PartitionBy(0)
UUID uid = java.util.UUID.randomUUID();
- @Column(name ="created_at", type= ColumnTypes.TIMESTAMP)
+ @Column(name ="created_at", type= TableColumnTypes.TIMESTAMP)
Instant createdAt = Instant.now();
- @Column(name ="created_by", type=ColumnTypes.UUID)
+ @Column(name ="created_by", type= TableColumnTypes.UUID)
UUID createdBy;
@Column(name ="name", type= TEXT)
@@ -58,22 +58,22 @@ public class RagSource {
@Column(name ="error_message", type= TEXT)
String errorMessage;
- @Column(name ="last_loaded", type=ColumnTypes.TIMESTAMP)
+ @Column(name ="last_loaded", type= TableColumnTypes.TIMESTAMP)
Instant lastLoaded;
- @Column(name ="expiration_date", type=ColumnTypes.TIMESTAMP)
+ @Column(name ="expiration_date", type= TableColumnTypes.TIMESTAMP)
Instant expirationDate;
@Column(name ="metadata", type= MAP, keyType = TEXT, valueType = TEXT)
Map metadata = new HashMap<>();
- @Column(name ="binary_data", type=ColumnTypes.BLOB)
+ @Column(name ="binary_data", type= TableColumnTypes.BLOB)
byte[] binaryData;
@Column(name ="binary_data_md5", type= TEXT)
String binaryDataMD5;
- @Column(name ="binary_data_size", type=ColumnTypes.BIGINT)
+ @Column(name ="binary_data_size", type= TableColumnTypes.BIGINT)
Long binaryDataSize;
@Column(name ="is_text", type= BOOLEAN)
diff --git a/astra-db-java-tools/src/main/java/com/datastax/astra/tool/loader/rag/stores/RagStore.java b/astra-db-java-tools/src/main/java/com/datastax/astra/tool/loader/rag/stores/RagStore.java
index 4c685166..4876a3fa 100644
--- a/astra-db-java-tools/src/main/java/com/datastax/astra/tool/loader/rag/stores/RagStore.java
+++ b/astra-db-java-tools/src/main/java/com/datastax/astra/tool/loader/rag/stores/RagStore.java
@@ -5,8 +5,8 @@
import com.datastax.astra.client.core.vector.SimilarityMetric;
import com.datastax.astra.client.core.vectorize.VectorServiceOptions;
import com.datastax.astra.client.tables.definition.TableDefinition;
-import com.datastax.astra.client.tables.definition.columns.ColumnDefinitionVector;
-import com.datastax.astra.client.tables.definition.columns.ColumnTypes;
+import com.datastax.astra.client.tables.definition.columns.TableColumnDefinitionVector;
+import com.datastax.astra.client.tables.definition.columns.TableColumnTypes;
import com.datastax.astra.client.tables.definition.indexes.TableVectorIndexDefinition;
import com.datastax.astra.client.tables.mapping.Column;
import com.datastax.astra.tool.loader.rag.ingestion.RagEmbeddingsModels;
@@ -26,59 +26,59 @@ public class RagStore {
public static final String INDEX_NAME_PREFIX = "idx_embeddings_";
- @Column(name ="source_id", type=ColumnTypes.UUID)
+ @Column(name ="source_id", type= TableColumnTypes.UUID)
UUID sourceId;
- @Column(name ="job_id", type=ColumnTypes.UUID)
+ @Column(name ="job_id", type= TableColumnTypes.UUID)
UUID jobId;
// Could be a metadata later on
- @Column(name ="contact°id", type=ColumnTypes.UUID)
+ @Column(name ="contact°id", type= TableColumnTypes.UUID)
UUID contactId;
- @Column(name ="created_at", type= ColumnTypes.TIMESTAMP)
+ @Column(name ="created_at", type= TableColumnTypes.TIMESTAMP)
Instant createdAt = Instant.now();
- @Column(name ="chunk_idx", type= ColumnTypes.INT)
+ @Column(name ="chunk_idx", type= TableColumnTypes.INT)
Integer chunkIdx = 0;
- @Column(name ="chunk_md5", type= ColumnTypes.TEXT)
+ @Column(name ="chunk_md5", type= TableColumnTypes.TEXT)
String chunkMd5;
- @Column(name ="embedded", type= ColumnTypes.TEXT)
+ @Column(name ="embedded", type= TableColumnTypes.TEXT)
String embedded;
- @Column(name ="language", type= ColumnTypes.TEXT)
+ @Column(name ="language", type= TableColumnTypes.TEXT)
String language;
- @Column(name ="embeddings", type= ColumnTypes.VECTOR)
+ @Column(name ="embeddings", type= TableColumnTypes.VECTOR)
DataAPIVector embeddings;
- @Column(name ="context", type= ColumnTypes.TEXT)
+ @Column(name ="context", type= TableColumnTypes.TEXT)
String context;
- @Column(name ="questions", type= ColumnTypes.SET, valueType = ColumnTypes.TEXT)
+ @Column(name ="questions", type= TableColumnTypes.SET, valueType = TableColumnTypes.TEXT)
Set questions;
- @Column(name ="metadata", type= ColumnTypes.SET, valueType = ColumnTypes.TEXT)
+ @Column(name ="metadata", type= TableColumnTypes.SET, valueType = TableColumnTypes.TEXT)
Map metadata;
- @Column(name ="tags", type= ColumnTypes.SET, valueType = ColumnTypes.TEXT)
+ @Column(name ="tags", type= TableColumnTypes.SET, valueType = TableColumnTypes.TEXT)
Set tags;
public static TableDefinition getTableDefinition(int dimension, VectorServiceOptions vso) {
return new TableDefinition()
- .addColumn("source_id", ColumnTypes.UUID)
- .addColumn("job_id", ColumnTypes.UUID)
+ .addColumn("source_id", TableColumnTypes.UUID)
+ .addColumn("job_id", TableColumnTypes.UUID)
.addColumnTimestamp("created_at")
.addColumnInt("chunk_idx")
.addColumnText("chunk_md5")
.addColumnText("embedded")
.addColumnText("context")
.addColumnText("language")
- .addColumnSet("questions", ColumnTypes.TEXT)
- .addColumnMap("metadata", ColumnTypes.TEXT, ColumnTypes.TEXT)
- .addColumnSet("tags", ColumnTypes.TEXT)
- .addColumnVector("embeddings", new ColumnDefinitionVector()
+ .addColumnSet("questions", TableColumnTypes.TEXT)
+ .addColumnMap("metadata", TableColumnTypes.TEXT, TableColumnTypes.TEXT)
+ .addColumnSet("tags", TableColumnTypes.TEXT)
+ .addColumnVector("embeddings", new TableColumnDefinitionVector()
.dimension(dimension)
.metric(SimilarityMetric.COSINE)
.service(vso)) // nullable
diff --git a/astra-db-java/pom.xml b/astra-db-java/pom.xml
index a035234b..766f60f0 100644
--- a/astra-db-java/pom.xml
+++ b/astra-db-java/pom.xml
@@ -10,7 +10,7 @@
com.datastax.astraastra-db-java-parent
- 2.0.0
+ 2.1.0-SNAPSHOT
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/DataAPIClient.java b/astra-db-java/src/main/java/com/datastax/astra/client/DataAPIClient.java
index db28f6bc..0317c40f 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/DataAPIClient.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/DataAPIClient.java
@@ -21,7 +21,7 @@
*/
import com.datastax.astra.client.admin.AstraDBAdmin;
-import com.datastax.astra.client.admin.AdminOptions;
+import com.datastax.astra.client.admin.options.AdminOptions;
import com.datastax.astra.client.core.options.DataAPIClientOptions;
import com.datastax.astra.client.databases.Database;
import com.datastax.astra.client.databases.DatabaseOptions;
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/admin/AstraDBAdmin.java b/astra-db-java/src/main/java/com/datastax/astra/client/admin/AstraDBAdmin.java
index 6c6c92b9..564cc809 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/admin/AstraDBAdmin.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/admin/AstraDBAdmin.java
@@ -20,6 +20,9 @@
* #L%
*/
+import com.datastax.astra.client.admin.commands.AstraAvailableRegionInfo;
+import com.datastax.astra.client.admin.options.AdminOptions;
+import com.datastax.astra.client.admin.options.AstraFindAvailableRegionsOptions;
import com.datastax.astra.client.core.options.DataAPIClientOptions;
import com.datastax.astra.client.databases.definition.DatabaseInfo;
import com.datastax.astra.client.databases.DatabaseOptions;
@@ -32,6 +35,8 @@
import com.dtsx.astra.sdk.db.domain.Database;
import com.dtsx.astra.sdk.db.domain.DatabaseCreationRequest;
import com.dtsx.astra.sdk.db.domain.DatabaseStatusType;
+import com.dtsx.astra.sdk.db.domain.FilterByOrgType;
+import com.dtsx.astra.sdk.db.domain.RegionType;
import com.dtsx.astra.sdk.db.exception.DatabaseNotFoundException;
import com.dtsx.astra.sdk.utils.AstraRc;
import com.dtsx.astra.sdk.utils.observability.ApiRequestObserver;
@@ -41,6 +46,7 @@
import java.net.http.HttpClient;
import java.time.Duration;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -120,6 +126,37 @@ public AstraDBAdmin(AdminOptions options) {
this.httpClient = httpClientBuilder.build();
}
+ // --------------------
+ // -- Regions ---
+ // --------------------
+
+ /**
+ * Find all available regions for vector databases.
+ * This method will return all regions, including the ones that are not enabled for the current organization.
+ *
+ * @param options
+ * options to filter the regions, such as onlyOrgEnabledRegions
+ *
+ * @return
+ * list of available regions
+ */
+ public List findAvailableRegions(AstraFindAvailableRegionsOptions options) {
+ FilterByOrgType filterByOrgType = FilterByOrgType.ENABLED;
+ /*
+ * This parameter would be a direct wrapper over the filter-by-org query parameter, where:
+ * - onlyOrgEnabledRegions: true or unset → filter-by-org=enabled
+ * - onlyOrgEnabledRegions: false → filter-by-org=disabled
+ */
+ if (options !=null && !options.isOnlyOrgEnabledRegions()) {
+ filterByOrgType = FilterByOrgType.DISABLED;
+ }
+ return devopsDbClient
+ .regions()
+ .findAllServerless(RegionType.VECTOR,filterByOrgType)
+ .map(AstraAvailableRegionInfo::new)
+ .toList();
+ }
+
// --------------------
// -- Databases ---
// --------------------
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/admin/AstraDBDatabaseAdmin.java b/astra-db-java/src/main/java/com/datastax/astra/client/admin/AstraDBDatabaseAdmin.java
index 2e402e12..83a7b5e2 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/admin/AstraDBDatabaseAdmin.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/admin/AstraDBDatabaseAdmin.java
@@ -21,10 +21,12 @@
*/
import com.datastax.astra.client.DataAPIDestination;
-import com.datastax.astra.client.core.options.BaseOptions;
+import com.datastax.astra.client.admin.options.AdminOptions;
import com.datastax.astra.client.core.options.DataAPIClientOptions;
import com.datastax.astra.client.databases.commands.options.CreateKeyspaceOptions;
import com.datastax.astra.client.databases.commands.options.DropKeyspaceOptions;
+import com.datastax.astra.client.databases.commands.options.FindEmbeddingProvidersOptions;
+import com.datastax.astra.client.databases.commands.options.FindRerankingProvidersOptions;
import com.datastax.astra.client.databases.commands.results.FindEmbeddingProvidersResult;
import com.datastax.astra.client.databases.DatabaseOptions;
import com.datastax.astra.client.databases.commands.results.FindRerankingProvidersResult;
@@ -191,18 +193,18 @@ public Set listKeyspaceNames() {
/** {@inheritDoc} */
@Override
- public FindEmbeddingProvidersResult findEmbeddingProviders() {
+ public FindEmbeddingProvidersResult findEmbeddingProviders(FindEmbeddingProvidersOptions options) {
log.debug("findEmbeddingProviders");
DataAPIDatabaseAdmin admin = new DataAPIDatabaseAdmin(db, this.options);
- return new FindEmbeddingProvidersResult(admin.findEmbeddingProviders().getEmbeddingProviders());
+ return new FindEmbeddingProvidersResult(admin.findEmbeddingProviders(options).getEmbeddingProviders());
}
/** {@inheritDoc} */
@Override
- public FindRerankingProvidersResult findRerankingProviders() {
+ public FindRerankingProvidersResult findRerankingProviders(FindRerankingProvidersOptions options) {
log.debug("findRerankingProviders");
DataAPIDatabaseAdmin admin = new DataAPIDatabaseAdmin(db, this.options);
- return new FindRerankingProvidersResult(admin.findRerankingProviders().getRerankingProviders());
+ return new FindRerankingProvidersResult(admin.findRerankingProviders(options).getRerankingProviders());
}
/** {@inheritDoc} */
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/admin/DataAPIDatabaseAdmin.java b/astra-db-java/src/main/java/com/datastax/astra/client/admin/DataAPIDatabaseAdmin.java
index f3c1cfe0..9cdc64a4 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/admin/DataAPIDatabaseAdmin.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/admin/DataAPIDatabaseAdmin.java
@@ -20,6 +20,7 @@
* #L%
*/
+import com.datastax.astra.client.admin.options.AdminOptions;
import com.datastax.astra.client.core.commands.Command;
import com.datastax.astra.client.core.commands.CommandType;
import com.datastax.astra.client.core.rerank.RerankProvider;
@@ -27,6 +28,8 @@
import com.datastax.astra.client.databases.Database;
import com.datastax.astra.client.databases.commands.options.CreateKeyspaceOptions;
import com.datastax.astra.client.databases.commands.options.DropKeyspaceOptions;
+import com.datastax.astra.client.databases.commands.options.FindEmbeddingProvidersOptions;
+import com.datastax.astra.client.databases.commands.options.FindRerankingProvidersOptions;
import com.datastax.astra.client.databases.commands.results.FindEmbeddingProvidersResult;
import com.datastax.astra.client.databases.commands.results.FindRerankingProvidersResult;
import com.datastax.astra.client.databases.definition.keyspaces.KeyspaceDefinition;
@@ -105,16 +108,26 @@ public Set listKeyspaceNames() {
/** {@inheritDoc} */
@Override
- public FindEmbeddingProvidersResult findEmbeddingProviders() {
- DataAPIResponse res = runCommand(Command.create("findEmbeddingProviders"));
+ public FindEmbeddingProvidersResult findEmbeddingProviders(FindEmbeddingProvidersOptions options) {
+ DataAPIResponse res = runCommand(Command
+ .create("findEmbeddingProviders")
+ .withOptions(options));
return new FindEmbeddingProvidersResult(
res.getStatusKeyAsMap("embeddingProviders",
- EmbeddingProvider.class));
+ EmbeddingProvider.class));
}
+// @Override
+// public FindRerankingProvidersResult findRerankingProviders() {
+// DataAPIResponse res = runCommand(Command.create("findRerankingProviders"));
+// return new FindRerankingProvidersResult(
+// res.getStatusKeyAsMap("rerankingProviders",
+// RerankProvider.class));
+// }
+
@Override
- public FindRerankingProvidersResult findRerankingProviders() {
- DataAPIResponse res = runCommand(Command.create("findRerankingProviders"));
+ public FindRerankingProvidersResult findRerankingProviders(FindRerankingProvidersOptions options) {
+ DataAPIResponse res = runCommand(Command.create("findRerankingProviders").withOptions(options));
return new FindRerankingProvidersResult(
res.getStatusKeyAsMap("rerankingProviders",
RerankProvider.class));
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/admin/DatabaseAdmin.java b/astra-db-java/src/main/java/com/datastax/astra/client/admin/DatabaseAdmin.java
index fcb80e23..d1295f38 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/admin/DatabaseAdmin.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/admin/DatabaseAdmin.java
@@ -22,11 +22,14 @@
import com.datastax.astra.client.core.options.BaseOptions;
import com.datastax.astra.client.core.rerank.RerankProvider;
+import com.datastax.astra.client.core.vectorize.SupportModelStatus;
import com.datastax.astra.client.databases.Database;
import com.datastax.astra.client.core.commands.CommandRunner;
import com.datastax.astra.client.core.vectorize.EmbeddingProvider;
import com.datastax.astra.client.databases.commands.options.CreateKeyspaceOptions;
import com.datastax.astra.client.databases.commands.options.DropKeyspaceOptions;
+import com.datastax.astra.client.databases.commands.options.FindEmbeddingProvidersOptions;
+import com.datastax.astra.client.databases.commands.options.FindRerankingProvidersOptions;
import com.datastax.astra.client.databases.commands.results.FindEmbeddingProvidersResult;
import com.datastax.astra.client.databases.commands.results.FindRerankingProvidersResult;
import com.datastax.astra.client.databases.definition.keyspaces.KeyspaceDefinition;
@@ -36,6 +39,8 @@
import java.util.Set;
import java.util.concurrent.CompletableFuture;
+import static com.datastax.astra.client.core.vectorize.SupportModelStatus.SUPPORTED;
+
/**
* Defines the core client interface for interacting with the Data API, focusing on CRUD (Create, Read, Update, Delete)
* operations for namespaces. This interface extends the {@link CommandRunner}, incorporating methods that
@@ -75,6 +80,9 @@ public interface DatabaseAdmin {
* that provide embeddings for text, images, or other data types. This method returns a map of provider names to
* {@link EmbeddingProvider} instances, allowing applications to access and utilize the embedding services.
*
+ * @param options
+ * Defines options for the operation, such as filtering by model status or other criteria.
+ *
*
Example usage:
*
* {@code
@@ -85,7 +93,17 @@ public interface DatabaseAdmin {
* @return
* list of available providers
*/
- FindEmbeddingProvidersResult findEmbeddingProviders();
+ FindEmbeddingProvidersResult findEmbeddingProviders(FindEmbeddingProvidersOptions options);
+
+ /**
+ * Backward compatible method to retrieve the list of embedding providers available in the current database.
+ *
+ * @return
+ * list of available providers with default options
+ */
+ default FindEmbeddingProvidersResult findEmbeddingProviders() {
+ return findEmbeddingProviders(null);
+ }
/**
* Retrieve the list of reranking providers available in the current database. Reranking providers are services
@@ -103,7 +121,17 @@ public interface DatabaseAdmin {
* @return
* list of available providers
*/
- FindRerankingProvidersResult findRerankingProviders();
+ FindRerankingProvidersResult findRerankingProviders(FindRerankingProvidersOptions options);
+
+ /**
+ * Backward compatible method to retrieve the list of reranking providers available in the current database.
+ *
+ * @return
+ * list of available providers with default options
+ */
+ default FindRerankingProvidersResult findRerankingProviders() {
+ return findRerankingProviders(null);
+ }
/**
* Asynchronously retrieves a stream of keyspaces names available in the current database. This method facilitates
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/admin/commands/AstraAvailableRegionInfo.java b/astra-db-java/src/main/java/com/datastax/astra/client/admin/commands/AstraAvailableRegionInfo.java
new file mode 100644
index 00000000..281493e5
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/admin/commands/AstraAvailableRegionInfo.java
@@ -0,0 +1,79 @@
+package com.datastax.astra.client.admin.commands;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 - 2025 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.dtsx.astra.sdk.db.domain.DatabaseRegionServerless;
+import lombok.Data;
+
+/**
+ * Information about an available region for Astra DB.
+ *
+ * This class encapsulates details about a specific region where Astra DB can be deployed,
+ * including the region name, cloud provider, display name, zone, classification, and whether
+ * the region is enabled or reserved for qualified users.
+ *
+ */
+@Data
+public class AstraAvailableRegionInfo {
+
+ /** Region Name. */
+ private String name;
+
+ /** Cloud provider. */
+ private String cloudProvider;
+
+ /** Name of the region picked. */
+ private String displayName;
+
+ /** Zone. */
+ private String zone;
+
+ /** Classification. */
+ private String classification;
+
+ /** working region. */
+ private boolean enabled;
+
+ /** limited ? */
+ private boolean reservedForQualifiedUsers;
+
+ /**
+ * Default Constructor.
+ */
+ public AstraAvailableRegionInfo() {
+ }
+
+ /**
+ * Constructor from DatabaseRegionServerless.
+ *
+ * @param dbRegionServerless
+ * the database region serverless object
+ */
+ public AstraAvailableRegionInfo(DatabaseRegionServerless dbRegionServerless) {
+ this.classification = dbRegionServerless.getClassification();
+ this.cloudProvider = dbRegionServerless.getCloudProvider();
+ this.displayName = dbRegionServerless.getDisplayName();
+ this.enabled = dbRegionServerless.isEnabled();
+ this.name = dbRegionServerless.getName();
+ this.reservedForQualifiedUsers = dbRegionServerless.isReservedForQualifiedUsers();
+ this.zone = dbRegionServerless.getZone();
+ }
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/admin/AdminOptions.java b/astra-db-java/src/main/java/com/datastax/astra/client/admin/options/AdminOptions.java
similarity index 98%
rename from astra-db-java/src/main/java/com/datastax/astra/client/admin/AdminOptions.java
rename to astra-db-java/src/main/java/com/datastax/astra/client/admin/options/AdminOptions.java
index be5a75ed..0866d8c1 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/admin/AdminOptions.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/admin/options/AdminOptions.java
@@ -1,4 +1,4 @@
-package com.datastax.astra.client.admin;
+package com.datastax.astra.client.admin.options;
/*-
* #%L
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/admin/options/AstraFindAvailableRegionsOptions.java b/astra-db-java/src/main/java/com/datastax/astra/client/admin/options/AstraFindAvailableRegionsOptions.java
new file mode 100644
index 00000000..710146de
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/admin/options/AstraFindAvailableRegionsOptions.java
@@ -0,0 +1,50 @@
+package com.datastax.astra.client.admin.options;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 - 2025 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import lombok.Data;
+
+/**
+ * Options for finding available regions in Astra.
+ * This class allows users to specify whether to filter regions
+ * based on organization enabled status.
+ */
+@Data
+public class AstraFindAvailableRegionsOptions {
+
+ /**
+ * Flag to indicate whether to return only regions enabled for the organization.
+ * Default is true, meaning only organization enabled regions will be returned.
+ */
+ private boolean onlyOrgEnabledRegions = true;
+
+ /**
+ * Constructs an instance of AstraFindAvailableRegionsOptions with default settings.
+ *
+ * @param onlyOrgEnabledRegions
+ * If true, only regions enabled for the organization will be returned.
+ */
+ public AstraFindAvailableRegionsOptions onlyOrgEnabledRegions(boolean onlyOrgEnabledRegions) {
+ this.onlyOrgEnabledRegions = onlyOrgEnabledRegions;
+ return this;
+ }
+
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/collections/commands/cursor/CollectionFindAndRerankCursor.java b/astra-db-java/src/main/java/com/datastax/astra/client/collections/commands/cursor/CollectionFindAndRerankCursor.java
index 4cacb473..c30c8465 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/collections/commands/cursor/CollectionFindAndRerankCursor.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/collections/commands/cursor/CollectionFindAndRerankCursor.java
@@ -208,7 +208,7 @@ public CollectionFindAndRerankCursor includeSortVector() {
/**
* {PageState is always null, all is returned here }
*/
- public void fetchNextBatch() {
+ public void fetchNextPage() {
// Only the first time
if (currentPage == null) {
currentPage = dataSource.findAndRerankPage(filter, options, newRowType);
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/collections/commands/cursor/CollectionFindCursor.java b/astra-db-java/src/main/java/com/datastax/astra/client/collections/commands/cursor/CollectionFindCursor.java
index cee96530..146a740d 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/collections/commands/cursor/CollectionFindCursor.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/collections/commands/cursor/CollectionFindCursor.java
@@ -214,7 +214,7 @@ public CollectionFindCursor includeSortVector() {
* Fetches the next batch of documents into the buffer.
* This method handles paging, using the page state from the previous batch to fetch the next one.
*/
- public void fetchNextBatch() {
+ public void fetchNextPage() {
if (currentPage == null) {
// Searching First Page
currentPage = dataSource.findPage(filter, collectionFindOptions, getRecordType());
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/collections/commands/options/ListCollectionOptions.java b/astra-db-java/src/main/java/com/datastax/astra/client/collections/commands/options/ListCollectionOptions.java
index 635f06f4..c93871c7 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/collections/commands/options/ListCollectionOptions.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/collections/commands/options/ListCollectionOptions.java
@@ -21,19 +21,38 @@
*/
import com.datastax.astra.client.core.options.BaseOptions;
+import com.datastax.astra.client.core.options.DataAPIClientOptions;
import com.datastax.astra.internal.serdes.collections.DocumentSerializer;
+import lombok.Setter;
+import lombok.experimental.Accessors;
import static com.datastax.astra.client.core.commands.CommandType.COLLECTION_ADMIN;
/**
* Options for the listCollection operation.
*/
+@Setter
+@Accessors(fluent = true, chain = true)
public class ListCollectionOptions extends BaseOptions {
+ /**
+ * The keyspace to use for the database.
+ */
+ String keyspace = DataAPIClientOptions.DEFAULT_KEYSPACE;
+
/**
* Default constructor.
*/
public ListCollectionOptions() {
super(null, COLLECTION_ADMIN, new DocumentSerializer(), null);
}
+
+ /**
+ * Gets keyspace
+ *
+ * @return value of keyspace
+ */
+ public String getKeyspace() {
+ return keyspace;
+ }
}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/collections/definition/documents/types/TimeUUID.java b/astra-db-java/src/main/java/com/datastax/astra/client/collections/definition/documents/types/TimeUUID.java
new file mode 100644
index 00000000..70c3749a
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/collections/definition/documents/types/TimeUUID.java
@@ -0,0 +1,128 @@
+package com.datastax.astra.client.collections.definition.documents.types;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 - 2025 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.datastax.astra.internal.serdes.collections.TimeUUIDSerializer;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.uuid.Generators;
+import com.fasterxml.uuid.impl.UUIDUtil;
+
+import java.time.Instant;
+import java.util.UUID;
+
+/**
+ * Represents a time-based UUID (Version 1).
+ *
+ * This class encapsulates a UUID that is generated based on the current time,
+ * allowing for the extraction of the timestamp embedded within the UUID.
+ *
+ */
+@JsonSerialize(using = TimeUUIDSerializer.class)
+public class TimeUUID {
+
+ /**
+ * UUID.
+ */
+ private final UUID uuid;
+
+ /**
+ * Default constructor.
+ */
+ public TimeUUID() {
+ // Create a time-based (Version-1) UUID generator
+ this(Generators.timeBasedGenerator().generate());
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param uuid
+ * uuid
+ */
+ public TimeUUID(UUID uuid) {
+ this.uuid = uuid;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param strUUID
+ * uuid
+ */
+ public TimeUUID(String strUUID) {
+ this(UUID.fromString(strUUID));
+ }
+
+ /**
+ * Return the Java Utils UUID.
+ *
+ * @return
+ * uuid value
+ */
+ public UUID toUUID() {
+ return uuid;
+ }
+
+ /**
+ * Extract the hidden timestamp (100-nanosecond units since UUID epoch).
+ *
+ * @return the raw 60-bit timestamp value embedded in this UUIDv6
+ */
+ public long readTimeStamp() {
+ return UUIDUtil.extractTimestamp(uuid);
+ }
+
+ /**
+ * Get the timestamp as an {@link Instant}.
+ *
+ * @return
+ * the timestamp as an Instant
+ */
+ public Instant readInstant() {
+ return Instant.ofEpochMilli(readTimeStamp());
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return toUUID().toString();
+ }
+
+ /**
+ * Generate from a string.
+ *
+ * @param strUUID
+ * uuid as a String
+ * @return
+ * an instance of UUIDv6
+ */
+ public static UUIDv6 fromString(String strUUID) {
+ return new UUIDv6(strUUID);
+ }
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/collections/definition/documents/types/UUIDv6.java b/astra-db-java/src/main/java/com/datastax/astra/client/collections/definition/documents/types/UUIDv6.java
index 8d58e7c2..53550f5b 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/collections/definition/documents/types/UUIDv6.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/collections/definition/documents/types/UUIDv6.java
@@ -20,13 +20,18 @@
* #L%
*/
+import com.datastax.astra.internal.serdes.collections.UUID6Serializer;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.uuid.Generators;
+import com.fasterxml.uuid.impl.UUIDUtil;
+import java.time.Instant;
import java.util.UUID;
/**
* Materializing the UUIDv6 as a specialization class to drive serialization and deserialization.
*/
+@JsonSerialize(using = UUID6Serializer.class)
public class UUIDv6 {
/**
@@ -51,6 +56,16 @@ public UUIDv6(UUID uuid) {
this.uuid = uuid;
}
+ /**
+ * Constructor.
+ *
+ * @param strUUID
+ * uuid
+ */
+ public UUIDv6(String strUUID) {
+ this(UUID.fromString(strUUID));
+ }
+
/**
* Return the Java Utils UUID.
*
@@ -61,6 +76,25 @@ public UUID toUUID() {
return uuid;
}
+ /**
+ * Extract the hidden timestamp (100-nanosecond units since UUID epoch).
+ *
+ * @return the raw 60-bit timestamp value embedded in this UUIDv6
+ */
+ public long readTimeStamp() {
+ return UUIDUtil.extractTimestamp(uuid);
+ }
+
+ /**
+ * Get the timestamp as an {@link Instant}.
+ *
+ * @return
+ * the timestamp as an Instant
+ */
+ public Instant readInstant() {
+ return Instant.ofEpochMilli(readTimeStamp());
+ }
+
/** {@inheritDoc} */
@Override
public String toString() {
@@ -76,7 +110,7 @@ public String toString() {
* an instance of UUIDv6
*/
public static UUIDv6 fromString(String strUUID) {
- return new UUIDv6(UUID.fromString(strUUID));
+ return new UUIDv6(strUUID);
}
}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/collections/definition/documents/types/UUIDv7.java b/astra-db-java/src/main/java/com/datastax/astra/client/collections/definition/documents/types/UUIDv7.java
index 5255161a..60f61672 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/collections/definition/documents/types/UUIDv7.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/collections/definition/documents/types/UUIDv7.java
@@ -21,6 +21,7 @@
*/
import com.fasterxml.uuid.Generators;
+import com.fasterxml.uuid.impl.UUIDUtil;
import java.security.SecureRandom;
import java.util.UUID;
@@ -62,6 +63,15 @@ public UUID toUUID() {
return uuid;
}
+ /**
+ * Extract the hidden timestamp (100-nanosecond units since UUID epoch).
+ *
+ * @return the raw 60-bit timestamp value embedded in this UUIDv6
+ */
+ public long getTimeStamp() {
+ return UUIDUtil.extractTimestamp(uuid);
+ }
+
/** {@inheritDoc} */
@Override
public String toString() {
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/core/rerank/RerankProvider.java b/astra-db-java/src/main/java/com/datastax/astra/client/core/rerank/RerankProvider.java
index 30cf2b8b..e9f6cf25 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/core/rerank/RerankProvider.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/core/rerank/RerankProvider.java
@@ -21,6 +21,7 @@
*/
import com.datastax.astra.client.collections.definition.documents.Document;
+import com.datastax.astra.client.core.vectorize.SupportModelStatus;
import lombok.Data;
import java.util.List;
@@ -106,6 +107,9 @@ public static class Model {
private Boolean isDefault;
+ /** Supported model or not */
+ private Map apiModelSupport;
+
/** Parameters for the model. */
private List parameters;
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/core/vectorize/EmbeddingProvider.java b/astra-db-java/src/main/java/com/datastax/astra/client/core/vectorize/EmbeddingProvider.java
index 7066f44a..7dae4985 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/core/vectorize/EmbeddingProvider.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/core/vectorize/EmbeddingProvider.java
@@ -91,6 +91,9 @@ public static class Model {
/** Model name */
private String name;
+ /** Supported model or not */
+ private Map apiModelSupport;
+
/** Model dimension. */
private Integer vectorDimension;
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/core/vectorize/SupportModelStatus.java b/astra-db-java/src/main/java/com/datastax/astra/client/core/vectorize/SupportModelStatus.java
new file mode 100644
index 00000000..77e487bc
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/core/vectorize/SupportModelStatus.java
@@ -0,0 +1,46 @@
+package com.datastax.astra.client.core.vectorize;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 - 2025 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+/**
+ * Enum representing the status of an embedding provider.
+ *
+ * - SUPPORTED: The provider is currently supported and available for use.
+ * - DEPRECATED: The provider is deprecated and may be removed in future versions.
+ * - END_OF_LIFE: The provider has reached its end of life and is no longer supported.
+ */
+public enum SupportModelStatus {
+
+ /**
+ * The provider is currently supported and available for use.
+ */
+ SUPPORTED,
+
+ /**
+ * The provider is deprecated and may be removed in future versions.
+ */
+ DEPRECATED,
+
+ /**
+ * The provider has reached its end of life and is no longer supported.
+ */
+ END_OF_LIFE
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/databases/Database.java b/astra-db-java/src/main/java/com/datastax/astra/client/databases/Database.java
index 2f1054f9..025a3b93 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/databases/Database.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/databases/Database.java
@@ -20,11 +20,11 @@
* #L%
*/
-import com.datastax.astra.client.admin.AdminOptions;
import com.datastax.astra.client.admin.AstraDBAdmin;
import com.datastax.astra.client.admin.AstraDBDatabaseAdmin;
import com.datastax.astra.client.admin.DataAPIDatabaseAdmin;
import com.datastax.astra.client.admin.DatabaseAdmin;
+import com.datastax.astra.client.admin.options.AdminOptions;
import com.datastax.astra.client.collections.Collection;
import com.datastax.astra.client.collections.CollectionOptions;
import com.datastax.astra.client.collections.commands.options.CreateCollectionOptions;
@@ -35,20 +35,26 @@
import com.datastax.astra.client.collections.definition.documents.Document;
import com.datastax.astra.client.core.commands.Command;
import com.datastax.astra.client.core.options.DataAPIClientOptions;
-import com.datastax.astra.client.core.vector.SimilarityMetric;
import com.datastax.astra.client.databases.definition.DatabaseInfo;
import com.datastax.astra.client.exceptions.InvalidConfigurationException;
import com.datastax.astra.client.tables.Table;
import com.datastax.astra.client.tables.TableOptions;
+import com.datastax.astra.client.tables.commands.AlterTypeOperation;
+import com.datastax.astra.client.tables.commands.options.AlterTypeOptions;
import com.datastax.astra.client.tables.commands.options.CreateTableOptions;
+import com.datastax.astra.client.tables.commands.options.CreateTypeOptions;
import com.datastax.astra.client.tables.commands.options.CreateVectorIndexOptions;
import com.datastax.astra.client.tables.commands.options.DropTableIndexOptions;
import com.datastax.astra.client.tables.commands.options.DropTableOptions;
+import com.datastax.astra.client.tables.commands.options.DropTypeOptions;
import com.datastax.astra.client.tables.commands.options.ListTablesOptions;
+import com.datastax.astra.client.tables.commands.options.ListTypesOptions;
import com.datastax.astra.client.tables.definition.TableDefinition;
import com.datastax.astra.client.tables.definition.TableDescriptor;
-import com.datastax.astra.client.tables.definition.indexes.TableVectorIndexDefinition;
import com.datastax.astra.client.tables.definition.rows.Row;
+import com.datastax.astra.client.tables.definition.types.TableUserDefinedType;
+import com.datastax.astra.client.tables.definition.types.TableUserDefinedTypeDefinition;
+import com.datastax.astra.client.tables.definition.types.TableUserDefinedTypeDescriptor;
import com.datastax.astra.client.tables.mapping.EntityTable;
import com.datastax.astra.internal.api.AstraApiEndpoint;
import com.datastax.astra.internal.command.AbstractCommandRunner;
@@ -462,6 +468,15 @@ public List listCollectionNames() {
* according to the provided options.
*/
public List listCollectionNames(ListCollectionOptions listCollectionOptions) {
+ // Keyspace is part of the database, a new temporary database object is required.
+ if (listCollectionOptions != null && Utils.hasLength(listCollectionOptions.getKeyspace())) {
+ String otherKeyspace = listCollectionOptions.getKeyspace();
+ listCollectionOptions.keyspace(null);
+ return new Database(
+ this.rootEndpoint,
+ this.options.clone().keyspace(otherKeyspace))
+ .listCollectionNames(listCollectionOptions);
+ }
return runCommand(Command.create("findCollections"), listCollectionOptions)
.getStatusKeyAsStringStream("collections")
.toList();
@@ -523,6 +538,15 @@ public List listCollections() {
* @return A {@link List} of {@link CollectionDescriptor} objects representing the collections that match the criteria.
*/
public List listCollections(ListCollectionOptions listCollectionOptions) {
+ // Keyspace is part of the database, a new temporary database object is required.
+ if (listCollectionOptions != null && Utils.hasLength(listCollectionOptions.getKeyspace())) {
+ String otherKeyspace = listCollectionOptions.getKeyspace();
+ listCollectionOptions.keyspace(null);
+ return new Database(
+ this.rootEndpoint,
+ this.options.clone().keyspace(otherKeyspace))
+ .listCollections(listCollectionOptions);
+ }
Command findCollections = Command.create("findCollections")
.withOptions(new Document().append("explain", true));
return runCommand(findCollections, listCollectionOptions)
@@ -1177,6 +1201,248 @@ public Table getTable(Class rowClass) {
return getTable(ann.value(), rowClass);
}
+ // -------------------------------------
+ // ---- Type and Object Mapping ---
+ // -------------------------------------
+
+ public TableUserDefinedTypeDefinition getType(Class rowClass) {
+ TableUserDefinedType ann = rowClass.getAnnotation(TableUserDefinedType.class);
+ if (ann == null) {
+ InvalidConfigurationException.throwErrorMissingAnnotation(
+ TableUserDefinedType.class.getSimpleName(),
+ rowClass.getName(),
+ "getType(rowClass)");
+ }
+
+ //FIX Es
+ return null;
+ }
+
+ /**
+ * Creates a table using default options and runtime configurations.
+ *
+ * @param the type of the row objects that the table will hold
+ * @param rowClass the class representing the row type; must not be null
+ * @return the created table object
+ */
+ public String getTypeName(Class rowClass) {
+ notNull(rowClass, "typeClass");
+ TableUserDefinedType ann = rowClass.getAnnotation(TableUserDefinedType.class);
+ if (ann == null) {
+ throw new IllegalArgumentException("Class " + rowClass.getName() +
+ " is not annotated with @" + TableUserDefinedType.class.getName());
+ }
+ if (!Utils.hasLength(ann.value())) {
+ throw new IllegalArgumentException("Annotation @Udt on class " + rowClass.getName() + " has no name");
+ }
+ return ann.value();
+ }
+
+ // -------------------------------------
+ // ---- List Types ----
+ // -------------------------------------
+
+ /**
+ * Retrieves the details of all tables in the database with default options.
+ *
+ * @return A list of {@link TableUserDefinedTypeDescriptor} objects representing all tables in the database.
+ *
+ *
+ */
+ public List listTypes() {
+ return listTypes(null);
+ }
+
+ /**
+ * Retrieves the details of all types in the database.
+ *
+ * @param listTypesOptions Options for filtering or configuring the types listing operation.
+ * @return A list of {@link TableUserDefinedTypeDescriptor} objects representing all tables in the database.
+ */
+ public List listTypes(ListTypesOptions listTypesOptions) {
+ // Keyspace is part of the database, a new temporary database object is required.
+ if (listTypesOptions != null && Utils.hasLength(listTypesOptions.getKeyspace())) {
+ String otherKeyspace = listTypesOptions.getKeyspace();
+ listTypesOptions.keyspace(null);
+ return new Database(
+ this.rootEndpoint,
+ this.options.clone().keyspace(otherKeyspace))
+ .listTypes(listTypesOptions);
+ }
+ Command listTypes = Command
+ .create("listTypes")
+ .withOptions(new Document().append("explain", true));
+ return runCommand(listTypes, listTypesOptions)
+ .getStatusKeyAsList("types", TableUserDefinedTypeDescriptor.class);
+ }
+
+ // -------------------------------------
+ // ---- Create Type ----
+ // -------------------------------------
+
+ /**
+ * Creates a user defined type in the system with the specified parameters.
+ *
+ * @param typeName the name of the type to be created; must not be null or empty
+ * @param typeDefinition the schema definition of the type; must not be null
+ * @param createTypeOptions additional options for creating the type; optional, can be null
+ * @throws IllegalArgumentException if any mandatory argument is null or invalid
+ *
+ *
+ */
+ public void createType(String typeName, TableUserDefinedTypeDefinition typeDefinition, CreateTypeOptions createTypeOptions) {
+ hasLength(typeName, "typeName");
+ notNull(typeDefinition, "typeDefinition");
+
+ // We are on a different keyspace, create the table on that keyspace
+ if (createTypeOptions != null && Utils.hasLength(createTypeOptions.getKeyspace())) {
+ String otherKeyspace = createTypeOptions.getKeyspace();
+ createTypeOptions.keyspace(null);
+ new Database(
+ this.rootEndpoint,
+ this.options.clone().keyspace(otherKeyspace))
+ .createType(typeName, typeDefinition, createTypeOptions);
+ }
+
+ Command createType = Command
+ .create("createType")
+ .append("name", typeName)
+ .append("definition", typeDefinition);
+ if (createTypeOptions != null) {
+ createType.append("options", createTypeOptions);
+ }
+ runCommand(createType, createTypeOptions);
+
+ }
+
+ /**
+ * Creates a table with a default row type of {@code Row}.
+ *
+ * @param typeName the name of the table to be created; must not be null or empty
+ * @param tableUserDefinedTypeDefinition the schema definition of the type; must not be null
+ *
+ */
+ public void createType(String typeName, TableUserDefinedTypeDefinition tableUserDefinedTypeDefinition) {
+ createType(typeName, tableUserDefinedTypeDefinition, new CreateTypeOptions().ifNotExists(true));
+ }
+
+ public void createType(Class UdtBean, CreateTypeOptions createTypeOptions) {
+ notNull(UdtBean, "udtDefinition");
+ TableUserDefinedType ann = UdtBean.getAnnotation(TableUserDefinedType.class);
+ Command createTypeCmd = new Command("createType", EntityBeanDefinition.createTypeCommand(UdtBean));
+ if (createTypeOptions != null) {
+ createTypeCmd.append("options", createTypeOptions);
+ }
+ runCommand(createTypeCmd);
+ }
+
+ // -------------------------------------
+ // ---- Drop Type ----
+ // -------------------------------------
+
+ /**
+ * Deletes a type from the database.
+ * This method delegates to {@link #dropType(String, DropTypeOptions)}
+ * with default options.
+ *
+ * @param udtName
+ * the name of the type to be deleted; must not be null or empty.
+ * @throws IllegalArgumentException
+ * if {@code udtName} is null or empty.
+ *
+ *
+ */
+ public void dropType(String udtName) {
+ dropType(udtName, null);
+ }
+
+ /**
+ * Deletes a type (UDT) from the database with specific options.
+ *
+ * @param udtName
+ * the name of the user defined type to be deleted; must not be null or empty.
+ * @param dropTypeOptions
+ * the options to configure the type deletion operation; can be null.
+ * @throws IllegalArgumentException
+ * if {@code udtName} is null or empty.
+ *
+ *
+ */
+ public void dropType(String udtName, DropTypeOptions dropTypeOptions) {
+ hasLength(udtName, "udtName");
+
+ // We are on a different keyspace, drop the table on a different keyspace
+ if (dropTypeOptions != null && Utils.hasLength(dropTypeOptions.getKeyspace())) {
+ String otherKeyspace = dropTypeOptions.getKeyspace();
+ dropTypeOptions.keyspace(null);
+ new Database(
+ this.rootEndpoint,
+ this.options.clone().keyspace(otherKeyspace))
+ .dropType(udtName, dropTypeOptions);
+ } else {
+ // Command on current keyspace
+ Command dropTypeCmd = Command
+ .create("dropType")
+ .append("name", udtName);
+ if (dropTypeOptions != null) {
+ dropTypeCmd.withOptions(dropTypeOptions);
+ }
+ runCommand(dropTypeCmd, dropTypeOptions);
+ }
+ }
+
+ // -------------------------------------
+ // ---- Alter Type ----
+ // -------------------------------------
+
+ /**
+ * Performs an alteration operation on the table with default options.
+ *
+ *
This method delegates to {@link #alterType(String, AlterTypeOperation, AlterTypeOptions)}
+ * with {@code options} set to {@code null}.
+ *
+ * @param udtName
+ * name of the user defined type to be altered; must not be null or empty.
+ * @param operation
+ * the alteration operation to be performed; must not be {@code null}.
+ */
+ public final void alterType(String udtName, AlterTypeOperation,?> operation) {
+ alterType(udtName, operation, null);
+ }
+
+ public final void alterType(String udtName, AlterTypeOperation,?> operation, AlterTypeOptions alterTypeOptions) {
+ notNull(operation, "operation");
+ Command alterType = Command.create("alterType")
+ .append("name", udtName)
+ .append(operation.getOperationName(), Map.of("fields", operation.getFields()));
+ runCommand(alterType, alterTypeOptions);
+ }
+
// -------------------------------------
// ---- Create Table ----
// -------------------------------------
@@ -1397,7 +1663,7 @@ public String getTableName(Class rowClass) {
notNull(rowClass, "rowClass");
EntityTable ann = rowClass.getAnnotation(EntityTable.class);
if (ann == null) {
- throw new IllegalArgumentException("Class " + rowClass.getName() + " is not annotated with @Table");
+ throw new IllegalArgumentException("Class " + rowClass.getName() + " is not annotated with "+ EntityTable.class.getName());
}
if (!Utils.hasLength(ann.value())) {
throw new IllegalArgumentException("Annotation @Table on class " + rowClass.getName() + " has no name");
@@ -1434,7 +1700,7 @@ private CollectionOptions defaultCollectionOptions() {
// -------------------------------------
/**
- * Deletes a collection (table) from the database.
+ * Deletes a table from the database.
* This method delegates to {@link #dropTable(String, DropTableOptions)}
* with default options.
*
@@ -1494,6 +1760,7 @@ public void dropTable(String tableName, DropTableOptions dropTableOptions) {
runCommand(dropTableCmd, dropTableOptions);
}
}
+
// ------------------------------------------
// ---- Drop Indexes ---
// ------------------------------------------
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/databases/commands/options/CreateKeyspaceOptions.java b/astra-db-java/src/main/java/com/datastax/astra/client/databases/commands/options/CreateKeyspaceOptions.java
index 2b78b536..cbac887f 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/databases/commands/options/CreateKeyspaceOptions.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/databases/commands/options/CreateKeyspaceOptions.java
@@ -20,16 +20,12 @@
* #L%
*/
-import com.datastax.astra.client.admin.AdminOptions;
+import com.datastax.astra.client.admin.options.AdminOptions;
import com.datastax.astra.client.core.commands.CommandType;
import com.datastax.astra.client.core.options.BaseOptions;
-import com.datastax.astra.client.core.options.DataAPIClientOptions;
-import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
-import static com.datastax.astra.client.tables.Table.DEFAULT_TABLE_SERIALIZER;
-
/**
* Set of options used when creating a table
*/
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/databases/commands/options/DropKeyspaceOptions.java b/astra-db-java/src/main/java/com/datastax/astra/client/databases/commands/options/DropKeyspaceOptions.java
index d93fe2b2..dea41370 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/databases/commands/options/DropKeyspaceOptions.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/databases/commands/options/DropKeyspaceOptions.java
@@ -20,14 +20,12 @@
* #L%
*/
-import com.datastax.astra.client.admin.AdminOptions;
+import com.datastax.astra.client.admin.options.AdminOptions;
import com.datastax.astra.client.core.commands.CommandType;
import com.datastax.astra.client.core.options.BaseOptions;
import lombok.Setter;
import lombok.experimental.Accessors;
-import static com.datastax.astra.client.tables.Table.DEFAULT_TABLE_SERIALIZER;
-
/**
* Set of options used when creating a table
*/
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/databases/commands/options/FindEmbeddingProvidersOptions.java b/astra-db-java/src/main/java/com/datastax/astra/client/databases/commands/options/FindEmbeddingProvidersOptions.java
new file mode 100644
index 00000000..bec34db8
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/databases/commands/options/FindEmbeddingProvidersOptions.java
@@ -0,0 +1,56 @@
+package com.datastax.astra.client.databases.commands.options;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 - 2025 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.datastax.astra.client.admin.options.AdminOptions;
+import com.datastax.astra.client.core.commands.CommandType;
+import com.datastax.astra.client.core.options.BaseOptions;
+import com.datastax.astra.client.core.vectorize.SupportModelStatus;
+import lombok.Setter;
+import lombok.experimental.Accessors;
+
+@Setter
+@Accessors(fluent = true, chain = true)
+public class FindEmbeddingProvidersOptions extends BaseOptions {
+
+ /**
+ * Condition to upsert the table.
+ */
+ SupportModelStatus filterModelStatus = null;
+
+ /**
+ * Default constructor
+ */
+ public FindEmbeddingProvidersOptions() {
+ super(null, CommandType.DATABASE_ADMIN, AdminOptions.DEFAULT_SERIALIZER, null);
+ }
+
+ /**
+ * Accessor for serialization.
+ *
+ * @return
+ * accessor for serialization
+ */
+ public SupportModelStatus getFilterModelStatus() {
+ return this.filterModelStatus;
+ }
+
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/databases/commands/options/FindRerankingProvidersOptions.java b/astra-db-java/src/main/java/com/datastax/astra/client/databases/commands/options/FindRerankingProvidersOptions.java
new file mode 100644
index 00000000..05fb805d
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/databases/commands/options/FindRerankingProvidersOptions.java
@@ -0,0 +1,56 @@
+package com.datastax.astra.client.databases.commands.options;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 - 2025 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.datastax.astra.client.admin.options.AdminOptions;
+import com.datastax.astra.client.core.commands.CommandType;
+import com.datastax.astra.client.core.options.BaseOptions;
+import com.datastax.astra.client.core.vectorize.SupportModelStatus;
+import lombok.Setter;
+import lombok.experimental.Accessors;
+
+@Setter
+@Accessors(fluent = true, chain = true)
+public class FindRerankingProvidersOptions extends BaseOptions {
+
+ /**
+ * Condition to upsert the table.
+ */
+ SupportModelStatus filterModelStatus = null;
+
+ /**
+ * Default constructor
+ */
+ public FindRerankingProvidersOptions() {
+ super(null, CommandType.DATABASE_ADMIN, AdminOptions.DEFAULT_SERIALIZER, null);
+ }
+
+ /**
+ * Accessor for serialization.
+ *
+ * @return
+ * accessor for serialization
+ */
+ public SupportModelStatus getFilterModelStatus() {
+ return this.filterModelStatus;
+ }
+
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/Table.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/Table.java
index c8801114..df384ae9 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/tables/Table.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/Table.java
@@ -54,6 +54,7 @@
import com.datastax.astra.client.tables.definition.TableDefinition;
import com.datastax.astra.client.tables.definition.TableDescriptor;
import com.datastax.astra.client.tables.definition.indexes.TableIndexDescriptor;
+import com.datastax.astra.client.tables.definition.indexes.TableIndexMapTypes;
import com.datastax.astra.client.tables.definition.indexes.TableRegularIndexDefinition;
import com.datastax.astra.client.tables.definition.indexes.TableTextIndexDefinition;
import com.datastax.astra.client.tables.definition.indexes.TableVectorIndexDefinition;
@@ -322,6 +323,20 @@ public void createIndex(String idxName, String columnName) {
createIndex(idxName, new TableRegularIndexDefinition().column(columnName), null);
}
+ /**
+ * Create a simple index on the given column with no special options
+ *
+ * @param idxName
+ * name of the index
+ * @param columnName
+ * column on which is the index
+ * @param type
+ * column type for the index, used for Map columns
+ */
+ public void createIndex(String idxName, String columnName, TableIndexMapTypes type) {
+ createIndex(idxName, new TableRegularIndexDefinition().column(columnName, type), null);
+ }
+
/**
* Create a simple index on the given column with no special options
*
@@ -336,6 +351,20 @@ public void createIndex(String idxName, String columnName, CreateIndexOptions id
createIndex(idxName, new TableRegularIndexDefinition().column(columnName), idxOptions);
}
+ /**
+ * Create a simple index on the given column with no special options
+ *
+ * @param idxName
+ * name of the index
+ * @param columnName
+ * column on which is the index
+ * @param type
+ * column type for the index, used for Map columns
+ */
+ public void createIndex(String idxName, String columnName, TableIndexMapTypes type, CreateIndexOptions idxOptions) {
+ createIndex(idxName, new TableRegularIndexDefinition().column(columnName, type), idxOptions);
+ }
+
/**
* Create a new index with the given description.
*
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/AlterTableAddColumns.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/AlterTableAddColumns.java
index 648c89fe..c3e8b5e0 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/AlterTableAddColumns.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/AlterTableAddColumns.java
@@ -20,20 +20,17 @@
* #L%
*/
-import com.datastax.astra.client.core.commands.CommandType;
-import com.datastax.astra.client.tables.definition.columns.ColumnDefinition;
-import com.datastax.astra.client.tables.definition.columns.ColumnDefinitionList;
-import com.datastax.astra.client.tables.definition.columns.ColumnDefinitionMap;
-import com.datastax.astra.client.tables.definition.columns.ColumnDefinitionSet;
-import com.datastax.astra.client.tables.definition.columns.ColumnDefinitionVector;
-import com.datastax.astra.client.tables.definition.columns.ColumnTypes;
+import com.datastax.astra.client.tables.definition.columns.TableColumnDefinition;
+import com.datastax.astra.client.tables.definition.columns.TableColumnDefinitionList;
+import com.datastax.astra.client.tables.definition.columns.TableColumnDefinitionMap;
+import com.datastax.astra.client.tables.definition.columns.TableColumnDefinitionSet;
+import com.datastax.astra.client.tables.definition.columns.TableColumnDefinitionVector;
+import com.datastax.astra.client.tables.definition.columns.TableColumnTypes;
import lombok.Getter;
import lombok.Setter;
import java.util.LinkedHashMap;
-import static com.datastax.astra.client.tables.Table.DEFAULT_TABLE_SERIALIZER;
-
/**
* Represents an operation to add columns to an existing table in a database schema.
* This class implements the {@link AlterTableOperation} interface, providing functionality
@@ -64,7 +61,7 @@ public final class AlterTableAddColumns implements AlterTableOperation {
* A map of column names to their definitions.
* The map preserves the order of added columns.
*/
- LinkedHashMap columns = new LinkedHashMap<>();
+ LinkedHashMap columns = new LinkedHashMap<>();
/**
* Constructs a new {@code AlterTableAddColumns} instance.
@@ -90,19 +87,19 @@ public String getOperationName() {
* @param type the type of the column.
* @return the current instance for chaining.
*/
- public AlterTableAddColumns addColumn(String name, ColumnTypes type) {
- columns.put(name, new ColumnDefinition(type));
+ public AlterTableAddColumns addColumn(String name, TableColumnTypes type) {
+ columns.put(name, new TableColumnDefinition(type));
return this;
}
/**
- * Adds a column defined by a {@link ColumnDefinitionVector}.
+ * Adds a column defined by a {@link TableColumnDefinitionVector}.
*
* @param name the name of the column.
* @param cdv the column definition vector.
* @return the current instance for chaining.
*/
- public AlterTableAddColumns addColumnVector(String name, ColumnDefinitionVector cdv) {
+ public AlterTableAddColumns addColumnVector(String name, TableColumnDefinitionVector cdv) {
columns.put(name, cdv);
return this;
}
@@ -114,7 +111,7 @@ public AlterTableAddColumns addColumnVector(String name, ColumnDefinitionVector
* @return the current instance for chaining.
*/
public AlterTableAddColumns addColumnText(String name) {
- return addColumn(name, ColumnTypes.TEXT);
+ return addColumn(name, TableColumnTypes.TEXT);
}
/**
@@ -124,7 +121,7 @@ public AlterTableAddColumns addColumnText(String name) {
* @return the current instance for chaining.
*/
public AlterTableAddColumns addColumnInt(String name) {
- return addColumn(name, ColumnTypes.INT);
+ return addColumn(name, TableColumnTypes.INT);
}
/**
@@ -134,7 +131,7 @@ public AlterTableAddColumns addColumnInt(String name) {
* @return the current instance for chaining.
*/
public AlterTableAddColumns addColumnBoolean(String name) {
- return addColumn(name, ColumnTypes.BOOLEAN);
+ return addColumn(name, TableColumnTypes.BOOLEAN);
}
/**
@@ -144,8 +141,8 @@ public AlterTableAddColumns addColumnBoolean(String name) {
* @param valueType the type of the values in the list.
* @return the current instance for chaining.
*/
- public AlterTableAddColumns addColumnList(String name, ColumnTypes valueType) {
- columns.put(name, new ColumnDefinitionList(valueType));
+ public AlterTableAddColumns addColumnList(String name, TableColumnTypes valueType) {
+ columns.put(name, new TableColumnDefinitionList(valueType));
return this;
}
@@ -156,8 +153,8 @@ public AlterTableAddColumns addColumnList(String name, ColumnTypes valueType) {
* @param valueType the type of the values in the set.
* @return the current instance for chaining.
*/
- public AlterTableAddColumns addColumnSet(String name, ColumnTypes valueType) {
- columns.put(name, new ColumnDefinitionSet(valueType));
+ public AlterTableAddColumns addColumnSet(String name, TableColumnTypes valueType) {
+ columns.put(name, new TableColumnDefinitionSet(valueType));
return this;
}
@@ -169,8 +166,8 @@ public AlterTableAddColumns addColumnSet(String name, ColumnTypes valueType) {
* @param valueType the type of the values in the map.
* @return the current instance for chaining.
*/
- public AlterTableAddColumns addColumnMap(String name, ColumnTypes keyType, ColumnTypes valueType) {
- columns.put(name, new ColumnDefinitionMap(keyType, valueType));
+ public AlterTableAddColumns addColumnMap(String name, TableColumnTypes keyType, TableColumnTypes valueType) {
+ columns.put(name, new TableColumnDefinitionMap(keyType, valueType));
return this;
}
}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/AlterTypeAddFields.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/AlterTypeAddFields.java
new file mode 100644
index 00000000..d19be1c3
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/AlterTypeAddFields.java
@@ -0,0 +1,58 @@
+package com.datastax.astra.client.tables.commands;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.datastax.astra.client.tables.definition.types.TableUserDefinedTypeFieldDefinition;
+import com.datastax.astra.client.tables.definition.types.TableUserDefinedTypeFieldTypes;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * Represents an operation to add columns to an existing table in a database schema.
+ * This class implements the {@link AlterTableOperation} interface, providing functionality
+ * to define new columns and their types for the "alter table add" operation.
+ *
+ *
Chainable methods for building operations fluently.
+ *
+ */
+@Setter @Getter
+public final class AlterTypeAddFields extends AlterTypeOperation {
+
+ /**
+ * Constructs a new {@code AlterTableAddColumns} instance.
+ */
+ public AlterTypeAddFields() {
+ super("add");
+ }
+
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/AlterTypeOperation.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/AlterTypeOperation.java
new file mode 100644
index 00000000..1bed352a
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/AlterTypeOperation.java
@@ -0,0 +1,87 @@
+package com.datastax.astra.client.tables.commands;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.datastax.astra.internal.serdes.tables.AlterTypeOperationSerializer;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import lombok.Getter;
+
+import java.util.LinkedHashMap;
+
+/**
+ * Represents a generic operation to alter a type schema.
+ * This interface provides a contract for implementing specific schema alteration operations.
+ *
+ * Implementations of this interface must define the name of the operation.
+ *
+ *
+ * @param
+ * the type of the fields in the operation.
+ * @param
+ * the type of the operation itself, used for method chaining.
+ */
+@Getter
+@JsonSerialize(using = AlterTypeOperationSerializer.class)
+public abstract class AlterTypeOperation> {
+
+ /**
+ * The Operation name.
+ */
+ final String operationName;
+
+ /**
+ * A map of column names to their definitions.
+ * The map preserves the order of added columns.
+ */
+ LinkedHashMap fields = new LinkedHashMap<>();
+
+ /**
+ * Gets the name of the operation.
+ *
+ * @param operationName
+ * the name of the operation.
+ */
+ public AlterTypeOperation(String operationName) {
+ this.operationName = operationName;
+ }
+
+ /**
+ * Adds a column with the specified name and type to the table.
+ *
+ * @param name the name of the column.
+ * @param type the type of the column.
+ * @return the current instance for chaining.
+ */
+ @SuppressWarnings("unchecked")
+ public T addField(String name, FIELD_TYPE type) {
+ fields.put(name, type);
+ return (T) this;
+ }
+
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/AlterTypeRenameFields.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/AlterTypeRenameFields.java
new file mode 100644
index 00000000..740ebd27
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/AlterTypeRenameFields.java
@@ -0,0 +1,44 @@
+package com.datastax.astra.client.tables.commands;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.datastax.astra.client.tables.definition.types.TableUserDefinedTypeFieldDefinition;
+
+import java.util.LinkedHashMap;
+
+/**
+ * Represents an operation to rename columns in a database table.
+ * This class implements the {@link AlterTableOperation} interface,
+ * providing the functionality to return the operation name as "rename".
+ *
+ *
This operation is typically used to rename one or more columns in a table
+ * during schema alterations.
+ */
+public class AlterTypeRenameFields extends AlterTypeOperation {
+
+ /**
+ * Constructs a new {@code AlterTableAddColumns} instance.
+ */
+ public AlterTypeRenameFields() {
+ super("rename");
+ }
+
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/options/AlterTypeOptions.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/options/AlterTypeOptions.java
new file mode 100644
index 00000000..d558cef3
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/options/AlterTypeOptions.java
@@ -0,0 +1,56 @@
+package com.datastax.astra.client.tables.commands.options;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.datastax.astra.client.core.commands.CommandType;
+import com.datastax.astra.client.core.options.BaseOptions;
+import lombok.Setter;
+import lombok.experimental.Accessors;
+
+import static com.datastax.astra.client.tables.Table.DEFAULT_TABLE_SERIALIZER;
+
+/**
+ * Represents options for altering a type in a database schema.
+ * Extends {@link BaseOptions} to provide additional functionality for type alteration commands.
+ *
+ * This class supports a fluent, chainable API using the {@link Accessors} annotation.
+ *
+ */
+@Setter
+@Accessors(fluent = true, chain = true)
+public class AlterTypeOptions extends BaseOptions {
+
+ /**
+ * Constructs a new {@code AlterTypeOptions} instance with default settings.
+ * Initializes the options with {@link CommandType#TABLE_ADMIN} and the default table serializer.
+ */
+ public AlterTypeOptions() {
+ super(null, CommandType.TABLE_ADMIN, DEFAULT_TABLE_SERIALIZER, null);
+ }
+}
+
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/options/CreateTypeOptions.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/options/CreateTypeOptions.java
new file mode 100644
index 00000000..1bb5193e
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/options/CreateTypeOptions.java
@@ -0,0 +1,77 @@
+package com.datastax.astra.client.tables.commands.options;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.datastax.astra.client.core.commands.CommandType;
+import com.datastax.astra.client.core.options.BaseOptions;
+import com.datastax.astra.client.core.options.DataAPIClientOptions;
+import lombok.Setter;
+import lombok.experimental.Accessors;
+
+import static com.datastax.astra.client.tables.Table.DEFAULT_TABLE_SERIALIZER;
+
+/**
+ * Set of options used when creating a table
+ */
+@Setter
+@Accessors(fluent = true, chain = true)
+public class CreateTypeOptions extends BaseOptions {
+
+ /** Improve syntax. */
+ public static final CreateTypeOptions IF_NOT_EXISTS = new CreateTypeOptions().ifNotExists(true);
+
+ /**
+ * The keyspace to use for the database.
+ */
+ String keyspace = DataAPIClientOptions.DEFAULT_KEYSPACE;
+
+ /**
+ * Condition to upsert the table.
+ */
+ boolean ifNotExists = true;
+
+ /**
+ * Default constructor
+ */
+ public CreateTypeOptions() {
+ super(null, CommandType.TABLE_ADMIN, DEFAULT_TABLE_SERIALIZER, null);
+ }
+
+ /**
+ * Accessor for serialization.
+ *
+ * @return
+ * accessor for serialization
+ */
+ public boolean isIfNotExists() {
+ return ifNotExists;
+ }
+
+ /**
+ * Gets keyspace
+ *
+ * @return value of keyspace
+ */
+ public String getKeyspace() {
+ return keyspace;
+ }
+
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/options/DropTypeOptions.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/options/DropTypeOptions.java
new file mode 100644
index 00000000..43eeee11
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/options/DropTypeOptions.java
@@ -0,0 +1,74 @@
+package com.datastax.astra.client.tables.commands.options;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.datastax.astra.client.core.options.BaseOptions;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import lombok.Setter;
+import lombok.experimental.Accessors;
+
+import static com.datastax.astra.client.core.commands.CommandType.TABLE_ADMIN;
+import static com.datastax.astra.client.tables.Table.DEFAULT_TABLE_SERIALIZER;
+
+/**
+ * Options for dropping a table.
+ */
+@Setter
+@Accessors(fluent = true, chain = true)
+public class DropTypeOptions extends BaseOptions {
+
+ /** Improve syntax. */
+ public static final DropTypeOptions IF_EXISTS = new DropTypeOptions().ifExists(true);
+
+ private String keyspace;
+
+ /**
+ * Condition to upsert the table.
+ */
+ boolean ifExists = true;
+
+ /**
+ * Default constructor
+ */
+ public DropTypeOptions() {
+ super(null, TABLE_ADMIN, DEFAULT_TABLE_SERIALIZER, null);
+ }
+
+ /**
+ * Accessor for serialization.
+ *
+ * @return
+ * accessor for serialization
+ */
+ public boolean isIfExists() {
+ return ifExists;
+ }
+
+ /**
+ * Gets keyspace
+ *
+ * @return value of keyspace
+ */
+ @JsonIgnore
+ public String getKeyspace() {
+ return keyspace;
+ }
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/options/ListTypesOptions.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/options/ListTypesOptions.java
new file mode 100644
index 00000000..ac0059b5
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/options/ListTypesOptions.java
@@ -0,0 +1,58 @@
+package com.datastax.astra.client.tables.commands.options;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.datastax.astra.client.core.options.BaseOptions;
+import com.datastax.astra.client.core.options.DataAPIClientOptions;
+import com.datastax.astra.internal.serdes.tables.RowSerializer;
+import lombok.Setter;
+import lombok.experimental.Accessors;
+
+import static com.datastax.astra.client.core.commands.CommandType.TABLE_ADMIN;
+
+/**
+ * Options for listing tables.
+ */
+@Setter
+@Accessors(fluent = true, chain = true)
+public class ListTypesOptions extends BaseOptions {
+
+ /**
+ * The keyspace to use for the database.
+ */
+ String keyspace = DataAPIClientOptions.DEFAULT_KEYSPACE;
+
+ /**
+ * Default constructor
+ */
+ public ListTypesOptions() {
+ super(null, TABLE_ADMIN, new RowSerializer(), null);
+ }
+
+ /**
+ * Gets keyspace
+ *
+ * @return value of keyspace
+ */
+ public String getKeyspace() {
+ return keyspace;
+ }
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/results/TableInsertManyResult.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/results/TableInsertManyResult.java
index 6812be36..7245a14e 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/results/TableInsertManyResult.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/results/TableInsertManyResult.java
@@ -22,7 +22,7 @@
import com.datastax.astra.client.collections.definition.documents.Document;
-import com.datastax.astra.client.tables.definition.columns.ColumnDefinition;
+import com.datastax.astra.client.tables.definition.columns.TableColumnDefinition;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
@@ -43,7 +43,7 @@ public class TableInsertManyResult {
ArrayList> insertedIds;
/** Schema on the response. */
- LinkedHashMap primaryKeySchema;
+ LinkedHashMap primaryKeySchema;
/** Document Response with flag is there. */
List documentResponses;
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/results/TableInsertOneResult.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/results/TableInsertOneResult.java
index a913f966..1c705340 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/results/TableInsertOneResult.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/commands/results/TableInsertOneResult.java
@@ -20,7 +20,7 @@
* #L%
*/
-import com.datastax.astra.client.tables.definition.columns.ColumnDefinition;
+import com.datastax.astra.client.tables.definition.columns.TableColumnDefinition;
import com.datastax.astra.client.tables.definition.rows.Row;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -46,9 +46,9 @@ public class TableInsertOneResult {
/**
* The schema of the primary key as a map, where keys are column names and values are
- * {@link ColumnDefinition} objects describing the column details.
+ * {@link TableColumnDefinition} objects describing the column details.
*/
- private LinkedHashMap primaryKeySchema;
+ private LinkedHashMap primaryKeySchema;
/**
* No-argument constructor that initializes {@code insertedId} to an empty {@link ArrayList}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/cursor/TableFindCursor.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/cursor/TableFindCursor.java
index 560f7bbd..fef98191 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/tables/cursor/TableFindCursor.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/cursor/TableFindCursor.java
@@ -206,7 +206,7 @@ public TableFindCursor includeSortVector() {
* Fetches the next batch of documents into the buffer.
* This method handles paging, using the page state from the previous batch to fetch the next one.
*/
- public void fetchNextBatch() {
+ public void fetchNextPage() {
if (currentPage == null) {
// Searching First Page
currentPage = dataSource.findPage(filter, tableFindOptions, getRecordType());
@@ -216,6 +216,8 @@ public void fetchNextBatch() {
tableFindOptions.pageState(currentPage.getPageState().get());
currentPage = dataSource.findPage(filter, tableFindOptions, getRecordType());
buffer.addAll(currentPage.getResults());
+ } else {
+ // Error ?
}
}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/TableDefinition.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/TableDefinition.java
index 3a7663fe..a5842410 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/TableDefinition.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/TableDefinition.java
@@ -21,12 +21,12 @@
*/
import com.datastax.astra.client.core.query.Sort;
-import com.datastax.astra.client.tables.definition.columns.ColumnDefinition;
-import com.datastax.astra.client.tables.definition.columns.ColumnDefinitionList;
-import com.datastax.astra.client.tables.definition.columns.ColumnDefinitionMap;
-import com.datastax.astra.client.tables.definition.columns.ColumnDefinitionSet;
-import com.datastax.astra.client.tables.definition.columns.ColumnDefinitionVector;
-import com.datastax.astra.client.tables.definition.columns.ColumnTypes;
+import com.datastax.astra.client.tables.definition.columns.TableColumnDefinition;
+import com.datastax.astra.client.tables.definition.columns.TableColumnDefinitionList;
+import com.datastax.astra.client.tables.definition.columns.TableColumnDefinitionMap;
+import com.datastax.astra.client.tables.definition.columns.TableColumnDefinitionSet;
+import com.datastax.astra.client.tables.definition.columns.TableColumnDefinitionVector;
+import com.datastax.astra.client.tables.definition.columns.TableColumnTypes;
import com.datastax.astra.internal.serdes.tables.RowSerializer;
import com.datastax.astra.internal.utils.Assert;
import lombok.Data;
@@ -43,7 +43,7 @@ public class TableDefinition {
/**
* The columns of the table.
*/
- private LinkedHashMap columns = new LinkedHashMap<>();
+ private LinkedHashMap columns = new LinkedHashMap<>();
/**
* The primary key of the table.
@@ -64,7 +64,7 @@ public TableDefinition() {
* @return the updated {@link TableDefinition} instance
* @throws IllegalArgumentException if {@code columnName} is null
*/
- public TableDefinition addColumn(String columnName, ColumnDefinition columnDefinition) {
+ public TableDefinition addColumn(String columnName, TableColumnDefinition columnDefinition) {
Assert.notNull(columnName, "Column columnName");
columns.put(columnName, columnDefinition);
return this;
@@ -77,11 +77,21 @@ public TableDefinition addColumn(String columnName, ColumnDefinition columnDefin
* @param type the type of the column
* @return the updated {@link TableDefinition} instance
*/
- public TableDefinition addColumn(String name, ColumnTypes type) {
- columns.put(name, new ColumnDefinition(type));
+ public TableDefinition addColumn(String name, TableColumnTypes type) {
+ columns.put(name, new TableColumnDefinition(type));
return this;
}
+ /**
+ * Adds a UUID column to the table.
+ *
+ * @param name the name of the column
+ * @return the updated {@link TableDefinition} instance
+ */
+ public TableDefinition addColumnUuid(String name) {
+ return addColumn(name, TableColumnTypes.UUID);
+ }
+
/**
* Adds a text column to the table.
*
@@ -89,7 +99,7 @@ public TableDefinition addColumn(String name, ColumnTypes type) {
* @return the updated {@link TableDefinition} instance
*/
public TableDefinition addColumnText(String name) {
- return addColumn(name, ColumnTypes.TEXT);
+ return addColumn(name, TableColumnTypes.TEXT);
}
/**
@@ -99,7 +109,7 @@ public TableDefinition addColumnText(String name) {
* @return the updated {@link TableDefinition} instance
*/
public TableDefinition addColumnAscii(String name) {
- return addColumn(name, ColumnTypes.ASCII);
+ return addColumn(name, TableColumnTypes.ASCII);
}
/**
@@ -109,7 +119,7 @@ public TableDefinition addColumnAscii(String name) {
* @return the updated {@link TableDefinition} instance
*/
public TableDefinition addColumnInt(String name) {
- return addColumn(name, ColumnTypes.INT);
+ return addColumn(name, TableColumnTypes.INT);
}
/**
@@ -119,7 +129,7 @@ public TableDefinition addColumnInt(String name) {
* @return the updated {@link TableDefinition} instance
*/
public TableDefinition addColumnTimestamp(String name) {
- return addColumn(name, ColumnTypes.TIMESTAMP);
+ return addColumn(name, TableColumnTypes.TIMESTAMP);
}
/**
@@ -129,7 +139,7 @@ public TableDefinition addColumnTimestamp(String name) {
* @return the updated {@link TableDefinition} instance
*/
public TableDefinition addColumnBoolean(String name) {
- return addColumn(name, ColumnTypes.BOOLEAN);
+ return addColumn(name, TableColumnTypes.BOOLEAN);
}
/**
@@ -139,7 +149,7 @@ public TableDefinition addColumnBoolean(String name) {
* @return the updated {@link TableDefinition} instance
*/
public TableDefinition addColumnBigInt(String name) {
- return addColumn(name, ColumnTypes.BIGINT);
+ return addColumn(name, TableColumnTypes.BIGINT);
}
/**
@@ -149,7 +159,7 @@ public TableDefinition addColumnBigInt(String name) {
* @return the updated {@link TableDefinition} instance
*/
public TableDefinition addColumnBlob(String name) {
- return addColumn(name, ColumnTypes.BLOB);
+ return addColumn(name, TableColumnTypes.BLOB);
}
/**
@@ -159,8 +169,8 @@ public TableDefinition addColumnBlob(String name) {
* @param valueType the type of the elements in the list
* @return the updated {@link TableDefinition} instance
*/
- public TableDefinition addColumnList(String name, ColumnTypes valueType) {
- columns.put(name, new ColumnDefinitionList(valueType));
+ public TableDefinition addColumnList(String name, TableColumnTypes valueType) {
+ columns.put(name, new TableColumnDefinitionList(valueType));
return this;
}
@@ -171,8 +181,8 @@ public TableDefinition addColumnList(String name, ColumnTypes valueType) {
* @param valueType the type of the elements in the set
* @return the updated {@link TableDefinition} instance
*/
- public TableDefinition addColumnSet(String name, ColumnTypes valueType) {
- columns.put(name, new ColumnDefinitionSet(valueType));
+ public TableDefinition addColumnSet(String name, TableColumnTypes valueType) {
+ columns.put(name, new TableColumnDefinitionSet(valueType));
return this;
}
@@ -184,8 +194,8 @@ public TableDefinition addColumnSet(String name, ColumnTypes valueType) {
* @param valueType the type of the values in the map
* @return the updated {@link TableDefinition} instance
*/
- public TableDefinition addColumnMap(String name, ColumnTypes keyType, ColumnTypes valueType) {
- columns.put(name, new ColumnDefinitionMap(keyType, valueType));
+ public TableDefinition addColumnMap(String name, TableColumnTypes keyType, TableColumnTypes valueType) {
+ columns.put(name, new TableColumnDefinitionMap(keyType, valueType));
return this;
}
@@ -196,7 +206,7 @@ public TableDefinition addColumnMap(String name, ColumnTypes keyType, ColumnType
* @param colDefVector the definition of the vector column
* @return the updated {@link TableDefinition} instance
*/
- public TableDefinition addColumnVector(String name, ColumnDefinitionVector colDefVector) {
+ public TableDefinition addColumnVector(String name, TableColumnDefinitionVector colDefVector) {
columns.put(name, colDefVector);
return this;
}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnDefinition.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinition.java
similarity index 82%
rename from astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnDefinition.java
rename to astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinition.java
index d660ebdc..26717090 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnDefinition.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinition.java
@@ -22,9 +22,6 @@
import com.datastax.astra.internal.serdes.tables.RowSerializer;
import lombok.Data;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
/**
* Represents a column definition in a database schema.
@@ -39,8 +36,8 @@
*
*
Fields:
*
- *
{@code type} - Specifies the type of the column, represented by {@link ColumnTypes}.
- *
{@code apiSupport} - Provides API support details for the column, defined by {@link ColumnDefinitionApiSupport}.
+ *
{@code type} - Specifies the type of the column, represented by {@link TableColumnTypes}.
+ *
{@code apiSupport} - Provides API support details for the column, defined by {@link TableColumnDefinitionApiSupport}.
*
*
*
Constructors:
@@ -64,16 +61,22 @@
*
*/
@Data
-public class ColumnDefinition {
+public class TableColumnDefinition {
- private ColumnTypes type;
+ /**
+ * The type of the column.
+ */
+ private TableColumnTypes type;
- private ColumnDefinitionApiSupport apiSupport;
+ /**
+ * API support details for the column when not fully supported by the Data API.
+ */
+ private TableColumnDefinitionApiSupport apiSupport;
/**
* Default constructor.
*/
- public ColumnDefinition() {
+ public TableColumnDefinition() {
}
/**
@@ -81,7 +84,7 @@ public ColumnDefinition() {
*
* @param type the column type
*/
- public ColumnDefinition(ColumnTypes type) {
+ public TableColumnDefinition(TableColumnTypes type) {
this.type = type;
}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnDefinitionApiSupport.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinitionApiSupport.java
similarity index 95%
rename from astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnDefinitionApiSupport.java
rename to astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinitionApiSupport.java
index 18831a25..8bdcec28 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnDefinitionApiSupport.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinitionApiSupport.java
@@ -22,7 +22,6 @@
import com.datastax.astra.internal.serdes.tables.RowSerializer;
import lombok.Data;
-import lombok.NoArgsConstructor;
/**
* Represents the API support configuration for a column definition.
@@ -58,7 +57,7 @@
*
*/
@Data
-public class ColumnDefinitionApiSupport {
+public class TableColumnDefinitionApiSupport {
/**
* Specifies whether the column is included in table creation.
@@ -83,7 +82,7 @@ public class ColumnDefinitionApiSupport {
/**
* Default constructor.
*/
- public ColumnDefinitionApiSupport() {
+ public TableColumnDefinitionApiSupport() {
}
/**
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnDefinitionList.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinitionList.java
similarity index 73%
rename from astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnDefinitionList.java
rename to astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinitionList.java
index 2dc5c8a1..5f09197a 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnDefinitionList.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinitionList.java
@@ -25,9 +25,9 @@
/**
* Represents a column definition for a list type in a database schema.
- * Extends {@link ColumnDefinition} to include details about the type of elements stored in the list.
+ * Extends {@link TableColumnDefinition} to include details about the type of elements stored in the list.
*
- * This class is used to configure columns of type {@link ColumnTypes#LIST}, allowing the specification
+ * This class is used to configure columns of type {@link TableColumnTypes#LIST}, allowing the specification
* of the data type for the values stored in the list.
*
*
@@ -41,18 +41,18 @@
*/
@Getter
@Setter
-public class ColumnDefinitionList extends ColumnDefinition {
+public class TableColumnDefinitionList extends TableColumnDefinition {
/**
* The data type of the values stored in the list.
*/
- private ColumnTypes valueType;
+ private TableColumnTypes valueType;
/**
- * Constructs a new {@code ColumnDefinitionList} instance with the column type set to {@link ColumnTypes#LIST}.
+ * Constructs a new {@code ColumnDefinitionList} instance with the column type set to {@link TableColumnTypes#LIST}.
*/
- public ColumnDefinitionList() {
- super(ColumnTypes.LIST);
+ public TableColumnDefinitionList() {
+ super(TableColumnTypes.LIST);
}
/**
@@ -60,7 +60,7 @@ public ColumnDefinitionList() {
*
* @param valueType the data type of the values in the list
*/
- public ColumnDefinitionList(ColumnTypes valueType) {
+ public TableColumnDefinitionList(TableColumnTypes valueType) {
this();
this.valueType = valueType;
}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnDefinitionMap.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinitionMap.java
similarity index 79%
rename from astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnDefinitionMap.java
rename to astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinitionMap.java
index 27ccd639..a461ad48 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnDefinitionMap.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinitionMap.java
@@ -25,7 +25,7 @@
/**
* Represents a column definition for a map type in a database schema.
- * Extends {@link ColumnDefinition} to include specific details about the key and value types
+ * Extends {@link TableColumnDefinition} to include specific details about the key and value types
* for map columns.
*
* This class facilitates the configuration of map columns, allowing specification of
@@ -43,23 +43,23 @@
*/
@Getter
@Setter
-public class ColumnDefinitionMap extends ColumnDefinition {
+public class TableColumnDefinitionMap extends TableColumnDefinition {
/**
* The data type of the keys in the map.
*/
- private ColumnTypes keyType;
+ private TableColumnTypes keyType;
/**
* The data type of the values in the map.
*/
- private ColumnTypes valueType;
+ private TableColumnTypes valueType;
/**
- * Constructs a new {@code ColumnDefinitionMap} instance with the column type set to {@link ColumnTypes#MAP}.
+ * Constructs a new {@code ColumnDefinitionMap} instance with the column type set to {@link TableColumnTypes#MAP}.
*/
- public ColumnDefinitionMap() {
- super(ColumnTypes.MAP);
+ public TableColumnDefinitionMap() {
+ super(TableColumnTypes.MAP);
}
/**
@@ -68,7 +68,7 @@ public ColumnDefinitionMap() {
* @param keyType the data type of the keys in the map
* @param valueType the data type of the values in the map
*/
- public ColumnDefinitionMap(ColumnTypes keyType, ColumnTypes valueType) {
+ public TableColumnDefinitionMap(TableColumnTypes keyType, TableColumnTypes valueType) {
this();
this.keyType = keyType;
this.valueType = valueType;
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnDefinitionSet.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinitionSet.java
similarity index 74%
rename from astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnDefinitionSet.java
rename to astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinitionSet.java
index 2445ffa5..59819285 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnDefinitionSet.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinitionSet.java
@@ -25,9 +25,9 @@
/**
* Represents a column definition for a set type in a database schema.
- * Extends {@link ColumnDefinition} to include details about the type of elements stored in the set.
+ * Extends {@link TableColumnDefinition} to include details about the type of elements stored in the set.
*
- * This class is used to configure columns of type {@link ColumnTypes#SET}, allowing the specification
+ * This class is used to configure columns of type {@link TableColumnTypes#SET}, allowing the specification
* of the data type for the values stored in the set.
*
*
@@ -40,18 +40,18 @@
*
*/
@Getter @Setter
-public class ColumnDefinitionSet extends ColumnDefinition {
+public class TableColumnDefinitionSet extends TableColumnDefinition {
/**
* The data type of the values stored in the set.
*/
- private ColumnTypes valueType;
+ private TableColumnTypes valueType;
/**
- * Constructs a new {@code ColumnDefinitionSet} instance with the column type set to {@link ColumnTypes#SET}.
+ * Constructs a new {@code ColumnDefinitionSet} instance with the column type set to {@link TableColumnTypes#SET}.
*/
- public ColumnDefinitionSet() {
- super(ColumnTypes.SET);
+ public TableColumnDefinitionSet() {
+ super(TableColumnTypes.SET);
}
/**
@@ -59,7 +59,7 @@ public ColumnDefinitionSet() {
*
* @param valueType the data type of the values in the set
*/
- public ColumnDefinitionSet(ColumnTypes valueType) {
+ public TableColumnDefinitionSet(TableColumnTypes valueType) {
this();
this.valueType = valueType;
}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinitionUserDefined.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinitionUserDefined.java
new file mode 100644
index 00000000..6405e57e
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinitionUserDefined.java
@@ -0,0 +1,59 @@
+package com.datastax.astra.client.tables.definition.columns;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * Represents a column definition for a user Defined Type (UDT) in a database schema.
+ * Extends {@link TableColumnDefinition} to include details about the type of elements stored in the list.
+ *
+ * This class is used to configure columns of type {@link TableColumnTypes#USER_DEFINED}, allowing the specification
+ * of the data type for user defined values stored in the column.
+ *
+ */
+@Getter
+@Setter
+public class TableColumnDefinitionUserDefined extends TableColumnDefinition {
+
+ /**
+ * The data type of the values stored in the list.
+ */
+ private String udtName;
+
+ /**
+ * Constructs a new {@code ColumnDefinitionList} instance with the column type set to {@link TableColumnTypes#LIST}.
+ */
+ public TableColumnDefinitionUserDefined() {
+ super(TableColumnTypes.USER_DEFINED);
+ }
+
+ /**
+ * Constructs a new {@code TableColumnDefinitionUserDefined} instance with the specified value type.
+ *
+ * @param udtName the name of the user defined type (UDT)
+ */
+ public TableColumnDefinitionUserDefined(String udtName) {
+ this();
+ this.udtName = udtName;
+ }
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnDefinitionVector.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinitionVector.java
similarity index 84%
rename from astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnDefinitionVector.java
rename to astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinitionVector.java
index 3c64672b..3c5119b8 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnDefinitionVector.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnDefinitionVector.java
@@ -27,7 +27,7 @@
/**
* Represents a column definition for vector-based data.
- * Extends {@link ColumnDefinition} to include properties and methods
+ * Extends {@link TableColumnDefinition} to include properties and methods
* specific to vector data such as dimension, similarity metric, and vectorization service.
*
* This class facilitates the configuration of vector columns in a data schema.
@@ -44,7 +44,7 @@
*/
@Getter
@Setter
-public class ColumnDefinitionVector extends ColumnDefinition {
+public class TableColumnDefinitionVector extends TableColumnDefinition {
/**
* The dimension of the vector.
@@ -66,10 +66,10 @@ public class ColumnDefinitionVector extends ColumnDefinition {
/**
* Constructs a new {@code ColumnDefinitionVector} instance
- * with the column type set to {@link ColumnTypes#VECTOR}.
+ * with the column type set to {@link TableColumnTypes#VECTOR}.
*/
- public ColumnDefinitionVector() {
- super(ColumnTypes.VECTOR);
+ public TableColumnDefinitionVector() {
+ super(TableColumnTypes.VECTOR);
}
/**
@@ -78,7 +78,7 @@ public ColumnDefinitionVector() {
* @param dimension the dimension of the vector
* @return this {@code ColumnDefinitionVector} instance
*/
- public ColumnDefinitionVector dimension(int dimension) {
+ public TableColumnDefinitionVector dimension(int dimension) {
this.dimension = dimension;
return this;
}
@@ -89,7 +89,7 @@ public ColumnDefinitionVector dimension(int dimension) {
* @param m the similarity metric
* @return this {@code ColumnDefinitionVector} instance
*/
- public ColumnDefinitionVector metric(SimilarityMetric m) {
+ public TableColumnDefinitionVector metric(SimilarityMetric m) {
this.metric = m;
return this;
}
@@ -100,7 +100,7 @@ public ColumnDefinitionVector metric(SimilarityMetric m) {
* @param service the vectorization service options
* @return this {@code ColumnDefinitionVector} instance
*/
- public ColumnDefinitionVector service(VectorServiceOptions service) {
+ public TableColumnDefinitionVector service(VectorServiceOptions service) {
this.service = service;
return this;
}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnTypeMapper.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnTypeMapper.java
similarity index 53%
rename from astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnTypeMapper.java
rename to astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnTypeMapper.java
index 467989b5..7cd57bf8 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnTypeMapper.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnTypeMapper.java
@@ -21,6 +21,7 @@
*/
import com.datastax.astra.client.core.vector.DataAPIVector;
+import com.datastax.astra.client.tables.definition.types.TableDataAPIUserDefinedType;
import java.math.BigDecimal;
import java.math.BigInteger;
@@ -58,68 +59,71 @@
*
Default fallback for unsupported types: {@code UNSUPPORTED}
*
*/
-public class ColumnTypeMapper {
+public class TableColumnTypeMapper {
/**
- * A static mapping of Java classes to their corresponding {@link ColumnTypes}.
+ * A static mapping of Java classes to their corresponding {@link TableColumnTypes}.
*/
- private static final Map, ColumnTypes> typeMapping = new HashMap<>();
+ private static final Map, TableColumnTypes> typeMapping = new HashMap<>();
/**
* Static initializer block that populates the type mapping.
*/
static {
// Primitive and wrapper types
- typeMapping.put(Integer.class, ColumnTypes.INT);
- typeMapping.put(int.class, ColumnTypes.INT);
- typeMapping.put(Long.class, ColumnTypes.BIGINT);
- typeMapping.put(long.class, ColumnTypes.BIGINT);
- typeMapping.put(Double.class, ColumnTypes.DOUBLE);
- typeMapping.put(double.class, ColumnTypes.DOUBLE);
- typeMapping.put(Float.class, ColumnTypes.FLOAT);
- typeMapping.put(float.class, ColumnTypes.FLOAT);
- typeMapping.put(Boolean.class, ColumnTypes.BOOLEAN);
- typeMapping.put(boolean.class, ColumnTypes.BOOLEAN);
- typeMapping.put(Byte.class, ColumnTypes.TINYINT);
- typeMapping.put(byte.class, ColumnTypes.TINYINT);
- typeMapping.put(Short.class, ColumnTypes.SMALLINT);
- typeMapping.put(short.class, ColumnTypes.SMALLINT);
+ typeMapping.put(Integer.class, TableColumnTypes.INT);
+ typeMapping.put(int.class, TableColumnTypes.INT);
+ typeMapping.put(Long.class, TableColumnTypes.BIGINT);
+ typeMapping.put(long.class, TableColumnTypes.BIGINT);
+ typeMapping.put(Double.class, TableColumnTypes.DOUBLE);
+ typeMapping.put(double.class, TableColumnTypes.DOUBLE);
+ typeMapping.put(Float.class, TableColumnTypes.FLOAT);
+ typeMapping.put(float.class, TableColumnTypes.FLOAT);
+ typeMapping.put(Boolean.class, TableColumnTypes.BOOLEAN);
+ typeMapping.put(boolean.class, TableColumnTypes.BOOLEAN);
+ typeMapping.put(Byte.class, TableColumnTypes.TINYINT);
+ typeMapping.put(byte.class, TableColumnTypes.TINYINT);
+ typeMapping.put(Short.class, TableColumnTypes.SMALLINT);
+ typeMapping.put(short.class, TableColumnTypes.SMALLINT);
// Commonly used Java types
- typeMapping.put(String.class, ColumnTypes.TEXT);
- typeMapping.put(UUID.class, ColumnTypes.UUID);
- typeMapping.put(BigDecimal.class, ColumnTypes.DECIMAL);
- typeMapping.put(BigInteger.class, ColumnTypes.VARINT);
- typeMapping.put(InetAddress.class, ColumnTypes.INET);
+ typeMapping.put(String.class, TableColumnTypes.TEXT);
+ typeMapping.put(UUID.class, TableColumnTypes.UUID);
+ typeMapping.put(BigDecimal.class, TableColumnTypes.DECIMAL);
+ typeMapping.put(BigInteger.class, TableColumnTypes.VARINT);
+ typeMapping.put(InetAddress.class, TableColumnTypes.INET);
// Date and time types
- typeMapping.put(Instant.class, ColumnTypes.TIMESTAMP);
- typeMapping.put(LocalDate.class, ColumnTypes.DATE);
- typeMapping.put(LocalTime.class, ColumnTypes.TIME);
+ typeMapping.put(Instant.class, TableColumnTypes.TIMESTAMP);
+ typeMapping.put(LocalDate.class, TableColumnTypes.DATE);
+ typeMapping.put(LocalTime.class, TableColumnTypes.TIME);
// Collection types
- typeMapping.put(List.class, ColumnTypes.LIST);
- typeMapping.put(Set.class, ColumnTypes.SET);
- typeMapping.put(Map.class, ColumnTypes.MAP);
- typeMapping.put(DataAPIVector.class, ColumnTypes.VECTOR);
+ typeMapping.put(List.class, TableColumnTypes.LIST);
+ typeMapping.put(Set.class, TableColumnTypes.SET);
+ typeMapping.put(Map.class, TableColumnTypes.MAP);
+ typeMapping.put(DataAPIVector.class, TableColumnTypes.VECTOR);
+
+ // Generic User Defined Types (UDTs)
+ typeMapping.put(TableDataAPIUserDefinedType.class, TableColumnTypes.USER_DEFINED);
// Unsupported or undefined types
- typeMapping.put(Object.class, ColumnTypes.UNSUPPORTED);
+ typeMapping.put(Object.class, TableColumnTypes.UNSUPPORTED);
}
/**
* Private constructor to prevent instantiation.
*/
- private ColumnTypeMapper() {}
+ private TableColumnTypeMapper() {}
/**
* Retrieves the Cassandra column type corresponding to the given Java class.
* If the type is not explicitly mapped, {@code ColumnTypes.UNSUPPORTED} is returned.
*
* @param clazz the Java class to map
- * @return the corresponding {@link ColumnTypes}, or {@code UNSUPPORTED} if the type is not mapped
+ * @return the corresponding {@link TableColumnTypes}, or {@code UNSUPPORTED} if the type is not mapped
*/
- public static ColumnTypes getColumnType(Class> clazz) {
- return typeMapping.getOrDefault(clazz, ColumnTypes.UNSUPPORTED);
+ public static TableColumnTypes getColumnType(Class> clazz) {
+ return typeMapping.getOrDefault(clazz, TableColumnTypes.UNSUPPORTED);
}
}
\ No newline at end of file
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnTypes.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnTypes.java
similarity index 92%
rename from astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnTypes.java
rename to astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnTypes.java
index 5eb658cd..ba8f759f 100644
--- a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/ColumnTypes.java
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/columns/TableColumnTypes.java
@@ -38,7 +38,7 @@
*
*/
@Getter
-public enum ColumnTypes {
+public enum TableColumnTypes {
/**
* ASCII string type.
@@ -60,6 +60,11 @@ public enum ColumnTypes {
*/
BOOLEAN("boolean"),
+ /**
+ * Counter.
+ */
+ COUNTER("counter"),
+
/**
* Date type, storing only the date part without a time zone.
*/
@@ -95,6 +100,11 @@ public enum ColumnTypes {
*/
INT("int"),
+ /**
+ * JSON type, storing JSON formatted data.
+ */
+ USER_DEFINED("userDefined"),
+
/**
* List collection type.
*/
@@ -130,6 +140,11 @@ public enum ColumnTypes {
*/
TIMESTAMP("timestamp"),
+ /**
+ * TimeUUID.
+ */
+ TIMEUUID("timeuuid"),
+
/**
* 8-bit signed integer.
*/
@@ -170,7 +185,7 @@ public enum ColumnTypes {
*
* @param value the string representation of the column type
*/
- ColumnTypes(String value) {
+ TableColumnTypes(String value) {
this.value = value;
}
}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableDataAPIUserDefinedType.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableDataAPIUserDefinedType.java
new file mode 100644
index 00000000..c6b6f213
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableDataAPIUserDefinedType.java
@@ -0,0 +1,33 @@
+package com.datastax.astra.client.tables.definition.types;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 - 2025 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import java.io.Serializable;
+
+/**
+ * Represents a user-defined type (UDT) in the Data API.
+ * This class is a placeholder for user-defined types and can be extended
+ * to include specific fields and methods as needed.
+ *
+ * @param the type of the user-defined type
+ */
+public class TableDataAPIUserDefinedType implements Serializable {
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedType.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedType.java
new file mode 100644
index 00000000..5de8103e
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedType.java
@@ -0,0 +1,40 @@
+package com.datastax.astra.client.tables.definition.types;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * EntityType annotation to define a user-defined type (UDT) in the context of mapping.
+ */
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface TableUserDefinedType {
+
+ /**
+ * Table Name, if not provided the class name will be used
+ * @return the table name
+ */
+ String value() default "";
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeDefinition.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeDefinition.java
new file mode 100644
index 00000000..931af90c
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeDefinition.java
@@ -0,0 +1,203 @@
+package com.datastax.astra.client.tables.definition.types;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.datastax.astra.internal.utils.Assert;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.Data;
+
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+
+/**
+ * Definition of a User-Defined Type (UDT) in Cassandra.
+ */
+@Data
+//@JsonSerialize(using = UdtDefinitionSerializer.class)
+public class TableUserDefinedTypeDefinition {
+
+ /**
+ * The columns of the table.
+ */
+ private LinkedHashMap fields = new LinkedHashMap<>();
+
+ /**
+ * Default constructor.
+ */
+ public TableUserDefinedTypeDefinition() {
+ }
+
+ /**
+ * Adds a column to the table definition.
+ *
+ * @param fieldName the name of the column
+ * @param fieldDefinition the definition of the field
+ * @return the updated {@link TableUserDefinedTypeDefinition} instance
+ * @throws IllegalArgumentException if {@code columnName} is null
+ */
+ public TableUserDefinedTypeDefinition addField(String fieldName, TableUserDefinedTypeFieldDefinition fieldDefinition) {
+ Assert.notNull(fieldName, "Column columnName");
+ fields.put(fieldName, fieldDefinition);
+ return this;
+ }
+
+ /**
+ * Adds a column to the table with a specific type.
+ *
+ * @param name the name of the column
+ * @param type the type of the column
+ * @return the updated {@link TableUserDefinedTypeDefinition} instance
+ */
+ public TableUserDefinedTypeDefinition addField(String name, TableUserDefinedTypeFieldTypes type) {
+ fields.put(name, new TableUserDefinedTypeFieldDefinition(type));
+ return this;
+ }
+
+ /**
+ * Adds a UUID column to the table.
+ *
+ * @param name the name of the column
+ * @return the updated {@link TableUserDefinedTypeDefinition} instance
+ */
+ public TableUserDefinedTypeDefinition addFieldUuid(String name) {
+ return addField(name, TableUserDefinedTypeFieldTypes.UUID);
+ }
+
+ /**
+ * Adds a text column to the table.
+ *
+ * @param name the name of the column
+ * @return the updated {@link TableUserDefinedTypeDefinition} instance
+ */
+ public TableUserDefinedTypeDefinition addFieldText(String name) {
+ return addField(name, TableUserDefinedTypeFieldTypes.TEXT);
+ }
+
+ /**
+ * Adds an ascii column to the table.
+ *
+ * @param name the name of the column
+ * @return the updated {@link TableUserDefinedTypeDefinition} instance
+ */
+ public TableUserDefinedTypeDefinition addFieldAscii(String name) {
+ return addField(name, TableUserDefinedTypeFieldTypes.ASCII);
+ }
+
+ /**
+ * Adds an integer column to the table.
+ *
+ * @param name the name of the column
+ * @return the updated {@link TableUserDefinedTypeDefinition} instance
+ */
+ public TableUserDefinedTypeDefinition addFieldInt(String name) {
+ return addField(name, TableUserDefinedTypeFieldTypes.INT);
+ }
+
+ /**
+ * Adds a timestamp column to the table.
+ *
+ * @param name the name of the column
+ * @return the updated {@link TableUserDefinedTypeDefinition} instance
+ */
+ public TableUserDefinedTypeDefinition addFieldTimestamp(String name) {
+ return addField(name, TableUserDefinedTypeFieldTypes.TIMESTAMP);
+ }
+
+ /**
+ * Adds a boolean column to the table.
+ *
+ * @param name the name of the column
+ * @return the updated {@link TableUserDefinedTypeDefinition} instance
+ */
+ public TableUserDefinedTypeDefinition addFieldBoolean(String name) {
+ return addField(name, TableUserDefinedTypeFieldTypes.BOOLEAN);
+ }
+
+ /**
+ * Adds a boolean column to the table.
+ *
+ * @param name the name of the column
+ * @return the updated {@link TableUserDefinedTypeDefinition} instance
+ */
+ public TableUserDefinedTypeDefinition addFieldBigInt(String name) {
+ return addField(name, TableUserDefinedTypeFieldTypes.BIGINT);
+ }
+
+ /**
+ * Adds a blob column to the table.
+ *
+ * @param name the name of the column
+ * @return the updated {@link TableUserDefinedTypeDefinition} instance
+ */
+ public TableUserDefinedTypeDefinition addFieldBlob(String name) {
+ return addField(name, TableUserDefinedTypeFieldTypes.BLOB);
+ }
+
+// /**
+// * Adds a list column to the table.
+// *
+// * @param name the name of the column
+// * @param valueType the type of the elements in the list
+// * @return the updated {@link UdtDefinition} instance
+// */
+// public UdtDefinition addFieldList(String name, UdtFieldTypes valueType) {
+// fields.put(name, new UdtFieldDefinitionList(valueType));
+// return this;
+// }
+//
+// /**
+// * Adds a set column to the table.
+// *
+// * @param name the name of the column
+// * @param valueType the type of the elements in the set
+// * @return the updated {@link UdtDefinition} instance
+// */
+// public UdtDefinition addFieldSet(String name, UdtFieldTypes valueType) {
+// fields.put(name, new UdtFieldDefinitionSet(valueType));
+// return this;
+// }
+//
+// /**
+// * Adds a map column to the table.
+// *
+// * @param name the name of the column
+// * @param keyType the type of the keys in the map
+// * @param valueType the type of the values in the map
+// * @return the updated {@link UdtDefinition} instance
+// */
+// public UdtDefinition addFieldMap(String name, UdtFieldTypes keyType, UdtFieldTypes valueType) {
+// fields.put(name, new UdtFieldDefinitionMap(keyType, valueType));
+// return this;
+// }
+
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ try {
+ return new ObjectMapper().writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+ return "TypeDefinition{" +
+ "fields=" + Arrays.toString(fields.entrySet().toArray()) +
+ '}';
+ }
+ }
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeDescriptor.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeDescriptor.java
new file mode 100644
index 00000000..ff3eb577
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeDescriptor.java
@@ -0,0 +1,85 @@
+package com.datastax.astra.client.tables.definition.types;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.datastax.astra.client.tables.definition.TableDefinition;
+import com.datastax.astra.internal.serdes.tables.RowSerializer;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * Represents the User Defined Type definition with its name and metadata.
+ */
+@Getter @Setter
+public class TableUserDefinedTypeDescriptor {
+
+ /**
+ * Name of the table.
+ */
+ private String name;
+
+ /**
+ * Options for the table.
+ */
+ private TableUserDefinedTypeDefinition definition;
+
+ /**
+ * Default constructor.
+ */
+ public TableUserDefinedTypeDescriptor() {
+ // left blank, serialization with jackson
+ }
+
+ /**
+ * Default constructor.
+ * @param name the name of the table
+ */
+ public TableUserDefinedTypeDescriptor(String name) {
+ // left blank, serialization with jackson
+ this.name = name;
+ }
+
+ /**
+ * Set the name of the table.
+ * @param name the name of the table
+ * @return the descriptor
+ */
+ public TableUserDefinedTypeDescriptor name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * Set the definition of the table.
+ * @param def the definition of the table
+ * @return the descriptor
+ */
+ public TableUserDefinedTypeDescriptor definition(TableUserDefinedTypeDefinition def) {
+ this.definition = def;
+ return this;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return new RowSerializer().marshall(this);
+ }
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeField.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeField.java
new file mode 100644
index 00000000..61b5a91c
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeField.java
@@ -0,0 +1,71 @@
+package com.datastax.astra.client.tables.definition.types;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.datastax.astra.client.tables.definition.columns.TableColumnTypes;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to define properties for a udt field. This annotation can be used on fields
+ * to specify custom column names, types, and additional properties.
+ *
+ *
The {@code Column} annotation provides flexibility for mapping fields to database columns,
+ * with options to customize column name, type, and other attributes.
+ */
+@Target({ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface TableUserDefinedTypeField {
+
+ /**
+ * Specifies the name of the column. If not provided, the field's name will be used.
+ *
+ * @return the custom column name or an empty string if not set
+ */
+ String name();
+
+ /**
+ * Specifies the type of the column. If not provided, the field's type will be used.
+ *
+ * @return the column type or {@link TableColumnTypes#UNDEFINED} if not set
+ */
+ TableUserDefinedTypeFieldTypes type() default TableUserDefinedTypeFieldTypes.UNDEFINED;
+
+ /**
+ * Specifies the value type of the column, typically used for complex data structures.
+ * If not provided, defaults to {@link TableColumnTypes#UNDEFINED}.
+ *
+ * @return the value type or {@link TableColumnTypes#UNDEFINED} if not set
+ */
+ TableUserDefinedTypeFieldTypes valueType() default TableUserDefinedTypeFieldTypes.UNDEFINED;
+
+ /**
+ * Specifies the key type of the column, typically used for mapping keys in key-value pairs.
+ * If not provided, defaults to {@link TableColumnTypes#UNDEFINED}.
+ *
+ * @return the key type or {@link TableColumnTypes#UNDEFINED} if not set
+ */
+ TableUserDefinedTypeFieldTypes keyType() default TableUserDefinedTypeFieldTypes.UNDEFINED;
+
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeFieldDefinition.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeFieldDefinition.java
new file mode 100644
index 00000000..afb68dd0
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeFieldDefinition.java
@@ -0,0 +1,99 @@
+package com.datastax.astra.client.tables.definition.types;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.datastax.astra.client.tables.definition.columns.TableColumnDefinitionApiSupport;
+import com.datastax.astra.client.tables.definition.columns.TableColumnTypes;
+import com.datastax.astra.internal.serdes.tables.RowSerializer;
+import lombok.Data;
+
+/**
+ * Represents a column definition in a database schema.
+ *
+ * This class encapsulates the type of the column and its associated API support
+ * configurations, providing a structure for managing column-specific details.
+ *
+ *
+ * The class uses Lombok annotations to automatically generate getter, setter, and
+ * no-argument constructor methods.
+ *
+ *
+ *
Fields:
+ *
+ *
{@code type} - Specifies the type of the column, represented by {@link TableColumnTypes}.
+ *
{@code apiSupport} - Provides API support details for the column, defined by {@link TableColumnDefinitionApiSupport}.
+ *
+ *
+ *
Constructors:
+ *
+ *
A no-argument constructor for creating a default instance of the class.
+ *
A parameterized constructor for initializing the column definition with a specified type.
+ */
+@Data
+public class TableUserDefinedTypeFieldDefinition {
+
+ /**
+ * The type of the column.
+ */
+ private TableUserDefinedTypeFieldTypes type;
+
+ /**
+ * API support details for the column when not fully supported by the Data API.
+ */
+ private TableColumnDefinitionApiSupport apiSupport;
+
+ /**
+ * Default constructor.
+ */
+ public TableUserDefinedTypeFieldDefinition() {
+ }
+
+ /**
+ * Constructor with type.
+ *
+ * @param type the column type
+ */
+ public TableUserDefinedTypeFieldDefinition(TableUserDefinedTypeFieldTypes type) {
+ this.type = type;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return new RowSerializer().marshall(this);
+ }
+
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeFieldDefinitionList.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeFieldDefinitionList.java
new file mode 100644
index 00000000..57a29463
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeFieldDefinitionList.java
@@ -0,0 +1,69 @@
+package com.datastax.astra.client.tables.definition.types;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.datastax.astra.client.tables.definition.columns.TableColumnDefinition;
+import com.datastax.astra.client.tables.definition.columns.TableColumnTypes;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * Represents a column definition for a list type in a database schema.
+ * Extends {@link TableColumnDefinition} to include details about the type of elements stored in the list.
+ *
+ * This class is used to configure columns of type {@link TableColumnTypes#LIST}, allowing the specification
+ * of the data type for the values stored in the list.
+ *
+ */
+@Getter
+@Setter
+public class TableUserDefinedTypeFieldDefinitionList extends TableUserDefinedTypeFieldDefinition {
+
+ /**
+ * The data type of the values stored in the list.
+ */
+ private TableUserDefinedTypeFieldTypes valueType;
+
+ /**
+ * Constructs a new {@code ColumnDefinitionList} instance with the column type set to {@link TableColumnTypes#LIST}.
+ */
+ public TableUserDefinedTypeFieldDefinitionList() {
+ super(TableUserDefinedTypeFieldTypes.UNSUPPORTED);
+ }
+
+ /**
+ * Constructs a new {@code ColumnDefinitionList} instance with the specified value type.
+ *
+ * @param valueType the data type of the values in the list
+ */
+ public TableUserDefinedTypeFieldDefinitionList(TableUserDefinedTypeFieldTypes valueType) {
+ this();
+ this.valueType = valueType;
+ }
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeFieldDefinitionMap.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeFieldDefinitionMap.java
new file mode 100644
index 00000000..f556a6b6
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeFieldDefinitionMap.java
@@ -0,0 +1,78 @@
+package com.datastax.astra.client.tables.definition.types;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.datastax.astra.client.tables.definition.columns.TableColumnDefinition;
+import com.datastax.astra.client.tables.definition.columns.TableColumnTypes;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * Represents a column definition for a map type in a database schema.
+ * Extends {@link TableColumnDefinition} to include specific details about the key and value types
+ * for map columns.
+ *
+ * This class facilitates the configuration of map columns, allowing specification of
+ * the types of keys and values stored in the map.
+ *
+ */
+@Getter
+@Setter
+public class TableUserDefinedTypeFieldDefinitionMap extends TableUserDefinedTypeFieldDefinition {
+
+ /**
+ * The data type of the keys in the map.
+ */
+ private TableUserDefinedTypeFieldTypes keyType;
+
+ /**
+ * The data type of the values in the map.
+ */
+ private TableUserDefinedTypeFieldTypes valueType;
+
+ /**
+ * Constructs a new {@code ColumnDefinitionMap} instance with the column type set to {@link TableColumnTypes#MAP}.
+ */
+ public TableUserDefinedTypeFieldDefinitionMap() {
+ super(TableUserDefinedTypeFieldTypes.UNSUPPORTED);
+ }
+
+ /**
+ * Constructs a new {@code ColumnDefinitionMap} instance with the specified key and value types.
+ *
+ * @param keyType the data type of the keys in the map
+ * @param valueType the data type of the values in the map
+ */
+ public TableUserDefinedTypeFieldDefinitionMap(TableUserDefinedTypeFieldTypes keyType, TableUserDefinedTypeFieldTypes valueType) {
+ this();
+ this.keyType = keyType;
+ this.valueType = valueType;
+ }
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeFieldDefinitionSet.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeFieldDefinitionSet.java
new file mode 100644
index 00000000..7003b826
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeFieldDefinitionSet.java
@@ -0,0 +1,68 @@
+package com.datastax.astra.client.tables.definition.types;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.datastax.astra.client.tables.definition.columns.TableColumnDefinition;
+import com.datastax.astra.client.tables.definition.columns.TableColumnTypes;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * Represents a column definition for a set type in a database schema.
+ * Extends {@link TableColumnDefinition} to include details about the type of elements stored in the set.
+ *
+ * This class is used to configure columns of type {@link TableColumnTypes#SET}, allowing the specification
+ * of the data type for the values stored in the set.
+ *
+ */
+@Getter @Setter
+public class TableUserDefinedTypeFieldDefinitionSet extends TableUserDefinedTypeFieldDefinition {
+
+ /**
+ * The data type of the values stored in the set.
+ */
+ private TableUserDefinedTypeFieldTypes valueType;
+
+ /**
+ * Constructs a new {@code ColumnDefinitionSet} instance with the column type set to {@link TableColumnTypes#SET}.
+ */
+ public TableUserDefinedTypeFieldDefinitionSet() {
+ super(TableUserDefinedTypeFieldTypes.UNSUPPORTED);
+ }
+
+ /**
+ * Constructs a new {@code ColumnDefinitionSet} instance with the specified value type.
+ *
+ * @param valueType the data type of the values in the set
+ */
+ public TableUserDefinedTypeFieldDefinitionSet(TableUserDefinedTypeFieldTypes valueType) {
+ this();
+ this.valueType = valueType;
+ }
+}
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeFieldTypeMapper.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeFieldTypeMapper.java
new file mode 100644
index 00000000..2fb569e9
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeFieldTypeMapper.java
@@ -0,0 +1,122 @@
+package com.datastax.astra.client.tables.definition.types;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.datastax.astra.client.tables.definition.columns.TableColumnTypes;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.InetAddress;
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.LocalTime;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * Maps Java types to corresponding Cassandra column types.
+ *
+ * The {@code ColumnTypeMapper} provides a utility method to determine the appropriate
+ * Cassandra column type for a given Java class. Commonly used Java types, such as
+ * primitives, wrapper types, collections, and date/time classes, are mapped to their
+ * respective Cassandra types.
+ *
Date and time types (e.g., {@code LocalDate -> DATE}, {@code Instant -> TIMESTAMP})
+ *
Collection types (e.g., {@code List -> LIST}, {@code Set -> SET}, {@code Map -> MAP})
+ *
Default fallback for unsupported types: {@code UNSUPPORTED}
+ *
+ */
+public class TableUserDefinedTypeFieldTypeMapper {
+
+ /**
+ * A static mapping of Java classes to their corresponding {@link TableColumnTypes}.
+ */
+ private static final Map, TableUserDefinedTypeFieldTypes> typeMapping = new HashMap<>();
+
+ /**
+ * Static initializer block that populates the type mapping.
+ */
+ static {
+ // Primitive and wrapper types
+ typeMapping.put(Integer.class, TableUserDefinedTypeFieldTypes.INT);
+ typeMapping.put(int.class, TableUserDefinedTypeFieldTypes.INT);
+ typeMapping.put(Long.class, TableUserDefinedTypeFieldTypes.BIGINT);
+ typeMapping.put(long.class, TableUserDefinedTypeFieldTypes.BIGINT);
+ typeMapping.put(Double.class, TableUserDefinedTypeFieldTypes.DOUBLE);
+ typeMapping.put(double.class, TableUserDefinedTypeFieldTypes.DOUBLE);
+ typeMapping.put(Float.class, TableUserDefinedTypeFieldTypes.FLOAT);
+ typeMapping.put(float.class, TableUserDefinedTypeFieldTypes.FLOAT);
+ typeMapping.put(Boolean.class, TableUserDefinedTypeFieldTypes.BOOLEAN);
+ typeMapping.put(boolean.class, TableUserDefinedTypeFieldTypes.BOOLEAN);
+ typeMapping.put(Byte.class, TableUserDefinedTypeFieldTypes.TINYINT);
+ typeMapping.put(byte.class, TableUserDefinedTypeFieldTypes.TINYINT);
+ typeMapping.put(Short.class, TableUserDefinedTypeFieldTypes.SMALLINT);
+ typeMapping.put(short.class, TableUserDefinedTypeFieldTypes.SMALLINT);
+
+ // Commonly used Java types
+ typeMapping.put(String.class, TableUserDefinedTypeFieldTypes.TEXT);
+ typeMapping.put(UUID.class, TableUserDefinedTypeFieldTypes.UUID);
+ typeMapping.put(BigDecimal.class, TableUserDefinedTypeFieldTypes.DECIMAL);
+ typeMapping.put(BigInteger.class, TableUserDefinedTypeFieldTypes.VARINT);
+ typeMapping.put(InetAddress.class, TableUserDefinedTypeFieldTypes.INET);
+
+ // Date and time types
+ typeMapping.put(Instant.class, TableUserDefinedTypeFieldTypes.TIMESTAMP);
+ typeMapping.put(LocalDate.class, TableUserDefinedTypeFieldTypes.DATE);
+ typeMapping.put(LocalTime.class, TableUserDefinedTypeFieldTypes.TIME);
+
+ // Collection types
+// typeMapping.put(List.class, UdtFieldTypes.LIST);
+// typeMapping.put(Set.class, UdtFieldTypes.SET);
+// typeMapping.put(Map.class, UdtFieldTypes.MAP);
+
+ // Unsupported or undefined types
+ typeMapping.put(Object.class, TableUserDefinedTypeFieldTypes.UNSUPPORTED);
+ }
+
+ /**
+ * Private constructor to prevent instantiation.
+ */
+ private TableUserDefinedTypeFieldTypeMapper() {}
+
+ /**
+ * Retrieves the Cassandra column type corresponding to the given Java class.
+ * If the type is not explicitly mapped, {@code ColumnTypes.UNSUPPORTED} is returned.
+ *
+ * @param clazz the Java class to map
+ * @return the corresponding {@link TableColumnTypes}, or {@code UNSUPPORTED} if the type is not mapped
+ */
+ public static TableUserDefinedTypeFieldTypes getUdtFieldType(Class> clazz) {
+ return typeMapping.getOrDefault(clazz, TableUserDefinedTypeFieldTypes.UNSUPPORTED);
+ }
+}
\ No newline at end of file
diff --git a/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeFieldTypes.java b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeFieldTypes.java
new file mode 100644
index 00000000..b80db695
--- /dev/null
+++ b/astra-db-java/src/main/java/com/datastax/astra/client/tables/definition/types/TableUserDefinedTypeFieldTypes.java
@@ -0,0 +1,183 @@
+package com.datastax.astra.client.tables.definition.types;
+
+/*-
+ * #%L
+ * Data API Java Client
+ * --
+ * Copyright (C) 2024 DataStax
+ * --
+ * Licensed under the Apache License, Version 2.0
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.datastax.astra.internal.serdes.tables.UdtFieldTypeDeserializer;
+import com.datastax.astra.internal.serdes.tables.UdtFieldTypeSerializer;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import lombok.Getter;
+
+/**
+ * Represents the various column types supported in a database schema.
+ * Each column type is associated with a string representation.
+ *
+ * This enum includes common types like {@code TEXT}, {@code INT}, and {@code UUID},
+ * as well as specialized types such as {@code VECTOR} and {@code UNSUPPORTED}.
+ *