|
2 | 2 |
|
3 | 3 | import io.tiledb.cloud.rest_api.ApiException;
|
4 | 4 | import io.tiledb.cloud.rest_api.api.SqlApi;
|
| 5 | +import io.tiledb.cloud.rest_api.model.ResultFormat; |
5 | 6 | import io.tiledb.cloud.rest_api.model.SQLParameters;
|
6 | 7 | import org.apache.arrow.memory.RootAllocator;
|
7 | 8 | import org.apache.arrow.memory.UnsafeAllocationManager;
|
@@ -56,7 +57,11 @@ public TileDBSQL(TileDBClient tileDBClient, String namespace, SQLParameters sql)
|
56 | 57 | */
|
57 | 58 | public Pair<ArrayList<ValueVector>, Integer> execArrow(){
|
58 | 59 | try {
|
59 |
| - assert sql.getResultFormat() != null; |
| 60 | + if (sql.getResultFormat() != ResultFormat.ARROW && sql.getResultFormat() != null){ |
| 61 | + throw new ApiException("The ResultFormat you specified is not 'ARROW'. Since you are calling " + |
| 62 | + "'execArrow()' you can not specify a different ResultFormat. "); |
| 63 | + } |
| 64 | + sql.setResultFormat(ResultFormat.ARROW); |
60 | 65 | byte[] bytes = apiInstance.runSQLBytes(namespace, sql, "none");
|
61 | 66 | ArrayList<ValueVector> valueVectors = null;
|
62 | 67 | int readBatchesCount = 0;
|
@@ -95,8 +100,11 @@ public Pair<ArrayList<ValueVector>, Integer> execArrow(){
|
95 | 100 | */
|
96 | 101 | public List<Object> exec(){
|
97 | 102 | try {
|
98 |
| - assert sql.getResultFormat() != null; |
99 |
| - return apiInstance.runSQL(namespace, sql, sql.getResultFormat().toString()); |
| 103 | + if (sql.getResultFormat() == null ){ |
| 104 | + return apiInstance.runSQL(namespace, sql, ResultFormat.TILEDB_JSON.toString()); |
| 105 | + } else { |
| 106 | + return apiInstance.runSQL(namespace, sql, sql.getResultFormat().toString()); |
| 107 | + } |
100 | 108 | } catch (ApiException e) {
|
101 | 109 | System.err.println("Exception when calling SqlApi#runSQL/runSQLBytes");
|
102 | 110 | System.err.println("Status code: " + e.getCode());
|
|
0 commit comments