9aman commented on code in PR #14798: URL: https://github.com/apache/pinot/pull/14798#discussion_r1928208335
########## pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/SimpleSegmentMetadata.java: ########## @@ -0,0 +1,174 @@ +/** + * 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.pinot.common.metadata.segment; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonGetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.TimeUnit; +import org.apache.pinot.spi.utils.CommonConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * A simplified version of SegmentZKMetadata designed for easy serialization and deserialization. + * This class maintains only the essential fields from SegmentZKMetadata while providing JSON + * serialization support via Jackson annotations. + * + * Use cases: + * 1. Serializing segment metadata for API responses + * 2. Transferring segment metadata between services + * 3. Storing segment metadata in a format that's easy to deserialize + * + * Example usage: + * SimpleSegmentMetadata metadata = SimpleSegmentMetadata.fromZKMetadata(zkMetadata); + * String json = JsonUtils.objectToString(metadata); + * SimpleSegmentMetadata deserialized = objectMapper.readValue(json, SimpleSegmentMetadata.class); + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class SimpleSegmentMetadata { Review Comment: @Jackie-Jiang have added this to simplify ser/deser of SegmentZkMetadata. Added few getters for easy access from simpleFields for important keys like crc. -- 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]
