Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
40 changes: 33 additions & 7 deletions fe/check/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,17 @@ under the License.
<module name="MissingOverride">
<property name="severity" value="error"/>
</module>
<module name="MissingDeprecated"/>

<!-- Block Checks -->
<module name="EmptyBlock">
<property name="option" value="TEXT"/>
<property name="tokens"
value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
<property name="severity" value="error"/>
</module>
<module name="EmptyCatchBlock">
<property name="exceptionVariableName" value="expected"/>
<property name="severity" value="error"/>
</module>
<module name="NeedBraces">
<property name="tokens"
Expand All @@ -117,12 +118,14 @@ under the License.
LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF,
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF,
OBJBLOCK, STATIC_INIT, RECORD_DEF, COMPACT_CTOR_DEF"/>
<property name="severity" value="error"/>
</module>
<module name="RightCurly">
<property name="id" value="RightCurlySame"/>
<property name="tokens"
value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE,
LITERAL_DO"/>
<property name="severity" value="error"/>
</module>
<module name="RightCurly">
<property name="id" value="RightCurlyAlone"/>
Expand All @@ -131,6 +134,7 @@ under the License.
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT,
INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF, INTERFACE_DEF, RECORD_DEF,
COMPACT_CTOR_DEF"/>
<property name="severity" value="error"/>
</module>
<module name="SuppressionXpathSingleFilter">
<!-- suppresion is required till https://github.com/checkstyle/checkstyle/issues/7541 -->
Expand All @@ -153,18 +157,27 @@ under the License.
value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
<property name="message"
value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
<property name="severity" value="error"/>
</module>
<module name="MissingSwitchDefault">
<property name="severity" value="error"/>
</module>
<module name="MultipleVariableDeclarations"/>
<module name="MultipleVariableDeclarations">
<property name="severity" value="error"/>
</module>
<module name="NoFinalizer">
<property name="severity" value="error"/>
</module>
<module name="OneStatementPerLine"/>
<module name="OneStatementPerLine">
<property name="severity" value="error"/>
</module>
<module name="OverloadMethodsDeclarationOrder"/>
<module name="StringLiteralEquality"/>
<module name="UnusedLocalVariable"/>
<module name="StringLiteralEquality">
<property name="severity" value="error"/>
</module>
<module name="UnusedLocalVariable">
<property name="severity" value="error"/>
</module>
<module name="VariableDeclarationUsageDistance"/>

<!-- Headers -->
Expand Down Expand Up @@ -244,6 +257,7 @@ under the License.
</module>
<module name="CommentsIndentation">
<property name="tokens" value="SINGLE_LINE_COMMENT, BLOCK_COMMENT_BEGIN"/>
<property name="severity" value="error"/>
</module>
<module name="Indentation">
<property name="basicOffset" value="4"/>
Expand All @@ -252,8 +266,11 @@ under the License.
<property name="throwsIndent" value="8"/>
<property name="lineWrappingIndentation" value="8"/>
<property name="arrayInitIndent" value="4"/>
<property name="severity" value="error"/>
</module>
<module name="OuterTypeFilename">
<property name="severity" value="error"/>
</module>
<module name="OuterTypeFilename"/>
<module name="UpperEll">
<property name="severity" value="error"/>
</module>
Expand Down Expand Up @@ -376,11 +393,13 @@ under the License.
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
<message key="ws.notPreceded"
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
<property name="severity" value="error"/>
</module>
<module name="MethodParamPad">
<property name="tokens"
value="CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF,
SUPER_CTOR_CALL, ENUM_CONSTANT_DEF, RECORD_DEF"/>
<property name="severity" value="error"/>
</module>
<module name="NoLineWrap">
<property name="tokens" value="PACKAGE_DEF, IMPORT, STATIC_IMPORT"/>
Expand All @@ -391,14 +410,18 @@ under the License.
value="COMMA, SEMI, POST_INC, POST_DEC, DOT,
LABELED_STAT, METHOD_REF"/>
<property name="allowLineBreaks" value="true"/>
<property name="severity" value="error"/>
</module>
<module name="NoWhitespaceBeforeCaseDefaultColon">
<property name="severity" value="error"/>
</module>
<module name="NoWhitespaceBeforeCaseDefaultColon"/>
<module name="OperatorWrap">
<property name="option" value="NL"/>
<property name="tokens"
value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR,
LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF,
TYPE_EXTENSION_AND "/>
<property name="severity" value="error"/>
</module>
<module name="ParenPad">
<property name="tokens"
Expand All @@ -407,6 +430,7 @@ under the License.
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_WHILE, METHOD_CALL,
METHOD_DEF, QUESTION, RESOURCE_SPECIFICATION, SUPER_CTOR_CALL, LAMBDA,
RECORD_DEF"/>
<property name="severity" value="error"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapDot"/>
Expand Down Expand Up @@ -439,6 +463,7 @@ under the License.
<property name="tokens"
value="COMMA, SEMI, TYPECAST, LITERAL_IF, LITERAL_ELSE,
LITERAL_WHILE, LITERAL_DO, LITERAL_FOR, DO_WHILE"/>
<property name="severity" value="error"/>
</module>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
Expand All @@ -455,6 +480,7 @@ under the License.
LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN,
NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR,
SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND"/>
<property name="severity" value="error"/>
<message key="ws.notFollowed"
value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
<message key="ws.notPreceded"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void serialize(DataOutput output) throws IOException {
// FE is big end but BE is little end.
if (isLongValue32bitEnough(singleValue)) {
output.write(SINGLE32);
output.writeInt(Integer.reverseBytes((int)singleValue));
output.writeInt(Integer.reverseBytes((int) singleValue));
} else {
output.writeByte(SINGLE64);
output.writeLong(Long.reverseBytes(singleValue));
Expand Down Expand Up @@ -227,12 +227,12 @@ public void or(BitmapValue other) {
}
}

public void remove(long value){
public void remove(long value) {
switch (this.bitmapType) { // CHECKSTYLE IGNORE THIS LINE: missing switch default
case EMPTY:
break;
case SINGLE_VALUE:
if(this.singleValue == value) {
if (this.singleValue == value) {
clear();
}
break;
Expand All @@ -256,7 +256,7 @@ public void not(BitmapValue other) {
case EMPTY:
break;
case SINGLE_VALUE:
if(other.bitmap.contains(this.singleValue)){
if (other.bitmap.contains(this.singleValue)) {
clear();
}
break;
Expand All @@ -280,16 +280,16 @@ public void xor(BitmapValue other) {
add(other.singleValue);
break;
case SINGLE_VALUE:
if(this.singleValue != other.singleValue){
if (this.singleValue != other.singleValue) {
add(other.singleValue);
}else{
} else {
clear();
}
break;
case BITMAP_VALUE:
if(!this.bitmap.contains(other.singleValue)){
if (!this.bitmap.contains(other.singleValue)) {
this.bitmap.add(other.singleValue);
}else{
} else {
this.bitmap.removeLong(other.singleValue);
convertToSmallerType();
}
Expand All @@ -305,9 +305,9 @@ public void xor(BitmapValue other) {
case SINGLE_VALUE:
this.bitmap = other.bitmap;
this.bitmapType = BITMAP_VALUE;
if(this.bitmap.contains(this.singleValue)){
if (this.bitmap.contains(this.singleValue)) {
this.bitmap.removeLong(this.singleValue);
}else{
} else {
this.bitmap.add(this.bitmapType);
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public CountingDataOutputStream(OutputStream out, long count) {
}

public long getCount() {
return ((CountingOutputStream)this.out).getCount();
return ((CountingOutputStream) this.out).getCount();
}

public void close() throws IOException {
Expand All @@ -59,7 +59,7 @@ public long getCount() {

public void write(byte[] b, int off, int len) throws IOException {
this.out.write(b, off, len);
this.count += (long)len;
this.count += len;
}

public void write(int b) throws IOException {
Expand Down
34 changes: 17 additions & 17 deletions fe/fe-common/src/main/java/org/apache/doris/common/io/Hll.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private void updateRegisters(long hashValue) {
hashValue >>>= HLL_COLUMN_PRECISION;
hashValue |= (1L << HLL_ZERO_COUNT_BITS);
byte firstOneBit = (byte) (getLongTailZeroNum(hashValue) + 1);
registers[idx] = registers[idx] > firstOneBit ? registers[idx] : firstOneBit ;
registers[idx] = registers[idx] > firstOneBit ? registers[idx] : firstOneBit;
}

private void mergeRegisters(byte[] other) {
Expand Down Expand Up @@ -217,7 +217,7 @@ public void serialize(DataOutput output) throws IOException {
output.writeInt(Integer.reverseBytes(nonZeroRegisterNum));
for (int i = 0; i < HLL_REGISTERS_COUNT; i++) {
if (registers[i] != 0) {
output.writeShort(Short.reverseBytes((short)i));
output.writeShort(Short.reverseBytes((short) i));
output.writeByte(registers[i]);
}
}
Expand Down Expand Up @@ -303,20 +303,20 @@ public strictfp long estimateCardinality() {
double estimate = alpha * numStreams * numStreams * harmonicMean;

if (estimate <= numStreams * 2.5 && numZeroRegisters != 0) {
estimate = numStreams * Math.log(((float)numStreams) / ((float)numZeroRegisters));
estimate = numStreams * Math.log(((float) numStreams) / ((float) numZeroRegisters));
} else if (numStreams == 16384 && estimate < 72000) {
double bias = 5.9119 * 1.0e-18 * (estimate * estimate * estimate * estimate)
- 1.4253 * 1.0e-12 * (estimate * estimate * estimate) +
1.2940 * 1.0e-7 * (estimate * estimate)
- 5.2921 * 1.0e-3 * estimate +
83.3216;
- 1.4253 * 1.0e-12 * (estimate * estimate * estimate)
+ 1.2940 * 1.0e-7 * (estimate * estimate)
- 5.2921 * 1.0e-3 * estimate
+ 83.3216;
estimate -= estimate * (bias / 100);
}

return (long)(estimate + 0.5);
return (long) (estimate + 0.5);
}

public int maxSerializedSize () {
public int maxSerializedSize() {
switch (type) {
case HLL_DATA_EMPTY:
default:
Expand All @@ -335,14 +335,14 @@ public int maxSerializedSize () {


private static long getLittleEndianLong(final byte[] data, final int index) {
return (((long) data[index ] & 0xff) ) |
(((long) data[index + 1] & 0xff) << 8) |
(((long) data[index + 2] & 0xff) << 16) |
(((long) data[index + 3] & 0xff) << 24) |
(((long) data[index + 4] & 0xff) << 32) |
(((long) data[index + 5] & 0xff) << 40) |
(((long) data[index + 6] & 0xff) << 48) |
(((long) data[index + 7] & 0xff) << 56);
return (((long) data[index ] & 0xff))
| (((long) data[index + 1] & 0xff) << 8)
| (((long) data[index + 2] & 0xff) << 16)
| (((long) data[index + 3] & 0xff) << 24)
| (((long) data[index + 4] & 0xff) << 32)
| (((long) data[index + 5] & 0xff) << 40)
| (((long) data[index + 6] & 0xff) << 48)
| (((long) data[index + 7] & 0xff) << 56);
}

public static long hash64(final byte[] data, final int length, final int seed) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public static long copyBytes(InputStream in, OutputStream out,
try {
Thread.sleep(sleepTime);
} catch (InterruptedException ie) {
// CHECKSTYLE IGNORE THIS LINE
}
}
}
Expand Down Expand Up @@ -250,6 +251,7 @@ public static void closeSocket(Socket sock) {
try {
sock.close();
} catch (IOException ignored) {
// CHECKSTYLE IGNORE THIS LINE
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,39 +72,35 @@ public void flush() throws IOException {
public void write(byte[] b, int off, int len) throws IOException {
long sleepTime = 0;
long curTime = 0;
try {
if ((off | len | (off + len) | (b.length - (off + len))) < 0) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return;
}
if ((off | len | (off + len) | (b.length - (off + len))) < 0) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return;
}

if (speed > 0 && !bstart) {
startTime = System.currentTimeMillis();
bstart = true;
}
long resetTime = System.currentTimeMillis();
if (resetTime - startTime > 1000) {
bytesWriteTotal = 0;
startTime = resetTime;
}
out.write(b, off, len);
if (len >= 0) {
bytesWriteTotal += len;
if (speed > 0) {
curTime = System.currentTimeMillis();
sleepTime = bytesWriteTotal / speed * 1000
- (curTime - startTime);
if (sleepTime > 0) {
try {
Thread.sleep(sleepTime);
} catch (InterruptedException ie) {
LOG.warn("Thread sleep is interrupted");
}
if (speed > 0 && !bstart) {
startTime = System.currentTimeMillis();
bstart = true;
}
long resetTime = System.currentTimeMillis();
if (resetTime - startTime > 1000) {
bytesWriteTotal = 0;
startTime = resetTime;
}
out.write(b, off, len);
if (len >= 0) {
bytesWriteTotal += len;
if (speed > 0) {
curTime = System.currentTimeMillis();
sleepTime = bytesWriteTotal / speed * 1000 - (curTime - startTime);
if (sleepTime > 0) {
try {
Thread.sleep(sleepTime);
} catch (InterruptedException ie) {
LOG.warn("Thread sleep is interrupted");
}
}
}
} finally {
}
}

Expand Down
Loading