Skip to content

Commit 7669f81

Browse files
committed
ban create insert drop translational tb.
1 parent b65c8e1 commit 7669f81

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HiveMetadataOps.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import com.google.common.base.Preconditions;
4747
import com.google.common.collect.ImmutableSet;
4848
import org.apache.hadoop.hive.conf.HiveConf;
49+
import org.apache.hadoop.hive.ql.io.AcidUtils;
4950
import org.apache.logging.log4j.LogManager;
5051
import org.apache.logging.log4j.Logger;
5152

@@ -179,6 +180,25 @@ public boolean createTable(CreateTableStmt stmt) throws UserException {
179180
props.put("owner", ConnectContext.get().getUserIdentity().getUser());
180181
}
181182
}
183+
184+
if (props.containsKey("transactional") && props.get("transactional").equals("true")) {
185+
throw new UserException("Not support create hive transactional table.");
186+
/*
187+
CREATE TABLE trans6(
188+
`col1` int,
189+
`col2` int
190+
) ENGINE=hive
191+
PROPERTIES (
192+
'file_format'='orc',
193+
'compression'='zlib',
194+
'bucketing_version'='2',
195+
'transactional'='true',
196+
'transactional_properties'='default'
197+
);
198+
In hive, this table only can insert not update(not report error,but not actually updated).
199+
*/
200+
}
201+
182202
String fileFormat = props.getOrDefault(FILE_FORMAT_KEY, Config.hive_default_file_format);
183203
Map<String, String> ddlProps = new HashMap<>();
184204
for (Map.Entry<String, String> entry : props.entrySet()) {
@@ -273,6 +293,10 @@ public void dropTable(DropTableStmt stmt) throws DdlException {
273293
ErrorReport.reportDdlException(ErrorCode.ERR_UNKNOWN_TABLE, tblName, dbName);
274294
}
275295
}
296+
if (AcidUtils.isTransactionalTable(client.getTable(dbName, tblName))) {
297+
throw new DdlException("Not support drop hive transactional table.");
298+
}
299+
276300
try {
277301
client.dropTable(dbName, tblName);
278302
db.setUnInitialized(true);

fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertIntoTableCommand.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.apache.doris.catalog.TableIf;
2525
import org.apache.doris.common.ErrorCode;
2626
import org.apache.doris.common.ErrorReport;
27+
import org.apache.doris.common.UserException;
2728
import org.apache.doris.common.profile.ProfileManager.ProfileType;
2829
import org.apache.doris.datasource.hive.HMSExternalTable;
2930
import org.apache.doris.datasource.iceberg.IcebergExternalTable;
@@ -269,6 +270,10 @@ private ExecutorFactory selectInsertExecutorFactory(
269270
} else if (physicalSink instanceof PhysicalHiveTableSink) {
270271
boolean emptyInsert = childIsEmptyRelation(physicalSink);
271272
HMSExternalTable hiveExternalTable = (HMSExternalTable) targetTableIf;
273+
if (hiveExternalTable.isHiveTransactionalTable()) {
274+
throw new UserException("Not supported insert into hive table");
275+
}
276+
272277
return ExecutorFactory.from(
273278
planner,
274279
dataSink,

0 commit comments

Comments
 (0)