Skip to content

refactor: Rename dataFile/df variables to baseFile/bf - #19944

Open
nanjeshramesh wants to merge 2 commits into
apache:masterfrom
nanjeshramesh:rename-datafile-to-basefile
Open

nanjeshramesh wants to merge 2 commits into
apache:masterfrom
nanjeshramesh:rename-datafile-to-basefile

Conversation

@nanjeshramesh

Copy link
Copy Markdown

Describe the issue this Pull Request addresses

Closes #14528.

HoodieBaseFile was previously named HoodieDataFile. Per the cWiki design and arch page, we should converge on one name, and many call sites across the codebase still name variables of this type dataFile or df rather than baseFile or bf.

Summary and Changelog

Renames every local variable, field, method parameter, and lambda argument whose declared or inferred type is HoodieBaseFile (or a direct List/Stream/Option/Collection of it) from dataFile/df to baseFile/bf, across 35 files in hudi-common, hudi-hadoop-common, hudi-hadoop-mr, hudi-sync/hudi-hive-sync, hudi-client-common, hudi-spark-client, hudi-java-client, hudi-flink-client, and hudi-spark-datasource.

Deliberately out of scope:

  • Method names such as HoodieFileGroup#getLatestDataFile and TestHoodieBaseFile#newDataFile are unchanged. Renaming a method, especially a public one, is a materially different, higher risk change than renaming a local variable or parameter, and the issue's own wording ("all variables of this type") does not ask for it.
  • Identifiers that are not of type HoodieBaseFile even though they contain "dataFile" in the name, for example dataFileName (String), skipCreatingDataFile (boolean), and the several FileSlice-typed orphan/inflightFileSliceWithDataFile locals in TestHoodieTableFileSystemView. Each was checked individually against its actual declared or inferred type before being included or excluded.
  • df/dataFile identifiers that are unrelated Spark DataFrames or other types entirely, such as StreamSync's transformed.map(df -> ...) and IncrementalTimelineSyncFileSystemView's deltaFileGroups.stream().map(df -> df.getTimeline()), the latter being a HoodieFileGroup, not a HoodieBaseFile, despite sitting one line away from two genuine HoodieBaseFile df usages that were renamed.

An earlier attempt at this same issue (#1650) was opened in 2022 and closed unmerged after review stalled. A good number of the dataFile/df sites it touched have since been renamed independently in other changes, which is why this diff is smaller in file count than that one.

Pure rename, no behavior change: 281 insertions, 281 deletions.

Impact

None. Internal identifier renaming only, no public API, storage format, or behavior change.

Risk Level

low

Verified by test-compiling every touched module (hudi-common, hudi-hadoop-common, hudi-hadoop-mr, hudi-hive-sync, hudi-client-common, hudi-spark-client, hudi-java-client, hudi-flink-client, hudi-spark-datasource/hudi-spark and its spark3.5 dependency chain) against JDK 11 with zero compile errors.

Documentation Update

none

Contributor's checklist

  • Read through contributor's guide
  • Enough context is provided in the sections above
  • Adequate tests were added if applicable

HoodieBaseFile was previously named HoodieDataFile, and many call sites
across the codebase still name variables, parameters, and lambda
arguments of this type dataFile or df rather than baseFile or bf,
per the terminology convergence the cWiki design and arch page calls
for.

This renames every local variable, field, method parameter, and
lambda argument whose declared or inferred type is HoodieBaseFile (or
a direct List/Stream/Option/Collection of it) from dataFile/df to
baseFile/bf, across 35 files in hudi-common, hudi-hadoop-common,
hudi-hadoop-mr, hudi-sync/hudi-hive-sync, hudi-client-common,
hudi-spark-client, hudi-java-client, hudi-flink-client, and
hudi-spark-datasource.

Deliberately out of scope:
- Method names such as HoodieFileGroup#getLatestDataFile and
  TestHoodieBaseFile#newDataFile are unchanged. Renaming a method,
  especially a public one, is a materially different, higher-risk
  change than renaming a local variable or parameter, and the issue's
  own wording ("all variables of this type") does not ask for it.
- Identifiers that are not of type HoodieBaseFile even though they
  contain "dataFile" in the name, for example dataFileName (String),
  skipCreatingDataFile (boolean), and the several FileSlice-typed
  orphan/inflightFileSliceWithDataFile locals in
  TestHoodieTableFileSystemView. Each was checked individually against
  its actual declared or inferred type before being included or
  excluded.
- df/dataFile identifiers that are unrelated Spark DataFrames or other
  types entirely, such as StreamSync's transformed.map(df -> ...) and
  IncrementalTimelineSyncFileSystemView's
  deltaFileGroups.stream().map(df -> df.getTimeline()), the latter
  being a HoodieFileGroup, not a HoodieBaseFile, despite sitting one
  line away from two genuine HoodieBaseFile df usages that were
  renamed.

An earlier attempt at this same issue (apache#1650) was opened in 2022 and
closed unmerged after review stalled; a good number of the dataFile/df
sites it touched have since been renamed independently in other
changes, which is why this diff is smaller in file count than that
one.

Pure rename, no behavior change: 281 insertions, 281 deletions.
Verified by test-compiling every touched module (hudi-common,
hudi-hadoop-common, hudi-hadoop-mr, hudi-hive-sync, hudi-client-common,
hudi-spark-client, hudi-java-client, hudi-flink-client,
hudi-spark-datasource/hudi-spark and its spark3.5 dependency chain)
against JDK 11 with zero compile errors.
@github-actions github-actions Bot added the size:L PR with lines of changes in (300, 1000] label Sep 14, 2026

@hudi-agent hudi-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 🤖 This review was generated by an AI agent and may contain mistakes. Please verify any suggestions before applying.

Thanks for working on this! This PR renames HoodieBaseFile-typed locals, fields, parameters, and lambda arguments from dataFile/df to baseFile/bf across hudi-common, hudi-client-common, the Spark/Flink/Java client tables, hadoop-common, hive-sync, and related tests, leaving method names and non-HoodieBaseFile identifiers untouched. The changes are pure identifier substitutions with no argument reordering or behavior change, the HoodieCompactionHandler#handleUpdate parameter rename is applied consistently across implementations, and the touched modules test-compile cleanly at the PR head. No correctness issues found. A few style/readability suggestions in the inline comments. Please take a look, and this should be ready for a Hudi committer or PMC member to take it from here. Mostly mechanical rename, but the new names aren't consistent across files — some spots use the full baseFile while others use the terse bf, which reintroduces the same ambiguity the PR is trying to remove.

cc @yihua

if (fileSliceOptional.isPresent()) {
FileSlice fs = fileSliceOptional.get();
Option<HoodieBaseFile> df = fs.getBaseFile();
Option<HoodieBaseFile> bf = fs.getBaseFile();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 nit: everywhere else in this PR dataFile/df is renamed to the full baseFile, but here it becomes the terse bf. Could you use baseFile for consistency with the rest of the rename?

⚠️ AI-generated; verify before applying. React 👍/👎 to flag quality.


sizesMap.forEach((k, v) -> {
HoodieBaseFile df = TestHoodieBaseFile.newDataFile(k);
HoodieBaseFile bf = TestHoodieBaseFile.newDataFile(k);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 nit: this uses bf while sibling test/util classes in the same PR (e.g. TestCleanerInsertAndCleanByVersions) use the full baseFile — worth aligning on one convention across the PR.

⚠️ AI-generated; verify before applying. React 👍/👎 to flag quality.

@danny0405 danny0405 changed the title [HUDI-541] Rename dataFile/df variables to baseFile/bf refactor: Rename dataFile/df variables to baseFile/bf Sep 15, 2026
@codecov-commenter

codecov-commenter commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.77049% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.05%. Comparing base (1f5a4fe) to head (e0ba874).
⚠️ Report is 31 commits behind head on master.

Files with missing lines Patch % Lines
.../org/apache/hudi/client/CompactionAdminClient.java 0.00% 4 Missing ⚠️
.../common/table/view/RocksDbBasedFileSystemView.java 0.00% 4 Missing ⚠️
...common/table/view/AbstractTableFileSystemView.java 85.71% 0 Missing and 2 partials ⚠️
...in/java/org/apache/hudi/io/HoodieConcatHandle.java 0.00% 1 Missing ⚠️
.../hudi/io/HoodieSortedMergeHandleWithChangeLog.java 0.00% 1 Missing ⚠️
...g/apache/hudi/table/action/clean/CleanPlanner.java 75.00% 0 Missing and 1 partial ⚠️
...apache/hudi/table/HoodieFlinkCopyOnWriteTable.java 0.00% 1 Missing ⚠️
.../apache/hudi/table/HoodieJavaCopyOnWriteTable.java 0.00% 1 Missing ⚠️
...apache/hudi/table/HoodieSparkCopyOnWriteTable.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #19944      +/-   ##
============================================
- Coverage     80.23%   80.05%   -0.19%     
- Complexity    34747    35051     +304     
============================================
  Files          2546     2548       +2     
  Lines        142608   143949    +1341     
  Branches      17362    17719     +357     
============================================
+ Hits         114419   115233     +814     
- Misses        20277    20762     +485     
- Partials       7912     7954      +42     
Components Coverage Δ
hudi-common 83.81% <81.81%> (-0.04%) ⬇️
hudi-client 83.27% <59.09%> (-0.06%) ⬇️
hudi-flink 85.57% <0.00%> (+<0.01%) ⬆️
hudi-spark-datasource 72.65% <ø> (-0.61%) ⬇️
hudi-utilities 77.84% <ø> (-0.36%) ⬇️
hudi-cli 69.99% <ø> (ø)
hudi-hadoop 70.24% <100.00%> (-0.65%) ⬇️
hudi-sync 76.02% <ø> (ø)
hudi-io 81.61% <ø> (ø)
hudi-timeline-service 83.34% <ø> (ø)
hudi-cloud 80.85% <ø> (-0.14%) ⬇️
hudi-kafka-connect 53.20% <ø> (-0.77%) ⬇️
Flag Coverage Δ
common-and-other-modules 52.09% <54.09%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...a/org/apache/hudi/io/HoodieMergeHandleFactory.java 75.00% <ø> (ø)
...apache/hudi/io/HoodieMergeHandleWithChangeLog.java 67.74% <100.00%> (ø)
...va/org/apache/hudi/io/HoodieSortedMergeHandle.java 72.50% <100.00%> (ø)
...ava/org/apache/hudi/io/HoodieWriteMergeHandle.java 88.15% <100.00%> (ø)
...org/apache/hudi/table/HoodieCompactionHandler.java 0.00% <ø> (ø)
.../generators/BaseHoodieCompactionPlanGenerator.java 94.59% <100.00%> (ø)
...ava/org/apache/hudi/client/SparkRDDReadClient.java 88.52% <100.00%> (ø)
...he/hudi/index/bloom/HoodieFileProbingFunction.java 80.85% <100.00%> (ø)
.../apache/hudi/common/model/CompactionOperation.java 97.56% <100.00%> (ø)
...a/org/apache/hudi/common/model/HoodieBaseFile.java 94.59% <100.00%> (ø)
... and 12 more

... and 51 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@voonhous

Copy link
Copy Markdown
Member

@nanjeshramesh Please address the nits.

Addresses review nits: the rename previously used the abbreviated bf
in a number of lambda parameters and local variables while using the
full baseFile elsewhere. Converts every remaining bf introduced by
this PR to baseFile so the whole change uses one convention.

Files touched: CompactionAdminClient, AbstractTableFileSystemView,
IncrementalTimelineSyncFileSystemView, RocksDbBasedFileSystemView,
TestCleanerInsertAndCleanByVersions, TestHoodieCompactionStrategy,
TestHoodieTableFileSystemView, TestCompactionUtils.

Verified by test-compiling hudi-common, hudi-hadoop-common,
hudi-client-common, and hudi-spark-client against JDK 11 with no
errors, including no lambda-parameter shadowing conflicts.
@nanjeshramesh

Copy link
Copy Markdown
Author

Addressed in e0ba874. Both hudi-agent nits (CompactionAdminClient and TestHoodieCompactionStrategy) flagged the same inconsistency: I'd used the abbreviated bf for some lambda parameters and locals while using the full baseFile elsewhere. Rather than fix only those two spots, I converted every bf this PR had introduced, across all 8 files (also AbstractTableFileSystemView, IncrementalTimelineSyncFileSystemView, RocksDbBasedFileSystemView, TestCleanerInsertAndCleanByVersions, TestHoodieTableFileSystemView, and TestCompactionUtils), so the whole change now uses baseFile uniformly. Test-compiled hudi-common, hudi-hadoop-common, hudi-client-common, and hudi-spark-client against JDK 11 with no errors, including no lambda-parameter shadowing conflicts.

On the Codecov patch-coverage note: those flagged lines are all pure renames of parameters and locals that were equally uncovered before and after, so the project-wide delta is -0.01% and no behavior or coverage actually changed. Happy to add anything if you'd still like it, but I didn't think new tests for a rename made sense.

@hudi-agent hudi-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 🤖 This review was generated by an AI agent and may contain mistakes. Please verify any suggestions before applying.

Thanks for the contribution! This PR renames dataFile/df identifiers whose type is HoodieBaseFile (or collections/Options of it) to baseFile across hudi-common, the client modules, the file-system-view code, and related test utilities, without touching method names or non-HoodieBaseFile identifiers. The diff is a pure identifier rename with no shadowing of enclosing locals, and the affected modules compile cleanly on the PR head. No correctness issues found. A few style/readability suggestions in the inline comments. Please take a look, and this should be ready for a Hudi committer or PMC member to take it from here. Mechanical rename looks clean and consistent; one minor leftover naming inconsistency noted below.

cc @yihua

private static HoodieBaseFile refreshFileStatus(Configuration conf, HoodieBaseFile dataFile) {
StoragePath dataPath = dataFile.getPathInfo().getPath();
private static HoodieBaseFile refreshFileStatus(Configuration conf, HoodieBaseFile baseFile) {
StoragePath dataPath = baseFile.getPathInfo().getPath();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 nit: since the param is now baseFile, it might be worth renaming dataPath to baseFilePath too so the method uses one term throughout.

⚠️ AI-generated; verify before applying. React 👍/👎 to flag quality.

@hudi-bot

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L PR with lines of changes in (300, 1000]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace variables/comments named "data files" to "base file"

5 participants