Skip to content

Commit 46ff8ac

Browse files
authored
Merge pull request #50 from blobcity/develop
1. Resolved issue with boolean values in SQL WHERE clause. 2. Improvement in thread safety for Aggregate operations on tables
2 parents 9e94d46 + be86750 commit 46ff8ac

File tree

20 files changed

+128
-28
lines changed

20 files changed

+128
-28
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
FROM blobcity/java8-ubuntu
1919

20-
ENV DB_VER=1.7.8-alpha
20+
ENV DB_VER=1.7.9-alpha
2121

2222
RUN cd / && mkdir data
2323

bean-manager/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2222
<parent>
2323
<groupId>com.blobcity.pom</groupId>
2424
<artifactId>database</artifactId>
25-
<version>1.7.8-alpha</version>
25+
<version>1.7.9-alpha</version>
2626
</parent>
2727

2828
<groupId>com.blobcity.lib</groupId>
@@ -63,7 +63,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
6363
<groupId>com.google.guava</groupId>
6464
<artifactId>guava</artifactId>
6565
<!--<version>r05</version>-->
66-
<version>22.0</version>
66+
<version>28.0-jre</version>
6767
</dependency>
6868

6969
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->

console-end-point/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2222
<parent>
2323
<groupId>com.blobcity.pom</groupId>
2424
<artifactId>database</artifactId>
25-
<version>1.7.8-alpha</version>
25+
<version>1.7.9-alpha</version>
2626
</parent>
2727

2828
<groupId>com.blobcity.lib</groupId>

distribution/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
<parent>
2222
<groupId>com.blobcity.pom</groupId>
2323
<artifactId>database</artifactId>
24-
<version>1.7.8-alpha</version>
24+
<version>1.7.9-alpha</version>
2525
</parent>
2626
<artifactId>blobcity-db</artifactId>
2727
<name>BlobCityDB Distribution</name>

engine/pom.xml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2222
<parent>
2323
<groupId>com.blobcity.pom</groupId>
2424
<artifactId>database</artifactId>
25-
<version>1.7.8-alpha</version>
25+
<version>1.7.9-alpha</version>
2626
</parent>
2727

2828
<groupId>com.blobcity.lib.database</groupId>
@@ -540,6 +540,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
540540
<groupId>com.fasterxml.jackson.core</groupId>
541541
<artifactId>jackson-core</artifactId>
542542
</exclusion>
543+
<exclusion>
544+
<groupId>com.google.code.findbugs</groupId>
545+
<artifactId>jsr305</artifactId>
546+
</exclusion>
543547
</exclusions>
544548
</dependency>
545549

@@ -585,6 +589,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
585589
<groupId>commons-codec</groupId>
586590
<artifactId>commons-codec</artifactId>
587591
</exclusion>
592+
<exclusion>
593+
<groupId>com.google.code.findbugs</groupId>
594+
<artifactId>jsr305</artifactId>
595+
</exclusion>
588596
</exclusions>
589597
</dependency>
590598

@@ -617,6 +625,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
617625
<groupId>com.google.collections</groupId>
618626
<artifactId>google-collections</artifactId>
619627
</exclusion>
628+
<exclusion>
629+
<groupId>com.google.code.findbugs</groupId>
630+
<artifactId>jsr305</artifactId>
631+
</exclusion>
620632
</exclusions>
621633
</dependency>
622634

engine/src/main/java/com/blobcity/db/bquery/BQueryExecutorBean.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,6 +1401,7 @@ private JSONObject search(final String datastore, final JSONObject payloadJson)
14011401
case GTEQ:
14021402
case LT:
14031403
case LTEQ:
1404+
System.out.println("The comparator: " + jsonObject.toString());
14041405
iterator = dataManager.selectWithPattern(datastore, selectTables.toArray()[0].toString(), jsonObject.getString("c"), jsonObject.get("v"), operator);
14051406
break;
14061407
case IN:

engine/src/main/java/com/blobcity/db/bquery/ConsoleExecutorBean.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,9 @@ public String runCommand(final String user, String query) {
455455
case "import-csv":
456456
response = importCSV(elements);
457457
break;
458+
case "import-excel":
459+
response = importExcel(elements);
460+
break;
458461
case "insert-custom":
459462
response = insertCustom(elements);
460463
break;
@@ -1466,6 +1469,40 @@ private String importCSV(String[] elements) throws OperationException {
14661469

14671470
operationsManager.registerOperation(datastore, collection, OperationTypes.IMPORT, opSpecs);
14681471

1472+
// mapReduceOutputImporter.importCSVFile(datastore, collection, filePath);
1473+
1474+
long elapsedTime = System.currentTimeMillis() - startTime;
1475+
return "Done in " + elapsedTime + " (ms)";
1476+
}
1477+
1478+
/**
1479+
* Used to import an Excel document in a specified table. Columns of the table correspond to columns of the Excel
1480+
* and the entry will have one record per row. Sheet name is also stored as a field per record.
1481+
* @param elements query elements from CLI request
1482+
* @return import success/fail status response in text form
1483+
* @throws OperationException if an error occurs while executing the oepration
1484+
*/
1485+
private String importExcel(String[] elements) throws OperationException {
1486+
long startTime = System.currentTimeMillis();
1487+
final String databaseAndTable = elements[1];
1488+
if (!databaseAndTable.contains(".")) {
1489+
throw new OperationException(ErrorCode.INVALID_QUERY_FORMAT, "Database and table should be specified in format: databaseName.tableName");
1490+
}
1491+
final String datastore = databaseAndTable.substring(0, databaseAndTable.indexOf(".", 1)); //start searching dot from index 1 to handle case of .systemdb as datastore name
1492+
final String collection = databaseAndTable.substring(databaseAndTable.indexOf(".", 1) + 1, databaseAndTable.length());
1493+
1494+
verifyDCInfo(datastore, collection);
1495+
1496+
/* Maybe a public URL or a local file system path. NFS paths are currently not supported */
1497+
String filePath = elements[2];
1498+
1499+
JSONObject opSpecs = new JSONObject();
1500+
opSpecs.put("type", "IMP");
1501+
opSpecs.put("import-type", "CSV");
1502+
opSpecs.put("file", filePath);
1503+
1504+
operationsManager.registerOperation(datastore, collection, OperationTypes.IMPORT, opSpecs);
1505+
14691506
// mapReduceOutputImporter.importCSVFile(datastore, collection, filePath);
14701507

14711508
long elapsedTime = System.currentTimeMillis() - startTime;

engine/src/main/java/com/blobcity/db/bsql/BSqlDataManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,9 @@ public Iterator<String> selectKeysWithPattern(final String datastore, final Stri
523523
case DOUBLE:
524524
comparableReferenceValue = new Double(referenceValue.toString());
525525
break;
526+
case BOOLEAN:
527+
comparableReferenceValue = (boolean) referenceValue;
528+
break;
526529
case STRING:
527530
case VARCHAR:
528531
case CHARACTER_LARGE_OBJECT:

engine/src/main/java/com/blobcity/db/bsql/filefilters/EQFilenameFilter.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ public TypeConverter getTypeConverter() {
6666

6767
@Override
6868
public Object getTypeConvertedReferenceValue() throws OperationException {
69+
if(referenceValue instanceof Boolean) {
70+
if(((Boolean) referenceValue).booleanValue()) return "true";
71+
else return "false";
72+
}
6973
return typeConverter.getValue(referenceValue.toString());
7074
}
7175
}

engine/src/main/java/com/blobcity/db/exceptions/ErrorCode.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ public enum ErrorCode {
128128
INVALID_WEBSERVICE_ENDPOINT("INVALID_WEBSERVICE_ENDPOINT", "No customer web-service registered at the specified endpoint"),
129129
CODE_LOAD_ERROR("CODE_LOAD_ERROR", "Unable to load code"),
130130
TABLEAU_EXCEPTION("TABLEAU_EXCEPTION", "Internal error with Tableau integration"),
131-
GROUP_BY("GROUP_BY", "Error executing GROUP BY clause");
131+
GROUP_BY("GROUP_BY", "Error executing GROUP BY clause"),
132+
EXCEL_DATA_READ_ERR("EXCEL_DATA_READ_ERR", "Error reading data in Excel format");
132133

133134
private final String errorCode;
134135
private final String errorMessage;

0 commit comments

Comments
 (0)