Visitar URL original
RowCells are not actually serializeable · Issue #384 · googleapis/java-bigtable · GitHub
Skip to content
This repository was archived by the owner on Aug 30, 2026. It is now read-only.
This repository was archived by the owner on Aug 30, 2026. It is now read-only.

RowCells are not actually serializeable #384

Closed

Description

@igorbernstein2

RowCells might contain UnmodifiableLazyStringList for values, which are not actually serializable.
We need to add custom hooks to RowCell to fix serialization.

The primary issue is that labels are a UnmodifiableLazyStringList, which is not serializeable

Activity

  1. added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    and removed
    triage meI really want to be triaged.
    🚨This issue needs some love.
    on Aug 19, 2020
  2. self-assigned this
    on Aug 28, 2020
  3. dmitry-fa commented on Aug 31, 2020

    @dmitry-fa
    Contributor

    @igorbernstein2, the bad news: RowCell is abstract and marked as @AutoValue, which means its implementation is generated.
    If I read the @AutoValue documentation correctly we can't customize serialization. I see several ways of fixing the issue, but none of them looks good to me:

    • RowCell instances are created by RowCell.create() method, implemented like:
    public static RowCell create(... List<String> labels, ...) {
       return new AutoValue_RowCell(...,labels);
    }
    

    method. We can do something like:

      try {
         tryToSerialize(labels)
      } catch (Exception e) {
         labels = ArrayList.of(labels)
      }
    

    or simple:

      labels = ArrayList.of(labels)
    
    • We can add post-compilation step to the build to instrument AutoValue_RowCell.class and insert private void writeObject() method. (a bit of hardcore)

    • Stop using @AutoValue and implement the custom serialization in the manually implemented subclass.

    Do you have any preferences or suggestions?

  4. igorbernstein2 commented on Aug 31, 2020

    @igorbernstein2
    ContributorAuthor

    I think the easiest way would be to update create

    public static RowCell create(
          @Nonnull String family,
          @Nonnull ByteString qualifier,
          long timestamp,
          @Nonnull List<String> labels,
          @Nonnull ByteString value) {
        // Ensure that the list is serializable and optimize for the common case
        labels = labels.isEmpty() ? ImmutableList.of() : ImmutableList.copyOf(labels);
        return new AutoValue_RowCell(family, qualifier, timestamp, value,ImmutableList. labels);
      }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: bigtableIssues related to the googleapis/java-bigtable API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions