|
46 | 46 | import com.google.common.base.Preconditions;
|
47 | 47 | import com.google.common.collect.ImmutableSet;
|
48 | 48 | import org.apache.hadoop.hive.conf.HiveConf;
|
| 49 | +import org.apache.hadoop.hive.ql.io.AcidUtils; |
49 | 50 | import org.apache.logging.log4j.LogManager;
|
50 | 51 | import org.apache.logging.log4j.Logger;
|
51 | 52 |
|
@@ -179,6 +180,25 @@ public boolean createTable(CreateTableStmt stmt) throws UserException {
|
179 | 180 | props.put("owner", ConnectContext.get().getUserIdentity().getUser());
|
180 | 181 | }
|
181 | 182 | }
|
| 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 | + |
182 | 202 | String fileFormat = props.getOrDefault(FILE_FORMAT_KEY, Config.hive_default_file_format);
|
183 | 203 | Map<String, String> ddlProps = new HashMap<>();
|
184 | 204 | for (Map.Entry<String, String> entry : props.entrySet()) {
|
@@ -273,6 +293,10 @@ public void dropTable(DropTableStmt stmt) throws DdlException {
|
273 | 293 | ErrorReport.reportDdlException(ErrorCode.ERR_UNKNOWN_TABLE, tblName, dbName);
|
274 | 294 | }
|
275 | 295 | }
|
| 296 | + if (AcidUtils.isTransactionalTable(client.getTable(dbName, tblName))) { |
| 297 | + throw new DdlException("Not support drop hive transactional table."); |
| 298 | + } |
| 299 | + |
276 | 300 | try {
|
277 | 301 | client.dropTable(dbName, tblName);
|
278 | 302 | db.setUnInitialized(true);
|
|
0 commit comments