mustafaiman commented on a change in pull request #1733: URL: https://github.com/apache/hive/pull/1733#discussion_r566426988
########## File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/model/MPackage.java ########## @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.hive.metastore.model; + +import org.apache.hadoop.hive.metastore.api.MetaException; + +public class MPackage { + private String name; + private MDatabase database; + private String owner; + private String header; + private String body; + private int createTime = (int)(System.currentTimeMillis() / 1000); + public static final int MAX_SOURCE_SIZE = 1073741823; + + public MPackage() {} + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public MDatabase getDatabase() { + return database; + } + + public void setDatabase(MDatabase database) { + this.database = database; + } + + public String getOwner() { + return owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getHeader() { + return header; + } + + public void setHeader(String header) throws MetaException { + if (header.length() > MAX_SOURCE_SIZE) { Review comment: Does header and body need to be under MAX_SOURCE_SIZE individually or together? These checks do not prevent these two going over the limit together. ########## File path: standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java ########## @@ -4675,4 +4676,145 @@ public void dropStoredProcedure(StoredProcedureRequest request) throws MetaExcep public List<String> getAllStoredProcedures(ListStoredProcedureRequest request) throws MetaException, TException { return client.get_all_stored_procedures(request); } + + @Override + public void addPackage(Package request) throws NoSuchObjectException, MetaException, TException { + client.add_package(request); + } + + @Override + public Package findPackage(PackageRequest request) throws TException { + return client.find_package(request); + } + + @Override + public List<String> listPackages(ListPackageRequest request) throws TException { + return client.get_all_packages(request); + } + + @Override + public void dropPackage(PackageRequest request) throws TException { + client.drop_package(request); + } + + /** + * Builder for the GetProjectionsSpec. This is a projection specification for partitions returned from the HMS. + */ + public static class GetPartitionProjectionsSpecBuilder { Review comment: I did not understand what these extra builder classes are for. Looks like unused. ########## File path: hplsql/src/test/results/local/create_package3.out.txt ########## @@ -1,5 +1,5 @@ Ln:1 INCLUDE src/test/queries/local/create_package3_include.sql INCLUDE CONTENT src/test/queries/local/create_package3_include.sql (non-empty) -EXEC PACKAGE PROCEDURE A.test -Ln:9 PRINT -"test ok" \ No newline at end of file +EXEC PACKAGE PROCEDURE A.TEST +Ln:8 PRINT Review comment: line number was correctly 9 earlier. I wonder why that changed to 8. ########## File path: hplsql/src/main/java/org/apache/hive/hplsql/Stmt.java ########## @@ -383,8 +383,11 @@ public Integer drop(HplsqlParser.Drop_stmtContext ctx) { sql += "IF EXISTS "; } sql += evalPop(ctx.table_name()).toString(); - } - else if (ctx.T_DATABASE() != null || ctx.T_SCHEMA() != null) { + } else if (ctx.T_PACKAGE() != null) { + exec.dropPackage(ctx.ident().getText().toUpperCase(), ctx.T_EXISTS() != null); Review comment: why don't we pass the context to these two functions too? That way we can get line info in trace call. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
