mchades commented on code in PR #7690: URL: https://github.com/apache/gravitino/pull/7690#discussion_r2266250540
########## scripts/postgresql/upgrade-0.9.0-to-1.0.0-postgresql.sql: ########## @@ -105,6 +105,32 @@ ALTER TABLE model_version_info ADD CONSTRAINT uk_mid_ver_uri_del UNIQUE (model_i -- remove the default value for model_version_uri_name ALTER TABLE model_version_info ALTER COLUMN model_version_uri_name DROP DEFAULT; +CREATE TABLE IF NOT EXISTS statistic_meta ( + id BIGINT NOT NULL, + statistic_id BIGINT NOT NULL, + statistic_name VARCHAR(128) NOT NULL, Review Comment: remove the indent ########## core/src/main/java/org/apache/gravitino/storage/relational/mapper/provider/base/StatisticBaseSQLProvider.java: ########## @@ -0,0 +1,184 @@ +/* + * 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.gravitino.storage.relational.mapper.provider.base; + +import static org.apache.gravitino.storage.relational.mapper.StatisticMetaMapper.STATISTIC_META_TABLE_NAME; + +import java.util.List; +import org.apache.gravitino.storage.relational.mapper.CatalogMetaMapper; +import org.apache.gravitino.storage.relational.mapper.FilesetMetaMapper; +import org.apache.gravitino.storage.relational.mapper.ModelMetaMapper; +import org.apache.gravitino.storage.relational.mapper.SchemaMetaMapper; +import org.apache.gravitino.storage.relational.mapper.TableMetaMapper; +import org.apache.gravitino.storage.relational.mapper.TopicMetaMapper; +import org.apache.gravitino.storage.relational.po.StatisticPO; +import org.apache.ibatis.annotations.Param; + +public class StatisticBaseSQLProvider { + + public String batchInsertStatisticPOs(@Param("statisticPOs") List<StatisticPO> statisticPOs) { + return "<script>" + + "INSERT INTO " + + STATISTIC_META_TABLE_NAME + + " (statistic_id, statistic_name, statistic_value, metalake_id, metadata_object_id," + + " metadata_object_type, audit_info, current_version, last_version, deleted_at) VALUES " + + "<foreach collection='statisticPOs' item='item' separator=','>" + + "(#{item.statisticId}, " + + "#{item.statisticName}, " + + "#{item.statisticValue}, " + + "#{item.metalakeId}, " + + "#{item.metadataObjectId}, " + + "#{item.metadataObjectType}, " + + "#{item.auditInfo}, " + + "#{item.currentVersion}, " + + "#{item.lastVersion}, " + + "#{item.deletedAt})" + + "</foreach>" + + " ON DUPLICATE KEY UPDATE " Review Comment: Does PG need to override this method? -- 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]
