Skip to content

Commit

Permalink
add WhitespaceAround and ParenPad
Browse files Browse the repository at this point in the history
  • Loading branch information
QiangCai committed Jan 25, 2017
1 parent 97405ad commit 256dbed
Show file tree
Hide file tree
Showing 84 changed files with 198 additions and 195 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ private boolean dictionaryCacheAlreadyExists(CacheType cacheType) {
* Below method will be used to clear the cache
*/
public void dropAllCache() {
if(null != carbonLRUCache) {
if (null != carbonLRUCache) {
carbonLRUCache.clear();
carbonLRUCache= null;
carbonLRUCache = null;
}
cacheTypeToCacheMap.clear();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private void removeKey(String key) {
currentSize = currentSize - cacheable.getMemorySize();
}
Cacheable remove = lruCacheMap.remove(key);
if(null != remove) {
if (null != remove) {
LOGGER.info("Removed entry from InMemory lru cache :: " + key);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private Dictionary getDictionary(
throws IOException {
Dictionary reverseDictionary = null;
// dictionary is only for primitive data type
assert(!dictionaryColumnUniqueIdentifier.getDataType().isComplexType());
assert (!dictionaryColumnUniqueIdentifier.getDataType().isComplexType());
String columnIdentifier = dictionaryColumnUniqueIdentifier.getColumnIdentifier().getColumnId();
ColumnReverseDictionaryInfo columnReverseDictionaryInfo =
getColumnReverseDictionaryInfo(dictionaryColumnUniqueIdentifier, columnIdentifier);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class BlockletLevelDeleteDeltaDataCache {

public BlockletLevelDeleteDeltaDataCache(int[] deleteDeltaFileData, String timeStamp) {
deleteDelataDataCache = RoaringBitmap.bitmapOf(deleteDeltaFileData);
this.timeStamp=timeStamp;
this.timeStamp = timeStamp;
}

public boolean contains(int key) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ protected Object compressValue(DataType convertedDataType, long[] value, long ma
intResult[j] = (int) (maxValue - value[j]);
}
} else {
for (int j=0; j < value.length; j++) {
for (int j = 0; j < value.length; j++) {
intResult[j] = (int) value[j];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -812,11 +812,11 @@ public final class CarbonCommonConstants {
/**
* 16 mb size
*/
public static final long CARBON_16MB = 16*1024*1024;
public static final long CARBON_16MB = 16 * 1024 * 1024;
/**
* 256 mb size
*/
public static final long CARBON_256MB = 256*1024*1024;
public static final long CARBON_256MB = 256 * 1024 * 1024;

/**
* COMPACTED is property to indicate whether seg is compacted or not.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public AbstractBlockIndexStoreCache(String carbonStorePath, CarbonLRUCache lruCa
this.carbonStorePath = carbonStorePath;
this.lruCache = lruCache;
blockInfoLock = new ConcurrentHashMap<BlockInfo, Object>();
segmentIDLock= new ConcurrentHashMap<String, Object>();
segmentIDLock = new ConcurrentHashMap<String, Object>();
segmentIdToBlockListMap = new ConcurrentHashMap<>();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public String getUniqueTableSegmentIdentifier() {
+ carbonTableIdentifier.getTableId() + CarbonCommonConstants.FILE_SEPARATOR + segmentId;
}
public void setIsSegmentUpdated(boolean isSegmentUpdated) {
this.isSegmentUpdated=isSegmentUpdated;
this.isSegmentUpdated = isSegmentUpdated;
}

public boolean isSegmentUpdated() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class BlockletInfos implements Serializable {
/**
* default constructor
*/
public BlockletInfos(){
public BlockletInfos() {
}
/**
* constructor to initialize the blockletinfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ public List<TableBlockInfo> getTableBlockInfoList() {
return tableBlockInfoList;
}

public TableTaskInfo(String taskId, List<TableBlockInfo> tableBlockInfoList){
public TableTaskInfo(String taskId, List<TableBlockInfo> tableBlockInfoList) {
this.taskId = taskId;
this.tableBlockInfoList = tableBlockInfoList;
}

@Override public String[] getLocations() {
Set<String> locations = new HashSet<String>();
for(TableBlockInfo tableBlockInfo: tableBlockInfoList){
for (TableBlockInfo tableBlockInfo : tableBlockInfoList) {
locations.addAll(Arrays.asList(tableBlockInfo.getLocations()));
}
locations.toArray(new String[locations.size()]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class TaskBlockInfo {
// stores TableBlockInfo list of each task
private Map<String, List<TableBlockInfo>> taskBlockInfoMapping;

public TaskBlockInfo(){
public TaskBlockInfo() {

taskBlockInfoMapping = new HashMap<>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public BlockIndexerStorageForNoInvertedIndex(byte[][] keyBlockInput, boolean com
int start = 0;
List<Integer> map = new ArrayList<Integer>(CarbonCommonConstants.CONSTANT_SIZE_TEN);
int length = keyBlockInput.length;
for(int i = 1; i < length; i++) {
for (int i = 1; i < length; i++) {
if (ByteUtil.UnsafeComparer.INSTANCE.compareTo(prvKey, keyBlockInput[i]) != 0) {
prvKey = keyBlockInput[i];
list.add(keyBlockInput[i]);
Expand Down Expand Up @@ -91,7 +91,7 @@ public int compare(byte[] col1, byte[] col2) {

private int[] convertToArray(List<Integer> list) {
int[] shortArray = new int[list.size()];
for(int i = 0; i < shortArray.length; i++) {
for (int i = 0; i < shortArray.length; i++) {
shortArray[i] = list.get(i);
}
return shortArray;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void setIndex(int index) {
}

@Override public boolean equals(Object obj) {
if(obj == null || getClass() != obj.getClass()) {
if (obj == null || getClass() != obj.getClass()) {
return false;
}
ColumnWithIntIndex o = (ColumnWithIntIndex)obj;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public ColumnWithIntIndexForHighCard(byte[] column, int index) {
}

@Override public boolean equals(Object obj) {
if(obj == null || getClass() != obj.getClass()) {
if (obj == null || getClass() != obj.getClass()) {
return false;
}
ColumnWithIntIndexForHighCard o = (ColumnWithIntIndexForHighCard)obj;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,11 @@ public class CompressByteArray extends ValueCompressionHolder<byte[]> {
int length = 0;
byte[] actualValue = null;
//CHECKSTYLE:OFF Approval No:Approval-367
while (buffer.hasRemaining()) {//CHECKSTYLE:ON
while (buffer.hasRemaining()) { //CHECKSTYLE:ON
length = buffer.getInt();
actualValue = new byte[length];
buffer.get(actualValue);
valsList.add(actualValue);

}
return valsList.get(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public K getOrGenerateKey(V value) throws DictionaryGenerationException {
return key;
} else {
K newKey = generator.generateKey(value);
assert(newKey != null);
assert (newKey != null);
put(newKey, value);
return newKey;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private void writeSortIndex(List<String> distinctValues,
DictionaryService dictionaryService,
CarbonTableIdentifier tableIdentifier,
ColumnIdentifier columnIdentifier,
String storePath) throws IOException{
String storePath) throws IOException {
CarbonDictionarySortIndexWriter carbonDictionarySortIndexWriter = null;
try {
CarbonDictionarySortInfoPreparator preparator = new CarbonDictionarySortInfoPreparator();
Expand All @@ -230,7 +230,7 @@ private void writeSortIndex(List<String> distinctValues,
* @param dictionaryWriter
* @throws IOException
*/
private void updateMetaData(CarbonDictionaryWriter dictionaryWriter) throws IOException{
private void updateMetaData(CarbonDictionaryWriter dictionaryWriter) throws IOException {
if (null != dictionaryWriter) {
dictionaryWriter.commit();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public int[] getBlockKeySize() {
}

@Override public boolean equals(Object obj) {
if(!(obj instanceof MultiDimKeyVarLengthEquiSplitGenerator)) {
if (!(obj instanceof MultiDimKeyVarLengthEquiSplitGenerator)) {
return false;
}
MultiDimKeyVarLengthEquiSplitGenerator o = (MultiDimKeyVarLengthEquiSplitGenerator)obj;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public int[] getBlockKeySize() {
}

@Override public boolean equals(Object obj) {
if(!(obj instanceof MultiDimKeyVarLengthVariableSplitGenerator)) {
if (!(obj instanceof MultiDimKeyVarLengthVariableSplitGenerator)) {
return false;
}
MultiDimKeyVarLengthVariableSplitGenerator o = (MultiDimKeyVarLengthVariableSplitGenerator)obj;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,9 @@ public TimeStampDirectDictionaryGenerator(String dateFormat) {
initialize();
}

public TimeStampDirectDictionaryGenerator( ) {
this(CarbonProperties.getInstance()
.getProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT));
public TimeStampDirectDictionaryGenerator() {
this(CarbonProperties.getInstance().getProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT));
}

/**
Expand Down Expand Up @@ -222,7 +221,7 @@ private int generateKey(long timeValue) {
}
}

public void initialize(){
public void initialize() {
if (simpleDateFormatLocal.get() == null) {
simpleDateFormatLocal.set(new SimpleDateFormat(dateFormat));
simpleDateFormatLocal.get().setLenient(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private void unCompressVal(byte[] key, int ls, long[] words, int offset) {
}
for (int j = ls; j < m; j++) {
l <<= BYTE_LENGTH;
l ^= key[offset+j] & 0xFF;
l ^= key[offset + j] & 0xFF;
}
words[i] = l;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class HdfsFileLock extends AbstractCarbonLock {
public HdfsFileLock(String lockFileLocation, String lockFile) {
this.location = tmpPath + CarbonCommonConstants.FILE_SEPARATOR + lockFileLocation
+ CarbonCommonConstants.FILE_SEPARATOR + lockFile;
LOGGER.info("HDFS lock path:"+this.location);
LOGGER.info("HDFS lock path:" + this.location);
initRetry();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ private void fillDimensionsAndMeasuresForTables(TableSchema tableSchema) {
private void addImplicitDimension(int dimensionOrdinal, List<CarbonDimension> dimensions) {
dimensions.add(new CarbonImplicitDimension(dimensionOrdinal,
CarbonCommonConstants.CARBON_IMPLICIT_COLUMN_POSITIONID));
dimensions.add(new CarbonImplicitDimension(dimensionOrdinal+1,
dimensions.add(new CarbonImplicitDimension(dimensionOrdinal + 1,
CarbonCommonConstants.CARBON_IMPLICIT_COLUMN_TUPLEID));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,9 @@ public static boolean updateSegmentStatus(List<SegmentUpdateDetails> updateDetai
if (index != -1) {
// update the element in existing list.
SegmentUpdateDetails blockDetail = oldList.get(index);
if(blockDetail.getDeleteDeltaStartTimestamp().isEmpty() ||
(isCompaction == true)) {
if (blockDetail.getDeleteDeltaStartTimestamp().isEmpty() || (isCompaction == true)) {
blockDetail
.setDeleteDeltaStartTimestamp(newBlockEntry.getDeleteDeltaStartTimestamp());
.setDeleteDeltaStartTimestamp(newBlockEntry.getDeleteDeltaStartTimestamp());
}
blockDetail.setDeleteDeltaEndTimestamp(newBlockEntry.getDeleteDeltaEndTimestamp());
blockDetail.setStatus(newBlockEntry.getStatus());
Expand Down Expand Up @@ -309,7 +308,7 @@ public static void cleanStaleDeltaFiles(CarbonTable table, final String timeStam
String partitionDir = carbonTablePath.getPartitionDir(partitionId);
CarbonFile file =
FileFactory.getCarbonFile(partitionDir, FileFactory.getFileType(partitionDir));
if(!file.exists()) {
if (!file.exists()) {
return;
}
for (CarbonFile eachDir : file.listFiles()) {
Expand Down Expand Up @@ -735,9 +734,9 @@ public static void decrementDeletedBlockCount(SegmentUpdateDetails details,
* @param segmentBlockCount
* @return
*/
public static List<String> getListOfSegmentsToMarkDeleted( Map<String, Long> segmentBlockCount) {
public static List<String> getListOfSegmentsToMarkDeleted(Map<String, Long> segmentBlockCount) {
List<String> segmentsToBeDeleted =
new ArrayList<>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
new ArrayList<>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);

for (Map.Entry<String, Long> eachSeg : segmentBlockCount.entrySet()) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,13 @@ public void setDeleteDeltaStartTimestamp(String deleteDeltaStartTimestamp) {
this.deleteDeltaStartTimestamp = deleteDeltaStartTimestamp;
}

public void setStatus(String status) { this.status = status;}
public void setStatus(String status) {
this.status = status;
}

public String getStatus() {return this.status;}
public String getStatus() {
return this.status;
}

@Override public int hashCode() {
final int prime = 31;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public enum TupleIdEnum {
this.index = index;
}

public int getTupleIdIndex(){
public int getTupleIdIndex() {
return this.index;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public BlockletDeleteDeltaCacheLoader(String blockletID,
DataRefNode blockletNode, AbsoluteTableIdentifier absoluteIdentifier) {
this.blockletID = blockletID;
this.blockletNode = blockletNode;
this.absoluteIdentifier= absoluteIdentifier;
this.absoluteIdentifier = absoluteIdentifier;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public DeleteDeltaBlockDetails getCompactedDeleteDeltaFileFromBlock(List<String>
try {
List<DeleteDeltaBlockletDetails> blockletDetails =
taskSubmitList.get(i).get().getBlockletDetails();
for(DeleteDeltaBlockletDetails blocklet : blockletDetails ) {
for (DeleteDeltaBlockletDetails blocklet : blockletDetails) {
deleteDeltaResultSet.addBlockletDetails(blocklet);
}
} catch (Throwable e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public DictionaryBasedResultCollector(BlockExecutionInfo blockExecutionInfos) {
QueryDimension[] queryDimensions = tableBlockExecutionInfos.getQueryDimensions();
List<Integer> dictionaryIndexes = new ArrayList<Integer>();
for (int i = 0; i < queryDimensions.length; i++) {
if(queryDimensions[i].getDimension().hasEncoding(Encoding.DICTIONARY) ||
queryDimensions[i].getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY) ) {
if (queryDimensions[i].getDimension().hasEncoding(Encoding.DICTIONARY) || queryDimensions[i]
.getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY)) {
dictionaryIndexes.add(queryDimensions[i].getDimension().getOrdinal());
}
}
Expand All @@ -69,10 +69,10 @@ public DictionaryBasedResultCollector(BlockExecutionInfo blockExecutionInfos) {
int[] actualIndexInSurrogateKey = new int[dictionaryIndexes.size()];
int index = 0;
for (int i = 0; i < queryDimensions.length; i++) {
if(queryDimensions[i].getDimension().hasEncoding(Encoding.DICTIONARY) ||
queryDimensions[i].getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY) ) {
actualIndexInSurrogateKey[index++] = Arrays.binarySearch(primitive,
queryDimensions[i].getDimension().getOrdinal());
if (queryDimensions[i].getDimension().hasEncoding(Encoding.DICTIONARY) || queryDimensions[i]
.getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY)) {
actualIndexInSurrogateKey[index++] =
Arrays.binarySearch(primitive, queryDimensions[i].getDimension().getOrdinal());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public StructQueryType(String name, String parentname, int blockIndex) {
ByteBuffer byteArray = ByteBuffer.wrap(input);
int childElement = byteArray.getInt();
dataOutputStream.writeInt(childElement);
if (childElement > 0){
if (childElement > 0) {
for (int i = 0; i < childElement; i++) {
children.get(i)
.parseBlocksAndReturnComplexColumnByteArray(dimensionColumnDataChunks, rowNumber,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ private int[] getComplexDimensionParentBlockIndexes(List<QueryDimension> queryDi
*/
@Override public void finish() throws QueryExecutionException {
CarbonUtil.clearBlockCache(queryProperties.dataBlocks);
if(null != queryIterator) {
if (null != queryIterator) {
queryIterator.close();
}
if (null != queryProperties.executorService) {
Expand Down
Loading

0 comments on commit 256dbed

Please sign in to comment.