diff --git a/fe/check/checkstyle/checkstyle.xml b/fe/check/checkstyle/checkstyle.xml
index 1bd1436b667721..b941c376b71aa1 100644
--- a/fe/check/checkstyle/checkstyle.xml
+++ b/fe/check/checkstyle/checkstyle.xml
@@ -94,16 +94,17 @@ under the License.
-
+
+
+
+
@@ -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"/>
+
@@ -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)"/>
+
-
+
+
+
-
+
+
+
-
-
+
+
+
+
+
+
@@ -244,6 +257,7 @@ under the License.
+
@@ -252,8 +266,11 @@ under the License.
+
+
+
+
-
@@ -376,11 +393,13 @@ under the License.
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
+
+
@@ -391,14 +410,18 @@ under the License.
value="COMMA, SEMI, POST_INC, POST_DEC, DOT,
LABELED_STAT, METHOD_REF"/>
+
+
+
+
-
+
+
@@ -439,6 +463,7 @@ under the License.
+
@@ -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"/>
+
>>= 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) {
@@ -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]);
}
}
@@ -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:
@@ -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) {
diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/io/IOUtils.java b/fe/fe-common/src/main/java/org/apache/doris/common/io/IOUtils.java
index 137315eddf7956..ffd2330bd30be3 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/io/IOUtils.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/io/IOUtils.java
@@ -100,6 +100,7 @@ public static long copyBytes(InputStream in, OutputStream out,
try {
Thread.sleep(sleepTime);
} catch (InterruptedException ie) {
+ // CHECKSTYLE IGNORE THIS LINE
}
}
}
@@ -250,6 +251,7 @@ public static void closeSocket(Socket sock) {
try {
sock.close();
} catch (IOException ignored) {
+ // CHECKSTYLE IGNORE THIS LINE
}
}
}
diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/io/LimitOutputStream.java b/fe/fe-common/src/main/java/org/apache/doris/common/io/LimitOutputStream.java
index 648f2e49eeddb2..e71af2dbbd0f1f 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/io/LimitOutputStream.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/io/LimitOutputStream.java
@@ -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 {
}
}
diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/io/Text.java b/fe/fe-common/src/main/java/org/apache/doris/common/io/Text.java
index a8977e5ed7f9d0..7331195d326060 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/io/Text.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/io/Text.java
@@ -470,65 +470,65 @@ public static void validateUTF8(byte[] utf8, int start, int len)
int aByte = ((int) utf8[count] & 0xFF);
switch (state) { // CHECKSTYLE IGNORE THIS LINE: missing switch default
- case LEAD_BYTE:
- leadByte = aByte;
- length = bytesFromUTF8[aByte];
+ case LEAD_BYTE:
+ leadByte = aByte;
+ length = bytesFromUTF8[aByte];
+
+ switch (length) {
+ case 0: // check for ASCII
+ if (leadByte > 0x7F) {
+ throw new MalformedInputException(count);
+ }
+ break;
+ case 1:
+ if (leadByte < 0xC2 || leadByte > 0xDF) {
+ throw new MalformedInputException(count);
+ }
+ state = TRAIL_BYTE_1;
+ break;
+ case 2:
+ if (leadByte < 0xE0 || leadByte > 0xEF) {
+ throw new MalformedInputException(count);
+ }
+ state = TRAIL_BYTE_1;
+ break;
+ case 3:
+ if (leadByte < 0xF0 || leadByte > 0xF4) {
+ throw new MalformedInputException(count);
+ }
+ state = TRAIL_BYTE_1;
+ break;
+ default:
+ // too long! Longest valid UTF-8 is 4 bytes (lead + three)
+ // or if < 0 we got a trail byte in the lead byte position
+ throw new MalformedInputException(count);
+ } // switch (length)
+ break;
- switch (length) {
- case 0: // check for ASCII
- if (leadByte > 0x7F) {
+ case TRAIL_BYTE_1:
+ if (leadByte == 0xF0 && aByte < 0x90) {
throw new MalformedInputException(count);
}
- break;
- case 1:
- if (leadByte < 0xC2 || leadByte > 0xDF) {
+ if (leadByte == 0xF4 && aByte > 0x8F) {
throw new MalformedInputException(count);
}
- state = TRAIL_BYTE_1;
- break;
- case 2:
- if (leadByte < 0xE0 || leadByte > 0xEF) {
+ if (leadByte == 0xE0 && aByte < 0xA0) {
throw new MalformedInputException(count);
}
- state = TRAIL_BYTE_1;
- break;
- case 3:
- if (leadByte < 0xF0 || leadByte > 0xF4) {
+ if (leadByte == 0xED && aByte > 0x9F) {
+ throw new MalformedInputException(count);
+ }
+ // falls through to regular trail-byte test!!
+ case TRAIL_BYTE:
+ if (aByte < 0x80 || aByte > 0xBF) {
throw new MalformedInputException(count);
}
- state = TRAIL_BYTE_1;
+ if (--length == 0) {
+ state = LEAD_BYTE;
+ } else {
+ state = TRAIL_BYTE;
+ }
break;
- default:
- // too long! Longest valid UTF-8 is 4 bytes (lead + three)
- // or if < 0 we got a trail byte in the lead byte position
- throw new MalformedInputException(count);
- } // switch (length)
- break;
-
- case TRAIL_BYTE_1:
- if (leadByte == 0xF0 && aByte < 0x90) {
- throw new MalformedInputException(count);
- }
- if (leadByte == 0xF4 && aByte > 0x8F) {
- throw new MalformedInputException(count);
- }
- if (leadByte == 0xE0 && aByte < 0xA0) {
- throw new MalformedInputException(count);
- }
- if (leadByte == 0xED && aByte > 0x9F) {
- throw new MalformedInputException(count);
- }
- // falls through to regular trail-byte test!!
- case TRAIL_BYTE:
- if (aByte < 0x80 || aByte > 0xBF) {
- throw new MalformedInputException(count);
- }
- if (--length == 0) {
- state = LEAD_BYTE;
- } else {
- state = TRAIL_BYTE;
- }
- break;
} // switch (state)
count++;
}
@@ -577,29 +577,29 @@ public static int bytesToCodePoint(ByteBuffer bytes) {
int ch = 0;
switch (extraBytesToRead) { // CHECKSTYLE IGNORE THIS LINE: missing switch default
- case 5:
- ch += (bytes.get() & 0xFF);
- ch <<= 6; /* remember, illegal UTF-8 */
- // CHECKSTYLE IGNORE THIS LINE: fall through
- case 4:
- ch += (bytes.get() & 0xFF);
- ch <<= 6; /* remember, illegal UTF-8 */
- // CHECKSTYLE IGNORE THIS LINE: fall through
- case 3:
- ch += (bytes.get() & 0xFF);
- ch <<= 6;
- // CHECKSTYLE IGNORE THIS LINE: fall through
- case 2:
- ch += (bytes.get() & 0xFF);
- ch <<= 6;
- // CHECKSTYLE IGNORE THIS LINE: fall through
- case 1:
- ch += (bytes.get() & 0xFF);
- ch <<= 6;
- // CHECKSTYLE IGNORE THIS LINE: fall through
- case 0:
- ch += (bytes.get() & 0xFF);
- // CHECKSTYLE IGNORE THIS LINE: fall through, missing switch default
+ case 5:
+ ch += (bytes.get() & 0xFF);
+ ch <<= 6; /* remember, illegal UTF-8 */
+ // CHECKSTYLE IGNORE THIS LINE: fall through
+ case 4:
+ ch += (bytes.get() & 0xFF);
+ ch <<= 6; /* remember, illegal UTF-8 */
+ // CHECKSTYLE IGNORE THIS LINE: fall through
+ case 3:
+ ch += (bytes.get() & 0xFF);
+ ch <<= 6;
+ // CHECKSTYLE IGNORE THIS LINE: fall through
+ case 2:
+ ch += (bytes.get() & 0xFF);
+ ch <<= 6;
+ // CHECKSTYLE IGNORE THIS LINE: fall through
+ case 1:
+ ch += (bytes.get() & 0xFF);
+ ch <<= 6;
+ // CHECKSTYLE IGNORE THIS LINE: fall through
+ case 0:
+ ch += (bytes.get() & 0xFF);
+ // CHECKSTYLE IGNORE THIS LINE: fall through, missing switch default
}
ch -= offsetsFromUTF8[extraBytesToRead];
diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/AutoType.java b/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/AutoType.java
index 3b30b04c85b179..eeebc76e7e5816 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/AutoType.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/AutoType.java
@@ -31,11 +31,11 @@ public static boolean isWrapperOfPrimitiveType(Class> type) {
}
public static Class> getPrimitiveType(Class> wrapperType) {
- return (Class)WRAPPER_TO_PRIMITIVE.get(wrapperType);
+ return WRAPPER_TO_PRIMITIVE.get(wrapperType);
}
public static Class> getWrapperType(Class> primitiveType) {
- return (Class)PRIMITIVE_TO_WRAPPER.get(primitiveType);
+ return PRIMITIVE_TO_WRAPPER.get(primitiveType);
}
static {
diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/ConstructorReflection.java b/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/ConstructorReflection.java
index e270078739fc1f..1636554fbc8e11 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/ConstructorReflection.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/ConstructorReflection.java
@@ -36,9 +36,9 @@ public static T invoke(Constructor constructor, Object... initArgs) {
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause instanceof Error) {
- throw (Error)cause;
+ throw (Error) cause;
} else if (cause instanceof RuntimeException) {
- throw (RuntimeException)cause;
+ throw (RuntimeException) cause;
} else {
throw new IllegalStateException("Should never get here", cause);
}
@@ -62,7 +62,7 @@ public static T newInstance(Class extends T> aClass, Object... nonNullArgs
* invoke the constructor with no parameters of {@aClass Class}.
*/
private static T newInstance(Class aClass) {
- return (T) newInstance((Class)aClass, ParameterReflection.NO_PARAMETERS);
+ return (T) newInstance((Class) aClass, ParameterReflection.NO_PARAMETERS);
}
/**
@@ -124,12 +124,12 @@ private static Constructor findCompatibleConstructor(Class> theClass, C
Constructor>[] declaredConstructors = theClass.getDeclaredConstructors();
Constructor[] declaredConstructorsArray = declaredConstructors;
- for(Constructor> declaredConstructor : declaredConstructorsArray) {
+ for (Constructor> declaredConstructor : declaredConstructorsArray) {
Class>[] declaredParamTypes = declaredConstructor.getParameterTypes();
int gap = declaredParamTypes.length - argTypes.length;
- if (gap == 0 && (ParameterReflection.matchesParameterTypes(declaredParamTypes, argTypes) ||
- ParameterReflection.acceptsArgumentTypes(declaredParamTypes, argTypes) ) &&
- (found == null || ParameterReflection.hasMoreSpecificTypes(declaredParamTypes, foundParameters))) {
+ if (gap == 0 && (ParameterReflection.matchesParameterTypes(declaredParamTypes, argTypes)
+ || ParameterReflection.acceptsArgumentTypes(declaredParamTypes, argTypes))
+ && (found == null || ParameterReflection.hasMoreSpecificTypes(declaredParamTypes, foundParameters))) {
found = (Constructor) declaredConstructor;
foundParameters = declaredParamTypes;
}
diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/Deencapsulation.java b/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/Deencapsulation.java
index 4aa1e988afec51..5fb33717e00222 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/Deencapsulation.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/Deencapsulation.java
@@ -21,11 +21,11 @@ public static T getField(Object objectWithField, Class fieldType) {
}
public static T getField(Class> classWithStaticField, String fieldName) {
- return FieldReflection.getField(classWithStaticField, fieldName, (Object)null);
+ return FieldReflection.getField(classWithStaticField, fieldName, null);
}
public static T getField(Class> classWithStaticField, Class fieldType) {
- return FieldReflection.getField(classWithStaticField, fieldType, (Object)null);
+ return FieldReflection.getField(classWithStaticField, fieldType, null);
}
public static void setField(Object objectWithField, String fieldName, Object fieldValue) {
@@ -33,15 +33,15 @@ public static void setField(Object objectWithField, String fieldName, Object fie
}
public static void setField(Object objectWithField, Object fieldValue) {
- FieldReflection.setField(objectWithField.getClass(), objectWithField, (String)null, fieldValue);
+ FieldReflection.setField(objectWithField.getClass(), objectWithField, null, fieldValue);
}
public static void setField(Class> classWithStaticField, String fieldName, Object fieldValue) {
- FieldReflection.setField(classWithStaticField, (Object)null, fieldName, fieldValue);
+ FieldReflection.setField(classWithStaticField, null, fieldName, fieldValue);
}
public static void setField(Class> classWithStaticField, Object fieldValue) {
- FieldReflection.setField(classWithStaticField, (Object)null, (String)null, fieldValue);
+ FieldReflection.setField(classWithStaticField, null, null, fieldValue);
}
public static T invoke(Object objectWithMethod, String methodName, Object... nonNullArgs) {
@@ -50,7 +50,7 @@ public static T invoke(Object objectWithMethod, String methodName, Object...
}
public static T invoke(Class> classWithStaticMethod, String methodName, Object... nonNullArgs) {
- return MethodReflection.invoke(classWithStaticMethod, (Object)null, methodName, nonNullArgs);
+ return MethodReflection.invoke(classWithStaticMethod, null, methodName, nonNullArgs);
}
public static T newInstance(Class extends T> classToInstantiate, Object... nonNullArgs) {
diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/FieldReflection.java b/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/FieldReflection.java
index e7aaae6daf6646..1974d4f53b4f43 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/FieldReflection.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/FieldReflection.java
@@ -140,7 +140,7 @@ private static Field getDeclaredFieldInSingleClass(Class> theClass, Type desir
Field found = null;
Field[] fields = theClass.getDeclaredFields();
- for(Field field : fields) {
+ for (Field field : fields) {
if (!field.isSynthetic()) {
Type fieldType = field.getGenericType();
if (instanceField != Modifier.isStatic(field.getModifiers()) && isCompatibleFieldType(fieldType, desiredType, forAssignment)) {
@@ -178,9 +178,10 @@ private static boolean isCompatibleFieldType(Type fieldType, Type desiredType, b
}
private static String errorMessageForMoreThanOneFieldFound(Type desiredFieldType, boolean instanceField, boolean forAssignment, Field firstField, Field secondField) {
- return "More than one " + (instanceField ? "instance" : "static") + " field " + (forAssignment ? "to" : "from") + " which a value of type " +
- getTypeName(desiredFieldType) + (forAssignment ? " can be assigned" : " can be read") + " exists in " +
- secondField.getDeclaringClass() + ": " + firstField.getName() + ", " + secondField.getName();
+ return "More than one " + (instanceField ? "instance" : "static") + " field " + (forAssignment ? "to" : "from")
+ + " which a value of type "
+ + getTypeName(desiredFieldType) + (forAssignment ? " can be assigned" : " can be read") + " exists in "
+ + secondField.getDeclaringClass() + ": " + firstField.getName() + ", " + secondField.getName();
}
private static String getTypeName(Type type) {
@@ -207,7 +208,7 @@ private static T getFieldValue(Field field, Object targetObject) {
makeAccessible(field);
try {
- return (T)field.get(targetObject);
+ return (T) field.get(targetObject);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
@@ -254,19 +255,19 @@ private static void setStaticFinalField(Field field, Object value) throws Illega
*/
public static Class> getClassType(Type declaredType) {
- while(!(declaredType instanceof Class)) {
+ while (!(declaredType instanceof Class)) {
if (declaredType instanceof ParameterizedType) {
- return (Class)((ParameterizedType)declaredType).getRawType();
+ return (Class) ((ParameterizedType) declaredType).getRawType();
}
if (!(declaredType instanceof TypeVariable)) {
throw new IllegalArgumentException("Type of unexpected kind: " + declaredType);
}
- declaredType = ((TypeVariable)declaredType).getBounds()[0];
+ declaredType = ((TypeVariable) declaredType).getBounds()[0];
}
- return (Class)declaredType;
+ return (Class) declaredType;
}
// ensure that field is accessible
@@ -278,9 +279,9 @@ public static void makeAccessible(AccessibleObject classMember) {
// return true if the two types are same type.
private static boolean isSameType(Class> firstType, Class> secondType) {
- return firstType == secondType ||
- firstType.isPrimitive() && firstType == AutoType.getPrimitiveType(secondType) ||
- secondType.isPrimitive() && firstType == AutoType.getPrimitiveType(secondType);
+ return firstType == secondType
+ || firstType.isPrimitive() && firstType == AutoType.getPrimitiveType(secondType)
+ || secondType.isPrimitive() && firstType == AutoType.getPrimitiveType(secondType);
}
}
diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/MethodReflection.java b/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/MethodReflection.java
index f81e957a063470..47bd5e5f2ad6c4 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/MethodReflection.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/MethodReflection.java
@@ -48,11 +48,11 @@ public static T invoke(Object targetInstance, Method method, Object... metho
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause instanceof Error) {
- throw (Error)cause;
+ throw (Error) cause;
} else if (cause instanceof RuntimeException) {
- throw (RuntimeException)cause;
+ throw (RuntimeException) cause;
} else {
- ThrowOfCheckedException.doThrow((Exception)cause);
+ ThrowOfCheckedException.doThrow((Exception) cause);
return null;
}
}
@@ -103,13 +103,14 @@ private static Method findCompatibleMethodInClass(Class> theClass, String meth
Class>[] foundParamTypes = null;
Method[] methods = theClass.getDeclaredMethods();
- for(Method declaredMethod : methods) {
+ for (Method declaredMethod : methods) {
if (declaredMethod.getName().equals(methodName)) {
Class>[] declaredParamTypes = declaredMethod.getParameterTypes();
int gap = declaredParamTypes.length - argTypes.length;
- if (gap == 0 && (ParameterReflection.matchesParameterTypes(declaredParamTypes, argTypes) ||
- ParameterReflection.acceptsArgumentTypes(declaredParamTypes, argTypes) ) &&
- (foundParamTypes == null || ParameterReflection.hasMoreSpecificTypes(declaredParamTypes, foundParamTypes))) {
+ if (gap == 0 && (ParameterReflection.matchesParameterTypes(declaredParamTypes, argTypes)
+ || ParameterReflection.acceptsArgumentTypes(declaredParamTypes, argTypes))
+ && (foundParamTypes == null
+ || ParameterReflection.hasMoreSpecificTypes(declaredParamTypes, foundParamTypes))) {
found = declaredMethod;
foundParamTypes = declaredParamTypes;
}
@@ -129,7 +130,7 @@ private static Method findCompatibleMethodIfAvailable(Class> theClass, String
}
Method methodFound = null;
- while(true) {
+ while (true) {
Method compatibleMethod = findCompatibleMethodInClass(theClass, methodName, argTypes);
if (compatibleMethod != null && (methodFound == null || ParameterReflection.hasMoreSpecificTypes(compatibleMethod.getParameterTypes(), methodFound.getParameterTypes()))) {
methodFound = compatibleMethod;
@@ -155,8 +156,8 @@ public static void makeAccessible(AccessibleObject classMember) {
// return true if the two types are same type.
private static boolean isSameType(Class> firstType, Class> secondType) {
- return firstType == secondType ||
- firstType.isPrimitive() && firstType == AutoType.getPrimitiveType(secondType) ||
- secondType.isPrimitive() && firstType == AutoType.getPrimitiveType(secondType);
+ return firstType == secondType
+ || firstType.isPrimitive() && firstType == AutoType.getPrimitiveType(secondType)
+ || secondType.isPrimitive() && firstType == AutoType.getPrimitiveType(secondType);
}
}
diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/ParameterReflection.java b/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/ParameterReflection.java
index f97195305aa964..9c47ffe5d84574 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/ParameterReflection.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/jmockit/ParameterReflection.java
@@ -26,7 +26,7 @@ static boolean matchesParameterTypes(Class>[] declaredTypes, Class>[] specif
if (declaredTypes == null || specifiedTypes == null) {
throw new IllegalArgumentException();
}
- for(int i = 0; i < declaredTypes.length; ++i) {
+ for (int i = 0; i < declaredTypes.length; ++i) {
Class> declaredType = declaredTypes[i];
Class> specifiedType = specifiedTypes[i];
if (!isSameType(declaredType, specifiedType)) {
@@ -44,7 +44,7 @@ static boolean acceptsArgumentTypes(Class>[] paramTypes, Class>[] argTypes)
if (paramTypes == null || argTypes == null) {
throw new IllegalArgumentException();
}
- for(int i = 0; i < paramTypes.length; ++i) {
+ for (int i = 0; i < paramTypes.length; ++i) {
Class> parType = paramTypes[i];
Class> argType = argTypes[i];
if (!isSameType(parType, argType) && !parType.isAssignableFrom(argType)) {
@@ -67,7 +67,7 @@ static Class>[] getArgumentTypesFromArgumentValues(Object... args) {
} else {
Class>[] argTypes = new Class[args.length];
- for(int i = 0; i < args.length; ++i) {
+ for (int i = 0; i < args.length; ++i) {
argTypes[i] = getArgumentTypeFromArgumentValue(i, args);
}
@@ -102,7 +102,7 @@ static boolean hasMoreSpecificTypes(Class>[] currentTypes, Class>[] previous
if (currentTypes == null || previousTypes == null) {
throw new IllegalArgumentException();
}
- for(int i = 0; i < currentTypes.length; ++i) {
+ for (int i = 0; i < currentTypes.length; ++i) {
Class> current = wrappedIfPrimitive(currentTypes[i]);
Class> previous = wrappedIfPrimitive(previousTypes[i]);
if (current != previous && previous.isAssignableFrom(current)) {
@@ -160,9 +160,9 @@ private static Class> wrappedIfPrimitive(Class> parameterType) {
// return true if the two types are same type.
private static boolean isSameType(Class> firstType, Class> secondType) {
- return firstType == secondType ||
- firstType.isPrimitive() && firstType == AutoType.getPrimitiveType(secondType) ||
- secondType.isPrimitive() && secondType == AutoType.getPrimitiveType(firstType);
+ return firstType == secondType
+ || firstType.isPrimitive() && firstType == AutoType.getPrimitiveType(secondType)
+ || secondType.isPrimitive() && secondType == AutoType.getPrimitiveType(firstType);
}
}
diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/property/PropertiesSet.java b/fe/fe-common/src/main/java/org/apache/doris/common/property/PropertiesSet.java
index 0eb32c6ad7d68b..5a0fd62a5116e3 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/property/PropertiesSet.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/property/PropertiesSet.java
@@ -44,8 +44,8 @@ private PropertiesSet(T schemaGroup, Map properties) {
@SuppressWarnings("unchecked")
public U get(PropertySchema prop) throws NoSuchElementException {
- return properties.containsKey(prop.getName()) ?
- (U) properties.get(prop.getName()) : prop.getDefaultValue().get();
+ return properties.containsKey(prop.getName())
+ ? (U) properties.get(prop.getName()) : prop.getDefaultValue().get();
}
public List getModifiedSchemas() {
diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/property/PropertySchema.java b/fe/fe-common/src/main/java/org/apache/doris/common/property/PropertySchema.java
index af61642ac11c00..b68d2072bfdbe3 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/property/PropertySchema.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/property/PropertySchema.java
@@ -31,7 +31,7 @@
import java.util.Date;
import java.util.Optional;
-@SuppressWarnings({"unchecked","rawtypes"})
+@SuppressWarnings({"unchecked", "rawtypes"})
public abstract class PropertySchema {
private final String name;
private final boolean required;
@@ -190,8 +190,8 @@ public static final class BooleanProperty extends ComparableProperty {
@Override
public Boolean read(String rawVal) {
- if (rawVal == null ||
- (!rawVal.equalsIgnoreCase("true") && !rawVal.equalsIgnoreCase("false"))) {
+ if (rawVal == null || (!rawVal.equalsIgnoreCase("true")
+ && !rawVal.equalsIgnoreCase("false"))) {
throw new IllegalArgumentException(String.format("Invalid boolean : %s, use true or false", rawVal));
}
diff --git a/fe/fe-common/src/test/java/org/apache/doris/common/io/BitmapValueTest.java b/fe/fe-common/src/test/java/org/apache/doris/common/io/BitmapValueTest.java
index 8c802da3ee0f99..785574981dbb5c 100644
--- a/fe/fe-common/src/test/java/org/apache/doris/common/io/BitmapValueTest.java
+++ b/fe/fe-common/src/test/java/org/apache/doris/common/io/BitmapValueTest.java
@@ -117,7 +117,7 @@ public void testBitmapValueAnd() {
// empty and bitmap
BitmapValue bitmapValue3 = new BitmapValue();
- BitmapValue bitmapValue3Dot1 =new BitmapValue();
+ BitmapValue bitmapValue3Dot1 = new BitmapValue();
bitmapValue3Dot1.add(1);
bitmapValue3Dot1.add(2);
bitmapValue3.and(bitmapValue3Dot1);
@@ -267,7 +267,7 @@ public void testBitmapValueOr() {
BitmapValue bitmapValue7 = new BitmapValue();
bitmapValue7.add(1);
bitmapValue7.add(2);
- BitmapValue bitmapValue7Dot1 =new BitmapValue();
+ BitmapValue bitmapValue7Dot1 = new BitmapValue();
bitmapValue7.or(bitmapValue7Dot1);
Assert.assertTrue(bitmapValue7.getBitmapType() == BitmapValue.BITMAP_VALUE);
@@ -275,7 +275,7 @@ public void testBitmapValueOr() {
BitmapValue bitmapValue8 = new BitmapValue();
bitmapValue8.add(1);
bitmapValue8.add(2);
- BitmapValue bitmapValue8Dot1 =new BitmapValue();
+ BitmapValue bitmapValue8Dot1 = new BitmapValue();
bitmapValue8Dot1.add(1);
bitmapValue8.or(bitmapValue8Dot1);
Assert.assertTrue(bitmapValue8.getBitmapType() == BitmapValue.BITMAP_VALUE);
@@ -284,7 +284,7 @@ public void testBitmapValueOr() {
BitmapValue bitmapValue9 = new BitmapValue();
bitmapValue9.add(1);
bitmapValue9.add(2);
- BitmapValue bitmapValue9Dot1 =new BitmapValue();
+ BitmapValue bitmapValue9Dot1 = new BitmapValue();
bitmapValue9.or(bitmapValue9Dot1);
Assert.assertTrue(bitmapValue9.getBitmapType() == BitmapValue.BITMAP_VALUE);
}
@@ -459,7 +459,7 @@ public void testEqual() {
@Test
- public void testBitmapOrDeepCopy(){
+ public void testBitmapOrDeepCopy() {
// this test is added for issue #6452
// baseIndex bitmap type == Roaring64Map
BitmapValue baseIndex1 = new BitmapValue();
diff --git a/fe/fe-common/src/test/java/org/apache/doris/common/io/HllTest.java b/fe/fe-common/src/test/java/org/apache/doris/common/io/HllTest.java
index 78ba33b6929f8c..fabc7c1f8da70f 100644
--- a/fe/fe-common/src/test/java/org/apache/doris/common/io/HllTest.java
+++ b/fe/fe-common/src/test/java/org/apache/doris/common/io/HllTest.java
@@ -76,8 +76,8 @@ public void hllBasicTest() throws IOException {
}
Assert.assertTrue(sparseHll.getType() == Hll.HLL_DATA_FULL);
// 2% error rate
- Assert.assertTrue(sparseHll.estimateCardinality() > Hll.HLL_SPARSE_THRESHOLD * (1 - 0.02) &&
- sparseHll.estimateCardinality() < Hll.HLL_SPARSE_THRESHOLD * (1 + 0.02));
+ Assert.assertTrue(sparseHll.estimateCardinality() > Hll.HLL_SPARSE_THRESHOLD * (1 - 0.02)
+ && sparseHll.estimateCardinality() < Hll.HLL_SPARSE_THRESHOLD * (1 + 0.02));
ByteArrayOutputStream sparseOutputStream = new ByteArrayOutputStream();
DataOutput sparseOutput = new DataOutputStream(sparseOutputStream);
@@ -97,8 +97,8 @@ public void hllBasicTest() throws IOException {
Assert.assertTrue(fullHll.getType() == Hll.HLL_DATA_FULL);
// the result 32748 is consistent with C++ 's implementation
Assert.assertTrue(fullHll.estimateCardinality() == 32748);
- Assert.assertTrue(fullHll.estimateCardinality() > Short.MAX_VALUE * (1 - 0.02) &&
- fullHll.estimateCardinality() < Short.MAX_VALUE * (1 + 0.02));
+ Assert.assertTrue(fullHll.estimateCardinality() > Short.MAX_VALUE * (1 - 0.02)
+ && fullHll.estimateCardinality() < Short.MAX_VALUE * (1 + 0.02));
ByteArrayOutputStream fullHllOutputStream = new ByteArrayOutputStream();
DataOutput fullHllOutput = new DataOutputStream(fullHllOutputStream);
@@ -116,18 +116,18 @@ public void hllBasicTest() throws IOException {
@Test
public void testCompareEstimateValueWithBe() throws IOException {
//empty
- {
+ { // CHECKSTYLE IGNORE THIS LINE
Hll hll = new Hll();
long estimateValue = hll.estimateCardinality();
byte[] serializedByte = serializeHll(hll);
hll = deserializeHll(serializedByte);
Assert.assertTrue(estimateValue == hll.estimateCardinality());
- }
+ } // CHECKSTYLE IGNORE THIS LINE
// explicit [0. 100)
Hll explicitHll = new Hll();
- {
+ { // CHECKSTYLE IGNORE THIS LINE
for (int i = 0; i < 100; i++) {
explicitHll.updateWithHash(i);
}
@@ -144,11 +144,11 @@ public void testCompareEstimateValueWithBe() throws IOException {
explicitHll.merge(otherHll);
// compare with C++ version result
Assert.assertTrue(explicitHll.estimateCardinality() == 100);
- }
+ } // CHECKSTYLE IGNORE THIS LINE
// sparse [1024, 2048)
Hll sparseHll = new Hll();
- {
+ { // CHECKSTYLE IGNORE THIS LINE
for (int i = 0; i < 1024; i++) {
sparseHll.updateWithHash(i + 1024);
}
@@ -174,11 +174,11 @@ public void testCompareEstimateValueWithBe() throws IOException {
Assert.assertTrue(cardinality > 1000 && cardinality < 1045);
// compare with C++ version result
Assert.assertTrue(cardinality == 1023);
- }
+ } // CHECKSTYLE IGNORE THIS LINE
// full [64 * 1024, 128 * 1024)
Hll fullHll = new Hll();
- {
+ { // CHECKSTYLE IGNORE THIS LINE
for (int i = 0; i < 64 * 1024; i++) {
fullHll.updateWithHash(64 * 1024 + i);
}
@@ -195,16 +195,16 @@ public void testCompareEstimateValueWithBe() throws IOException {
// compare with C++ version result
Assert.assertTrue(preValue == 66112);
- }
+ } // CHECKSTYLE IGNORE THIS LINE
// merge explicit to empty_hll
- {
+ { // CHECKSTYLE IGNORE THIS LINE
Hll newExplicit = new Hll();
newExplicit.merge(explicitHll);
Assert.assertTrue(newExplicit.estimateCardinality() == 100);
// merge another explicit
- {
+ { // CHECKSTYLE IGNORE THIS LINE
Hll otherHll = new Hll();
for (int i = 100; i < 200; i++) {
otherHll.updateWithHash(i);
@@ -214,18 +214,18 @@ public void testCompareEstimateValueWithBe() throws IOException {
Assert.assertTrue(otherHll.estimateCardinality() > 190);
// compare with C++ version result
Assert.assertTrue(otherHll.estimateCardinality() == 201);
- }
+ } // CHECKSTYLE IGNORE THIS LINE
// merge full
- {
+ { // CHECKSTYLE IGNORE THIS LINE
newExplicit.merge(fullHll);
Assert.assertTrue(newExplicit.estimateCardinality() > fullHll.estimateCardinality());
// compare with C++ version result
Assert.assertTrue(newExplicit.estimateCardinality() == 66250);
- }
- }
+ } // CHECKSTYLE IGNORE THIS LINE
+ } // CHECKSTYLE IGNORE THIS LINE
// merge sparse into empty
- {
+ { // CHECKSTYLE IGNORE THIS LINE
Hll newSparseHll = new Hll();
newSparseHll.merge(sparseHll);
Assert.assertTrue(sparseHll.estimateCardinality() == newSparseHll.estimateCardinality());
@@ -243,7 +243,7 @@ public void testCompareEstimateValueWithBe() throws IOException {
Assert.assertTrue(newSparseHll.estimateCardinality() > fullHll.estimateCardinality());
// compare with C++ version result
Assert.assertTrue(newSparseHll.estimateCardinality() == 67316);
- }
+ } // CHECKSTYLE IGNORE THIS LINE
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/PaloFe.java b/fe/fe-core/src/main/java/org/apache/doris/PaloFe.java
index 612c97893740ac..32ebb5d6917a48 100755
--- a/fe/fe-core/src/main/java/org/apache/doris/PaloFe.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/PaloFe.java
@@ -145,7 +145,7 @@ public static void start(String dorisHomeDir, String pidDir, String[] args) {
httpServer.setWorkers(Config.jetty_server_workers);
httpServer.setMaxThreads(Config.jetty_threadPool_maxThreads);
httpServer.setMinThreads(Config.jetty_threadPool_minThreads);
- httpServer.setMaxHttpHeaderSize (Config.jetty_server_max_http_header_size);
+ httpServer.setMaxHttpHeaderSize(Config.jetty_server_max_http_header_size);
httpServer.start();
qeService.start();
diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/AlterJobV2.java b/fe/fe-core/src/main/java/org/apache/doris/alter/AlterJobV2.java
index 34fc631f2ee9f2..cb58707c1a1977 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/alter/AlterJobV2.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/alter/AlterJobV2.java
@@ -45,8 +45,7 @@ public abstract class AlterJobV2 implements Writable {
public enum JobState {
PENDING, // Job is created
- WAITING_TXN, // New replicas are created and Shadow catalog object is visible for incoming txns,
- // waiting for previous txns to be finished
+ WAITING_TXN, // New replicas are created and Shadow catalog object is visible for incoming txns, waiting for previous txns to be finished
RUNNING, // alter tasks are sent to BE, and waiting for them finished.
FINISHED, // job is done
CANCELLED; // job is cancelled(failed or be cancelled by user)
@@ -159,17 +158,17 @@ public synchronized void run() {
try {
switch (jobState) {
- case PENDING:
- runPendingJob();
- break;
- case WAITING_TXN:
- runWaitingTxnJob();
- break;
- case RUNNING:
- runRunningJob();
- break;
- default:
- break;
+ case PENDING:
+ runPendingJob();
+ break;
+ case WAITING_TXN:
+ runWaitingTxnJob();
+ break;
+ case RUNNING:
+ runRunningJob();
+ break;
+ default:
+ break;
}
} catch (AlterCancelException e) {
cancelImpl(e.getMessage());
diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java b/fe/fe-core/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java
index 4d7eb8f5a5ba6e..2c8e3dc550aef1 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java
@@ -246,8 +246,8 @@ public void processBatchAddRollup(List alterClauses, Database db, O
Map properties = addRollupClause.getProperties();
if (properties == null || !properties.containsKey(PropertyAnalyzer.PROPERTIES_STORAGE_FORMAT)
|| !properties.get(PropertyAnalyzer.PROPERTIES_STORAGE_FORMAT).equalsIgnoreCase("v2")) {
- throw new DdlException("Table[" + olapTable.getName() + "] can not " +
- "add segment v2 rollup index without setting storage format to v2.");
+ throw new DdlException("Table[" + olapTable.getName() + "] can not "
+ + "add segment v2 rollup index without setting storage format to v2.");
}
rollupIndexName = NEW_STORAGE_FORMAT_INDEX_NAME_PREFIX + olapTable.getName();
changeStorageFormat = true;
@@ -461,8 +461,8 @@ private List checkAndPrepareMaterializedView(CreateMaterializedViewStmt
}
if (baseAggregationType != mvAggregationType) {
throw new DdlException(
- "The aggregation type of column[" + mvColumnName + "] must be same as the aggregate " +
- "type of base column in aggregate table");
+ "The aggregation type of column[" + mvColumnName + "] must be same as the aggregate "
+ + "type of base column in aggregate table");
}
if (baseAggregationType != null && baseAggregationType.isReplaceFamily() && olapTable
.getKeysNum() != numOfKeys) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
index 89b40db88b6f74..46c65acf211e09 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
@@ -255,8 +255,8 @@ private void processDropColumn(DropColumnClause alterClause, OlapTable olapTable
for (Column column : baseSchema) {
if (column.isKey() && column.getName().equalsIgnoreCase(dropColName)) {
isKey = true;
- } else if (AggregateType.REPLACE == column.getAggregationType() ||
- AggregateType.REPLACE_IF_NOT_NULL == column.getAggregationType()) {
+ } else if (AggregateType.REPLACE == column.getAggregationType()
+ || AggregateType.REPLACE_IF_NOT_NULL == column.getAggregationType()) {
hasReplaceColumn = true;
}
}
@@ -273,8 +273,8 @@ private void processDropColumn(DropColumnClause alterClause, OlapTable olapTable
for (Column column : targetIndexSchema) {
if (column.isKey() && column.getName().equalsIgnoreCase(dropColName)) {
isKey = true;
- } else if (AggregateType.REPLACE == column.getAggregationType() ||
- AggregateType.REPLACE_IF_NOT_NULL == column.getAggregationType()) {
+ } else if (AggregateType.REPLACE == column.getAggregationType()
+ || AggregateType.REPLACE_IF_NOT_NULL == column.getAggregationType()) {
hasReplaceColumn = true;
}
}
@@ -360,7 +360,6 @@ private void processModifyColumn(ModifyColumnClause alterClause, Table externalT
String newColName = modColumn.getName();
boolean hasColPos = (columnPos != null && !columnPos.isFirst());
boolean found = false;
- boolean typeChanged = false;
int modColIndex = -1;
int lastColIndex = -1;
@@ -369,9 +368,6 @@ private void processModifyColumn(ModifyColumnClause alterClause, Table externalT
if (col.getName().equalsIgnoreCase(newColName)) {
modColIndex = i;
found = true;
- if (!col.equals(modColumn)) {
- typeChanged = true;
- }
}
if (hasColPos) {
if (col.getName().equalsIgnoreCase(columnPos.getLastCol())) {
@@ -781,8 +777,8 @@ private void addColumnInternal(OlapTable olapTable, Column newColumn, ColumnPosi
throw new DdlException("Can not assign aggregation method on column in Duplicate data model table: " + newColName);
}
if (!newColumn.isKey()) {
- if (targetIndexId != -1L &&
- olapTable.getIndexMetaByIndexId(targetIndexId).getKeysType() == KeysType.AGG_KEYS) {
+ if (targetIndexId != -1L
+ && olapTable.getIndexMetaByIndexId(targetIndexId).getKeysType() == KeysType.AGG_KEYS) {
throw new DdlException("Please add non-key column on base table directly");
}
newColumn.setAggregationType(AggregateType.NONE, true);
@@ -1402,8 +1398,8 @@ protected void runAfterCatalogReady() {
private void runAlterJobV2() {
runnableSchemaChangeJobV2.values().forEach(
alterJobsV2 -> {
- if (!alterJobsV2.isDone() && !activeSchemaChangeJobsV2.containsKey(alterJobsV2.getJobId()) &&
- activeSchemaChangeJobsV2.size() < MAX_ACTIVE_SCHEMA_CHANGE_JOB_V2_SIZE) {
+ if (!alterJobsV2.isDone() && !activeSchemaChangeJobsV2.containsKey(alterJobsV2.getJobId())
+ && activeSchemaChangeJobsV2.size() < MAX_ACTIVE_SCHEMA_CHANGE_JOB_V2_SIZE) {
if (FeConstants.runningUnitTest) {
alterJobsV2.run();
} else {
@@ -1494,9 +1490,10 @@ public void process(List alterClauses, String clusterName, Database
DynamicPartitionUtil.checkInputDynamicPartitionProperties(properties, olapTable.getPartitionInfo());
} catch (DdlException e) {
// This table is not a dynamic partition table and didn't supply all dynamic partition properties
- throw new DdlException("Table " + db.getFullName() + "." +
- olapTable.getName() + " is not a dynamic partition table. Use command `HELP ALTER TABLE` " +
- "to see how to change a normal table to a dynamic partition table.");
+ throw new DdlException("Table " + db.getFullName() + "."
+ + olapTable.getName() + " is not a dynamic partition table."
+ + " Use command `HELP ALTER TABLE` "
+ + "to see how to change a normal table to a dynamic partition table.");
}
}
Catalog.getCurrentCatalog().modifyTableDynamicPartition(db, olapTable, properties);
@@ -1662,8 +1659,8 @@ public void updatePartitionsInMemoryMeta(Database db,
try {
updatePartitionInMemoryMeta(db, olapTable.getName(), partitionName, isInMemory);
} catch (Exception e) {
- String errMsg = "Failed to update partition[" + partitionName + "]'s 'in_memory' property. " +
- "The reason is [" + e.getMessage() + "]";
+ String errMsg = "Failed to update partition[" + partitionName + "]'s 'in_memory' property. "
+ + "The reason is [" + e.getMessage() + "]";
throw new DdlException(errMsg);
}
}
@@ -1765,8 +1762,8 @@ public void cancel(CancelStmt stmt) throws DdlException {
OlapTable olapTable = db.getOlapTableOrDdlException(tableName);
olapTable.writeLockOrDdlException();
try {
- if (olapTable.getState() != OlapTableState.SCHEMA_CHANGE &&
- olapTable.getState() != OlapTableState.WAITING_STABLE) {
+ if (olapTable.getState() != OlapTableState.SCHEMA_CHANGE
+ && olapTable.getState() != OlapTableState.WAITING_STABLE) {
throw new DdlException("Table[" + tableName + "] is not under SCHEMA_CHANGE.");
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeJobV2.java b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeJobV2.java
index 605df4cb96adba..2d55523d7567d1 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeJobV2.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeJobV2.java
@@ -273,7 +273,7 @@ protected void runPendingJob() throws AlterCancelException {
AgentTaskQueue.addBatchTask(batchTask);
AgentTaskExecutor.submit(batchTask);
long timeout = Math.min(Config.tablet_create_timeout_second * 1000L * totalReplicaNum,
- Config.max_create_table_timeout_second * 1000L);
+ Config.max_create_table_timeout_second * 1000L);
boolean ok = false;
try {
ok = countDownLatch.await(timeout, TimeUnit.MILLISECONDS);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/AddColumnClause.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/AddColumnClause.java
index f92ee18ba0b24c..03afe36ed5144d 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AddColumnClause.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AddColumnClause.java
@@ -42,7 +42,9 @@ public class AddColumnClause extends AlterTableClause {
// set in analyze
private Column column;
- public Column getColumn() { return column; }
+ public Column getColumn() {
+ return column;
+ }
public ColumnPosition getColPos() {
return colPos;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfo.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfo.java
index 988dff558439de..d2ea7443e90a59 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfo.java
@@ -77,7 +77,9 @@ public enum AggPhase {
SECOND,
SECOND_MERGE;
- public boolean isMerge() { return this == FIRST_MERGE || this == SECOND_MERGE; }
+ public boolean isMerge() {
+ return this == FIRST_MERGE || this == SECOND_MERGE;
+ }
};
// created by createMergeAggInfo()
@@ -153,8 +155,13 @@ private AggregateInfo(AggregateInfo other) {
(other.partitionExprs != null) ? Expr.cloneList(other.partitionExprs) : null;
}
- public List getPartitionExprs() { return partitionExprs; }
- public void setPartitionExprs(List exprs) { partitionExprs = exprs; }
+ public List getPartitionExprs() {
+ return partitionExprs;
+ }
+
+ public void setPartitionExprs(List exprs) {
+ partitionExprs = exprs;
+ }
/**
* Creates complete AggregateInfo for groupingExprs and aggExprs, including
@@ -189,9 +196,8 @@ static public AggregateInfo create(
// 1: if aggExprs don't have distinct or have multi distinct , create aggregate info for
// one stage aggregation.
// 2: if aggExprs have one distinct , create aggregate info for two stage aggregation
- boolean isMultiDistinct = result.estimateIfContainsMultiDistinct(distinctAggExprs);
- if (distinctAggExprs.isEmpty()
- || isMultiDistinct) {
+ boolean isMultiDistinct = estimateIfContainsMultiDistinct(distinctAggExprs);
+ if (distinctAggExprs.isEmpty() || isMultiDistinct) {
// It is used to map new aggr expr to old expr to help create an external
// reference to the aggregation node tuple
result.setIsMultiDistinct(isMultiDistinct);
@@ -225,7 +231,7 @@ static public AggregateInfo create(
* @return
*/
public static boolean estimateIfContainsMultiDistinct(List distinctAggExprs)
- throws AnalysisException {
+ throws AnalysisException {
if (distinctAggExprs == null || distinctAggExprs.size() <= 0) {
return false;
@@ -330,8 +336,8 @@ private void createDistinctAggInfo(
public ArrayList getMaterializedAggregateExprs() {
ArrayList result = Lists.newArrayList();
- for (Integer i: materializedSlots) {
- result.add(aggregateExprs.get(i));
+ for (Integer i : materializedSlots) {
+ result.add(aggregateExprs.get(i));
}
return result;
}
@@ -340,18 +346,30 @@ public AggregateInfo getMergeAggInfo() {
return mergeAggInfo;
}
- public boolean isMerge() { return aggPhase.isMerge(); }
- public boolean isDistinctAgg() { return secondPhaseDistinctAggInfo != null; }
- public ExprSubstitutionMap getIntermediateSmap() { return intermediateTupleSmap; }
- public ExprSubstitutionMap getOutputSmap() { return outputTupleSmap; }
+ public boolean isMerge() {
+ return aggPhase.isMerge();
+ }
+
+ public boolean isDistinctAgg() {
+ return secondPhaseDistinctAggInfo != null;
+ }
+
+ public ExprSubstitutionMap getIntermediateSmap() {
+ return intermediateTupleSmap;
+ }
+
+ public ExprSubstitutionMap getOutputSmap() {
+ return outputTupleSmap;
+ }
+
public ExprSubstitutionMap getOutputToIntermediateSmap() {
return outputToIntermediateTupleSmap;
}
public boolean hasAggregateExprs() {
- return !aggregateExprs.isEmpty() ||
- (secondPhaseDistinctAggInfo != null &&
- !secondPhaseDistinctAggInfo.getAggregateExprs().isEmpty());
+ return !aggregateExprs.isEmpty()
+ || (secondPhaseDistinctAggInfo != null
+ && !secondPhaseDistinctAggInfo.getAggregateExprs().isEmpty());
}
public void setIsMultiDistinct(boolean value) {
@@ -419,10 +437,9 @@ public void substitute(ExprSubstitutionMap smap, Analyzer analyzer) {
// The smap in this case should not substitute the aggs themselves, only
// their subexpressions.
- List substitutedAggs =
- Expr.substituteList(aggregateExprs, smap, analyzer, false);
+ List substitutedAggs = Expr.substituteList(aggregateExprs, smap, analyzer, false);
aggregateExprs.clear();
- for (Expr substitutedAgg: substitutedAggs) {
+ for (Expr substitutedAgg : substitutedAggs) {
aggregateExprs.add((FunctionCallExpr) substitutedAgg);
}
@@ -461,8 +478,8 @@ private void createMergeAggInfo(Analyzer analyzer) {
List paramExprs = new ArrayList<>();
// TODO(zhannngchen), change intermediate argument to a list, and remove this
// ad-hoc logic
- if (inputExpr.fn.functionName().equals("max_by") ||
- inputExpr.fn.functionName().equals("min_by")) {
+ if (inputExpr.fn.functionName().equals("max_by")
+ || inputExpr.fn.functionName().equals("min_by")) {
paramExprs.addAll(inputExpr.getFnParams().exprs());
} else {
paramExprs.add(new SlotRef(inputDesc.getSlots().get(i + getGroupingExprs().size())));
@@ -541,7 +558,6 @@ private void createSecondPhaseAggInfo(
// construct agg exprs for original DISTINCT aggregate functions
// (these aren't part of this.aggExprs)
ArrayList secondPhaseAggExprs = Lists.newArrayList();
- int distinctExprPos = 0;
for (FunctionCallExpr inputExpr : distinctAggExprs) {
Preconditions.checkState(inputExpr.isAggregateFunction());
FunctionCallExpr aggExpr = null;
@@ -638,8 +654,8 @@ private void createSecondPhaseAggSMap(
int numOrigGroupingExprs = inputAggInfo.getGroupingExprs().size() - numDistinctParams;
Preconditions.checkState(
- slotDescs.size() == numOrigGroupingExprs + distinctAggExprs.size() +
- inputAggInfo.getAggregateExprs().size());
+ slotDescs.size() == numOrigGroupingExprs + distinctAggExprs.size()
+ + inputAggInfo.getAggregateExprs().size());
// original grouping exprs -> first m slots
for (int i = 0; i < numOrigGroupingExprs; ++i, ++slotIdx) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfoBase.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfoBase.java
index 7fa14b758d0e6b..b44dc45589f594 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfoBase.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfoBase.java
@@ -129,8 +129,8 @@ private TupleDescriptor createTupleDesc(Analyzer analyzer, boolean isOutputTuple
int aggregateExprStartIndex = groupingExprs.size();
// if agg is grouping set, so we should set all groupingExpr unless last groupingExpr
// must set be be nullable
- boolean isGroupingSet = !groupingExprs.isEmpty() &&
- groupingExprs.get(groupingExprs.size() - 1) instanceof VirtualSlotRef;
+ boolean isGroupingSet = !groupingExprs.isEmpty()
+ && groupingExprs.get(groupingExprs.size() - 1) instanceof VirtualSlotRef;
for (int i = 0; i < exprs.size(); ++i) {
Expr expr = exprs.get(i);
@@ -150,7 +150,7 @@ private TupleDescriptor createTupleDesc(Analyzer analyzer, boolean isOutputTuple
}
} else {
Preconditions.checkArgument(expr instanceof FunctionCallExpr);
- FunctionCallExpr aggExpr = (FunctionCallExpr)expr;
+ FunctionCallExpr aggExpr = (FunctionCallExpr) expr;
if (aggExpr.isMergeAggFn()) {
slotDesc.setLabel(aggExpr.getChild(0).toSql());
slotDesc.setSourceExpr(aggExpr.getChild(0));
@@ -159,13 +159,13 @@ private TupleDescriptor createTupleDesc(Analyzer analyzer, boolean isOutputTuple
slotDesc.setSourceExpr(aggExpr);
}
- if (isOutputTuple && aggExpr.getFn().getNullableMode().equals(Function.NullableMode.DEPEND_ON_ARGUMENT) &&
- groupingExprs.size() == 0) {
+ if (isOutputTuple && aggExpr.getFn().getNullableMode().equals(Function.NullableMode.DEPEND_ON_ARGUMENT)
+ && groupingExprs.size() == 0) {
slotDesc.setIsNullable(true);
}
if (!isOutputTuple) {
- Type intermediateType = ((AggregateFunction)aggExpr.fn).getIntermediateType();
+ Type intermediateType = ((AggregateFunction) aggExpr.fn).getIntermediateType();
if (intermediateType != null) {
// Use the output type as intermediate if the function has a wildcard decimal.
if (!intermediateType.isWildcardDecimal()) {
@@ -193,12 +193,30 @@ private TupleDescriptor createTupleDesc(Analyzer analyzer, boolean isOutputTuple
public abstract void materializeRequiredSlots(Analyzer analyzer,
ExprSubstitutionMap smap);
- public ArrayList getGroupingExprs() { return groupingExprs; }
- public ArrayList getAggregateExprs() { return aggregateExprs; }
- public TupleDescriptor getOutputTupleDesc() { return outputTupleDesc; }
- public TupleDescriptor getIntermediateTupleDesc() { return intermediateTupleDesc; }
- public TupleId getIntermediateTupleId() { return intermediateTupleDesc.getId(); }
- public TupleId getOutputTupleId() { return outputTupleDesc.getId(); }
+ public ArrayList getGroupingExprs() {
+ return groupingExprs;
+ }
+
+ public ArrayList getAggregateExprs() {
+ return aggregateExprs;
+ }
+
+ public TupleDescriptor getOutputTupleDesc() {
+ return outputTupleDesc;
+ }
+
+ public TupleDescriptor getIntermediateTupleDesc() {
+ return intermediateTupleDesc;
+ }
+
+ public TupleId getIntermediateTupleId() {
+ return intermediateTupleDesc.getId();
+ }
+
+ public TupleId getOutputTupleId() {
+ return outputTupleDesc.getId();
+ }
+
public boolean requiresIntermediateTuple() {
Preconditions.checkNotNull(intermediateTupleDesc);
Preconditions.checkNotNull(outputTupleDesc);
@@ -211,7 +229,7 @@ public boolean requiresIntermediateTuple() {
* its output type.
*/
public static boolean requiresIntermediateTuple(List aggExprs) {
- for (Expr aggExpr: aggExprs) {
+ for (Expr aggExpr : aggExprs) {
Type intermediateType = ((AggregateFunction) aggExpr.fn).getIntermediateType();
if (intermediateType != null) {
return true;
@@ -225,7 +243,7 @@ public static boolean requiresIntermediateTuple(List aggExpr
* is depend on argument
*/
public static boolean requiresIntermediateTuple(List aggExprs, boolean noGrouping) {
- for (Expr aggExpr: aggExprs) {
+ for (Expr aggExpr : aggExprs) {
Type intermediateType = ((AggregateFunction) aggExpr.fn).getIntermediateType();
if (intermediateType != null) {
return true;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterColumnStatsStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterColumnStatsStmt.java
index 17d631a1a422bf..b5627c256543a9 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterColumnStatsStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterColumnStatsStmt.java
@@ -62,7 +62,7 @@ public void analyze(Analyzer analyzer) throws UserException {
tableName.analyze(analyzer);
// check properties
Optional optional = properties.keySet().stream().map(StatsType::fromString)
- .filter(statsType -> !CONFIGURABLE_PROPERTIES_SET.contains(statsType)).findFirst();
+ .filter(statsType -> !CONFIGURABLE_PROPERTIES_SET.contains(statsType)).findFirst();
if (optional.isPresent()) {
throw new AnalysisException(optional.get() + " is invalid statistic");
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterDatabaseQuotaStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterDatabaseQuotaStmt.java
index a45ff28f3d6a04..daacdadb91b986 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterDatabaseQuotaStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterDatabaseQuotaStmt.java
@@ -80,6 +80,8 @@ public void analyze(Analyzer analyzer) throws UserException {
@Override
public String toSql() {
- return "ALTER DATABASE " + dbName + " SET " + (quotaType == QuotaType.DATA ? "DATA" : "REPLICA") +" QUOTA " + quotaValue;
+ return "ALTER DATABASE " + dbName + " SET "
+ + (quotaType == QuotaType.DATA ? "DATA" : "REPLICA")
+ + " QUOTA " + quotaValue;
}
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterTableStatsStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterTableStatsStmt.java
index 6d8ea6027ea47e..42661b7bdda716 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterTableStatsStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterTableStatsStmt.java
@@ -56,7 +56,7 @@ public void analyze(Analyzer analyzer) throws UserException {
tableName.analyze(analyzer);
// check properties
Optional optional = properties.keySet().stream().map(StatsType::fromString)
- .filter(statsType -> !CONFIGURABLE_PROPERTIES_SET.contains(statsType)).findFirst();
+ .filter(statsType -> !CONFIGURABLE_PROPERTIES_SET.contains(statsType)).findFirst();
if (optional.isPresent()) {
throw new AnalysisException(optional.get() + " is invalid statistic");
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterTableStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterTableStmt.java
index 6f7cd7f257e7ba..1085197b122d37 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterTableStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterTableStmt.java
@@ -152,17 +152,17 @@ public void rewriteAlterClause(OlapTable table) throws UserException {
public void checkExternalTableOperationAllow(Table table) throws UserException {
List clauses = new ArrayList<>();
for (AlterClause alterClause : ops) {
- if (alterClause instanceof TableRenameClause ||
- alterClause instanceof AddColumnClause ||
- alterClause instanceof AddColumnsClause ||
- alterClause instanceof DropColumnClause ||
- alterClause instanceof ModifyColumnClause ||
- alterClause instanceof ReorderColumnsClause ||
- alterClause instanceof ModifyEngineClause) {
+ if (alterClause instanceof TableRenameClause
+ || alterClause instanceof AddColumnClause
+ || alterClause instanceof AddColumnsClause
+ || alterClause instanceof DropColumnClause
+ || alterClause instanceof ModifyColumnClause
+ || alterClause instanceof ReorderColumnsClause
+ || alterClause instanceof ModifyEngineClause) {
clauses.add(alterClause);
} else {
- throw new AnalysisException(table.getType().toString() + " [" + table.getName() + "] " +
- "do not support " + alterClause.getOpType().toString() + " clause now");
+ throw new AnalysisException(table.getType().toString() + " [" + table.getName() + "] "
+ + "do not support " + alterClause.getOpType().toString() + " clause now");
}
}
ops = clauses;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterViewStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterViewStmt.java
index 91ed2c65c5edbe..124b7cc850b524 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterViewStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterViewStmt.java
@@ -80,7 +80,7 @@ public String toSql() {
sb.append(tableName.toSql()).append("\n");
if (cols != null) {
sb.append("(\n");
- for (int i = 0 ; i < cols.size(); i++) {
+ for (int i = 0; i < cols.size(); i++) {
if (i != 0) {
sb.append(",\n");
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticExpr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticExpr.java
index bb3cf7730fc3a5..55169443e460ce 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticExpr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticExpr.java
@@ -154,7 +154,7 @@ public boolean equals(Object obj) {
return false;
}
- AnalyticExpr o = (AnalyticExpr)obj;
+ AnalyticExpr o = (AnalyticExpr) obj;
if (!fnCall.equals(o.getFnCall())) {
return false;
@@ -177,7 +177,9 @@ public boolean equals(Object obj) {
* Analytic exprs cannot be constant.
*/
@Override
- protected boolean isConstantImpl() { return false; }
+ protected boolean isConstantImpl() {
+ return false;
+ }
@Override
public Expr clone() {
@@ -245,32 +247,11 @@ static private boolean isHllAggFn(Function fn) {
return fn.functionName().equalsIgnoreCase(HLL_UNION_AGG);
}
- /**
- * Rewrite the following analytic functions:
- * percent_rank(), cume_dist() and ntile()
- *
- * Returns a new Expr if the analytic expr is rewritten, returns null if it's not one
- * that we want to equal.
- */
- public static Expr rewrite(AnalyticExpr analyticExpr) {
- Function fn = analyticExpr.getFnCall().getFn();
- // TODO(zc)
- // if (AnalyticExpr.isPercentRankFn(fn)) {
- // return createPercentRank(analyticExpr);
- // } else if (AnalyticExpr.isCumeDistFn(fn)) {
- // return createCumeDist(analyticExpr);
- // } else if (AnalyticExpr.isNtileFn(fn)) {
- // return createNtile(analyticExpr);
- // }
- return null;
- }
-
/**
* Checks that the value expr of an offset boundary of a RANGE window is compatible
* with orderingExprs (and that there's only a single ordering expr).
*/
- private void checkRangeOffsetBoundaryExpr(AnalyticWindow.Boundary boundary)
- throws AnalysisException {
+ private void checkRangeOffsetBoundaryExpr(AnalyticWindow.Boundary boundary) throws AnalysisException {
Preconditions.checkState(boundary.getType().isOffset());
if (orderByElements.size() > 1) {
@@ -332,12 +313,12 @@ void checkDefaultValue(Analyzer analyzer) throws AnalysisException {
out = true;
}
} else {
- return ;
+ return;
}
if (out) {
throw new AnalysisException("Column type="
- + getFnCall().getChildren().get(0).getType() + ", value is out of range ") ;
+ + getFnCall().getChildren().get(0).getType() + ", value is out of range ");
}
}
@@ -365,10 +346,10 @@ void checkOffset(Analyzer analyzer) throws AnalysisException {
double value = 0;
if (offset instanceof IntLiteral) {
- IntLiteral intl = (IntLiteral)offset;
+ IntLiteral intl = (IntLiteral) offset;
value = intl.getDoubleValue();
} else if (offset instanceof LargeIntLiteral) {
- LargeIntLiteral intl = (LargeIntLiteral)offset;
+ LargeIntLiteral intl = (LargeIntLiteral) offset;
value = intl.getDoubleValue();
}
@@ -490,8 +471,8 @@ public void analyzeImpl(Analyzer analyzer) throws AnalysisException {
if (!VectorizedUtil.isVectorized()) {
// min/max is not currently supported on sliding windows (i.e. start bound is not
// unbounded).
- if (window != null && isMinMax(fn) &&
- window.getLeftBoundary().getType() != BoundaryType.UNBOUNDED_PRECEDING) {
+ if (window != null && isMinMax(fn)
+ && window.getLeftBoundary().getType() != BoundaryType.UNBOUNDED_PRECEDING) {
throw new AnalysisException(
"'" + getFnCall().toSql() + "' is only supported with an "
+ "UNBOUNDED PRECEDING start bound.");
@@ -585,10 +566,10 @@ private void standardize(Analyzer analyzer) throws AnalysisException {
try {
getFnCall().uncheckedCastChild(getFnCall().getChildren().get(0).getType(), 2);
} catch (Exception e) {
- LOG.warn("" , e);
+ LOG.warn("", e);
throw new AnalysisException("Convert type error in offset fn(default value); old_type="
+ getFnCall().getChildren().get(2).getType() + " new_type="
- + getFnCall().getChildren().get(0).getType()) ;
+ + getFnCall().getChildren().get(0).getType());
}
if (getFnCall().getChildren().get(2) instanceof CastExpr) {
@@ -602,7 +583,7 @@ private void standardize(Analyzer analyzer) throws AnalysisException {
try {
getFnCall().uncheckedCastChild(Type.BIGINT, 1);
} catch (Exception e) {
- LOG.warn("" , e);
+ LOG.warn("", e);
throw new AnalysisException("Convert type error in offset fn(default offset); type="
+ getFnCall().getChildren().get(1).getType());
}
@@ -646,26 +627,24 @@ private void standardize(Analyzer analyzer) throws AnalysisException {
} else {
//TODO: Now we don't want to first_value to rewrite in vectorized mode;
//if have to rewrite in future, could exec this rule;
- if(!VectorizedUtil.isVectorized()) {
- List paramExprs = Expr.cloneList(getFnCall().getParams().exprs());
-
- if (window.getRightBoundary().getType() == BoundaryType.PRECEDING) {
- // The number of rows preceding for the end bound determines the number of
- // rows at the beginning of each partition that should have a NULL value.
- paramExprs.add(window.getRightBoundary().getExpr());
- } else {
- // -1 indicates that no NULL values are inserted even though we set the end
- // bound to the start bound (which is PRECEDING) below; this is different from
- // the default behavior of windows with an end bound PRECEDING.
- paramExprs.add(new IntLiteral(-1, Type.BIGINT));
- }
+ if (!VectorizedUtil.isVectorized()) {
+ List paramExprs = Expr.cloneList(getFnCall().getParams().exprs());
+
+ if (window.getRightBoundary().getType() == BoundaryType.PRECEDING) {
+ // The number of rows preceding for the end bound determines the number of
+ // rows at the beginning of each partition that should have a NULL value.
+ paramExprs.add(window.getRightBoundary().getExpr());
+ } else {
+ // -1 indicates that no NULL values are inserted even though we set the end
+ // bound to the start bound (which is PRECEDING) below; this is different from
+ // the default behavior of windows with an end bound PRECEDING.
+ paramExprs.add(new IntLiteral(-1, Type.BIGINT));
+ }
- window = new AnalyticWindow(window.getType(),
- new Boundary(BoundaryType.UNBOUNDED_PRECEDING, null),
- window.getLeftBoundary());
- fnCall = new FunctionCallExpr("FIRST_VALUE_REWRITE",
- new FunctionParams(paramExprs));
- // fnCall_.setIsInternalFnCall(true);
+ window = new AnalyticWindow(window.getType(),
+ new Boundary(BoundaryType.UNBOUNDED_PRECEDING, null),
+ window.getLeftBoundary());
+ fnCall = new FunctionCallExpr("FIRST_VALUE_REWRITE", new FunctionParams(paramExprs));
}
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticInfo.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticInfo.java
index 0b3cf4f1bc6b7e..8b88f4c4fc29f2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticInfo.java
@@ -53,7 +53,7 @@ private AnalyticInfo(ArrayList analyticExprs) {
super(new ArrayList(), new ArrayList());
this.analyticExprs = Expr.cloneList(analyticExprs);
// Extract the analytic function calls for each analytic expr.
- for (Expr analyticExpr: analyticExprs) {
+ for (Expr analyticExpr : analyticExprs) {
aggregateExprs.add(((AnalyticExpr) analyticExpr).getFnCall());
}
analyticTupleSmap = new ExprSubstitutionMap();
@@ -71,16 +71,23 @@ private AnalyticInfo(AnalyticInfo other) {
commonPartitionExprs = Expr.cloneList(other.commonPartitionExprs);
}
- public ArrayList getAnalyticExprs() { return analyticExprs; }
- public ExprSubstitutionMap getSmap() { return analyticTupleSmap; }
- public List getCommonPartitionExprs() { return commonPartitionExprs; }
+ public ArrayList getAnalyticExprs() {
+ return analyticExprs;
+ }
+
+ public ExprSubstitutionMap getSmap() {
+ return analyticTupleSmap;
+ }
+
+ public List getCommonPartitionExprs() {
+ return commonPartitionExprs;
+ }
/**
* Creates complete AnalyticInfo for analyticExprs, including tuple descriptors and
* smaps.
*/
- static public AnalyticInfo create(
- ArrayList analyticExprs, Analyzer analyzer) {
+ static public AnalyticInfo create(ArrayList analyticExprs, Analyzer analyzer) {
Preconditions.checkState(analyticExprs != null && !analyticExprs.isEmpty());
Expr.removeDuplicates(analyticExprs);
AnalyticInfo result = new AnalyticInfo(analyticExprs);
@@ -113,7 +120,7 @@ static public AnalyticInfo create(
*/
private List computeCommonPartitionExprs() {
List result = Lists.newArrayList();
- for (Expr analyticExpr: analyticExprs) {
+ for (Expr analyticExpr : analyticExprs) {
Preconditions.checkState(analyticExpr.isAnalyzed());
List partitionExprs = ((AnalyticExpr) analyticExpr).getPartitionExprs();
if (partitionExprs == null) {
@@ -159,23 +166,20 @@ public void checkConsistency() {
// Check materialized slots.
int numMaterializedSlots = 0;
- for (SlotDescriptor slotDesc: slots) {
+ for (SlotDescriptor slotDesc : slots) {
if (slotDesc.isMaterialized()) {
++numMaterializedSlots;
}
}
- Preconditions.checkState(numMaterializedSlots ==
- materializedSlots.size());
+ Preconditions.checkState(numMaterializedSlots == materializedSlots.size());
// Check that analytic expr return types match the slot descriptors.
int slotIdx = 0;
- for (int i = 0; i < analyticExprs.size(); ++i) {
- Expr analyticExpr = analyticExprs.get(i);
+ for (Expr analyticExpr : analyticExprs) {
Type slotType = slots.get(slotIdx).getType();
Preconditions.checkState(analyticExpr.getType().equals(slotType),
- String.format("Analytic expr %s returns type %s but its analytic tuple " +
- "slot has type %s", analyticExpr.toSql(),
- analyticExpr.getType().toString(), slotType.toString()));
+ String.format("Analytic expr %s returns type %s but its analytic tuple " + "slot has type %s",
+ analyticExpr.toSql(), analyticExpr.getType().toString(), slotType.toString()));
++slotIdx;
}
}
@@ -191,8 +195,12 @@ public String debugString() {
}
@Override
- protected String tupleDebugName() { return "analytic-tuple"; }
+ protected String tupleDebugName() {
+ return "analytic-tuple";
+ }
@Override
- public AnalyticInfo clone() { return new AnalyticInfo(this); }
+ public AnalyticInfo clone() {
+ return new AnalyticInfo(this);
+ }
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticWindow.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticWindow.java
index 53265089b4be6c..b6bc06d3bbd615 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticWindow.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticWindow.java
@@ -206,7 +206,7 @@ public boolean equals(Object obj) {
return false;
}
- Boundary o = (Boundary)obj;
+ Boundary o = (Boundary) obj;
boolean exprEqual = (expr == null) == (o.expr == null);
if (exprEqual && expr != null) {
@@ -360,9 +360,8 @@ public boolean equals(Object obj) {
return false;
}
- AnalyticWindow o = (AnalyticWindow)obj;
- boolean rightBoundaryEqual =
- (rightBoundary == null) == (o.rightBoundary == null);
+ AnalyticWindow o = (AnalyticWindow) obj;
+ boolean rightBoundaryEqual = (rightBoundary == null) == (o.rightBoundary == null);
if (rightBoundaryEqual && rightBoundary != null) {
rightBoundaryEqual = rightBoundary.equals(o.rightBoundary);
@@ -382,7 +381,7 @@ public AnalyticWindow clone() {
* Semantic analysis for expr of a PRECEDING/FOLLOWING clause.
*/
private void checkOffsetExpr(Analyzer analyzer, Boundary boundary)
- throws AnalysisException {
+ throws AnalysisException {
Preconditions.checkState(boundary.getType().isOffset());
Expr e = boundary.getExpr();
Preconditions.checkNotNull(e);
@@ -392,9 +391,6 @@ private void checkOffsetExpr(Analyzer analyzer, Boundary boundary)
if (e.isConstant() && e.getType().isNumericType()) {
try {
val = Expr.getConstFromExpr(e);
-// val = TColumnValueUtil.getNumericVal(
-// FeSupport.EvalConstExpr(e, analyzer.getQueryGlobals()));
-
if (val <= 0) {
isPos = false;
}
@@ -428,7 +424,7 @@ private void checkOffsetExpr(Analyzer analyzer, Boundary boundary)
* Check that b1 <= b2.
*/
private void checkOffsetBoundaries(Analyzer analyzer, Boundary b1, Boundary b2)
- throws AnalysisException {
+ throws AnalysisException {
Preconditions.checkState(b1.getType().isOffset());
Preconditions.checkState(b2.getType().isOffset());
Expr e1 = b1.getExpr();
@@ -439,8 +435,6 @@ private void checkOffsetBoundaries(Analyzer analyzer, Boundary b1, Boundary b2)
e2 != null && e2.isConstant() && e2.getType().isNumericType());
try {
-// TColumnValue val1 = FeSupport.EvalConstExpr(e1, analyzer.getQueryGlobals());
-// TColumnValue val2 = FeSupport.EvalConstExpr(e2, analyzer.getQueryGlobals());
double left = Expr.getConstFromExpr(e1);
double right = Expr.getConstFromExpr(e2);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
index a5a18d0d3ced83..cebd197fd57b22 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
@@ -167,19 +167,50 @@ public void setIsSubquery() {
isSubquery = true;
globalState.containsSubquery = true;
}
- public boolean setHasPlanHints() { return globalState.hasPlanHints = true; }
- public boolean hasPlanHints() { return globalState.hasPlanHints; }
- public void setIsWithClause() { isWithClause = true; }
- public boolean isWithClause() { return isWithClause; }
- public void setUDFAllowed(boolean val) { this.isUDFAllowed = val; }
- public boolean isUDFAllowed() { return this.isUDFAllowed; }
- public void setTimezone(String timezone) { this.timezone = timezone; }
- public String getTimezone() { return timezone; }
+ public boolean setHasPlanHints() {
+ return globalState.hasPlanHints = true;
+ }
+
+ public boolean hasPlanHints() {
+ return globalState.hasPlanHints;
+ }
+
+ public void setIsWithClause() {
+ isWithClause = true;
+ }
+
+ public boolean isWithClause() {
+ return isWithClause;
+ }
+
+ public void setUDFAllowed(boolean val) {
+ this.isUDFAllowed = val;
+ }
- public void putAssignedRuntimeFilter(RuntimeFilter rf) { assignedRuntimeFilters.add(rf); }
- public List getAssignedRuntimeFilter() { return assignedRuntimeFilters; }
- public void clearAssignedRuntimeFilters() { assignedRuntimeFilters.clear(); }
+ public boolean isUDFAllowed() {
+ return this.isUDFAllowed;
+ }
+
+ public void setTimezone(String timezone) {
+ this.timezone = timezone;
+ }
+
+ public String getTimezone() {
+ return timezone;
+ }
+
+ public void putAssignedRuntimeFilter(RuntimeFilter rf) {
+ assignedRuntimeFilters.add(rf);
+ }
+
+ public List getAssignedRuntimeFilter() {
+ return assignedRuntimeFilters;
+ }
+
+ public void clearAssignedRuntimeFilters() {
+ assignedRuntimeFilters.clear();
+ }
public long getAutoBroadcastJoinThreshold() {
return globalState.autoBroadcastJoinThreshold;
@@ -428,8 +459,13 @@ public static Analyzer createWithNewGlobalState(Analyzer parentAnalyzer) {
return new Analyzer(parentAnalyzer, globalState);
}
- public void setIsExplain() { globalState.isExplain = true; }
- public boolean isExplain() { return globalState.isExplain; }
+ public void setIsExplain() {
+ globalState.isExplain = true;
+ }
+
+ public boolean isExplain() {
+ return globalState.isExplain;
+ }
public int incrementCallDepth() {
return ++callDepth;
@@ -454,10 +490,10 @@ public void registerLocalView(View view) throws AnalysisException {
List viewLabels = view.getColLabels();
List queryStmtLabels = view.getQueryStmt().getColLabels();
if (viewLabels.size() > queryStmtLabels.size()) {
- throw new AnalysisException("WITH-clause view '" + view.getName() +
- "' returns " + queryStmtLabels.size() + " columns, but " +
- viewLabels.size() + " labels were specified. The number of column " +
- "labels must be smaller or equal to the number of returned columns.");
+ throw new AnalysisException("WITH-clause view '" + view.getName()
+ + "' returns " + queryStmtLabels.size() + " columns, but "
+ + viewLabels.size() + " labels were specified. The number of column "
+ + "labels must be smaller or equal to the number of returned columns.");
}
}
if (localViews.put(view.getName(), view) != null) {
@@ -627,7 +663,7 @@ public TableRef resolveTableRef(TableRef tableRef) throws AnalysisException {
partition -> partition.getState() == PartitionState.RESTORE
).collect(Collectors.toList()).isEmpty();
- if(!isNotRestoring){
+ if (!isNotRestoring) {
// if doing restore with partitions, the status check push down to OlapScanNode::computePartitionInfo to
// support query that partitions is not restoring.
} else {
@@ -791,7 +827,7 @@ private TupleDescriptor resolveColumnRef(TableName tblName, String colName) thro
//result = desc;
if (!colName.equalsIgnoreCase(Column.DELETE_SIGN) && !isVisible(desc.getId())) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_ILLEGAL_COLUMN_REFERENCE_ERROR,
- Joiner.on(".").join(tblName.getTbl(),colName));
+ Joiner.on(".").join(tblName.getTbl(), colName));
}
Column col = desc.getTable().getColumn(colName);
if (col != null) {
@@ -862,7 +898,7 @@ public void registerFullOuterJoinedConjunct(Expr e) {
!globalState.fullOuterJoinedConjuncts.containsKey(e.getId()));
List tids = Lists.newArrayList();
e.getIds(tids, null);
- for (TupleId tid: tids) {
+ for (TupleId tid : tids) {
if (!globalState.fullOuterJoinedTupleIds.containsKey(tid)) {
continue;
}
@@ -871,8 +907,7 @@ public void registerFullOuterJoinedConjunct(Expr e) {
break;
}
if (LOG.isDebugEnabled()) {
- LOG.debug("registerFullOuterJoinedConjunct: " +
- globalState.fullOuterJoinedConjuncts.toString());
+ LOG.debug("registerFullOuterJoinedConjunct: " + globalState.fullOuterJoinedConjuncts);
}
}
@@ -881,12 +916,11 @@ public void registerFullOuterJoinedConjunct(Expr e) {
* rhsRef.
*/
public void registerFullOuterJoinedTids(List tids, TableRef rhsRef) {
- for (TupleId tid: tids) {
+ for (TupleId tid : tids) {
globalState.fullOuterJoinedTupleIds.put(tid, rhsRef);
}
if (LOG.isTraceEnabled()) {
- LOG.trace("registerFullOuterJoinedTids: " +
- globalState.fullOuterJoinedTupleIds.toString());
+ LOG.trace("registerFullOuterJoinedTids: " + globalState.fullOuterJoinedTupleIds);
}
}
@@ -895,12 +929,11 @@ public void registerFullOuterJoinedTids(List tids, TableRef rhsRef) {
* All tuple of outer join should be null in slot desc
*/
public void registerOuterJoinedTids(List tids, TableRef rhsRef) {
- for (TupleId tid: tids) {
+ for (TupleId tid : tids) {
globalState.outerJoinedTupleIds.put(tid, rhsRef);
}
if (LOG.isDebugEnabled()) {
- LOG.debug("registerOuterJoinedTids: " +
- globalState.outerJoinedTupleIds.toString());
+ LOG.debug("registerOuterJoinedTids: " + globalState.outerJoinedTupleIds);
}
}
@@ -983,7 +1016,7 @@ public void registerOnSlotToLiteralExpr(Expr expr) {
globalState.onSlotToLiteralExpr.add(expr);
}
- public void registerOnSlotToLiteralDeDuplication(Pair pair) {
+ public void registerOnSlotToLiteralDeDuplication(Pair pair) {
globalState.onSlotToLiteralDeDuplication.add(pair);
}
@@ -1046,7 +1079,7 @@ public void registerConjuncts(Expr e, boolean fromHavingClause) throws AnalysisE
// Register all conjuncts and handle constant conjuncts with ids
public void registerConjuncts(Expr e, boolean fromHavingClause, List ids) throws AnalysisException {
- for (Expr conjunct: e.getConjuncts()) {
+ for (Expr conjunct : e.getConjuncts()) {
registerConjunct(conjunct);
if (ids != null) {
for (TupleId id : ids) {
@@ -1263,10 +1296,9 @@ && canEvalPredicate(tupleIds, e)) {
public List getAllUnassignedConjuncts(List tupleIds) {
List result = Lists.newArrayList();
for (Expr e : globalState.conjuncts.values()) {
- if (!e.isAuxExpr()
- && e.isBoundByTupleIds(tupleIds)
- && !globalState.assignedConjuncts.contains(e.getId())
- && !globalState.ojClauseByConjunct.containsKey(e.getId())) {
+ if (!e.isAuxExpr() && e.isBoundByTupleIds(tupleIds)
+ && !globalState.assignedConjuncts.contains(e.getId())
+ && !globalState.ojClauseByConjunct.containsKey(e.getId())) {
result.add(e);
}
}
@@ -1384,7 +1416,7 @@ public boolean isVisible(TupleId tid) {
}
public boolean containsOuterJoinedTid(List tids) {
- for (TupleId tid: tids) {
+ for (TupleId tid : tids) {
if (isOuterJoined(tid)) {
return true;
}
@@ -1427,7 +1459,7 @@ public List getAllConjuncts(TupleId id) {
public List getRemainConjuncts(List tupleIds) {
Set remainConjunctIds = Sets.newHashSet();
for (TupleId tupleId : tupleIds) {
- if (tuplePredicates.get(tupleId) !=null) {
+ if (tuplePredicates.get(tupleId) != null) {
remainConjunctIds.addAll(tuplePredicates.get(tupleId));
}
}
@@ -1448,7 +1480,7 @@ public List getOnSlotEqSlotExpr() {
return new ArrayList<>(globalState.onSlotEqSlotExpr);
}
- public Set> getOnSlotEqSlotDeDuplication() {
+ public Set> getOnSlotEqSlotDeDuplication() {
return Sets.newHashSet(globalState.onSlotEqSlotDeDuplication);
}
@@ -1498,9 +1530,14 @@ public void setVisibleSemiJoinedTuple(TupleId tid) {
* Return true if this analyzer has no ancestors. (i.e. false for the analyzer created
* for inline views/ union operands, etc.)
*/
- public boolean isRootAnalyzer() { return ancestors.isEmpty(); }
+ public boolean isRootAnalyzer() {
+ return ancestors.isEmpty();
+ }
+
+ public boolean hasAncestors() {
+ return !ancestors.isEmpty();
+ }
- public boolean hasAncestors() { return !ancestors.isEmpty(); }
public Analyzer getParentAnalyzer() {
return hasAncestors() ? ancestors.get(0) : null;
}
@@ -1510,10 +1547,17 @@ public Analyzer getParentAnalyzer() {
* to return an empty result set, e.g., due to a limit 0 or a constant predicate
* that evaluates to false.
*/
- public boolean hasEmptyResultSet() { return hasEmptyResultSet; }
- public void setHasEmptyResultSet() { hasEmptyResultSet = true; }
+ public boolean hasEmptyResultSet() {
+ return hasEmptyResultSet;
+ }
+
+ public void setHasEmptyResultSet() {
+ hasEmptyResultSet = true;
+ }
- public boolean hasEmptySpjResultSet() { return hasEmptySpjResultSet; }
+ public boolean hasEmptySpjResultSet() {
+ return hasEmptySpjResultSet;
+ }
public void setHasLimitOffsetClause(boolean hasLimitOffset) {
this.hasLimitOffsetClause = hasLimitOffset;
@@ -1538,7 +1582,7 @@ public void registerOnClauseConjuncts(List conjuncts, TableRef rhsRef)
globalState.conjunctsByOjClause.put(rhsRef.getId(), ojConjuncts);
}
}
- for (Expr conjunct: conjuncts) {
+ for (Expr conjunct : conjuncts) {
conjunct.setIsOnClauseConjunct(true);
registerConjunct(conjunct);
if (rhsRef.getJoinOp().isOuterJoin()) {
@@ -1631,7 +1675,7 @@ public TableRef getOjRef(Expr e) {
return globalState.ojClauseByConjunct.get(e.getId());
}
- /**
+ /**
* Returns false if 'e' originates from an outer-join On-clause and it is incorrect to
* evaluate 'e' at a node materializing 'tids'. Returns true otherwise.
*/
@@ -1655,12 +1699,12 @@ public List getEqJoinConjuncts(List lhsTblRefIds,
// Contains all equi-join conjuncts that have one child fully bound by one of the
// rhs table ref ids (the other child is not bound by that rhs table ref id).
List conjunctIds = Lists.newArrayList();
- for (TupleId rhsId: rhsTblRefIds) {
+ for (TupleId rhsId : rhsTblRefIds) {
List cids = globalState.eqJoinConjuncts.get(rhsId);
if (cids == null) {
continue;
}
- for (ExprId eid: cids) {
+ for (ExprId eid : cids) {
if (!conjunctIds.contains(eid)) {
conjunctIds.add(eid);
}
@@ -1679,12 +1723,12 @@ public List getEqJoinConjuncts(List lhsTblRefIds,
List nodeTblRefIds = Lists.newArrayList(lhsTblRefIds);
nodeTblRefIds.addAll(rhsTblRefIds);
List result = Lists.newArrayList();
- for (ExprId conjunctId: conjunctIds) {
+ for (ExprId conjunctId : conjunctIds) {
Expr e = globalState.conjuncts.get(conjunctId);
Preconditions.checkState(e != null);
- if (!canEvalFullOuterJoinedConjunct(e, nodeTblRefIds) ||
- !canEvalAntiJoinedConjunct(e, nodeTblRefIds) ||
- !canEvalOuterJoinedConjunct(e, nodeTblRefIds)) {
+ if (!canEvalFullOuterJoinedConjunct(e, nodeTblRefIds)
+ || !canEvalAntiJoinedConjunct(e, nodeTblRefIds)
+ || !canEvalOuterJoinedConjunct(e, nodeTblRefIds)) {
continue;
}
@@ -2065,7 +2109,7 @@ public boolean canEvalPredicate(List tupleIds, Expr e) {
}
}
- for (TupleId tid: tids) {
+ for (TupleId tid : tids) {
TableRef rhsRef = getLastOjClause(tid);
// this is not outer-joined; ignore
if (rhsRef == null) {
@@ -2145,13 +2189,13 @@ public boolean evalByJoin(Expr e) {
public void materializeSlots(List exprs) {
List slotIds = Lists.newArrayList();
- for (Expr e: exprs) {
+ for (Expr e : exprs) {
Preconditions.checkState(e.isAnalyzed);
e.getIds(null, slotIds);
}
- for (TupleDescriptor tupleDesc: this.getDescTbl().getTupleDescs()) {
- for (SlotDescriptor slotDesc: tupleDesc.getSlots()) {
+ for (TupleDescriptor tupleDesc : this.getDescTbl().getTupleDescs()) {
+ for (SlotDescriptor slotDesc : tupleDesc.getSlots()) {
if (slotIds.contains(slotDesc.getId())) {
slotDesc.setIsMaterialized(true);
}
@@ -2159,7 +2203,9 @@ public void materializeSlots(List exprs) {
}
}
- public Map getLocalViews() { return localViews; }
+ public Map getLocalViews() {
+ return localViews;
+ }
public boolean isOuterJoined(TupleId tid) {
return globalState.outerJoinedTupleIds.containsKey(tid);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/ArrayLiteral.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/ArrayLiteral.java
index 7e06d1b7aae62e..d9024de8072ad2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ArrayLiteral.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ArrayLiteral.java
@@ -132,7 +132,7 @@ public Expr uncheckedCastTo(Type targetType) throws AnalysisException {
ArrayLiteral literal = new ArrayLiteral(this);
for (int i = 0; i < children.size(); ++ i) {
Expr child = children.get(i);
- literal.children.set(i, child.uncheckedCastTo(((ArrayType)targetType).getItemType()));
+ literal.children.set(i, child.uncheckedCastTo(((ArrayType) targetType).getItemType()));
}
literal.setType(targetType);
return literal;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/BetweenPredicate.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/BetweenPredicate.java
index 5dc2e4c5a9fb01..84fe3112374bb4 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/BetweenPredicate.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/BetweenPredicate.java
@@ -49,13 +49,6 @@ protected BetweenPredicate(BetweenPredicate other) {
isNotBetween = other.isNotBetween;
}
-// @Override
-// public Expr reset() {
-// super.reset();
-// originalChildren = Expr.resetList(originalChildren);
-// return this;
-// }
-
@Override
public Expr clone() {
return new BetweenPredicate(this);
@@ -68,10 +61,10 @@ public boolean isNotBetween() {
@Override
public void analyzeImpl(Analyzer analyzer) throws AnalysisException {
super.analyzeImpl(analyzer);
- if (children.get(0) instanceof Subquery &&
- (children.get(1) instanceof Subquery || children.get(2) instanceof Subquery)) {
- throw new AnalysisException("Comparison between subqueries is not " +
- "supported in a BETWEEN predicate: " + toSql());
+ if (children.get(0) instanceof Subquery
+ && (children.get(1) instanceof Subquery || children.get(2) instanceof Subquery)) {
+ throw new AnalysisException("Comparison between subqueries is not "
+ + "supported in a BETWEEN predicate: " + toSql());
}
// if children has subquery, it will be written and reanalyzed in the future.
if (children.get(0) instanceof Subquery
@@ -82,10 +75,10 @@ public void analyzeImpl(Analyzer analyzer) throws AnalysisException {
analyzer.castAllToCompatibleType(children);
}
- @Override
- public boolean isVectorized() {
- return false;
- }
+ @Override
+ public boolean isVectorized() {
+ return false;
+ }
@Override
protected void toThrift(TExprNode msg) {
@@ -96,19 +89,21 @@ protected void toThrift(TExprNode msg) {
@Override
public String toSqlImpl() {
String notStr = (isNotBetween) ? "NOT " : "";
- return children.get(0).toSql() + " " + notStr + "BETWEEN " +
- children.get(1).toSql() + " AND " + children.get(2).toSql();
+ return children.get(0).toSql() + " " + notStr + "BETWEEN "
+ + children.get(1).toSql() + " AND " + children.get(2).toSql();
}
@Override
public String toDigestImpl() {
String notStr = (isNotBetween) ? "NOT " : "";
- return children.get(0).toDigest() + " " + notStr + "BETWEEN " +
- children.get(1).toDigest() + " AND " + children.get(2).toDigest();
+ return children.get(0).toDigest() + " " + notStr + "BETWEEN "
+ + children.get(1).toDigest() + " AND " + children.get(2).toDigest();
}
@Override
- public Expr clone(ExprSubstitutionMap sMap) { return new BetweenPredicate(this); }
+ public Expr clone(ExprSubstitutionMap sMap) {
+ return new BetweenPredicate(this);
+ }
@Override
public boolean equals(Object o) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/BinaryPredicate.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/BinaryPredicate.java
index 271c8d22603146..12d6aa7b24f2f6 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/BinaryPredicate.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/BinaryPredicate.java
@@ -134,11 +134,17 @@ public Operator converse() {
}
}
- public boolean isEquivalence() { return this == EQ || this == EQ_FOR_NULL; };
+ public boolean isEquivalence() {
+ return this == EQ || this == EQ_FOR_NULL;
+ }
- public boolean isUnNullSafeEquivalence() { return this == EQ; };
+ public boolean isUnNullSafeEquivalence() {
+ return this == EQ;
+ }
- public boolean isUnequivalence() { return this == NE; }
+ public boolean isUnequivalence() {
+ return this == NE;
+ }
}
private Operator op;
@@ -163,15 +169,20 @@ public BinaryPredicate(Operator op, Expr e1, Expr e2) {
protected BinaryPredicate(BinaryPredicate other) {
super(other);
op = other.op;
- slotIsleft= other.slotIsleft;
+ slotIsleft = other.slotIsleft;
isInferred = other.isInferred;
}
- public boolean isInferred() { return isInferred; }
- public void setIsInferred() { isInferred = true; }
+ public boolean isInferred() {
+ return isInferred;
+ }
+
+ public void setIsInferred() {
+ isInferred = true;
+ }
public static void initBuiltins(FunctionSet functionSet) {
- for (Type t: Type.getSupportedTypes()) {
+ for (Type t : Type.getSupportedTypes()) {
if (t.isNull()) {
continue; // NULL is handled through type promotion.
}
@@ -201,7 +212,9 @@ public Operator getOp() {
return op;
}
- public void setOp(Operator op) { this.op = op; }
+ public void setOp(Operator op) {
+ this.op = op;
+ }
@Override
public Expr negate() {
@@ -339,17 +352,17 @@ private Type getCmpType() throws AnalysisException {
// When int column compares with string, Mysql will convert string to int.
// So it is also compatible with Mysql.
- if (t1 == PrimitiveType.BIGINT && (t2 == PrimitiveType.VARCHAR || t2 ==PrimitiveType.STRING)) {
+ if (t1 == PrimitiveType.BIGINT && (t2 == PrimitiveType.VARCHAR || t2 == PrimitiveType.STRING)) {
Expr rightChild = getChild(1);
Long parsedLong = Type.tryParseToLong(rightChild);
- if(parsedLong != null) {
+ if (parsedLong != null) {
return Type.BIGINT;
}
}
- if ((t1 == PrimitiveType.VARCHAR || t1 ==PrimitiveType.STRING) && t2 == PrimitiveType.BIGINT) {
+ if ((t1 == PrimitiveType.VARCHAR || t1 == PrimitiveType.STRING) && t2 == PrimitiveType.BIGINT) {
Expr leftChild = getChild(0);
Long parsedLong = Type.tryParseToLong(leftChild);
- if(parsedLong != null) {
+ if (parsedLong != null) {
return Type.BIGINT;
}
}
@@ -404,8 +417,8 @@ public void analyzeImpl(Analyzer analyzer) throws AnalysisException {
// determine selectivity
Reference slotRefRef = new Reference();
- if (op == Operator.EQ && isSingleColumnPredicate(slotRefRef,
- null) && slotRefRef.getRef().getNumDistinctValues() > 0) {
+ if (op == Operator.EQ && isSingleColumnPredicate(slotRefRef, null)
+ && slotRefRef.getRef().getNumDistinctValues() > 0) {
Preconditions.checkState(slotRefRef.getRef() != null);
selectivity = 1.0 / slotRefRef.getRef().getNumDistinctValues();
selectivity = Math.max(0, Math.min(1, selectivity));
@@ -604,11 +617,11 @@ public Expr getResultValue() throws AnalysisException {
recursiveResetChildrenResult();
final Expr leftChildValue = getChild(0);
final Expr rightChildValue = getChild(1);
- if(!(leftChildValue instanceof LiteralExpr)
+ if (!(leftChildValue instanceof LiteralExpr)
|| !(rightChildValue instanceof LiteralExpr)) {
return this;
}
- return compareLiteral((LiteralExpr)leftChildValue, (LiteralExpr)rightChildValue);
+ return compareLiteral((LiteralExpr) leftChildValue, (LiteralExpr) rightChildValue);
}
private Expr compareLiteral(LiteralExpr first, LiteralExpr second) throws AnalysisException {
@@ -621,13 +634,13 @@ private Expr compareLiteral(LiteralExpr first, LiteralExpr second) throws Analys
return new BoolLiteral(false);
}
} else {
- if (isFirstNull || isSecondNull){
+ if (isFirstNull || isSecondNull) {
return new NullLiteral();
}
}
final int compareResult = first.compareLiteral(second);
- switch(op) {
+ switch (op) {
case EQ:
case EQ_FOR_NULL:
return new BoolLiteral(compareResult == 0);
@@ -649,7 +662,7 @@ private Expr compareLiteral(LiteralExpr first, LiteralExpr second) throws Analys
@Override
public void setSelectivity() {
- switch(op) {
+ switch (op) {
case EQ:
case EQ_FOR_NULL: {
Reference slotRefRef = new Reference();
@@ -661,7 +674,8 @@ public void setSelectivity() {
}
}
break;
- } default: {
+ }
+ default: {
// Reference hive
selectivity = 1.0 / 3.0;
break;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/BuiltinAggregateFunction.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/BuiltinAggregateFunction.java
index ff66fb29e4078f..3ccb85f0ae3f9f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/BuiltinAggregateFunction.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/BuiltinAggregateFunction.java
@@ -20,7 +20,6 @@
import org.apache.doris.catalog.Function;
import org.apache.doris.catalog.ScalarType;
import org.apache.doris.catalog.Type;
-import org.apache.doris.common.AnalysisException;
import org.apache.doris.thrift.TAggregateFunction;
import org.apache.doris.thrift.TAggregationOp;
import org.apache.doris.thrift.TFunction;
@@ -50,10 +49,8 @@ public boolean isReqIntermediateTuple() {
}
public BuiltinAggregateFunction(Operator op, ArrayList argTypes,
- Type retType, org.apache.doris.catalog.Type intermediateType, boolean isAnalyticFn)
- throws AnalysisException {
- super(FunctionName.createBuiltinName(op.toString()), argTypes,
- retType, false);
+ Type retType, org.apache.doris.catalog.Type intermediateType, boolean isAnalyticFn) {
+ super(FunctionName.createBuiltinName(op.toString()), argTypes, retType, false);
Preconditions.checkState(intermediateType != null);
Preconditions.checkState(op != null);
// may be no need to analyze
@@ -128,8 +125,8 @@ public enum Operator {
// The intermediate type for this function if it is constant regardless of
// input type. Set to null if it can only be determined during analysis.
private final org.apache.doris.catalog.Type intermediateType;
- private Operator(String description, TAggregationOp thriftOp,
- org.apache.doris.catalog.Type intermediateType) {
+ Operator(String description, TAggregationOp thriftOp,
+ org.apache.doris.catalog.Type intermediateType) {
this.description = description;
this.thriftOp = thriftOp;
this.intermediateType = intermediateType;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CancelAlterTableStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/CancelAlterTableStmt.java
index d49c68fd1e85ca..8f88a8580ab9d1 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CancelAlterTableStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CancelAlterTableStmt.java
@@ -88,8 +88,8 @@ public String toSql() {
stringBuilder.append("CANCEL ALTER " + this.alterType);
stringBuilder.append(" FROM " + dbTableName.toSql());
if (!CollectionUtils.isEmpty(alterJobIdList)) {
- stringBuilder.append(" (")
- .append(String.join(",",alterJobIdList.stream().map(String::valueOf).collect(Collectors.toList())));
+ stringBuilder.append(" (").append(String.join(",", alterJobIdList.stream()
+ .map(String::valueOf).collect(Collectors.toList())));
stringBuilder.append(")");
}
return stringBuilder.toString();
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java
index d2e9691bf2a04c..10cd2d065c5a50 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java
@@ -65,11 +65,11 @@ public class CastExpr extends Expr {
static {
TYPE_NULLABLE_MODE = Maps.newHashMap();
- for (ScalarType fromType: Type.getSupportedTypes()) {
+ for (ScalarType fromType : Type.getSupportedTypes()) {
if (fromType.isNull()) {
continue;
}
- for (ScalarType toType: Type.getSupportedTypes()) {
+ for (ScalarType toType : Type.getSupportedTypes()) {
if (fromType.isNull()) {
continue;
}
@@ -138,9 +138,8 @@ public TypeDef getTargetTypeDef() {
private static boolean disableRegisterCastingFunction(Type fromType, Type toType) {
// Disable casting from boolean to decimal or datetime or date
- if (fromType.isBoolean() &&
- (toType.equals(Type.DECIMALV2) ||
- toType.equals(Type.DATETIME) || toType.equals(Type.DATE))) {
+ if (fromType.isBoolean()
+ && (toType.equals(Type.DECIMALV2) || toType.equals(Type.DATETIME) || toType.equals(Type.DATE))) {
return true;
}
@@ -173,7 +172,7 @@ public static void initBuiltins(FunctionSet functionSet) {
+ typeName;
functionSet.addBuiltinBothScalaAndVectorized(ScalarFunction.createBuiltin(getFnName(toType),
toType, TYPE_NULLABLE_MODE.get(new Pair<>(fromType, toType)),
- Lists.newArrayList(fromType), false ,
+ Lists.newArrayList(fromType), false,
beSymbol, null, null, true));
}
}
@@ -186,11 +185,11 @@ public Expr clone() {
@Override
public String toSqlImpl() {
- boolean isVerbose = ConnectContext.get() != null &&
- ConnectContext.get().getExecutor() != null &&
- ConnectContext.get().getExecutor().getParsedStmt() != null &&
- ConnectContext.get().getExecutor().getParsedStmt().getExplainOptions() != null &&
- ConnectContext.get().getExecutor().getParsedStmt().getExplainOptions().isVerbose();
+ boolean isVerbose = ConnectContext.get() != null
+ && ConnectContext.get().getExecutor() != null
+ && ConnectContext.get().getExecutor().getParsedStmt() != null
+ && ConnectContext.get().getExecutor().getParsedStmt().getExplainOptions() != null
+ && ConnectContext.get().getExecutor().getParsedStmt().getExplainOptions().isVerbose();
if (isImplicit && !isVerbose) {
return getChild(0).toSql();
}
@@ -207,11 +206,11 @@ public String toSqlImpl() {
@Override
public String toDigestImpl() {
- boolean isVerbose = ConnectContext.get() != null &&
- ConnectContext.get().getExecutor() != null &&
- ConnectContext.get().getExecutor().getParsedStmt() != null &&
- ConnectContext.get().getExecutor().getParsedStmt().getExplainOptions() != null &&
- ConnectContext.get().getExecutor().getParsedStmt().getExplainOptions().isVerbose();
+ boolean isVerbose = ConnectContext.get() != null
+ && ConnectContext.get().getExecutor() != null
+ && ConnectContext.get().getExecutor().getParsedStmt() != null
+ && ConnectContext.get().getExecutor().getParsedStmt().getExplainOptions() != null
+ && ConnectContext.get().getExecutor().getParsedStmt().getExplainOptions().isVerbose();
if (isImplicit && !isVerbose) {
return getChild(0).toDigest();
}
@@ -278,10 +277,10 @@ public void analyze() throws AnalysisException {
fn = Catalog.getCurrentCatalog().getFunction(
searchDesc, Function.CompareMode.IS_IDENTICAL);
}
- } else if (type.isArrayType()){
+ } else if (type.isArrayType()) {
fn = ScalarFunction.createBuiltin(getFnName(Type.ARRAY),
type, Function.NullableMode.ALWAYS_NULLABLE,
- Lists.newArrayList(Type.VARCHAR), false ,
+ Lists.newArrayList(Type.VARCHAR), false,
"doris::CastFunctions::cast_to_array_val", null, null, true);
}
@@ -334,8 +333,8 @@ public boolean equals(Object obj) {
public Expr ignoreImplicitCast() {
if (isImplicit) {
// we don't expect to see to consecutive implicit casts
- Preconditions.checkState(
- !(getChild(0) instanceof CastExpr) || !((CastExpr) getChild(0)).isImplicit());
+ Preconditions.checkState(!(getChild(0) instanceof CastExpr)
+ || !((CastExpr) getChild(0)).isImplicit());
return getChild(0);
} else {
return this;
@@ -361,7 +360,7 @@ public Expr getResultValue() throws AnalysisException {
}
Expr targetExpr;
try {
- targetExpr = castTo((LiteralExpr)value);
+ targetExpr = castTo((LiteralExpr) value);
} catch (AnalysisException ae) {
targetExpr = this;
} catch (NumberFormatException nfe) {
@@ -493,7 +492,7 @@ private int getDigital(String desc, List parameters, List inputPar
if (index != -1) {
Expr expr = inputParamsExprs.get(index);
if (expr.getType().isIntegerType()) {
- return ((Long)((IntLiteral) expr).getRealValue()).intValue();
+ return ((Long) ((IntLiteral) expr).getRealValue()).intValue();
}
}
return -1;
@@ -501,8 +500,8 @@ private int getDigital(String desc, List parameters, List inputPar
@Override
public boolean isNullable() {
- return children.get(0).isNullable() ||
- (children.get(0).getType().isStringType() && !getType().isStringType()) ||
- (!children.get(0).getType().isDateType() && getType().isDateType());
+ return children.get(0).isNullable()
+ || (children.get(0).getType().isStringType() && !getType().isStringType())
+ || (!children.get(0).getType().isDateType() && getType().isDateType());
}
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java
index 86a818ff8e159f..d3831f2de639f7 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java
@@ -131,15 +131,41 @@ public static ColumnDef newSequenceColumnDef(Type type, AggregateType aggregateT
"sequence column hidden column", false);
}
- public boolean isAllowNull() { return isAllowNull; }
- public String getDefaultValue() { return defaultValue.value; }
- public String getName() { return name; }
- public AggregateType getAggregateType() { return aggregateType; }
- public void setAggregateType(AggregateType aggregateType) { this.aggregateType = aggregateType; }
- public boolean isKey() { return isKey; }
- public void setIsKey(boolean isKey) { this.isKey = isKey; }
- public TypeDef getTypeDef() { return typeDef; }
- public Type getType() { return typeDef.getType(); }
+ public boolean isAllowNull() {
+ return isAllowNull;
+ }
+
+ public String getDefaultValue() {
+ return defaultValue.value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public AggregateType getAggregateType() {
+ return aggregateType;
+ }
+
+ public void setAggregateType(AggregateType aggregateType) {
+ this.aggregateType = aggregateType;
+ }
+
+ public boolean isKey() {
+ return isKey;
+ }
+
+ public void setIsKey(boolean isKey) {
+ this.isKey = isKey;
+ }
+
+ public TypeDef getTypeDef() {
+ return typeDef;
+ }
+
+ public Type getType() {
+ return typeDef.getType();
+ }
public String getComment() {
return comment;
@@ -168,9 +194,9 @@ public void analyze(boolean isOlap) throws AnalysisException {
Type type = typeDef.getType();
- if(!Config.enable_quantile_state_type && type.isQuantileStateType()) {
- throw new AnalysisException("quantile_state is disabled" +
- "Set config 'enable_quantile_state_type' = 'true' to enable this column type.");
+ if (!Config.enable_quantile_state_type && type.isQuantileStateType()) {
+ throw new AnalysisException("quantile_state is disabled"
+ + "Set config 'enable_quantile_state_type' = 'true' to enable this column type.");
}
// disable Bitmap Hll type in keys, values without aggregate function.
@@ -270,10 +296,10 @@ public static void validateDefaultValue(Type type, String defaultValue) throws A
case SMALLINT:
case INT:
case BIGINT:
- IntLiteral intLiteral = new IntLiteral(defaultValue, type);
+ new IntLiteral(defaultValue, type);
break;
case LARGEINT:
- LargeIntLiteral largeIntLiteral = new LargeIntLiteral(defaultValue);
+ new LargeIntLiteral(defaultValue);
break;
case FLOAT:
FloatLiteral floatLiteral = new FloatLiteral(defaultValue);
@@ -282,7 +308,7 @@ public static void validateDefaultValue(Type type, String defaultValue) throws A
}
break;
case DOUBLE:
- FloatLiteral doubleLiteral = new FloatLiteral(defaultValue);
+ new FloatLiteral(defaultValue);
break;
case DECIMALV2:
DecimalLiteral decimalLiteral = new DecimalLiteral(defaultValue);
@@ -290,7 +316,7 @@ public static void validateDefaultValue(Type type, String defaultValue) throws A
break;
case DATE:
case DATETIME:
- DateLiteral dateLiteral = new DateLiteral(defaultValue, type);
+ new DateLiteral(defaultValue, type);
break;
case CHAR:
case VARCHAR:
@@ -309,7 +335,7 @@ public static void validateDefaultValue(Type type, String defaultValue) throws A
case STRUCT:
break;
case BOOLEAN:
- BoolLiteral boolLiteral = new BoolLiteral(defaultValue);
+ new BoolLiteral(defaultValue);
break;
default:
throw new AnalysisException("Unsupported type: " + type);
@@ -346,5 +372,7 @@ public Column toColumn() {
}
@Override
- public String toString() { return toSql(); }
+ public String toString() {
+ return toSql();
+ }
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CompoundPredicate.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/CompoundPredicate.java
index 87b0dfd8830521..d2175117a01527 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CompoundPredicate.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CompoundPredicate.java
@@ -57,8 +57,7 @@ public CompoundPredicate(Operator op, Expr e1, Expr e2) {
this.op = op;
Preconditions.checkNotNull(e1);
children.add(e1);
- Preconditions.checkArgument(
- op == Operator.NOT && e2 == null || op != Operator.NOT && e2 != null);
+ Preconditions.checkArgument(op == Operator.NOT && e2 == null || op != Operator.NOT && e2 != null);
if (e2 != null) {
children.add(e2);
}
@@ -121,14 +120,13 @@ public void analyzeImpl(Analyzer analyzer) throws AnalysisException {
for (Expr e : children) {
if (!e.getType().equals(Type.BOOLEAN) && !e.getType().isNull()) {
throw new AnalysisException(String.format(
- "Operand '%s' part of predicate " + "'%s' should return type 'BOOLEAN' but " +
- "returns type '%s'.",
+ "Operand '%s' part of predicate " + "'%s' should return type 'BOOLEAN' but "
+ + "returns type '%s'.",
e.toSql(), toSql(), e.getType()));
}
}
- if (getChild(0).selectivity == -1 || children.size() == 2 && getChild(
- 1).selectivity == -1) {
+ if (getChild(0).selectivity == -1 || children.size() == 2 && getChild(1).selectivity == -1) {
// give up if we're missing an input
selectivity = -1;
return;
@@ -205,37 +203,36 @@ public static Expr createConjunction(Expr lhs, Expr rhs) {
*/
public static Expr createConjunctivePredicate(List conjuncts) {
Expr conjunctivePred = null;
- for (Expr expr: conjuncts) {
- if (conjunctivePred == null) {
- conjunctivePred = expr;
- continue;
- }
- conjunctivePred = new CompoundPredicate(CompoundPredicate.Operator.AND,
- expr, conjunctivePred);
+ for (Expr expr : conjuncts) {
+ if (conjunctivePred == null) {
+ conjunctivePred = expr;
+ continue;
+ }
+ conjunctivePred = new CompoundPredicate(CompoundPredicate.Operator.AND, expr, conjunctivePred);
}
return conjunctivePred;
}
- @Override
+ @Override
public Expr getResultValue() throws AnalysisException {
recursiveResetChildrenResult();
boolean compoundResult = false;
if (op == Operator.NOT) {
final Expr childValue = getChild(0);
- if(!(childValue instanceof BoolLiteral)) {
+ if (!(childValue instanceof BoolLiteral)) {
return this;
}
- final BoolLiteral boolChild = (BoolLiteral)childValue;
+ final BoolLiteral boolChild = (BoolLiteral) childValue;
compoundResult = !boolChild.getValue();
} else {
final Expr leftChildValue = getChild(0);
final Expr rightChildValue = getChild(1);
- if(!(leftChildValue instanceof BoolLiteral)
+ if (!(leftChildValue instanceof BoolLiteral)
|| !(rightChildValue instanceof BoolLiteral)) {
return this;
}
- final BoolLiteral leftBoolValue = (BoolLiteral)leftChildValue;
- final BoolLiteral rightBoolValue = (BoolLiteral)rightChildValue;
+ final BoolLiteral leftBoolValue = (BoolLiteral) leftChildValue;
+ final BoolLiteral rightBoolValue = (BoolLiteral) rightChildValue;
switch (op) {
case AND:
compoundResult = leftBoolValue.getValue() && rightBoolValue.getValue();
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateEncryptKeyStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateEncryptKeyStmt.java
index ad694ad8caa062..626cef29b623a8 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateEncryptKeyStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateEncryptKeyStmt.java
@@ -40,7 +40,7 @@
* for example:
* CREATE ENCRYPTKEY test.key1 AS "beijing";
*/
-public class CreateEncryptKeyStmt extends DdlStmt{
+public class CreateEncryptKeyStmt extends DdlStmt {
private final EncryptKeyName encryptKeyName;
private final String keyString;
private EncryptKey encryptKey;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateRoutineLoadStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateRoutineLoadStmt.java
index 45a0a7ff42dcb8..eff6a8bb7c3fe1 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateRoutineLoadStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateRoutineLoadStmt.java
@@ -97,7 +97,7 @@ public class CreateRoutineLoadStmt extends DdlStmt {
public static final String MAX_BATCH_SIZE_PROPERTY = "max_batch_size";
public static final String EXEC_MEM_LIMIT_PROPERTY = "exec_mem_limit";
- public static final String FORMAT = "format";// the value is csv or json, default is csv
+ public static final String FORMAT = "format"; // the value is csv or json, default is csv
public static final String STRIP_OUTER_ARRAY = "strip_outer_array";
public static final String JSONPATHS = "jsonpaths";
public static final String JSONROOT = "json_root";
@@ -338,7 +338,7 @@ public void checkDBTable(Analyzer analyzer) throws AnalysisException {
throw new AnalysisException("load by MERGE or DELETE is only supported in unique tables.");
}
if (mergeType != LoadTask.MergeType.APPEND
- && !(table.getType() == Table.TableType.OLAP && ((OlapTable) table).hasDeleteSign()) ) {
+ && !(table.getType() == Table.TableType.OLAP && ((OlapTable) table).hasDeleteSign())) {
throw new AnalysisException("load by MERGE or DELETE need to upgrade table to support batch delete.");
}
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableLikeStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableLikeStmt.java
index 70223c87cc27d6..b65aaa4d28d209 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableLikeStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableLikeStmt.java
@@ -51,7 +51,7 @@ public CreateTableLikeStmt(boolean ifNotExists, TableName tableName, TableName e
this.ifNotExists = ifNotExists;
this.tableName = tableName;
this.existedTableName = existedTableName;
- if (!CollectionUtils.isEmpty(rollupNames) && withAllRollup){
+ if (!CollectionUtils.isEmpty(rollupNames) && withAllRollup) {
throw new DdlException("Either all or part of the rollup can be copied, not both");
}
this.rollupNames = rollupNames;
@@ -108,10 +108,10 @@ public void analyze(Analyzer analyzer) throws UserException {
public String toSql() {
StringBuilder sb = new StringBuilder();
sb.append("CREATE TABLE ").append(tableName.toSql()).append(" LIKE ").append(existedTableName.toSql());
- if (withAllRollup && CollectionUtils.isEmpty(rollupNames)){
+ if (withAllRollup && CollectionUtils.isEmpty(rollupNames)) {
sb.append(" WITH ROLLUP");
}
- if (!withAllRollup && !CollectionUtils.isEmpty(rollupNames)){
+ if (!withAllRollup && !CollectionUtils.isEmpty(rollupNames)) {
sb.append(" WITH ROLLUP (").append(Joiner.on(",").join(rollupNames)).append(")");
}
return sb.toString();
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableStmt.java
index 5c2db118bb755c..44de0d27f95580 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableStmt.java
@@ -183,9 +183,13 @@ public CreateTableStmt(boolean ifNotExists,
this.comment = Strings.nullToEmpty(comment);
}
- public void addColumnDef(ColumnDef columnDef) { columnDefs.add(columnDef); }
+ public void addColumnDef(ColumnDef columnDef) {
+ columnDefs.add(columnDef);
+ }
- public void setIfNotExists(boolean ifNotExists) { this.ifNotExists = ifNotExists; }
+ public void setIfNotExists(boolean ifNotExists) {
+ this.ifNotExists = ifNotExists;
+ }
public boolean isSetIfNotExists() {
return ifNotExists;
@@ -380,8 +384,8 @@ public void analyze(Analyzer analyzer) throws UserException {
throw new AnalysisException("Array column can't support aggregation " + columnDef.getAggregateType());
}
if (columnDef.isKey()) {
- throw new AnalysisException("Array can only be used in the non-key column of" +
- " the duplicate table at present.");
+ throw new AnalysisException("Array can only be used in the non-key column of"
+ + " the duplicate table at present.");
}
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/DataSortInfo.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/DataSortInfo.java
index 783ccde0ec7bc0..4393dc162cf1bc 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DataSortInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DataSortInfo.java
@@ -54,7 +54,7 @@ public DataSortInfo(Map properties) {
}
}
- public DataSortInfo (TSortType sortType, int colNum) {
+ public DataSortInfo(TSortType sortType, int colNum) {
this.sortType = sortType;
this.colNum = colNum;
}
@@ -97,8 +97,8 @@ public boolean equals(DataSortInfo dataSortInfo) {
}
public String toSql() {
- String res = ",\n\"" + DATA_SORT_TYPE + "\" = \"" + this.sortType + "\"" +
- ",\n\"" + DATA_SORT_COL_NUM + "\" = \"" + this.colNum + "\"";
+ String res = ",\n\"" + DATA_SORT_TYPE + "\" = \"" + this.sortType + "\""
+ + ",\n\"" + DATA_SORT_COL_NUM + "\" = \"" + this.colNum + "\"";
return res;
}
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java
index 75fcb05f2a117d..a59952f55edd38 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java
@@ -1054,7 +1054,7 @@ private boolean checkRange() {
|| microsecond > MAX_MICROSECOND;
}
private boolean checkDate() {
- if (month != 0 && day > DAYS_IN_MONTH[((int) month)]){
+ if (month != 0 && day > DAYS_IN_MONTH[((int) month)]) {
if (month == 2 && day == 29 && Year.isLeap(year)) {
return false;
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/DecimalLiteral.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/DecimalLiteral.java
index 07abe74bed66c4..b2b1278d5d607c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DecimalLiteral.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DecimalLiteral.java
@@ -193,7 +193,6 @@ public double getDoubleValue() {
protected void toThrift(TExprNode msg) {
// TODO(hujie01) deal with loss information
msg.node_type = TExprNodeType.DECIMAL_LITERAL;
- BigDecimal v = new BigDecimal(value.toBigInteger());
msg.decimal_literal = new TDecimalLiteral(value.toPlainString());
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/DescriptorTable.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/DescriptorTable.java
index e2f933291f9a0a..526c6e4806941c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DescriptorTable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DescriptorTable.java
@@ -82,7 +82,7 @@ public TupleDescriptor copyTupleDescriptor(TupleId srcId, String debugName) {
tupleDescs.put(d.getId(), d);
// create copies of slots
TupleDescriptor src = tupleDescs.get(srcId);
- for (SlotDescriptor slot: src.getSlots()) {
+ for (SlotDescriptor slot : src.getSlots()) {
copySlotDescriptor(d, slot);
}
d.computeStatAndMemLayout();
@@ -119,7 +119,7 @@ public void addReferencedTable(Table table) {
* Marks all slots in list as materialized.
*/
public void markSlotsMaterialized(List ids) {
- for (SlotId id: ids) {
+ for (SlotId id : ids) {
getSlotDesc(id).setIsMaterialized(true);
}
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/DropFunctionStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/DropFunctionStmt.java
index da90e1c0f4f8ae..4e88751ede41a6 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DropFunctionStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DropFunctionStmt.java
@@ -37,8 +37,13 @@ public DropFunctionStmt(FunctionName functionName, FunctionArgsDef argsDef) {
this.argsDef = argsDef;
}
- public FunctionName getFunctionName() { return functionName; }
- public FunctionSearchDesc getFunction() { return function; }
+ public FunctionName getFunctionName() {
+ return functionName;
+ }
+
+ public FunctionSearchDesc getFunction() {
+ return function;
+ }
@Override
public void analyze(Analyzer analyzer) throws UserException {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/ExistsPredicate.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/ExistsPredicate.java
index bdb2fbee0622c3..b061b19e2f47a9 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ExistsPredicate.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ExistsPredicate.java
@@ -27,11 +27,12 @@
* Class representing a [NOT] EXISTS predicate.
*/
public class ExistsPredicate extends Predicate {
- private static final Logger LOG = LoggerFactory.getLogger(
- ExistsPredicate.class);
+ private static final Logger LOG = LoggerFactory.getLogger(ExistsPredicate.class);
private boolean notExists = false;
- public boolean isNotExists() { return notExists; }
+ public boolean isNotExists() {
+ return notExists;
+ }
public ExistsPredicate(Subquery subquery, boolean notExists) {
Preconditions.checkNotNull(subquery);
@@ -56,7 +57,9 @@ protected void toThrift(TExprNode msg) {
}
@Override
- public Expr clone() { return new ExistsPredicate(this); }
+ public Expr clone() {
+ return new ExistsPredicate(this);
+ }
@Override
public String toSqlImpl() {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/ExportStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/ExportStmt.java
index a77d151168da1f..6df62c42f4cd8e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ExportStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ExportStmt.java
@@ -72,7 +72,7 @@ public class ExportStmt extends StatementBase {
private Map properties = Maps.newHashMap();
private String columnSeparator;
private String lineDelimiter;
- private String columns ;
+ private String columns;
private TableRef tableRef;
@@ -243,17 +243,17 @@ public static String checkPath(String path, StorageBackend.StorageType type) thr
if (schema == null || !schema.equalsIgnoreCase("s3")) {
throw new AnalysisException("Invalid export path. please use valid 'S3://' path.");
}
- } else if (type == StorageBackend.StorageType.HDFS) {
- if (schema == null || !schema.equalsIgnoreCase("hdfs")) {
- throw new AnalysisException("Invalid export path. please use valid 'HDFS://' path.");
- }
- } else if (type == StorageBackend.StorageType.LOCAL) {
- if (schema != null && !schema.equalsIgnoreCase("file")) {
- throw new AnalysisException("Invalid export path. please use valid '"
- + OutFileClause.LOCAL_FILE_PREFIX + "' path.");
- }
- path = path.substring(OutFileClause.LOCAL_FILE_PREFIX.length() - 1);
+ } else if (type == StorageBackend.StorageType.HDFS) {
+ if (schema == null || !schema.equalsIgnoreCase("hdfs")) {
+ throw new AnalysisException("Invalid export path. please use valid 'HDFS://' path.");
}
+ } else if (type == StorageBackend.StorageType.LOCAL) {
+ if (schema != null && !schema.equalsIgnoreCase("file")) {
+ throw new AnalysisException(
+ "Invalid export path. please use valid '" + OutFileClause.LOCAL_FILE_PREFIX + "' path.");
+ }
+ path = path.substring(OutFileClause.LOCAL_FILE_PREFIX.length() - 1);
+ }
return path;
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/Expr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/Expr.java
index 82130639657979..2bf7e5929f78d5 100755
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/Expr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/Expr.java
@@ -48,7 +48,6 @@
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
-import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -77,8 +76,8 @@ abstract public class Expr extends TreeNode implements ParseNode, Cloneabl
private final static com.google.common.base.Predicate IS_AGGREGATE_PREDICATE =
new com.google.common.base.Predicate() {
public boolean apply(Expr arg) {
- return arg instanceof FunctionCallExpr &&
- ((FunctionCallExpr)arg).isAggregateFunction();
+ return arg instanceof FunctionCallExpr
+ && ((FunctionCallExpr) arg).isAggregateFunction();
}
};
@@ -87,8 +86,8 @@ public boolean apply(Expr arg) {
new com.google.common.base.Predicate() {
@Override
public boolean apply(Expr arg) {
- return arg instanceof CompoundPredicate &&
- ((CompoundPredicate)arg).getOp() == CompoundPredicate.Operator.NOT;
+ return arg instanceof CompoundPredicate
+ && ((CompoundPredicate) arg).getOp() == CompoundPredicate.Operator.NOT;
}
};
@@ -97,8 +96,8 @@ public boolean apply(Expr arg) {
new com.google.common.base.Predicate() {
@Override
public boolean apply(Expr arg) {
- return arg instanceof CompoundPredicate &&
- ((CompoundPredicate)arg).getOp() == CompoundPredicate.Operator.OR;
+ return arg instanceof CompoundPredicate
+ && ((CompoundPredicate) arg).getOp() == CompoundPredicate.Operator.OR;
}
};
@@ -113,33 +112,21 @@ public boolean apply(Expr arg) {
// Returns true if an Expr is an aggregate function that returns non-null on
// an empty set (e.g. count).
- public final static com.google.common.base.Predicate
- NON_NULL_EMPTY_AGG = new com.google.common.base.Predicate() {
- @Override
- public boolean apply(Expr arg) {
- return arg instanceof FunctionCallExpr &&
- ((FunctionCallExpr)arg).returnsNonNullOnEmpty();
- }
- };
-
- /* TODO(zc)
- // Returns true if an Expr is a builtin aggregate function.
- public final static com.google.common.base.Predicate IS_BUILTIN_AGG_FN =
+ public final static com.google.common.base.Predicate NON_NULL_EMPTY_AGG =
new com.google.common.base.Predicate() {
@Override
public boolean apply(Expr arg) {
- return arg instanceof FunctionCallExpr &&
- ((FunctionCallExpr)arg).getFnName().isBuiltin();
+ return arg instanceof FunctionCallExpr && ((FunctionCallExpr) arg).returnsNonNullOnEmpty();
}
};
- */
+
// Returns true if an Expr is a builtin aggregate function.
public final static com.google.common.base.Predicate CORRELATED_SUBQUERY_SUPPORT_AGG_FN =
new com.google.common.base.Predicate() {
@Override
public boolean apply(Expr arg) {
if (arg instanceof FunctionCallExpr) {
- String fnName = ((FunctionCallExpr)arg).getFnName().getFunction();
+ String fnName = ((FunctionCallExpr) arg).getFnName().getFunction();
return (fnName.equalsIgnoreCase("sum")
|| fnName.equalsIgnoreCase("max")
|| fnName.equalsIgnoreCase("min")
@@ -156,7 +143,7 @@ public boolean apply(Expr arg) {
new com.google.common.base.Predicate() {
@Override
public boolean apply(Expr arg) {
- return arg instanceof BoolLiteral && ((BoolLiteral)arg).getValue();
+ return arg instanceof BoolLiteral && ((BoolLiteral) arg).getValue();
}
};
@@ -164,26 +151,32 @@ public boolean apply(Expr arg) {
new com.google.common.base.Predicate() {
@Override
public boolean apply(Expr arg) {
- return arg instanceof BoolLiteral && !((BoolLiteral)arg).getValue();
+ return arg instanceof BoolLiteral && !((BoolLiteral) arg).getValue();
}
};
public final static com.google.common.base.Predicate IS_EQ_BINARY_PREDICATE =
new com.google.common.base.Predicate() {
@Override
- public boolean apply(Expr arg) { return BinaryPredicate.getEqSlots(arg) != null; }
+ public boolean apply(Expr arg) {
+ return BinaryPredicate.getEqSlots(arg) != null;
+ }
};
public final static com.google.common.base.Predicate IS_BINARY_PREDICATE =
new com.google.common.base.Predicate() {
@Override
- public boolean apply(Expr arg) { return arg instanceof BinaryPredicate; }
+ public boolean apply(Expr arg) {
+ return arg instanceof BinaryPredicate;
+ }
};
public static final com.google.common.base.Predicate IS_NULL_LITERAL =
new com.google.common.base.Predicate() {
@Override
- public boolean apply(Expr arg) { return arg instanceof NullLiteral; }
+ public boolean apply(Expr arg) {
+ return arg instanceof NullLiteral;
+ }
};
public static final com.google.common.base.Predicate IS_VARCHAR_SLOT_REF_IMPLICIT_CAST =
@@ -302,7 +295,8 @@ public boolean isAnalyzed() {
return isAnalyzed;
}
- public void checkValueValid() throws AnalysisException {}
+ public void checkValueValid() throws AnalysisException {
+ }
public ExprId getId() {
return id;
@@ -329,7 +323,9 @@ public double getSelectivity() {
return selectivity;
}
- public boolean hasSelectivity() { return selectivity >= 0; }
+ public boolean hasSelectivity() {
+ return selectivity >= 0;
+ }
public long getNumDistinctValues() {
return numDistinctValues;
@@ -353,14 +349,22 @@ public boolean isFilter() {
return isFilter;
}
- public void setIsFilter(boolean v) {
- isFilter = v;
+ public boolean isOnClauseConjunct() {
+ return isOnClauseConjunct;
+ }
+
+ public void setIsOnClauseConjunct(boolean b) {
+ isOnClauseConjunct = b;
+ }
+
+ public boolean isAuxExpr() {
+ return isAuxExpr;
+ }
+
+ public void setIsAuxExpr() {
+ isAuxExpr = true;
}
- public boolean isOnClauseConjunct() { return isOnClauseConjunct; }
- public void setIsOnClauseConjunct(boolean b) { isOnClauseConjunct = b; }
- public boolean isAuxExpr() { return isAuxExpr; }
- public void setIsAuxExpr() { isAuxExpr = true; }
public Function getFn() {
return fn;
}
@@ -384,8 +388,8 @@ public final void analyze(Analyzer analyzer) throws AnalysisException {
// Check the expr child limit.
if (children.size() > Config.expr_children_limit) {
- throw new AnalysisException(String.format("Exceeded the maximum number of child " +
- "expressions (%d).", Config.expr_children_limit));
+ throw new AnalysisException(String.format("Exceeded the maximum number of child "
+ + "expressions (%d).", Config.expr_children_limit));
}
// analyzer may be null for certain literal constructions (e.g. IntLiteral).
@@ -393,14 +397,14 @@ public final void analyze(Analyzer analyzer) throws AnalysisException {
analyzer.incrementCallDepth();
// Check the expr depth limit. Do not print the toSql() to not overflow the stack.
if (analyzer.getCallDepth() > Config.expr_depth_limit) {
- throw new AnalysisException(String.format("Exceeded the maximum depth of an " +
- "expression tree (%s).", Config.expr_depth_limit));
+ throw new AnalysisException(String.format("Exceeded the maximum depth of an "
+ + "expression tree (%s).", Config.expr_depth_limit));
}
} else {
throw new AnalysisException("analyzer is null.");
}
- for (Expr child: children) {
+ for (Expr child : children) {
child.analyze(analyzer);
}
if (analyzer != null) {
@@ -443,7 +447,7 @@ protected void computeNumDistinctValues() {
List slotRefs = Lists.newArrayList();
this.collect(SlotRef.class, slotRefs);
numDistinctValues = -1;
- for (SlotRef slotRef: slotRefs) {
+ for (SlotRef slotRef : slotRefs) {
numDistinctValues = Math.max(numDistinctValues, slotRef.numDistinctValues);
}
}
@@ -547,14 +551,14 @@ public static boolean equalSets(List l1, List l2) {
}
public static HashMap toCountMap(List list) {
- HashMap countMap = new HashMap();
+ HashMap countMap = new HashMap();
for (int i = 0; i < list.size(); i++) {
C obj = list.get(i);
Integer count = (Integer) countMap.get(obj);
if (count == null) {
countMap.put(obj, 1);
} else {
- countMap.put(obj, count+1);
+ countMap.put(obj, count + 1);
}
}
return countMap;
@@ -609,22 +613,13 @@ public static ArrayList cloneAndResetList(List l) {
* This can't go into TreeNode<>, because we'd be using the template param
* NodeType.
*/
- public static void collectList(List extends Expr> input, Class cl,
- List output) {
+ public static void collectList(List extends Expr> input, Class cl, List output) {
Preconditions.checkNotNull(input);
for (Expr e : input) {
e.collect(cl, output);
}
}
- public static void collectAggregateExprs(List extends Expr> input,
- List output) {
- Preconditions.checkNotNull(input);
- for (Expr e : input) {
- e.collectAggregateExprs(output);
- }
- }
-
/**
* get the expr which in l1 and l2 in the same time.
* Return the intersection of l1 and l2
@@ -632,7 +627,7 @@ public static void collectAggregateExprs(List extends Expr> i
public static List intersect(List l1, List l2) {
List result = new ArrayList();
- for (C element: l1) {
+ for (C element : l1) {
if (l2.contains(element)) {
result.add(element);
}
@@ -728,14 +723,14 @@ public Expr substitute(ExprSubstitutionMap smap, Analyzer analyzer, boolean pres
}
}
- public static ArrayList trySubstituteList(Iterable extends Expr > exprs,
+ public static ArrayList trySubstituteList(Iterable extends Expr> exprs,
ExprSubstitutionMap smap, Analyzer analyzer, boolean preserveRootTypes)
throws AnalysisException {
if (exprs == null) {
return null;
}
ArrayList result = new ArrayList();
- for (Expr e: exprs) {
+ for (Expr e : exprs) {
result.add(e.trySubstitute(smap, analyzer, preserveRootTypes));
}
return result;
@@ -819,7 +814,7 @@ public static boolean isBound(List extends Expr> exprs, List tids) {
}
public static void getIds(List extends Expr> exprs, List tupleIds,
- List slotIds) {
+ List slotIds) {
if (exprs == null) {
return;
}
@@ -838,22 +833,22 @@ public void markAgg() {
* the exprs have an invalid number of distinct values.
*/
public static long getNumDistinctValues(List exprs) {
- if (exprs == null || exprs.isEmpty()) {
- return 0;
- }
- long numDistinctValues = 1;
- for (Expr expr: exprs) {
- if (expr.getNumDistinctValues() == -1) {
- numDistinctValues = -1;
- break;
+ if (exprs == null || exprs.isEmpty()) {
+ return 0;
}
- numDistinctValues *= expr.getNumDistinctValues();
- }
- return numDistinctValues;
+ long numDistinctValues = 1;
+ for (Expr expr : exprs) {
+ if (expr.getNumDistinctValues() == -1) {
+ numDistinctValues = -1;
+ break;
+ }
+ numDistinctValues *= expr.getNumDistinctValues();
+ }
+ return numDistinctValues;
}
public void vectorizedAnalyze(Analyzer analyzer) {
- for (Expr child: children) {
+ for (Expr child : children) {
child.vectorizedAnalyze(analyzer);
}
}
@@ -869,31 +864,6 @@ public void computeOutputColumn(Analyzer analyzer) {
getIds(tupleIds, null);
Preconditions.checkArgument(tupleIds.size() == 1);
- //List reuseExprs = analyzer.getBufferReuseConjuncts(tupleIds.get(0));
- //for (Expr child : children) {
- //if (child instanceof SlotRef) {
- //if (!((SlotRef) child).getDesc().isMultiRef()) {
- //LOG.debug("add " + child.debugString() + " to reuse exprs.");
- //reuseExprs.add(child);
- //}
- //} else {
- //LOG.debug("add " + child.debugString() + " to reuse exprs.");
- //reuseExprs.add(child);
- //}
- //}
-
- //for (Expr reuseExpr : reuseExprs) {
- //if (reuseExpr.getType() == PrimitiveType.getAssignmentCompatibleType(getType(),
- //reuseExpr.getType())) {
- //LOG.debug(
- //"reuse " + reuseExpr.debugString() + " buffer for " + this.debugString());
- //outputColumn = reuseExpr.getOutputColumn();
- //Preconditions.checkArgument(outputColumn >= 0);
- //reuseExprs.remove(reuseExpr);
- //return;
- //}
- //}
-
int currentOutputColumn = analyzer.getCurrentOutputColumn(tupleIds.get(0));
this.outputColumn = currentOutputColumn;
LOG.info(debugString() + " outputColumn: " + this.outputColumn);
@@ -1022,27 +992,29 @@ public String debugString() {
* Resets the internal state of this expr produced by analyze().
* Only modifies this expr, and not its child exprs.
*/
- protected void resetAnalysisState() { isAnalyzed = false; }
+ protected void resetAnalysisState() {
+ isAnalyzed = false;
+ }
/**
* Resets the internal analysis state of this expr tree. Removes implicit casts.
*/
public Expr reset() {
- if (isImplicitCast()) {
- return getChild(0).reset();
- }
- for (int i = 0; i < children.size(); ++i) {
- children.set(i, children.get(i).reset());
- }
- resetAnalysisState();
- return this;
+ if (isImplicitCast()) {
+ return getChild(0).reset();
+ }
+ for (int i = 0; i < children.size(); ++i) {
+ children.set(i, children.get(i).reset());
+ }
+ resetAnalysisState();
+ return this;
}
public static ArrayList resetList(ArrayList l) {
- for (int i = 0; i < l.size(); ++i) {
- l.set(i, l.get(i).reset());
- }
- return l;
+ for (int i = 0; i < l.size(); ++i) {
+ l.set(i, l.get(i).reset());
+ }
+ return l;
}
/**
@@ -1101,8 +1073,8 @@ public int hashCode() {
*/
public List getConjuncts() {
List list = Lists.newArrayList();
- if (this instanceof CompoundPredicate && ((CompoundPredicate) this).getOp() ==
- CompoundPredicate.Operator.AND) {
+ if (this instanceof CompoundPredicate
+ && ((CompoundPredicate) this).getOp() == CompoundPredicate.Operator.AND) {
// TODO: we have to convert CompoundPredicate.AND to two expr trees for
// conjuncts because NULLs are handled differently for CompoundPredicate.AND
// and conjunct evaluation. This is not optimal for jitted exprs because it
@@ -1189,7 +1161,7 @@ public boolean isBound(TupleId tid) {
* Returns true if expr is fully bound by tids, otherwise false.
*/
public boolean isBoundByTupleIds(List tids) {
- for (Expr child: children) {
+ for (Expr child : children) {
if (!child.isBoundByTupleIds(tids)) {
return false;
}
@@ -1317,8 +1289,8 @@ public void checkReturnsBool(String name, boolean printExpr) throws AnalysisExce
}
public Expr checkTypeCompatibility(Type targetType) throws AnalysisException {
- if (targetType.getPrimitiveType() != PrimitiveType.ARRAY &&
- targetType.getPrimitiveType() == type.getPrimitiveType()) {
+ if (targetType.getPrimitiveType() != PrimitiveType.ARRAY
+ && targetType.getPrimitiveType() == type.getPrimitiveType()) {
return this;
}
// bitmap must match exactly
@@ -1350,8 +1322,8 @@ private void checkHllCompatibility() throws AnalysisException {
}
} else if (this instanceof FunctionCallExpr) {
final FunctionCallExpr functionExpr = (FunctionCallExpr) this;
- if (!functionExpr.getFnName().getFunction().equalsIgnoreCase("hll_hash") &&
- !functionExpr.getFnName().getFunction().equalsIgnoreCase("hll_empty")) {
+ if (!functionExpr.getFnName().getFunction().equalsIgnoreCase("hll_hash")
+ && !functionExpr.getFnName().getFunction().equalsIgnoreCase("hll_empty")) {
throw new AnalysisException(hllMismatchLog);
}
} else {
@@ -1379,7 +1351,7 @@ public final Expr castTo(Type targetType) throws AnalysisException {
}
if ((targetType.isStringType() || targetType.isHllType())
- && (this.type.isStringType() || this.type.isHllType())) {
+ && (this.type.isStringType() || this.type.isHllType())) {
return this;
}
// Preconditions.checkState(PrimitiveType.isImplicitCast(type, targetType), "cast %s to %s", this.type, targetType);
@@ -1582,14 +1554,14 @@ public SlotDescriptor findSrcScanSlot() {
return null;
}
- public static double getConstFromExpr(Expr e) throws AnalysisException{
+ public static double getConstFromExpr(Expr e) throws AnalysisException {
Preconditions.checkState(e.isConstant());
double value = 0;
- if( e instanceof LiteralExpr){
- LiteralExpr lit = (LiteralExpr)e;
+ if (e instanceof LiteralExpr) {
+ LiteralExpr lit = (LiteralExpr) e;
value = lit.getDoubleValue();
} else {
- throw new AnalysisException("To const value not a LiteralExpr " );
+ throw new AnalysisException("To const value not a LiteralExpr ");
}
return value;
}
@@ -1675,7 +1647,7 @@ public static Expr pushNegationToOperands(Expr root) {
try {
// Make sure we call function 'negate' only on classes that support it,
// otherwise we may recurse infinitely.
- Method m = root.getChild(0).getClass().getDeclaredMethod(NEGATE_FN);
+ root.getChild(0).getClass().getDeclaredMethod(NEGATE_FN);
return pushNegationToOperands(root.getChild(0).negate());
} catch (NoSuchMethodException e) {
// The 'negate' function is not implemented. Break the recursion.
@@ -1687,7 +1659,7 @@ public static Expr pushNegationToOperands(Expr root) {
Expr left = pushNegationToOperands(root.getChild(0));
Expr right = pushNegationToOperands(root.getChild(1));
CompoundPredicate compoundPredicate =
- new CompoundPredicate(((CompoundPredicate)root).getOp(), left, right);
+ new CompoundPredicate(((CompoundPredicate) root).getOp(), left, right);
compoundPredicate.setPrintSqlInParens(root.getPrintSqlInParens());
return compoundPredicate;
}
@@ -1806,9 +1778,9 @@ public static void writeTo(Expr expr, DataOutput output) throws IOException {
output.writeInt(ExprSerCode.FUNCTION_CALL.getCode());
} else if (expr instanceof ArrayLiteral) {
output.writeInt(ExprSerCode.ARRAY_LITERAL.getCode());
- } else if (expr instanceof CastExpr){
+ } else if (expr instanceof CastExpr) {
output.writeInt(ExprSerCode.CAST_EXPR.getCode());
- }else {
+ } else {
throw new IOException("Unknown class " + expr.getClass().getName());
}
expr.write(output);
@@ -1895,7 +1867,7 @@ public String getStringValue() {
}
public static Expr getFirstBoundChild(Expr expr, List tids) {
- for (Expr child: expr.getChildren()) {
+ for (Expr child : expr.getChildren()) {
if (child.isBoundByTupleIds(tids)) {
return child;
}
@@ -1913,7 +1885,7 @@ public boolean isContainsFunction(String functionName) {
if (fn.functionName().equalsIgnoreCase(functionName)) {
return true;
}
- for (Expr child: children) {
+ for (Expr child : children) {
if (child.isContainsFunction(functionName)) {
return true;
}
@@ -1928,7 +1900,7 @@ public boolean isContainsClass(String className) {
if (this.getClass().getName().equalsIgnoreCase(className)) {
return true;
}
- for (Expr child: children) {
+ for (Expr child : children) {
if (child.isContainsClass(className)) {
return true;
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/ExprId.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/ExprId.java
index 8507fd26a52b88..79b2fc721ee04d 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ExprId.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ExprId.java
@@ -37,9 +37,14 @@ public ExprId(int id) {
public static IdGenerator createGenerator() {
return new IdGenerator() {
@Override
- public ExprId getNextId() { return new ExprId(nextId++); }
+ public ExprId getNextId() {
+ return new ExprId(nextId++);
+ }
+
@Override
- public ExprId getMaxId() { return new ExprId(nextId - 1); }
+ public ExprId getMaxId() {
+ return new ExprId(nextId - 1);
+ }
};
}
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/ExprSubstitutionMap.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/ExprSubstitutionMap.java
index b7d44fe501a324..46b9caa0fa535e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ExprSubstitutionMap.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ExprSubstitutionMap.java
@@ -157,10 +157,17 @@ public void substituteLhs(ExprSubstitutionMap lhsSmap, Analyzer analyzer) {
lhs = Expr.substituteList(lhs, lhsSmap, analyzer, false);
}
- public List getLhs() { return lhs; }
- public List getRhs() { return rhs; }
+ public List getLhs() {
+ return lhs;
+ }
+
+ public List getRhs() {
+ return rhs;
+ }
- public int size() { return lhs.size(); }
+ public int size() {
+ return lhs.size();
+ }
public String debugString() {
Preconditions.checkState(lhs.size() == rhs.size());
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/ExpressionFunctions.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/ExpressionFunctions.java
index 7789202e884ede..220fe552993feb 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ExpressionFunctions.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ExpressionFunctions.java
@@ -192,7 +192,7 @@ public FEFunctionSignature getSignature() {
public LiteralExpr invoke(List args) throws AnalysisException {
final List