rtrivedi12 commented on code in PR #6674:
URL: https://github.com/apache/hive/pull/6674#discussion_r3730594850
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java:
##########
@@ -2076,84 +2076,20 @@ private void
alter_partitions_with_environment_context(String catName, String db
@Override
public AlterTableResponse alter_table_req(AlterTableRequest req)
throws InvalidOperationException, MetaException {
- alter_table_core(req.getCatName(), req.getDbName(), req.getTableName(),
- req.getTable(), req.getEnvironmentContext(), req.getValidWriteIdList(),
- req.getProcessorCapabilities(), req.getProcessorIdentifier(),
- req.getExpectedParameterKey(), req.getExpectedParameterValue());
- return new AlterTableResponse();
- }
-
- private void alter_table_core(String catName, String dbname, String name,
Table newTable,
- EnvironmentContext envContext, String
validWriteIdList, List<String> processorCapabilities,
- String processorId, String
expectedPropertyKey, String expectedPropertyValue)
- throws InvalidOperationException, MetaException {
- startFunction("alter_table", ": " + TableName.getQualified(catName,
dbname, name)
- + " newtbl=" + newTable.getTableName());
- if (envContext == null) {
- envContext = new EnvironmentContext();
- }
- // Set the values to the envContext, so we do not have to change the
HiveAlterHandler API
- if (expectedPropertyKey != null) {
-
envContext.putToProperties(hive_metastoreConstants.EXPECTED_PARAMETER_KEY,
expectedPropertyKey);
- }
- if (expectedPropertyValue != null) {
-
envContext.putToProperties(hive_metastoreConstants.EXPECTED_PARAMETER_VALUE,
expectedPropertyValue);
- }
-
- if (catName == null) {
- catName = getDefaultCatalog(conf);
- }
-
- // HIVE-25282: Drop/Alter table in REMOTE db should fail
- try {
- Database db = get_database_core(catName, dbname);
- if (MetaStoreUtils.isDatabaseRemote(db)) {
- throw new MetaException("Alter table in REMOTE database " +
db.getName() + " is not allowed");
- }
- } catch (NoSuchObjectException e) {
- throw new InvalidOperationException("Alter table in REMOTE database is
not allowed");
- }
-
- // Update the time if it hasn't been specified.
- if (newTable.getParameters() == null ||
- newTable.getParameters().get(hive_metastoreConstants.DDL_TIME) ==
null) {
- newTable.putToParameters(hive_metastoreConstants.DDL_TIME,
Long.toString(System
- .currentTimeMillis() / 1000));
- }
-
- // Adds the missing scheme/authority for the new table location
- if (newTable.getSd() != null) {
- String newLocation = newTable.getSd().getLocation();
- if (org.apache.commons.lang3.StringUtils.isNotEmpty(newLocation)) {
- Path tblPath = wh.getDnsPath(new Path(newLocation));
- newTable.getSd().setLocation(tblPath.toString());
- }
- }
- // Set the catalog name if it hasn't been set in the new table
- if (!newTable.isSetCatName()) {
- newTable.setCatName(catName);
- }
-
- boolean success = false;
+ startFunction("alter_table", ": " +
TableName.getQualified(req.getCatName(), req.getDbName(),
+ req.getTableName()) + " newtbl=" + req.getTable().getTableName());
Review Comment:
Will address this as well.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]