GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — StringEnumValue does not support reference equality after Serialization · Issue #3942 · googleapis/google-cloud-java

StringEnumValue does not support reference equality after Serialization #3942

New issue
Copy link
New issue
Copy link
Closed
Closed
StringEnumValue does not support reference equality after Serialization#3942
Copy link
Assignees
JesseLovelace
Labels
api: bigqueryIssues related to the BigQuery 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.

Description

@pmkc
pmkc
opened on Nov 14, 2018
Issue body actions

Environment details

  • OS: Linux (Debian 9)
  • Java version: openjdk version "1.8.0_181"
  • google-cloud-java version(s): 1.52.0

Steps to reproduce

  1. Serialize StringEnumValue
  2. Deserialize StringEnumValue
  3. Use it in a way that requires reference equality
  4. Crash

Stacktrace

Exception in thread "main" java.lang.IllegalArgumentException: Only RECORD fields can have sub-fields
        at com.google.cloud.bigquery.Field$Builder.setType(Field.java:137)
        at com.google.cloud.bigquery.Field.newBuilder(Field.java:275)
        at com.google.cloud.bigquery.Field.of(Field.java:261)
        at App.main(App.java:27)

Code snippet

LegacySQLTypeName record = SerializationUtils.clone(LegacySQLTypeName.RECORD);
System.out.println(LegacySQLTypeName.RECORD == record); // false
Field.of("foo", record, Field.of("bar", LegacySQLTypeName.BOOLEAN)); // throws

Activity

  1. bsidhom commented on Nov 14, 2018

    @bsidhom
    bsidhom
    on Nov 14, 2018
    More actions

    Representing these values as standard Java enums would provide (de)serialization-safe reference equality for free. Why not use enums? StringEnumValue has a doc comment that indicates enums don't work due to the need to extend values later. What exactly does this mean and why can't this functionality be provided as a method on standard enum types?

  2. JustinBeckwith
    added
    triage meI really want to be triaged.
    on Nov 15, 2018
  3. chingor13
    added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    api: bigqueryIssues related to the BigQuery API.
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Nov 15, 2018
  4. JustinBeckwith
    removed
    triage meI really want to be triaged.
    on Nov 15, 2018
  5. pmkc commented on Nov 19, 2018

    @pmkc
    pmkc
    on Nov 19, 2018
    Author
    More actions

    I don't think this is a BigQuery client issue.

    The BigQuery client simply tripped over the underlying issue that StringEnumValue isn't safe.

  6. JesseLovelace
    closed this as completedin #4283on Jan 9, 2019
  7. JustinBeckwith
    assigned
    JesseLovelace
    on Feb 1, 2021
  8. chingor13
    added 2 commits that reference this issue on Mar 24, 2026

    deps: Bump grpc-java to v1.76.0 (#3942)

    dfa2b76

    chore(main): release 2.64.0 (#3954)

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

Metadata

Metadata

Assignees

  • @JesseLovelace
    JesseLovelace

Labels

api: bigqueryIssues related to the BigQuery 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

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.