[Enhancement](Nereids)enable nereids DML by default. (#21539)

TODO: fix cast agg_state type when do insert
This commit is contained in:
mch_ucchi
2023-07-19 13:52:15 +08:00
committed by GitHub
parent d8272b16e9
commit f668b3965e
17 changed files with 22 additions and 26 deletions

View File

@ -147,7 +147,7 @@ public class CastExpr extends Expr {
Type to = getActualType(type);
NullableMode nullableMode = TYPE_NULLABLE_MODE.get(Pair.of(from, to));
Preconditions.checkState(nullableMode != null,
"cannot find nullable node for cast from " + from + " to " + to);
"cannot find nullable mode for cast from " + from + " to " + to);
fn = new Function(new FunctionName(getFnName(type)), Lists.newArrayList(e.type), type,
false, true, nullableMode);
} else {

View File

@ -22,6 +22,7 @@ import org.apache.doris.nereids.rules.expression.AbstractExpressionRewriteRule;
import org.apache.doris.nereids.rules.expression.ExpressionRewriteContext;
import org.apache.doris.nereids.trees.expressions.Cast;
import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.types.AggStateType;
import org.apache.doris.nereids.types.ArrayType;
import org.apache.doris.nereids.types.DataType;
@ -46,6 +47,8 @@ public class CheckCast extends AbstractExpressionRewriteRule {
private boolean check(DataType originalType, DataType targetType) {
if (originalType.isArrayType() && targetType.isArrayType()) {
return check(((ArrayType) originalType).getItemType(), ((ArrayType) targetType).getItemType());
} else if (originalType.isAggStateType() && targetType.isAggStateType()) {
return AggStateType.canCastTo(((AggStateType) originalType), ((AggStateType) targetType));
} else if (originalType.isMapType()) {
// TODO support map cast check when we support map
return false;

View File

@ -67,6 +67,13 @@ public class AggStateType extends DataType {
return result;
}
/**
* check the left agg state type can be cast to the right.
*/
public static boolean canCastTo(AggStateType lhs, AggStateType rhs) {
throw new UnsupportedOperationException("currently cast for agg_state type is unsupported");
}
@Override
public Type toCatalogDataType() {
List<Type> types = subTypes.stream().map(t -> t.toCatalogDataType()).collect(Collectors.toList());

View File

@ -615,7 +615,7 @@ public class SessionVariable implements Serializable, Writable {
public boolean extractWideRangeExpr = true;
@VariableMgr.VarAttr(name = ENABLE_NEREIDS_DML)
public boolean enableNereidsDML = false;
public boolean enableNereidsDML = true;
@VariableMgr.VarAttr(name = ENABLE_VECTORIZED_ENGINE, expType = ExperimentalType.EXPERIMENTAL_ONLINE)
public boolean enableVectorizedEngine = true;