voonhous commented on code in PR #18967:
URL: https://github.com/apache/hudi/pull/18967#discussion_r3426966382


##########
hudi-common/src/main/java/org/apache/hudi/common/schema/AvroToHoodieSchemaCache.java:
##########
@@ -0,0 +1,52 @@
+/*
+ * 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.hudi.common.schema;
+
+import com.github.benmanes.caffeine.cache.Caffeine;
+import com.github.benmanes.caffeine.cache.LoadingCache;
+import org.apache.avro.Schema;
+
+/**
+ * A global cache mapping Avro {@link Schema} instances to their canonical 
{@link HoodieSchema}.
+ *
+ * <p>This is an Avro-schema-keyed view onto {@link HoodieSchemaCache} for 
per-record call sites:
+ * {@code weakKeys} gives identity-based lookups (records of one file share 
the same {@link Schema}
+ * instance), so the hot path is a single cache hit with no wrapper allocation 
or type dispatch.
+ * Misses convert and then value-intern through {@link HoodieSchemaCache}, so 
equal but distinct Avro
+ * schema instances still converge on one canonical {@link HoodieSchema}.
+ *
+ * <p>This is a global cache which works for a JVM lifecycle.
+ */
+public class AvroToHoodieSchemaCache {
+
+  private static final LoadingCache<Schema, HoodieSchema> AVRO_SCHEMA_CACHE =

Review Comment:
   Renamed to HoodieAvroSchemaCache to match the Hoodie-prefix convention of 
the rest of the org.apache.hudi.common.schema package. Updated the class and 
all 8 referencing files.



-- 
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]

Reply via email to