Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

[SQL-DS-CACHE-17][POAE7-905]replace intel-arrow with apache-arrow v3.0.0 #18

Merged
merged 1 commit into from
Feb 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions HCFS-based-cache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
<version>${hadoop.version}</version>
</dependency>
<dependency>
<groupId>com.intel.arrow</groupId>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-plasma</artifactId>
<version>0.17.0</version>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@

package com.intel.oap.fs.hadoop.cachedfs.cacheutil;

import java.nio.ByteBuffer;

import org.apache.arrow.plasma.PlasmaClient;
import org.apache.arrow.plasma.exceptions.*;
import sun.nio.ch.DirectBuffer;


public class PlasmaCacheManager implements CacheManager {
Expand All @@ -41,11 +44,13 @@ public void put(ObjectId id) {
public FiberCache get(ObjectId id) {
// TODO: what if get an unsealed object? Let's throw an exception here,
// higher level should catch this exception and do some fall back.
try {
// TODO: should not return a ArrowFiberCache directly
return new SimpleFiberCache(client.getObjAsByteBuffer(id.toByteArray(), -1, false));
} catch(PlasmaGetException e) {
throw new CacheManagerException("Plasma exception:" + e.getMessage());
// TODO: should not return a ArrowFiberCache directly
ByteBuffer bb = client.getObjAsByteBuffer(id.toByteArray(), -1, false);
// get api may return a nullptr which means get an invalid value.
if(((DirectBuffer)bb).address() != 0) {
return new SimpleFiberCache(bb);
} else {
throw new CacheManagerException("Plasma get an invalid value.");
}
}

Expand All @@ -67,7 +72,7 @@ public FiberCache create(ObjectId id, Long length) {
if (length > Integer.MAX_VALUE) {
throw new ArithmeticException("Can't create $length bytes Object");
}
return new SimpleFiberCache(client.create(id.toByteArray(), length.intValue()));
return new SimpleFiberCache(client.create(id.toByteArray(), length.intValue(), null));
} catch (DuplicateObjectException | PlasmaOutOfMemoryException e) {
throw new CacheManagerException("Plasma exception:" + e.getMessage());
}
Expand Down