This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 0daa25d9a9 [fix](nereids) UT failed when test cases in package (#12622)
0daa25d9a9 is described below
commit 0daa25d9a96ae42ba1aa1e0250e2a9bf7f2eb54d
Author: Adonis Ling <[email protected]>
AuthorDate: Thu Sep 15 22:25:40 2022 +0800
[fix](nereids) UT failed when test cases in package (#12622)
NamedExpressionUtil::clear should reset the nextId rather than create a new
IdGenerator<ExprId> because the old one may be referenced by other objects and
it may cause some cases start in a dirty environment when we run test cases in
package.
---
.../doris/nereids/trees/expressions/NamedExpressionUtil.java | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/NamedExpressionUtil.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/NamedExpressionUtil.java
index 9e5fa24062..12ab04ce92 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/NamedExpressionUtil.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/NamedExpressionUtil.java
@@ -22,7 +22,6 @@ import org.apache.doris.common.IdGenerator;
import com.google.common.annotations.VisibleForTesting;
import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
/**
* The util of named expression.
@@ -42,11 +41,8 @@ public class NamedExpressionUtil {
*/
@VisibleForTesting
public static void clear() throws Exception {
- Field f = NamedExpressionUtil.class.getDeclaredField("ID_GENERATOR");
- f.setAccessible(true);
- Field mf = Field.class.getDeclaredField("modifiers");
- mf.setAccessible(true);
- mf.setInt(f, f.getModifiers() & ~Modifier.FINAL);
- f.set(NamedExpressionUtil.class, ExprId.createGenerator());
+ Field nextId =
ID_GENERATOR.getClass().getSuperclass().getDeclaredField("nextId");
+ nextId.setAccessible(true);
+ nextId.setInt(ID_GENERATOR, 0);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]