Skip to content

Commit 5d29dea

Browse files
add support for aggregates
1 parent 3105b54 commit 5d29dea

File tree

8 files changed

+382
-11
lines changed

8 files changed

+382
-11
lines changed

.github/workflows/github_actions.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ jobs:
6161
6262
- run: |
6363
unset SYSTEM
64-
set +e;
6564
./gradlew test
6665
shell: bash
6766
name: test

cmake/Modules/FindTileDB_EP.cmake

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,24 @@ if (NOT TILEDB_FOUND)
4848
# Try to download prebuilt artifacts unless the user specifies to build from source
4949
if(DOWNLOAD_TILEDB_PREBUILT)
5050
if (WIN32) # Windows
51-
SET(DOWNLOAD_URL "https://github.com/TileDB-Inc/TileDB/releases/download/2.18.0-rc2/tiledb-windows-x86_64-2.18.0-rc2-3af8017.zip")
52-
SET(DOWNLOAD_SHA1 "3ba44ff0ad6a758774f2d827e15dc0f841fb5e21")
51+
SET(DOWNLOAD_URL "https://github.com/TileDB-Inc/TileDB/releases/download/2.18.0-rc3/tiledb-windows-x86_64-2.18.0-rc3-925dac8.zip")
52+
SET(DOWNLOAD_SHA1 "9d4448751126762fab1ccb7540c30cdaec297f16")
5353
elseif(APPLE) # macOS
5454

5555
if (CMAKE_OSX_ARCHITECTURES STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(AMD64|amd64)|(^i.86$)")
5656
message(STATUS "Building for intel mac")
57-
SET(DOWNLOAD_URL "https://github.com/TileDB-Inc/TileDB/releases/download/2.18.0-rc2/tiledb-macos-x86_64-2.18.0-rc2-3af8017.tar.gz")
58-
SET(DOWNLOAD_SHA1 "b6e2e5667c80158936033f0199c880992da5de4f")
57+
SET(DOWNLOAD_URL "https://github.com/TileDB-Inc/TileDB/releases/download/2.18.0-rc3/tiledb-macos-x86_64-2.18.0-rc3-925dac8.tar.gz")
58+
SET(DOWNLOAD_SHA1 "2a767197e8286560e1457cc223b5c0453c7b9711")
5959

6060
elseif (CMAKE_OSX_ARCHITECTURES STREQUAL arm64 OR CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
6161
message(STATUS "Building for apple silicon mac")
62-
SET(DOWNLOAD_URL "https://github.com/TileDB-Inc/TileDB/releases/download/2.18.0-rc2/tiledb-macos-arm64-2.18.0-rc2-3af8017.tar.gz")
63-
SET(DOWNLOAD_SHA1 "7e058b50693c065dd1875c0ff8e47f6f36a54420")
62+
SET(DOWNLOAD_URL "https://github.com/TileDB-Inc/TileDB/releases/download/2.18.0-rc3/tiledb-macos-arm64-2.18.0-rc3-925dac8.tar.gz")
63+
SET(DOWNLOAD_SHA1 "92eee3a48335ba9dd72bb79915a9d3f8def387dc")
6464
endif()
6565

6666
else() # Linux
67-
SET(DOWNLOAD_URL "https://github.com/TileDB-Inc/TileDB/releases/download/2.18.0-rc2/tiledb-linux-x86_64-2.18.0-rc2-3af8017.tar.gz")
68-
SET(DOWNLOAD_SHA1 "52b263dd22e5fc278f36fbe4219719ed302d7c38")
67+
SET(DOWNLOAD_URL "https://github.com/TileDB-Inc/TileDB/releases/download/2.18.0-rc3/tiledb-linux-x86_64-2.18.0-rc3-925dac8.tar.gz")
68+
SET(DOWNLOAD_SHA1 "1ac2474fd57f1f23d52e5ff7c7ca410621773ba8")
6969
endif()
7070

7171
ExternalProject_Add(ep_tiledb

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
TILEDB_GIT_REPOSITORY=https://github.com/TileDB-Inc/TileDB
2-
TILEDB_GIT_TAG=2.18.0-rc2
2+
TILEDB_GIT_TAG=2.18.0-rc3
33
TILEDB_VERBOSE=ON
44
TILEDB_S3=ON
55
TILEDB_AZURE=OFF
66
TILEDB_HDFS=OFF
77
TILEDB_SERIALIZATION=OFF
8-
FORCE_BUILD_TILEDB=OFF
8+
FORCE_BUILD_TILEDB=ON
99
DOWNLOAD_TILEDB_PREBUILT=ON
1010
TILEDB_SKIP_S3AWSSDK_DIR_LENGTH_CHECK=ON
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package io.tiledb.java.api;
2+
3+
import io.tiledb.libtiledb.SWIGTYPE_p_p_tiledb_channel_operation_t;
4+
import io.tiledb.libtiledb.SWIGTYPE_p_tiledb_channel_operation_t;
5+
import io.tiledb.libtiledb.tiledb;
6+
7+
public class ChannelOperation {
8+
private Context ctx;
9+
private SWIGTYPE_p_tiledb_channel_operation_t operationp;
10+
private SWIGTYPE_p_p_tiledb_channel_operation_t operationpp;
11+
12+
public ChannelOperation(Context ctx, ChannelOperator operator, Query query, String fieldName)
13+
throws TileDBError {
14+
this.ctx = ctx;
15+
this.operationpp = tiledb.new_tiledb_channel_operation_tpp();
16+
ctx.handleError(
17+
tiledb.tiledb_create_unary_aggregate(
18+
ctx.getCtxp(),
19+
query.getQueryp(),
20+
operator.getOperatorp(),
21+
fieldName,
22+
this.operationpp));
23+
this.operationp = tiledb.tiledb_channel_operation_tpp_value(operationpp);
24+
}
25+
26+
public SWIGTYPE_p_tiledb_channel_operation_t getOperationp() {
27+
return operationp;
28+
}
29+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package io.tiledb.java.api;
2+
3+
import io.tiledb.libtiledb.SWIGTYPE_p_p_tiledb_channel_operator_t;
4+
import io.tiledb.libtiledb.SWIGTYPE_p_tiledb_channel_operator_t;
5+
import io.tiledb.libtiledb.tiledb;
6+
7+
public class ChannelOperator {
8+
public enum AggregationOperator {
9+
TILEDB_MIN,
10+
TILEDB_SUM,
11+
TILEDB_MEAN,
12+
TILEDB_MAX,
13+
TILEDB_NULL_COUNT,
14+
}
15+
16+
private SWIGTYPE_p_tiledb_channel_operator_t operatorp;
17+
private SWIGTYPE_p_p_tiledb_channel_operator_t operatorpp;
18+
private AggregationOperator aggregationOperator;
19+
20+
public ChannelOperator(Context ctx, AggregationOperator op) {
21+
this.aggregationOperator = op;
22+
operatorpp = tiledb.new_tiledb_channel_operator_tpp();
23+
switch (op) {
24+
case TILEDB_MIN:
25+
tiledb.tiledb_channel_operator_min_get(ctx.getCtxp(), operatorpp);
26+
break;
27+
case TILEDB_MAX:
28+
tiledb.tiledb_channel_operator_max_get(ctx.getCtxp(), operatorpp);
29+
break;
30+
case TILEDB_SUM:
31+
tiledb.tiledb_channel_operator_sum_get(ctx.getCtxp(), operatorpp);
32+
break;
33+
case TILEDB_MEAN:
34+
tiledb.tiledb_channel_operator_mean_get(ctx.getCtxp(), operatorpp);
35+
break;
36+
case TILEDB_NULL_COUNT:
37+
tiledb.tiledb_channel_operator_null_count_get(ctx.getCtxp(), operatorpp);
38+
break;
39+
}
40+
41+
operatorp = tiledb.tiledb_channel_operator_tpp_value(operatorpp);
42+
}
43+
44+
public SWIGTYPE_p_tiledb_channel_operator_t getOperatorp() {
45+
return operatorp;
46+
}
47+
}

src/main/java/io/tiledb/java/api/Query.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,26 @@ public long getRelevantFragmentNum() throws TileDBError {
282282
}
283283
}
284284

285+
/**
286+
* Gets the default channel of the query. The default channel consists of all the rows the query
287+
* would return as if executed standalone.
288+
*
289+
* @return The default channel
290+
* @throws TileDBError
291+
*/
292+
public QueryChannel getDefaultChannel() throws TileDBError {
293+
SWIGTYPE_p_p_tiledb_query_channel_t queryChannelpp = tiledb.new_tiledb_query_channel_tpp();
294+
295+
try {
296+
ctx.handleError(
297+
tiledb.tiledb_query_get_default_channel(this.ctx.getCtxp(), this.queryp, queryChannelpp));
298+
return new QueryChannel(this.ctx, queryChannelpp);
299+
} catch (TileDBError error) {
300+
tiledb.delete_tiledb_query_channel_tpp(queryChannelpp);
301+
throw error;
302+
}
303+
}
304+
285305
/**
286306
* Retrieves the estimated result size for a var-sized attribute/dimension.
287307
*
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package io.tiledb.java.api;
2+
3+
import io.tiledb.libtiledb.SWIGTYPE_p_p_tiledb_query_channel_t;
4+
import io.tiledb.libtiledb.SWIGTYPE_p_tiledb_query_channel_t;
5+
import io.tiledb.libtiledb.tiledb;
6+
7+
public class QueryChannel implements AutoCloseable {
8+
9+
private SWIGTYPE_p_tiledb_query_channel_t queryChannelp;
10+
private SWIGTYPE_p_p_tiledb_query_channel_t queryChannelpp;
11+
private Context ctx;
12+
13+
protected QueryChannel(Context ctx, SWIGTYPE_p_p_tiledb_query_channel_t queryChannelpp) {
14+
this.ctx = ctx;
15+
this.queryChannelpp = queryChannelpp;
16+
this.queryChannelp = tiledb.tiledb_query_channel_tpp_value(queryChannelpp);
17+
}
18+
19+
/**
20+
* @param fieldName
21+
* @param channelOperation
22+
* @throws TileDBError
23+
*/
24+
public void applyAggregate(String fieldName, ChannelOperation channelOperation)
25+
throws TileDBError {
26+
ctx.handleError(
27+
tiledb.tiledb_channel_apply_aggregate(
28+
this.ctx.getCtxp(), this.queryChannelp, fieldName, channelOperation.getOperationp()));
29+
}
30+
31+
@Override
32+
public void close() throws Exception {
33+
if (queryChannelp != null) {
34+
tiledb.tiledb_query_channel_free(ctx.getCtxp(), queryChannelpp);
35+
tiledb.delete_tiledb_query_channel_tpp(queryChannelpp);
36+
queryChannelpp = null;
37+
queryChannelp = null;
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)