Skip to content

Commit

Permalink
HIVE-15419. Separate storage-api to be released independently. (omalley
Browse files Browse the repository at this point in the history
reviewed by Prasanth Jayachandran and Eugene Koifman)

Fixes apache#125

Signed-off-by: Owen O'Malley <omalley@apache.org>
  • Loading branch information
omalley committed Jan 5, 2017
1 parent ad335c1 commit 9e7d384
Show file tree
Hide file tree
Showing 19 changed files with 467 additions and 87 deletions.
1 change: 0 additions & 1 deletion common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-storage-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
Expand Down
1 change: 0 additions & 1 deletion orc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-storage-api</artifactId>
<version>${project.version}</version>
</dependency>

<!-- inter-project -->
Expand Down
1 change: 0 additions & 1 deletion packaging/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-storage-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
Expand Down
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
<stax.version>1.0.1</stax.version>
<slf4j.version>1.7.10</slf4j.version>
<ST4.version>4.0.4</ST4.version>
<storage-api.version>2.3.0-SNAPSHOT</storage-api.version>
<tez.version>0.8.4</tez.version>
<slider.version>0.90.2-incubating</slider.version>
<super-csv.version>2.2.0</super-csv.version>
Expand Down Expand Up @@ -507,6 +508,11 @@
<artifactId>stax-api</artifactId>
<version>${stax.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-storage-api</artifactId>
<version>${storage-api.version}</version>
</dependency>
<dependency>
<groupId>org.apache.pig</groupId>
<artifactId>pig</artifactId>
Expand Down
82 changes: 75 additions & 7 deletions storage-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,28 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.hive</groupId>
<artifactId>hive</artifactId>
<version>2.2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
<version>18</version>
<relativePath></relativePath>
</parent>

<groupId>org.apache.hive</groupId>
<artifactId>hive-storage-api</artifactId>
<version>2.3.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Hive Storage API</name>

<properties>
<hive.path.to.root>..</hive.path.to.root>
<commons-lang.version>2.6</commons-lang.version>
<guava.version>14.0.1</guava.version>
<hadoop.version>2.7.2</hadoop.version>
<junit.version>4.11</junit.version>
<slf4j.version>1.7.10</slf4j.version>
</properties>

<dependencies>
<!-- inter-project -->
<!-- compile inter-project -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
Expand All @@ -49,17 +55,45 @@
<artifactId>guava</artifactId>
</exclusion>
<exclusion>
<groupId>commmons-logging</groupId>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
</exclusion>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down Expand Up @@ -91,5 +125,39 @@
<directory>${basedir}/src/test/resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.9</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<reuseForks>false</reuseForks>
<argLine>-Xmx2048m</argLine>
<failIfNoTests>false</failIfNoTests>
<systemPropertyVariables>
<test.tmp.dir>${project.build.directory}/tmp</test.tmp.dir>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</project>
8 changes: 6 additions & 2 deletions storage-api/src/java/org/apache/hadoop/hive/common/Pool.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@
public interface Pool<T> {
/** Object helper for objects stored in the pool. */
public interface PoolObjectHelper<T> {
/** Called to create an object when one cannot be provided. */
/** Called to create an object when one cannot be provided.
* @return a newly allocated object
*/
T create();
/** Called before the object is put in the pool (regardless of whether put succeeds). */
/** Called before the object is put in the pool (regardless of whether put succeeds).
* @param t the object to reset
*/
void resetBeforeOffer(T t);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,22 @@ public AllocatorOutOfMemoryException(String msg) {
* Creates an unallocated memory buffer object. This object can be passed to allocateMultiple
* to allocate; this is useful if data structures are created for separate buffers that can
* later be allocated together.
* @return a new unallocated memory buffer
*/
MemoryBuffer createUnallocated();
/** Deallocates a memory buffer. */

/** Deallocates a memory buffer.
* @param buffer the buffer to deallocate
*/
void deallocate(MemoryBuffer buffer);
/** Whether the allocator uses direct buffers. */

/** Whether the allocator uses direct buffers.
* @return are they direct buffers?
*/
boolean isDirectAlloc();
/** Maximum allocation size supported by this allocator. */

/** Maximum allocation size supported by this allocator.
* @return a number of bytes
*/
int getMaxAllocation();
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public interface DiskRangeListFactory {
* return both ranges). It should really be same as #1, however currently ORC uses estimated
* end offsets; if we don't return the end block, the caller may read it from disk needlessly.
*
* @param fileId Unique ID of the target file on the file system.
* @param fileKey Unique ID of the target file on the file system.
* @param range A set of DiskRange-s (linked list) that is to be retrieved. May be modified.
* @param baseOffset base offset for the ranges (stripe/stream offset in case of ORC).
* @param factory A factory to produce DiskRangeList-s out of cached MemoryBuffer-s.
Expand All @@ -72,7 +72,7 @@ DiskRangeList getFileData(Object fileKey, DiskRangeList range, long baseOffset,
* caller is done with it. Buffers rejected due to conflict will neither be locked, nor
* automatically deallocated. The caller must take care to discard these buffers.
*
* @param fileId Unique ID of the target file on the file system.
* @param fileKey Unique ID of the target file on the file system.
* @param ranges The ranges for which the data is being cached. These objects will not be stored.
* @param data The data for the corresponding ranges.
* @param baseOffset base offset for the ranges (stripe/stream offset in case of ORC).
Expand All @@ -84,17 +84,20 @@ DiskRangeList getFileData(Object fileKey, DiskRangeList range, long baseOffset,
/**
* Releases the buffer returned by getFileData/provided to putFileData back to cache.
* See respective javadocs for details.
* @param buffer the buffer to release
*/
void releaseBuffer(MemoryBuffer buffer);

/**
* Notifies the cache that the buffer returned from getFileData/provided to putFileData will
* be used by another consumer and therefore released multiple times (one more time per call).
* @param buffer the buffer to reuse
*/
void reuseBuffer(MemoryBuffer buffer);

/**
* Gets the allocator associated with this DataCache.
* @return the allocator
*/
Allocator getAllocator();
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ public DiskRangeList(long offset, long end) {
super(offset, end);
}

/** Replaces this element with another in the list; returns the new element. */
/** Replaces this element with another in the list; returns the new element.
* @param other the disk range to swap into this list
* @return the new element
*/
public DiskRangeList replaceSelfWith(DiskRangeList other) {
other.prev = this.prev;
other.next = this.next;
Expand All @@ -47,7 +50,8 @@ public DiskRangeList replaceSelfWith(DiskRangeList other) {

/**
* Inserts an intersecting range before current in the list and adjusts offset accordingly.
* @returns the new element.
* @param other the element to insert
* @return the new element.
*/
public DiskRangeList insertPartBefore(DiskRangeList other) {
assert other.end >= this.offset;
Expand All @@ -63,7 +67,8 @@ public DiskRangeList insertPartBefore(DiskRangeList other) {

/**
* Inserts an element after current in the list.
* @returns the new element.
* @param other the new element to insert
* @return the new element.
* */
public DiskRangeList insertAfter(DiskRangeList other) {
other.next = this.next;
Expand All @@ -77,7 +82,8 @@ public DiskRangeList insertAfter(DiskRangeList other) {

/**
* Inserts an intersecting range after current in the list and adjusts offset accordingly.
* @returns the new element.
* @param other the new element to insert
* @return the new element.
*/
public DiskRangeList insertPartAfter(DiskRangeList other) {
assert other.offset <= this.end;
Expand Down Expand Up @@ -106,7 +112,10 @@ public void removeSelf() {
this.next = this.prev = null;
}

/** Splits current element in the list, using DiskRange::slice */
/** Splits current element in the list, using DiskRange::slice.
* @param cOffset the position to split the list
* @return the split list
*/
public final DiskRangeList split(long cOffset) {
insertAfter((DiskRangeList)this.sliceAndShift(cOffset, end, 0));
return replaceSelfWith((DiskRangeList)this.sliceAndShift(offset, cOffset, 0));
Expand Down Expand Up @@ -207,4 +216,4 @@ public DiskRangeList extract() {
return result;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@

/** Abstract interface for any class wrapping a ByteBuffer. */
public interface MemoryBuffer {
/** Note - raw buffer should not be modified. */
/**
* Get the raw byte buffer that backs this buffer.
* Note - raw buffer should not be modified.
* @return the shared byte buffer
*/
public ByteBuffer getByteBufferRaw();
public ByteBuffer getByteBufferDup();
}
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ protected boolean fastSetFromDouble(double doubleValue) {

protected void fastFractionPortion() {
FastHiveDecimalImpl.fastFractionPortion(
fastSignum, fast0, fast1, fast2, fastIntegerDigitCount, fastScale,
fastSignum, fast0, fast1, fast2, fastScale,
this);
}

Expand Down
Loading

0 comments on commit 9e7d384

Please sign in to comment.