From ce236bfcd4a93cdd75fb0cd131356f01886f7c2c Mon Sep 17 00:00:00 2001 From: xionglei0 <55084968+xionglei0@users.noreply.github.com> Date: Sat, 12 Oct 2019 19:11:17 +0800 Subject: [PATCH] add alter table modify limit: Cannot change DATETIME to DATE (#1963) --- fe/src/main/java/org/apache/doris/catalog/Column.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fe/src/main/java/org/apache/doris/catalog/Column.java b/fe/src/main/java/org/apache/doris/catalog/Column.java index 6e076c3734..7ff5466441 100644 --- a/fe/src/main/java/org/apache/doris/catalog/Column.java +++ b/fe/src/main/java/org/apache/doris/catalog/Column.java @@ -260,6 +260,10 @@ public class Column implements Writable { } } + if (getDataType() == PrimitiveType.DATETIME && other.getDataType() == PrimitiveType.DATE) { + throw new DdlException("Cannot change from DATETIME to DATE"); + } + if (this.getPrecision() != other.getPrecision()) { throw new DdlException("Cannot change precision"); }