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 — Is MergeFrom used by accident (instead of CopyFrom) in bigtable.Table.create? · Issue #3571 · googleapis/google-cloud-python

Is MergeFrom used by accident (instead of CopyFrom) in bigtable.Table.create? #3571

New issue
Copy link
New issue
Copy link
Closed
Closed
Is MergeFrom used by accident (instead of CopyFrom) in bigtable.Table.create?#3571
Copy link
Assignees
tseaver
Labels
api: bigtableIssues related to the Bigtable API.type: questionRequest for information or clarification. Not an issue.

Description

@dhermes
dhermes
opened on Jun 30, 2017
Issue body actions

See source. As an example of why MergeFrom instead of CopyFrom can be a bug:

>>> from google.protobuf.timestamp_pb2 import Timestamp
>>> from google.cloud.bigtable._generated.bigtable_instance_admin_pb2 import (
...     CreateInstanceMetadata)
>>>
>>> metadata1 = CreateInstanceMetadata(request_time=Timestamp(nanos=100))
>>> metadata2 = CreateInstanceMetadata(request_time=Timestamp(nanos=100))
>>> t = Timestamp(seconds=1000)
>>> metadata1
request_time {
  nanos: 100
}

>>> metadata2
request_time {
  nanos: 100
}

>>> t
seconds: 1000

>>>
>>> metadata1.request_time.MergeFrom(t)
>>> metadata2.request_time.CopyFrom(t)
>>>
>>> metadata1
request_time {
  seconds: 1000
  nanos: 100
}

>>> metadata2
request_time {
  seconds: 1000
}

Activity

  1. dhermes
    added
    api: bigtableIssues related to the Bigtable API.
    type: questionRequest for information or clarification. Not an issue.
    on Jun 30, 2017
  2. dhermes
    assigned
    tseaver
    on Jun 30, 2017
  3. dhermes commented on Jun 30, 2017

    @dhermes
    dhermes
    on Jun 30, 2017
    ContributorAuthor
    More actions

    @tseaver I assigned to you but a git blame reveals I am the last one to touch that line.

  4. tseaver commented on Jun 30, 2017

    @tseaver
    tseaver
    on Jun 30, 2017
    Contributor
    More actions

    In that particular case, the target starts as an empty Table protobuf. Unless the column_families argument contains entries with duplicate column_family_id values, there won't be any effective difference between CopyFrom and MergeFrom.

  5. dhermes commented on Jun 30, 2017

    @dhermes
    dhermes
    on Jun 30, 2017
    ContributorAuthor
    More actions

    In other words, we aren't relying on MergeFrom, but (assuming users don't pass in duplicate names with different settings) the code "works fine"?

    In that case, ISTM that we should

    • Switch from CopyFrom (since it will be the same in the "safe case" and is it what we intend)
    • Add a guard that a key can't be written over

    WDYT?

  6. dhermes
    added a commit that references this issue on Jul 16, 2017

    Using `CopyFrom` to set protobuf message fields (instead of `MergeFro…

    This issue will close once commit 53e2712 is merged into the 'master' branch.
    53e2712
  7. dhermes
    closed this as completedin #3612on Jul 17, 2017
  8. dhermes
    added a commit that references this issue on Jul 17, 2017

    Using `CopyFrom` to set protobuf message fields (instead of `MergeFro…

    This issue will close once commit 46f519a is merged into the 'main' branch.
    46f519a
  9. landrito
    added 3 commits that reference this issue on Aug 21, 2017

    Using `CopyFrom` to set protobuf message fields (instead of `MergeFro…

    This issue will close once commit 8bb5002 is merged into the 'master' branch.
    8bb5002

    Using `CopyFrom` to set protobuf message fields (instead of `MergeFro…

    This issue will close once commit 1c0a4af is merged into the 'master' branch.
    1c0a4af

    Using `CopyFrom` to set protobuf message fields (instead of `MergeFro…

    This issue will close once commit 3a4d031 is merged into the 'master' branch.
    3a4d031
  10. parthea
    added 2 commits that reference this issue on Oct 21, 2023

    docs: add samples from tables/automl (#54)

    c829cc3

    chore: release 2.0.0 (#68)

    629a2a6
  11. parthea
    added a commit that references this issue on Nov 22, 2025

    Using `CopyFrom` to set protobuf message fields (instead of `MergeFro…

    This issue will close once commit fdb4a43 is merged into the 'main' branch.
    fdb4a43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @tseaver
    tseaver

Labels

api: bigtableIssues related to the Bigtable API.type: questionRequest for information or clarification. Not an issue.

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.