Skip to content

Commit

Permalink
DRILL-1942-hygiene
Browse files Browse the repository at this point in the history
- Formatting
- @OVERRIDES
- finals
- some AutoCloseable additions
- new isCancelled() abstract method on FragmentManager, implemented on subclasses

Added missing new abstract method isCancelled()
  • Loading branch information
cwestin committed Aug 17, 2015
1 parent 6813b20 commit 993844f
Show file tree
Hide file tree
Showing 25 changed files with 281 additions and 190 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,172 +30,211 @@
import com.typesafe.config.ConfigValue;

abstract class NestedConfig implements Config {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(NestedConfig.class);
// private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(NestedConfig.class);

private final Config c;

NestedConfig(Config c) {
this.c = c;
}

@Override
public ConfigObject root() {
return c.root();
}

@Override
public ConfigOrigin origin() {
return c.origin();
}

@Override
public Config withFallback(ConfigMergeable other) {
return c.withFallback(other);
}

@Override
public Config resolve() {
return c.resolve();
}

@Override
public Config resolve(ConfigResolveOptions options) {
return c.resolve(options);
}

@Override
public void checkValid(Config reference, String... restrictToPaths) {
c.checkValid(reference, restrictToPaths);
}

@Override
public boolean hasPath(String path) {
return c.hasPath(path);
}

@Override
public boolean isEmpty() {
return c.isEmpty();
}

@Override
public Set<Entry<String, ConfigValue>> entrySet() {
return c.entrySet();
}

@Override
public boolean getBoolean(String path) {
return c.getBoolean(path);
}

@Override
public Number getNumber(String path) {
return c.getNumber(path);
}

@Override
public int getInt(String path) {
return c.getInt(path);
}

@Override
public long getLong(String path) {
return c.getLong(path);
}

@Override
public double getDouble(String path) {
return c.getDouble(path);
}

@Override
public String getString(String path) {
return c.getString(path);
}

@Override
public ConfigObject getObject(String path) {
return c.getObject(path);
}

@Override
public Config getConfig(String path) {
return c.getConfig(path);
}

@Override
public Object getAnyRef(String path) {
return c.getAnyRef(path);
}

@Override
public ConfigValue getValue(String path) {
return c.getValue(path);
}

@Override
public Long getBytes(String path) {
return c.getBytes(path);
}

@Override
public Long getMilliseconds(String path) {
return c.getMilliseconds(path);
}

@Override
public Long getNanoseconds(String path) {
return c.getNanoseconds(path);
}

@Override
public ConfigList getList(String path) {
return c.getList(path);
}

@Override
public List<Boolean> getBooleanList(String path) {
return c.getBooleanList(path);
}

@Override
public List<Number> getNumberList(String path) {
return c.getNumberList(path);
}

@Override
public List<Integer> getIntList(String path) {
return c.getIntList(path);
}

@Override
public List<Long> getLongList(String path) {
return c.getLongList(path);
}

@Override
public List<Double> getDoubleList(String path) {
return c.getDoubleList(path);
}

@Override
public List<String> getStringList(String path) {
return c.getStringList(path);
}

@Override
public List<? extends ConfigObject> getObjectList(String path) {
return c.getObjectList(path);
}

@Override
public List<? extends Config> getConfigList(String path) {
return c.getConfigList(path);
}

@Override
public List<? extends Object> getAnyRefList(String path) {
return c.getAnyRefList(path);
}

@Override
public List<Long> getBytesList(String path) {
return c.getBytesList(path);
}

@Override
public List<Long> getMillisecondsList(String path) {
return c.getMillisecondsList(path);
}

@Override
public List<Long> getNanosecondsList(String path) {
return c.getNanosecondsList(path);
}

@Override
public Config withOnlyPath(String path) {
return c.withOnlyPath(path);
}

@Override
public Config withoutPath(String path) {
return c.withoutPath(path);
}

@Override
public Config atPath(String path) {
return c.atPath(path);
}

@Override
public Config atKey(String key) {
return c.atKey(key);
}

@Override
public Config withValue(String path, ConfigValue value) {
return c.withValue(path, value);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package org.apache.drill.exec.planner.logical;

import com.google.common.collect.Lists;
import com.sun.java.swing.plaf.windows.resources.windows;
import org.apache.calcite.linq4j.Ord;
import org.apache.calcite.util.BitSets;
import org.apache.drill.common.expression.ExpressionPosition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,35 @@

import org.apache.drill.common.expression.SchemaPath;

// TODO javadoc
public interface VectorAccessible extends Iterable<VectorWrapper<?>> {
// TODO are these <?> releated in any way? Should they be the same one?
// TODO javadoc
public VectorWrapper<?> getValueAccessorById(Class<?> clazz, int... fieldIds);

/**
* Get the value vector type and id for the given schema path. The TypedFieldId
* should store a fieldId which is the same as the ordinal position of the field
* within the Iterator provided this classes implementation of Iterable<ValueVector>.
*
* @param path the path where the vector should be located.
* @return the local field id associated with this vector. If no field matches this
* path, this will return a null TypedFieldId
*/
public TypedFieldId getValueVectorId(SchemaPath path);

/**
* Get the schema of the current RecordBatch. This changes if and only if a *_NEW_SCHEMA
* IterOutcome is provided.
*
* @return schema of the current batch
*/
public BatchSchema getSchema();

/**
* Get the number of records.
*
* @return number of records
*/
public int getRecordCount();
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,15 @@

import io.netty.buffer.DrillBuf;

import java.io.Closeable;
import java.io.IOException;

import org.apache.drill.exec.memory.BufferAllocator;
import org.apache.drill.exec.memory.OutOfMemoryRuntimeException;
import org.apache.drill.exec.record.DeadBuf;

/**
* A selection vector that fronts, at most, a
*/
public class SelectionVector2 implements Closeable{
// private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SelectionVector2.class);
public class SelectionVector2 implements AutoCloseable {
// private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SelectionVector2.class);

private final BufferAllocator allocator;
private int recordCount;
Expand All @@ -42,7 +39,7 @@ public SelectionVector2(BufferAllocator allocator) {
this.allocator = allocator;
}

public int getCount(){
public int getCount() {
return recordCount;
}

Expand All @@ -55,7 +52,7 @@ public DrillBuf getBuffer(boolean clear) {

if (clear) {
/* Increment the ref count for this buffer */
bufferHandle.retain();
bufferHandle.retain(1);

/* We are passing ownership of the buffer to the
* caller. clear the buffer from within our selection vector
Expand All @@ -66,28 +63,27 @@ public DrillBuf getBuffer(boolean clear) {
return bufferHandle;
}

public void setBuffer(DrillBuf bufferHandle)
{
public void setBuffer(DrillBuf bufferHandle) {
/* clear the existing buffer */
clear();

this.buffer = bufferHandle;
buffer.retain();
buffer.retain(1);
}

public char getIndex(int index){
public char getIndex(int index) {
return buffer.getChar(index * RECORD_SIZE);
}

public void setIndex(int index, char value){
public void setIndex(int index, char value) {
buffer.setChar(index * RECORD_SIZE, value);
}

public long getDataAddr(){
public long getDataAddr() {
return buffer.memoryAddress();
}

public void setIndex(int index, int value){
public void setIndex(int index, int value) {
buffer.setChar(index, value);
}

Expand All @@ -106,7 +102,7 @@ public void allocateNew(int size) {
}

@Override
public SelectionVector2 clone(){
public SelectionVector2 clone() {
SelectionVector2 newSV = new SelectionVector2(allocator);
newSV.recordCount = recordCount;
newSV.buffer = buffer;
Expand All @@ -115,7 +111,7 @@ public SelectionVector2 clone(){
* same buffer, if we don't do a retain() on the newSV's
* buffer, it might get freed.
*/
newSV.buffer.retain();
newSV.buffer.retain(1);
clear();
return newSV;
}
Expand All @@ -134,9 +130,7 @@ public void setRecordCount(int recordCount){
}

@Override
public void close() throws IOException {
public void close() {
clear();
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import org.apache.drill.exec.exception.SchemaChangeException;
import org.apache.drill.exec.record.DeadBuf;

public class SelectionVector4 {
// private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SelectionVector4.class);
public class SelectionVector4 implements AutoCloseable {
// private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SelectionVector4.class);

private ByteBuf data;
private int recordCount;
Expand Down Expand Up @@ -73,7 +73,7 @@ public int get(int index) {
public SelectionVector4 createNewWrapperCurrent(int batchRecordCount) {
try {
data.retain();
SelectionVector4 sv4 = new SelectionVector4(data, recordCount, batchRecordCount);
final SelectionVector4 sv4 = new SelectionVector4(data, recordCount, batchRecordCount);
sv4.start = this.start;
return sv4;
} catch (SchemaChangeException e) {
Expand Down Expand Up @@ -116,4 +116,8 @@ public void clear() {
}
}

@Override
public void close() {
clear();
}
}

0 comments on commit 993844f

Please sign in to comment.