tmp fix ATK-1378

This commit is contained in:
yanhuqing
2020-10-14 14:59:26 +08:00
parent 4af7151211
commit 6ed5c582cd
3 changed files with 6 additions and 4 deletions
@@ -13,6 +13,7 @@ import com.actiontech.dble.plan.common.context.ReferContext;
import com.actiontech.dble.plan.common.field.Field;
import com.actiontech.dble.plan.common.field.FieldUtil;
import com.actiontech.dble.plan.common.field.TypeConversionStatus;
import com.actiontech.dble.plan.common.item.function.operator.controlfunc.ItemFuncCase;
import com.actiontech.dble.plan.common.time.*;
import com.actiontech.dble.plan.node.PlanNode;
import com.alibaba.druid.sql.ast.SQLExpr;
@@ -1019,7 +1020,7 @@ public abstract class Item {
public final Item reStruct(List<Item> calArgs, boolean isPushDown, List<Field> fields) {
Item clone = cloneStruct(true, calArgs, isPushDown, fields);
if (calArgs.size() > 0) {
if (calArgs.size() > 0 && !(clone instanceof ItemFuncCase)) {
clone.setCharsetIndex(calArgs.get(0).getCharsetIndex());
}
return clone;
@@ -33,12 +33,13 @@ public class ItemFuncCase extends ItemFunc {
* @param firstExprNum -1 means no case exp,else means the index of args in case exp,case and else exp are at the end of args
* @param elseExprNum the index of else in args
*/
public ItemFuncCase(List<Item> args, int ncases, int firstExprNum, int elseExprNum) {
public ItemFuncCase(List<Item> args, int ncases, int firstExprNum, int elseExprNum, int charsetIndex) {
super(args);
this.ncases = ncases;
this.firstExprNum = firstExprNum;
this.elseExprNum = elseExprNum;
this.cachedResultType = ItemResult.INT_RESULT;
this.charsetIndex = charsetIndex;
}
@Override
@@ -227,6 +228,6 @@ public class ItemFuncCase extends ItemFunc {
newArgs = cloneStructList(args);
else
newArgs = calArgs;
return new ItemFuncCase(newArgs, ncases, firstExprNum, elseExprNum);
return new ItemFuncCase(newArgs, ncases, firstExprNum, elseExprNum, charsetIndex);
}
}
@@ -396,7 +396,7 @@ public class MySQLItemVisitor extends MySqlASTVisitorAdapter {
elseExprNum = args.size();
args.add(getItem(elseExpr));
}
item = new ItemFuncCase(args, nCases, firstExprNum, elseExprNum);
item = new ItemFuncCase(args, nCases, firstExprNum, elseExprNum, this.charsetIndex);
}
@Override