Skip to content

[Bug] Field cache ignores orderByIncludeColumn and can reuse the wrong column order #1151

Description

@Aias00

Fesod version

Current main at 5a9a16b.

Description

The cached FieldCache depends on WriteHolder#orderByIncludeColumn, but ClassUtils.FieldCacheKey contains only the class and include/exclude collections. Two sheets using the same class and include list but different ordering settings can therefore share the wrong cached result.

Location

  • fesod-sheet/src/main/java/org/apache/fesod/sheet/util/ClassUtils.java:278-291
  • fesod-sheet/src/main/java/org/apache/fesod/sheet/util/ClassUtils.java:379-431
  • fesod-sheet/src/main/java/org/apache/fesod/sheet/util/ClassUtils.java:556-573

Reproduction

Use the same model and include list column4, column2, column3 in one writer:

  1. First sheet: orderByIncludeColumn(false)
  2. Second sheet: orderByIncludeColumn(true)

Observed second-sheet order after cache reuse:

column2, column3, column4

A fresh writer using only orderByIncludeColumn(true) produces the requested order:

column4, column2, column3

Expected behavior

Each sheet should honor its own orderByIncludeColumn setting regardless of a prior cache entry.

Suggested fix

Include orderByIncludeColumn in FieldCacheKey and add a multi-sheet regression test that changes only this setting.

Related existing work

None covers this cache collision.

Are you willing to submit a PR?

Yes.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions