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 all commits
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/ci-astra-col-db-dbadmin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
java_version:
description: 'JDK version to use'
required: true
default: '11.0'
default: '17.0'
cache_pkg_mgr_name:
description: 'Cache package manager to be used'
required: true
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci-astra-dev-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
java_version:
description: 'JDK version to use'
required: true
default: '11.0'
default: '17.0'
cache_pkg_mgr_name:
description: 'Cache package manager to be used'
required: true
Expand Down Expand Up @@ -100,9 +100,9 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '11.0'
cache: 'maven'
distribution: ${{ inputs.java_distribution }}
java-version: ${{ inputs.java_version }}
cache: ${{ inputs.cache_pkg_mgr_name }}

- name: Run Maven Tests
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-astra-vectorize-bedrock-hf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
java_version:
description: 'JDK version to use'
required: true
default: '11.0'
default: '17.0'
cache_pkg_mgr_name:
description: 'Cache package manager to be used'
required: true
Expand Down
Empty file added File
Empty file.
Empty file added Preferences...
Empty file.
58 changes: 0 additions & 58 deletions RELEASE.MD
Original file line number Diff line number Diff line change
Expand Up @@ -15,64 +15,6 @@ docker-compose -f ./docker-compose-dse.yml up -d
docker run -it --rm --network container:$(docker ps | grep dse | cut -b 1-12) cassandra:latest cqlsh -u cassandra -p cassandra
```


```sql
insert into default_keyspace.table_all_returns (
p_ascii,
p_bigint,
p_blob,
p_boolean,
p_date,
p_decimal,
p_double,
p_double_minf,
p_double_pinf,
p_duration,
p_float,
p_float_nan,
p_inet,
p_int,
p_smallint,
p_text,
p_text_nulled,
p_time,
p_timestamp,
p_tinyint,
p_uuid,
p_varint,
p_vector,
p_list_int,
// p_map_text_int,
p_set_int
) values (
'abc',
10000,
0xabcdef0123456789,
true,
'2015-05-03',
123.45,
987.6543,
-Infinity,
Infinity,
12h48m,
66.55,
NaN,
'12.34.56.78',
2024,
200,
'måndag',
null,
'13:30:54.234',
'2015-05-03 13:30:54.234',
104,
9c5b94b1-35ad-49bb-b118-8e8fc24abf80,
123456789,
[0.1, 0.2, 0.3],
[4, 17, 34],
// {'a': 101, 'b': 102},
{9, 81}
);
```
## Run the Test

### Prerequisites
Expand Down
Empty file added Resources
Empty file.
52 changes: 52 additions & 0 deletions TEST.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

## Run against Local HCD Instance
(_to run locally your must have the data api running locally on op of HCD or DSE_)

```bash
mvn clean test -Ptest_local
```

> **Why it works ?**
>
> - In `pom.xml` the environment variable `ASTRA_DB_JAVA_TEST_ENV` is set to `local`
> - Tests are annotated with
>
> ```java
> @EnabledIfSystemProperty(named = "ASTRA_DB_JAVA_TEST_ENV", matches = "local")
> @DisabledIfSystemProperty(named = "ASTRA_DB_JAVA_TEST_ENV", matches = "(?!local)")
> public class MyTest {
> }
> ```

- To run with IDE make sure to set the environment variable `ASTRA_DB_JAVA_TEST_ENV` to `local` in your Run configuration


## Run against Astra DEV

- `ASTRA_DB_APPLICATION_TOKEN_DEV` should be defined in your environment variables, it is not in the different POM for privacy reasons.

- To run with Maven (AWS,`eu-west-2`)

```bash
mvn clean test -Ptest_astra_dev
```

- To run with Maven on One particular region

```java
mvn clean test -Ptest_astra_dev \
-DASTRA_CLOUD_PROVIDER_DEV=GCP \
-DASTRA_CLOUD_REGION_DEV=us-central-1
```

- To run overriding also the token

```java
mvn clean test \
-Ptest_astra_dev \
-DASTRA_CLOUD_PROVIDER_DEV=GCP \
-DASTRA_CLOUD_REGION_DEV=us-central-1 \
-ASTRA_DB_APPLICATION_TOKEN_DEV=AstraCS:... \
-Dtest="com.datastax.astra.test.integration.*.*Test"
```

2 changes: 1 addition & 1 deletion tools/pom.xml → astra-db-java-tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.datastax.astra</groupId>
<artifactId>astra-db-java-parent</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>2.0.0-PREVIEW1-SNAPSHOT</version>
</parent>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.datastax.astra.tool.loader.csv;

import com.datastax.astra.client.collections.Collection;
import com.datastax.astra.client.collections.documents.Document;
import com.datastax.astra.client.collections.definition.documents.Document;
import com.opencsv.CSVReader;
import lombok.extern.slf4j.Slf4j;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.datastax.astra.tool.loader.csv;

import com.datastax.astra.client.collections.documents.Document;
import com.datastax.astra.client.collections.definition.documents.Document;

/**
* Settings for the CSV Loader
Expand All @@ -13,6 +13,6 @@ public interface CsvRowMapper {
* @param doc
* document to process
*/
Document map(Document doc) ;
Document map(Document doc);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package com.datastax.astra.tool.loader.json;

import com.datastax.astra.client.collections.Collection;
import com.datastax.astra.client.collections.definition.documents.Document;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

@Slf4j
public class JsonDocumentLoader {

/**
* Distributed import of CSV file into Astra.
*
* @throws Exception
* exception in processing CSV
*/
public static void load(String fileName, Collection<Document> collection, JsonRecordMapper processor) throws Exception {
load(fileName, JsonLoaderSettings.builder().build(), collection, processor);
}

/**
* Distributed import of CSV file into Astra.
*
* @throws Exception
* exception in processing CSV
*/
public static void load(String fileName, JsonLoaderSettings settings, Collection<Document> collection) throws Exception {
load(fileName, settings, collection, doc -> doc);
}

/**
* Distributed import of a JSON file into Astra.
*
* @param settings
* settings
* @param collection
* collection
* @param processor
* processor
* @throws Exception
* exception in processing CSV
*/
public static void load(String fileName,
JsonLoaderSettings settings,
Collection<Document> collection,
JsonRecordMapper processor)
throws Exception {
AtomicInteger counter = new AtomicInteger();
long top = System.currentTimeMillis();
// Multithreaded executor to process the CSV file
long startTime = System.currentTimeMillis();
ObjectMapper objectMapper = new ObjectMapper();
List<Document> batch = new ArrayList<>(settings.batchSize);
ExecutorService executor = Executors.newFixedThreadPool(settings.threadPoolSize);

try (JsonParser parser = new JsonFactory().createParser(new File(fileName))) {
if (parser.nextToken() != JsonToken.START_ARRAY) {
throw new RuntimeException("JSON file must contain an array at the root");
}
while (parser.nextToken() == JsonToken.START_OBJECT) {
Document doc = objectMapper.readValue(parser, Document.class);
//Document doc = new Document();
//doc.putAll();
counter.incrementAndGet();
batch.add(processor.map(doc));
if (batch.size() == settings.batchSize) {
final List<Document> batchToInsert = new ArrayList<>(batch);
log.info("Enqueuing " + batch.size() + " rows into collection...");
executor.submit(() -> collection.insertMany(batchToInsert));
batch.clear();
}
}

// Process remaining batch
if (!batch.isEmpty()) {
executor.submit(() -> collection.insertMany(batch));
}
} finally {
executor.shutdown();
log.info(counter.get() + " rows enqueued from " + collection + " in " + (System.currentTimeMillis() - startTime) + " ms");
try {
if (!executor.awaitTermination(settings.timeoutSeconds, TimeUnit.SECONDS)) {
executor.shutdownNow();
log.info(counter.get() + " rows processed in " + (System.currentTimeMillis() - startTime) + " ms");
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
executor.shutdownNow();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.datastax.astra.tool.loader.json;

import lombok.Builder;

@Builder
public class JsonLoaderSettings {

private static final int BATCH_SIZE = 20;

private static final int THREAD_POOL_SIZE = 5;

private static final int TIMEOUT = 1800;

@Builder.Default
int batchSize = BATCH_SIZE;;

@Builder.Default
int threadPoolSize = THREAD_POOL_SIZE;;

@Builder.Default
int timeoutSeconds = TIMEOUT;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.datastax.astra.tool.loader.json;

import com.datastax.astra.client.collections.definition.documents.Document;

/**
* To import a Json containing an arrray of records.
*/
public interface JsonRecordMapper {

Document map(Document jsonRecord);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.datastax.astra.tool.loader.rag;

import com.datastax.astra.client.core.query.Projection;
import com.datastax.astra.client.tables.Table;
import com.datastax.astra.client.tables.commands.options.TableFindOptions;
import com.datastax.astra.tool.loader.rag.sources.RagSource;

import java.util.UUID;

public class RagGenericTest {

public static void main(String[] args) {

String token = System.getenv("ASTRA_DB_APPLICATION_TOKEN");
UUID TEST_TENANT = UUID.fromString("00000000-0000-0000-0000-000000000000");

//Database db = DataAPIClients.astra(token).getDatabase(TEST_TENANT);
//System.out.println(db.getInfo().getName());
RagRepository repo = new RagRepository(token, "goodbards");
Table<RagSource> tableSources = repo.getTableRagSource(TEST_TENANT);

TableFindOptions options = new TableFindOptions()
.projection(Projection.include("name", "source", "location"));
tableSources.find(options).toList().forEach(System.out::println);
}


}
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