Skip to content
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

Add ScalarDB Dao and related files #2417

Merged
merged 38 commits into from
Jan 31, 2025
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
753618b
Util classes for data loader
inv-jishnu Dec 4, 2024
8d39d02
Fix spotbug issue
inv-jishnu Dec 4, 2024
bf94c49
Removed error message and added core error
inv-jishnu Dec 6, 2024
47be388
Applied spotless
inv-jishnu Dec 6, 2024
913eb1c
Fixed unit test failures
inv-jishnu Dec 6, 2024
1f204b8
Merge branch 'master' into feat/data-loader/utils
ypeckstadt Dec 11, 2024
6cfa83a
Basic data import enum and exception
inv-jishnu Dec 11, 2024
d381b2b
Removed exception class for now
inv-jishnu Dec 11, 2024
67f2474
Added DECIMAL_FORMAT
inv-jishnu Dec 12, 2024
14e3593
Path util class updated
inv-jishnu Dec 12, 2024
a096d51
Feedback changes
inv-jishnu Dec 13, 2024
dbf1940
Merge branch 'master' into feat/data-loader/utils
ypeckstadt Dec 13, 2024
cd8add9
Merge branch 'master' into feat/data-loader/utils
ypeckstadt Dec 16, 2024
52890c8
Changes
inv-jishnu Dec 16, 2024
5114639
Merge branch 'master' into feat/data-loader/import-data-1
inv-jishnu Dec 17, 2024
4f9cd75
Merge branch 'feat/data-loader/utils' into feat/data-loader/scaladb-dao
inv-jishnu Dec 17, 2024
1997eb8
Added ScalarDB Dao
inv-jishnu Dec 17, 2024
91e6310
Merge branch 'master' into feat/data-loader/scaladb-dao
inv-jishnu Dec 17, 2024
8a7338b
Remove unnecessary files
inv-jishnu Dec 17, 2024
e206073
Changes
inv-jishnu Dec 17, 2024
26d3144
Changes
inv-jishnu Dec 18, 2024
b86487d
spotbugs exclude
inv-jishnu Dec 18, 2024
818a2b4
spotbugs exclude -2
inv-jishnu Dec 18, 2024
90abd9e
Removed use of List.of to fix CI error
inv-jishnu Dec 19, 2024
ba2b3dd
Merged changes from master after resolving conflict
inv-jishnu Dec 19, 2024
03324e1
Minor change in test
inv-jishnu Dec 19, 2024
acedabe
Partial feedback changes
inv-jishnu Dec 24, 2024
67dcb06
Merge branch 'master' into feat/data-loader/scaladb-dao
ypeckstadt Jan 7, 2025
90c4830
Changes added
inv-jishnu Jan 16, 2025
39c43de
Removed scalardb manager file
inv-jishnu Jan 16, 2025
3fe30a3
Merge branch 'master' into feat/data-loader/scaladb-dao
inv-jishnu Jan 20, 2025
4df4acd
Removed wildcard import
inv-jishnu Jan 20, 2025
53cd523
Merge branch 'master' into feat/data-loader/scaladb-dao
inv-jishnu Jan 23, 2025
f4f253e
Changes
inv-jishnu Jan 28, 2025
6d43bdc
Merge branch 'master' into feat/data-loader/scaladb-dao
inv-jishnu Jan 28, 2025
e492fad
Merge branch 'master' into feat/data-loader/scaladb-dao
ypeckstadt Jan 31, 2025
7d50971
Merge branch 'master' into feat/data-loader/scaladb-dao
ypeckstadt Jan 31, 2025
94039b2
Merge branch 'master' into feat/data-loader/scaladb-dao
ypeckstadt Jan 31, 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
Changes
inv-jishnu committed Jan 28, 2025

Verified

This commit was signed with the committer’s verified signature.
theseion Max Leske
commit f4f253e67fbc3dc7ef69a353f5e28a6fac272a5b
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Optional;
import javax.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@@ -285,10 +286,10 @@ public Scanner createScanner(
public Scanner createScanner(
String namespace,
String table,
Key partitionKey,
ScanRange scanRange,
List<Scan.Ordering> sortOrders,
List<String> projectionColumns,
@Nullable Key partitionKey,
@Nullable ScanRange scanRange,
@Nullable List<Scan.Ordering> sortOrders,
@Nullable List<String> projectionColumns,
int limit,
DistributedStorage storage)
throws ScalarDBDaoException {
@@ -317,10 +318,10 @@ public Scanner createScanner(
Scan createScan(
String namespace,
String table,
Key partitionKey,
ScanRange scanRange,
List<Scan.Ordering> sortOrders,
List<String> projectionColumns,
@Nullable Key partitionKey,
@Nullable ScanRange scanRange,
@Nullable List<Scan.Ordering> sortOrders,
@Nullable List<String> projectionColumns,
int limit) {
// If no partition key is provided a scan all is created
if (partitionKey == null) {
@@ -331,9 +332,11 @@ Scan createScan(
if (projectionColumns != null && !projectionColumns.isEmpty()) {
buildableScanAll.projections(projectionColumns);
}
// Can ordering be added?
for (Scan.Ordering sort : sortOrders) {
buildableScanAll.ordering(sort);

if (sortOrders != null && !sortOrders.isEmpty()) {
for (Scan.Ordering sort : sortOrders) {
buildableScanAll.ordering(sort);
}
}

// limit
@@ -361,8 +364,10 @@ Scan createScan(
}

// clustering order
for (Scan.Ordering sort : sortOrders) {
buildableScan.ordering(sort);
if (sortOrders != null && !sortOrders.isEmpty()) {
for (Scan.Ordering sort : sortOrders) {
buildableScan.ordering(sort);
}
}

// projections
@@ -386,7 +391,8 @@ Scan createScan(
* @param clusteringKey Optional clustering key for get
* @return ScalarDB Get instance
*/
private Get createGetWith(String namespace, String table, Key partitionKey, Key clusteringKey) {
private Get createGetWith(
String namespace, String table, Key partitionKey, @Nullable Key clusteringKey) {
GetBuilder.BuildableGetWithPartitionKey buildable =
Get.newBuilder().namespace(namespace).table(table).partitionKey(partitionKey);
if (clusteringKey != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[minor] I think we can reduce the duplicated code by setting Clustering Key like this as well as createPutWith()

    Buildable buildable = ...

    if (clusteringKey != null) {
      buildable.clusteringKey(clusteringKey);
    }

@@ -409,7 +415,7 @@ private Put createPutWith(
String namespace,
String table,
Key partitionKey,
Key clusteringKey,
@Nullable Key clusteringKey,
List<Column<?>> columns) {
Buildable buildable =
Put.newBuilder().namespace(namespace).table(table).partitionKey(partitionKey);
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
import java.io.IOException;
import javax.annotation.Nullable;

public class ScalarDbStorageManger {
public class ScalarDbStorageManager {

@Nullable private final DistributedStorage storage;
private final DistributedStorageAdmin storageAdmin;
@@ -16,17 +16,17 @@ public class ScalarDbStorageManger {
*
* @param storageFactory Factory to create all the necessary ScalarDB data managers
*/
public ScalarDbStorageManger(StorageFactory storageFactory) throws IOException {
public ScalarDbStorageManager(StorageFactory storageFactory) throws IOException {
storage = storageFactory.getStorage();
storageAdmin = storageFactory.getStorageAdmin();
}

/** @return storage for ScalarDB connection that is running in storage mode */
/** Returns distributed storage for ScalarDB connection that is running in storage mode */
public DistributedStorage getDistributedStorage() {
return storage;
}

/** @return Distributed storage admin for ScalarDB admin operations */
/** Returns distributed storage admin for ScalarDB admin operations */
public DistributedStorageAdmin getDistributedStorageAdmin() {
return storageAdmin;
}
Original file line number Diff line number Diff line change
@@ -4,17 +4,17 @@
import com.scalar.db.service.TransactionFactory;
import java.io.IOException;

public class ScalarDbTransactionManger {
public class ScalarDbTransactionManager {

private final DistributedTransactionManager transactionManager;

public ScalarDbTransactionManger(TransactionFactory transactionFactory) throws IOException {
public ScalarDbTransactionManager(TransactionFactory transactionFactory) throws IOException {
transactionManager = transactionFactory.getTransactionManager();
}

/**
* @return Distributed Transaction manager for ScalarDB connection that is running in transaction
* mode
* Returns distributed Transaction manager for ScalarDB connection that is running in transaction
* mode
*/
public DistributedTransactionManager getDistributedTransactionManager() {
return transactionManager;