Skip to content

Update 2.0 Branch #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 72 commits into from
Apr 4, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
242fa57
Update dependent job name
msmygit Nov 21, 2024
040d39f
Merge pull request #30 from datastax/2.0-beta
clun Nov 30, 2024
086aa17
Merge pull request #31 from datastax/2.0-beta
clun Nov 30, 2024
f0c9d0a
reducing to 1838474 warnings
clun Nov 30, 2024
de15941
less warnings
clun Nov 30, 2024
edda748
Add a getTable sample + options
clun Dec 2, 2024
521379a
javadoc
clun Dec 2, 2024
8889da7
Fixing Build
clun Dec 2, 2024
4da67b0
add sample
clun Dec 2, 2024
3ed6293
sample
clun Dec 2, 2024
43931f9
update list tables
clun Dec 3, 2024
4fbb79b
update list tables
clun Dec 3, 2024
163f010
Add Sample + simple syntax for creste index
clun Dec 3, 2024
395f50f
list indexes
clun Dec 3, 2024
b6206e6
Allow operations from the on other keyspace
clun Dec 3, 2024
b0a0eca
update examples
clun Dec 3, 2024
6bc862b
Fix #32: remove accidental debug System.out.println()
tatu-at-datastax Dec 3, 2024
ab80aec
update examples
clun Dec 4, 2024
3f8361e
Merge pull request #34 from tatu-at-datastax/main
clun Dec 4, 2024
98e9de3
update examples
clun Dec 4, 2024
e789bfa
update examples
clun Dec 4, 2024
e39a405
update examples
clun Dec 4, 2024
7e1039b
add samples
clun Dec 4, 2024
38d60ba
Mapping Row=> Bean and deserialization
clun Dec 5, 2024
2386880
Mapping Row=> Bean and deserialization
clun Dec 5, 2024
de5bf9a
double typing cursor and specialization
clun Dec 5, 2024
91ba89c
double typing cursor and specialization
clun Dec 5, 2024
0fa781c
double typing cursor and specialization
clun Dec 5, 2024
acaf500
double typing cursor and specialization
clun Dec 5, 2024
241b110
samples for updateOne
clun Dec 5, 2024
ce35c3c
samples for updateOne
clun Dec 5, 2024
143a3a4
update
clun Dec 6, 2024
6a1eef6
Samples for DataAPIVector
clun Dec 6, 2024
49557db
javadocs, javadoc, javadoc
clun Dec 7, 2024
b366490
javadocs, javadoc, javadoc
clun Dec 7, 2024
c08267d
javadocs, javadoc, javadoc...46 to go
clun Dec 7, 2024
05af2bc
javadocs, javadoc, javadoc...28 to go
clun Dec 8, 2024
97c8ce0
Fix all warnings, javadocs and compiling issue
clun Dec 9, 2024
a5dfb11
fixes
clun Dec 9, 2024
b6db3d5
[maven-release-plugin] prepare release 2.0.0-PREVIEW
clun Dec 9, 2024
9e4539c
[maven-release-plugin] prepare for next development iteration
clun Dec 9, 2024
eac62bc
[maven-release-plugin] rollback the release of 2.0.0-PREVIEW
clun Dec 9, 2024
8a52aca
removing samples and tools from the build
clun Dec 9, 2024
e0d900e
[maven-release-plugin] prepare release 2.0.0-PREVIEW
clun Dec 9, 2024
b433672
[maven-release-plugin] prepare for next development iteration
clun Dec 9, 2024
e2f3482
Split the controls to avoid NPE
clun Dec 9, 2024
02716eb
fixing #35 and aligning version
clun Dec 9, 2024
ecd471f
Remove Sort from deleteOne
clun Dec 10, 2024
15c5e86
Adding controls on serializations
clun Dec 10, 2024
78c7aea
update samples
clun Dec 10, 2024
5233a1c
Adjust the Java dist version to 17 by default
msmygit Jan 6, 2025
0cd195a
test
clun Jan 28, 2025
76fcffd
tmp update cursor and document dot notation
clun Jan 29, 2025
fb1791a
Changing collection to cursor, iprove distinct, fix getSortVector, ad…
clun Jan 30, 2025
762fb0c
remove secret
clun Jan 30, 2025
4dd9849
fix error on update
clun Jan 30, 2025
f606652
fix error on update
clun Jan 30, 2025
fda3b58
ok
clun Feb 11, 2025
52c3cef
update
clun Feb 11, 2025
6dd92a4
[maven-release-plugin] prepare release 2.0.0-PREVIEW1
clun Feb 11, 2025
46a7129
[maven-release-plugin] prepare for next development iteration
clun Feb 11, 2025
266b0a5
push the json loader to the repo
clun Mar 5, 2025
856867a
removing CRTP
clun Mar 7, 2025
d91d707
FindAndRerank
clun Mar 11, 2025
9548ffc
FindAndRerank
clun Mar 11, 2025
1daf15c
FindAndRerank
clun Mar 11, 2025
e32fb25
FindAndRerank
clun Mar 14, 2025
49d5c2e
FindAndRerank
clun Mar 14, 2025
cd00bbb
FindAndRerank
clun Mar 14, 2025
e2f2668
Update find and Rerank, start reworking the tests
clun Mar 27, 2025
c575a1f
test for BYOV
clun Mar 28, 2025
f6c8288
more test
clun Mar 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Allow operations from the on other keyspace
  • Loading branch information
clun committed Dec 3, 2024
commit b6206e61f624a76c1063cbfd9cd74260aeeee633
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* #%L
* Data API Java Client
* --
* Copyright (C) 2024 DataStax
* Copyright (C) 2024 DataStaxcc
* --
* Licensed under the Apache License, Version 2.0
* You may not use this file except in compliance with the License.
Expand Down Expand Up @@ -1165,9 +1165,8 @@ public <T> Table<T> getTable(Class<T> rowClass) {
* @param <T> the type of the row objects that the table will hold
* @param tableName the name of the table to be created; must not be null or empty
* @param tableDefinition the schema definition of the table; must not be null
* @param creatTableOptions additional options for creating the table; optional, can be null
* @param createTableOptions additional options for creating the table; optional, can be null
* @param rowClass the class representing the row type; must not be null
* @param tableOptions runtime options for interacting with the table; must not be null
* @return the created table object
* @throws IllegalArgumentException if any mandatory argument is null or invalid
*
Expand All @@ -1189,31 +1188,48 @@ public <T> Table<T> getTable(Class<T> rowClass) {
* CreateTableOptions createTableOptions =
* new CreateTableOptions().timeout(Duration.ofMillis(1000));
*
* // Optional to override spawn options
* TableOptions tableOptions =
* new TableOptions().timeout(Duration.ofMillis(1000));
*
* Table<Row> tableSimple2 = db.createTable("TABLE_SIMPLE", tableDefinition,
* Row.class, createTableOptions, tableOptions);
* Row.class, createTableOptions);
* }
* </pre>
*/
public <T> Table<T> createTable(String tableName,
TableDefinition tableDefinition,
Class<T> rowClass,
CreateTableOptions creatTableOptions,
TableOptions tableOptions) {
CreateTableOptions createTableOptions) {
hasLength(tableName, "tableName");
notNull(tableDefinition, "tableDefinition");
notNull(rowClass, "rowClass");

// We are on a different keyspace, create the table on that keyspace
if (createTableOptions != null && Utils.hasLength(createTableOptions.getKeyspace())) {
String otherKeyspace = createTableOptions.getKeyspace();
createTableOptions.keyspace(null);
return new Database(
this.rootEndpoint,
this.options.clone().keyspace(otherKeyspace))
.createTable(tableName, tableDefinition, rowClass, createTableOptions);
}

Command createTable = Command
.create("createTable")
.append("name", tableName)
.append("definition", tableDefinition);
if (creatTableOptions != null) {
createTable.append("options", creatTableOptions);
if (createTableOptions != null) {
createTable.append("options", createTableOptions);
}
runCommand(createTable, createTableOptions);

// Spawning a Table inheriting the current database options and the table options
TableOptions tableOptions = defaultTableOptions();
if (createTableOptions != null) {
if (createTableOptions.getDataAPIClientOptions() != null) {
tableOptions.dataAPIClientOptions(createTableOptions.getDataAPIClientOptions());
}
if (createTableOptions.getToken() != null) {
tableOptions.token(createTableOptions.getToken());
}
}
runCommand(createTable, tableOptions);
return getTable(tableName, rowClass, tableOptions);
}

Expand All @@ -1227,44 +1243,30 @@ public <T> Table<T> createTable(String tableName,
* @return the created table object
*/
public <T> Table<T> createTable(String tableName, TableDefinition tableDefinition, Class<T> rowClass) {
return createTable(tableName, tableDefinition, rowClass, new CreateTableOptions(), defaultTableOptions());
return createTable(tableName, tableDefinition, rowClass, null);
}

/**
* Creates a table with a default row type of {@code Row}.
* Creates a table using default options and runtime configurations.
*
* @param tableName the name of the table to be created; must not be null or empty
* @param tableDefinition the schema definition of the table; must not be null
* @return the created table object with rows of type {@code Row}
*/
public Table<Row> createTable(String tableName, TableDefinition tableDefinition) {
return createTable(tableName, tableDefinition, Row.class);
}

/**
* Creates a table using the specified row class and runtime configurations.
*
* @param <T> the type of the row objects that the table will hold
* @param tableName the name of the table to be created; must not be null or empty
* @param rowClass the class representing the row type; must not be null
* @param tableDefinition the schema definition of the table; must not be null
* @param createTableOptions additional options for creating the table; optional, can be null
* @param options the option to initialize the class.
* @return the created table object
*/
public <T> Table<T> createTable(String tableName, TableDefinition tableDefinition, Class<T> rowClass, CreateTableOptions createTableOptions) {
return createTable(tableName, tableDefinition, rowClass, createTableOptions, defaultTableOptions());
public Table<Row> createTable(String tableName, TableDefinition tableDefinition, CreateTableOptions options) {
return createTable(tableName, tableDefinition, Row.class, options);
}

/**
* Creates a table using the specified row class and runtime configurations.
* Creates a table with a default row type of {@code Row}.
*
* @param tableName the name of the table to be created; must not be null or empty
* @param createTableOptions additional options for creating the table; optional, can be null
* @param tableDefinition the schema definition of the table; must not be null
* @return the created table object
* @return the created table object with rows of type {@code Row}
*/
public Table<Row> createTable(String tableName, TableDefinition tableDefinition, CreateTableOptions createTableOptions) {
return createTable(tableName, tableDefinition, Row.class, createTableOptions);
public Table<Row> createTable(String tableName, TableDefinition tableDefinition) {
return createTable(tableName, tableDefinition, Row.class);
}

/**
Expand All @@ -1287,7 +1289,7 @@ public <T> Table<T> createTable(Class<T> rowClass) {
* @return the created table object
*/
public <T> Table<T> createTable(Class<T> rowClass, CreateTableOptions createTableOptions) {
return createTable(getTableName(rowClass), rowClass, createTableOptions, defaultTableOptions());
return createTable(getTableName(rowClass), rowClass, createTableOptions);
}

/**
Expand All @@ -1296,22 +1298,41 @@ public <T> Table<T> createTable(Class<T> rowClass, CreateTableOptions createTabl
* @param <T> the type of the row objects that the table will hold
* @param rowClass the class representing the row type; must not be null
* @param tableName the name of the table to be created; must not be null or empty
* @param tableOptions runtime options for interacting with the table; must not be null
* @param createTableOptions additional options for creating the table; optional, can be null
* @return the created table object
*/
public <T> Table<T> createTable(String tableName,
Class<T> rowClass,
CreateTableOptions createTableOptions,
TableOptions tableOptions) {
CreateTableOptions createTableOptions) {
hasLength(tableName, "tableName");
notNull(rowClass, "rowClass");
// FIX ME INVESTIGATING TO CREATE A TABLE DEFINITION OBJECT

// We are on a different keyspace, create the table on that keyspace
if (createTableOptions != null && Utils.hasLength(createTableOptions.getKeyspace())) {
String otherKeyspace = createTableOptions.getKeyspace();
createTableOptions.keyspace(null);
return new Database(
this.rootEndpoint,
this.options.clone().keyspace(otherKeyspace))
.createTable(tableName, rowClass, createTableOptions);
}

// Building from the command
Command createTable = new Command("createTable", createTableCommand(tableName, rowClass));
if (createTableOptions != null) {
createTable.append("options", createTableOptions);
}
runCommand(createTable, createTableOptions);

// Getting ready for a table
TableOptions tableOptions = defaultTableOptions();
if (createTableOptions != null) {
if (createTableOptions.getDataAPIClientOptions() != null) {
tableOptions.dataAPIClientOptions(createTableOptions.getDataAPIClientOptions());
}
if (createTableOptions.getToken() != null) {
tableOptions.token(createTableOptions.getToken());
}
}
return getTable(tableName, rowClass, tableOptions);
}

Expand Down Expand Up @@ -1391,13 +1412,25 @@ public void dropTable(String tableName) {
*/
public void dropTable(String tableName, DropTableOptions dropTableOptions) {
hasLength(tableName, "tableName");
Command dropTableCmd = Command
.create("dropTable")
.append("name", tableName);
if (dropTableOptions != null) {
dropTableCmd.withOptions(dropTableOptions);

// We are on a different keyspace, drop the table on a different keyspace
if (dropTableOptions != null && Utils.hasLength(dropTableOptions.getKeyspace())) {
String otherKeyspace = dropTableOptions.getKeyspace();
dropTableOptions.keyspace(null);
new Database(
this.rootEndpoint,
this.options.clone().keyspace(otherKeyspace))
.dropTable(tableName, dropTableOptions);
} else {
// Command on current keyspace
Command dropTableCmd = Command
.create("dropTable")
.append("name", tableName);
if (dropTableOptions != null) {
dropTableCmd.withOptions(dropTableOptions);
}
runCommand(dropTableCmd, dropTableOptions);
}
runCommand(dropTableCmd, dropTableOptions);
}
// ------------------------------------------
// ---- Drop Indexes ---
Expand All @@ -1422,13 +1455,26 @@ public void dropTableIndex(String indexName) {
* flag to drop index
*/
public void dropTableIndex(String indexName, DropTableIndexOptions dropIndexOptions) {
Command dropIndexCommand = Command
.create("dropIndex")
.append("name", indexName);
if (dropIndexOptions != null) {
dropIndexCommand.withOptions(dropIndexOptions);
Assert.hasLength(indexName, "indexName");

// We are on a different keyspace, drop the table on a different keyspace
if (dropIndexOptions != null && Utils.hasLength(dropIndexOptions.getKeyspace())) {
String otherKeyspace = dropIndexOptions.getKeyspace();
dropIndexOptions.keyspace(null);
new Database(
this.rootEndpoint,
this.options.clone().keyspace(otherKeyspace))
.dropTableIndex(indexName, dropIndexOptions);
} else {
// Command on current keyspace
Command dropIndexCommand = Command
.create("dropIndex")
.append("name", indexName);
if (dropIndexOptions != null) {
dropIndexCommand.withOptions(dropIndexOptions);
}
runCommand(dropIndexCommand, dropIndexOptions);
}
runCommand(dropIndexCommand, dropIndexOptions);
}

// ------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import com.datastax.astra.client.core.options.BaseOptions;
import com.datastax.astra.client.core.commands.CommandType;
import com.datastax.astra.client.core.options.DataAPIClientOptions;
import lombok.Setter;
import lombok.experimental.Accessors;

Expand All @@ -37,6 +38,11 @@ public class CreateTableOptions extends BaseOptions<CreateTableOptions> {
/** Improve syntax. */
public static final CreateTableOptions IF_NOT_EXISTS = new CreateTableOptions().ifNotExists(true);

/**
* The keyspace to use for the database.
*/
String keyspace = DataAPIClientOptions.DEFAULT_KEYSPACE;

/**
* Condition to upsert the table.
*/
Expand All @@ -56,4 +62,13 @@ public boolean isIfNotExists() {
return ifNotExists;
}

/**
* Gets keyspace
*
* @return value of keyspace
*/
public String getKeyspace() {
return keyspace;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

import com.datastax.astra.client.core.options.BaseOptions;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Setter;
import lombok.experimental.Accessors;

Expand All @@ -29,7 +30,7 @@

@Setter
@Accessors(fluent = true, chain = true)
public class DropTableIndexOptions extends BaseOptions<DropTableOptions> {
public class DropTableIndexOptions extends BaseOptions<DropTableIndexOptions> {

/** Improve syntax. */
public static final DropTableIndexOptions IF_EXISTS = new DropTableIndexOptions().ifExists(true);
Expand All @@ -39,6 +40,11 @@ public class DropTableIndexOptions extends BaseOptions<DropTableOptions> {
*/
boolean ifExists = true;

/**
* Keyspace where to execute this command
*/
private String keyspace;

public DropTableIndexOptions() {
super(null, TABLE_ADMIN, DEFAULT_TABLE_SERIALIZER, null);
}
Expand All @@ -53,4 +59,13 @@ public boolean isIfExists() {
return ifExists;
}

/**
* Gets keyspace
*
* @return value of keyspace
*/
@JsonIgnore
public String getKeyspace() {
return keyspace;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

import com.datastax.astra.client.core.options.BaseOptions;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Setter;
import lombok.experimental.Accessors;

Expand All @@ -34,6 +35,8 @@ public class DropTableOptions extends BaseOptions<DropTableOptions> {
/** Improve syntax. */
public static final DropTableOptions IF_EXISTS = new DropTableOptions().ifExists(true);

private String keyspace;

/**
* Condition to upsert the table.
*/
Expand All @@ -53,6 +56,13 @@ public boolean isIfExists() {
return ifExists;
}



/**
* Gets keyspace
*
* @return value of keyspace
*/
@JsonIgnore
public String getKeyspace() {
return keyspace;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public class ListTablesOptions extends BaseOptions<ListTablesOptions> {
*/
String keyspace = DataAPIClientOptions.DEFAULT_KEYSPACE;


public ListTablesOptions() {
super(null, TABLE_ADMIN, new RowSerializer(), null);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
package com.datastax.astra.internal.utils;

/*-
* #%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%
*/

/**
* Utility class for internal usage
*/
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy