nsivabalan commented on code in PR #19045: URL: https://github.com/apache/hudi/pull/19045#discussion_r3611502840
########## hudi-common/src/main/java/org/apache/hudi/metadata/LayoutContext.java: ########## @@ -0,0 +1,66 @@ +/* + * 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.metadata; + +import org.apache.hudi.common.util.Option; + +import java.io.Serializable; + +/** + * Per-file-group context handed to a {@link HoodieMetadataTableLayout}. + * + * <p>Carries everything a layout needs to compute the on-disk relative path + * and fileId for a single file group: the metadata partition type, the global + * file-group index, the total number of file groups in that partition, and + * the data-table partition name (set only for partitioned RLI). + */ +public final class LayoutContext implements Serializable { Review Comment: Done in `0eac426fa1ac`. Renamed to `HoodieMetadataLayoutContext` — thanks, agree it matches the `Hoodie*` prefix used by the sibling SPI types. All references (writer, sibling layouts, tests) updated; git tracks it as a rename. ########## hudi-common/src/main/java/org/apache/hudi/metadata/FileIdInfo.java: ########## @@ -0,0 +1,47 @@ +/* + * 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.metadata; + +import org.apache.hudi.common.util.Option; + +import java.io.Serializable; + +/** + * Parsed representation of an MDT fileId, produced by + * {@link HoodieMetadataTableLayout#parseFileId}. + */ +public final class FileIdInfo implements Serializable { Review Comment: Done in `0eac426fa1ac`. Renamed to `HoodieMetadataFileIdInfo` — same reasoning as the `LayoutContext` rename, matches the `Hoodie*` prefix convention on other SPI types in this package. ########## hudi-common/src/main/java/org/apache/hudi/metadata/FlatMDTLayout.java: ########## @@ -0,0 +1,72 @@ +/* + * 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.metadata; + +import org.apache.hudi.common.util.Option; + +import java.util.Collections; +import java.util.List; + +/** + * Default MDT layout: every file group lives directly under its metadata + * partition directory, and a single {@code .hoodie_partition_metadata} marker + * lives at the partition root. This is the layout that existed before the + * layout SPI was introduced and remains the default for all tables that have + * not explicitly opted into a different layout. + */ +public final class FlatMDTLayout implements HoodieMetadataTableLayout { + + public static final String LAYOUT_ID = "flat"; + + @Override + public String getLayoutId() { + return LAYOUT_ID; + } + + @Override + public String getFileGroupRelativePath(LayoutContext ctx) { + return ctx.getPartitionType().getPartitionPath(); Review Comment: Good catch, thank you. This was fixed in `e28eef5e345c` — `HoodieMetadataLayoutContext` (formerly `LayoutContext`) now carries `relativePartitionPath`, and `FlatMDTLayout.getFileGroupRelativePath` / `getFileId` use it directly instead of falling back to the static `partitionType.getPartitionPath()` prefix. The writer at `initializeFileGroups` threads the real partition name in. SI/EI bootstrap should now behave correctly under the SPI. -- 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]
