[ https://issues.apache.org/jira/browse/HIVE-26035?focusedWorklogId=842282&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-842282 ]
ASF GitHub Bot logged work on HIVE-26035: ----------------------------------------- Author: ASF GitHub Bot Created on: 30/Jan/23 12:59 Start Date: 30/Jan/23 12:59 Worklog Time Spent: 10m Work Description: VenuReddy2103 commented on code in PR #3905: URL: https://github.com/apache/hive/pull/3905#discussion_r1090594571 ########## standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/DirectSqlInsertPart.java: ########## @@ -0,0 +1,804 @@ +/* + * 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; + +import static org.apache.commons.lang3.StringUtils.repeat; +import static org.apache.hadoop.hive.metastore.Batchable.NO_BATCHING; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.jdo.PersistenceManager; + +import org.apache.hadoop.hive.metastore.api.MetaException; +import org.apache.hadoop.hive.metastore.model.MColumnDescriptor; +import org.apache.hadoop.hive.metastore.model.MFieldSchema; +import org.apache.hadoop.hive.metastore.model.MOrder; +import org.apache.hadoop.hive.metastore.model.MPartition; +import org.apache.hadoop.hive.metastore.model.MPartitionColumnPrivilege; +import org.apache.hadoop.hive.metastore.model.MPartitionPrivilege; +import org.apache.hadoop.hive.metastore.model.MSerDeInfo; +import org.apache.hadoop.hive.metastore.model.MStorageDescriptor; +import org.apache.hadoop.hive.metastore.model.MStringList; +import org.datanucleus.ExecutionContext; +import org.datanucleus.api.jdo.JDOPersistenceManager; +import org.datanucleus.identity.DatastoreId; +import org.datanucleus.metadata.AbstractClassMetaData; +import org.datanucleus.metadata.IdentityType; + +/** + * This class contains the methods to insert into tables on the underlying database using direct SQL + */ +class DirectSqlInsertPart { + private final PersistenceManager pm; + private final DatabaseProduct dbType; + private final int batchSize; + + public DirectSqlInsertPart(PersistenceManager pm, DatabaseProduct dbType, int batchSize) { + this.pm = pm; + this.dbType = dbType; + this.batchSize = batchSize; + } + + /** + * Interface to execute multiple row insert query in batch for direct SQL + */ + interface BatchExecutionContext { + void execute(String batchQueryText, int batchRowCount, int batchParamCount) throws MetaException; Review Comment: done Issue Time Tracking ------------------- Worklog Id: (was: 842282) Time Spent: 6h 10m (was: 6h) > Explore moving to directsql for ObjectStore::addPartitions > ---------------------------------------------------------- > > Key: HIVE-26035 > URL: https://issues.apache.org/jira/browse/HIVE-26035 > Project: Hive > Issue Type: Bug > Reporter: Rajesh Balamohan > Assignee: Venugopal Reddy K > Priority: Major > Labels: pull-request-available > Time Spent: 6h 10m > Remaining Estimate: 0h > > Currently {{addPartitions}} uses datanuclues and is super slow for large > number of partitions. It will be good to move to direct sql. Lots of repeated > SQLs can be avoided as well (e.g SDS, SERDE, TABLE_PARAMS) -- This message was sent by Atlassian Jira (v8.20.10#820010)