Skip to content

feat: add bigframes.bigquery.deterministic_decrypt* and bigframes.bigquery.deterministic_encrypt functions#17212

Open
tswast wants to merge 2 commits into
mainfrom
tswast-bbq-gen
Open

feat: add bigframes.bigquery.deterministic_decrypt* and bigframes.bigquery.deterministic_encrypt functions#17212
tswast wants to merge 2 commits into
mainfrom
tswast-bbq-gen

Conversation

@tswast
Copy link
Copy Markdown
Contributor

@tswast tswast commented May 20, 2026

🦕

@tswast tswast marked this pull request as ready for review May 20, 2026 19:07
@tswast tswast requested review from a team as code owners May 20, 2026 19:07
@tswast tswast requested review from GarrettWu and removed request for a team May 20, 2026 19:07
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces deterministic encryption operations (encrypt, decrypt_bytes, and decrypt_string) to the BigQuery operations module. The changes include updates to the global namespace, a new configuration file, and corresponding unit tests. Review feedback points out several PEP 8 line length violations in type hints and identifies unused imports in the newly generated aead_encryption.py file, suggesting improvements to the generator script.

I am having trouble creating individual review comments. Click here to see my feedback.

packages/bigframes/bigframes/bigquery/_operations/aead.py (53-55)

medium

The manual flattening of these type hints into single lines violates PEP 8 line length limits (79 characters) and degrades readability. Additionally, the nested Union is redundant. Reverting to a multi-line format with a simplified Union is recommended.

    keyset: Union[
        T,
        bigframes.core.col.Expression,
        Literal[sentinels.Sentinel.ARGUMENT_DEFAULT],
        bytes,
        dict,
    ],
    ciphertext: Union[
        T,
        bigframes.core.col.Expression,
        Literal[sentinels.Sentinel.ARGUMENT_DEFAULT],
        bytes,
    ],
    additional_data: Union[
        T,
        bigframes.core.col.Expression,
        Literal[sentinels.Sentinel.ARGUMENT_DEFAULT],
        bytes,
    ],
References
  1. PEP 8 recommends a line length limit of 79 characters for Python code. (link)

packages/bigframes/bigframes/bigquery/_operations/aead.py (67-69)

medium

The manual flattening of these type hints into single lines violates PEP 8 line length limits (79 characters) and degrades readability. Additionally, the nested Union is redundant. Reverting to a multi-line format with a simplified Union is recommended.

    keyset: Union[
        T,
        bigframes.core.col.Expression,
        Literal[sentinels.Sentinel.ARGUMENT_DEFAULT],
        bytes,
        dict,
    ],
    ciphertext: Union[
        T,
        bigframes.core.col.Expression,
        Literal[sentinels.Sentinel.ARGUMENT_DEFAULT],
        bytes,
    ],
    additional_data: Union[
        T,
        bigframes.core.col.Expression,
        Literal[sentinels.Sentinel.ARGUMENT_DEFAULT],
        str,
    ],
References
  1. PEP 8 recommends a line length limit of 79 characters for Python code. (link)

packages/bigframes/bigframes/bigquery/_operations/aead.py (81-83)

medium

The manual flattening of these type hints into single lines violates PEP 8 line length limits (79 characters) and degrades readability. Additionally, the nested Union is redundant. Reverting to a multi-line format with a simplified Union is recommended.

    keyset: Union[
        T,
        bigframes.core.col.Expression,
        Literal[sentinels.Sentinel.ARGUMENT_DEFAULT],
        bytes,
        dict,
    ],
    plaintext: Union[
        T,
        bigframes.core.col.Expression,
        Literal[sentinels.Sentinel.ARGUMENT_DEFAULT],
        bytes,
        str,
    ],
    additional_data: Union[
        T,
        bigframes.core.col.Expression,
        Literal[sentinels.Sentinel.ARGUMENT_DEFAULT],
        bytes,
        str,
    ],
References
  1. PEP 8 recommends a line length limit of 79 characters for Python code. (link)

packages/bigframes/bigframes/bigquery/_operations/global_namespace/aead_encryption.py (21-31)

medium

This generated file contains several unused imports: datetime, Any, Optional, bigframes.core.expression as ex, and bigframes.operations as ops. Please update the generator script scripts/generate_bigframes_bigquery.py to only include necessary imports.

from typing import Literal, TypeVar, Union

import bigframes.bigquery._googlesql
import bigframes.core.col
import bigframes.core.sentinels as sentinels
import bigframes.series as series
from bigframes import dtypes
from bigframes.operations import googlesql
References
  1. Unused imports should be removed to maintain code cleanliness. (link)

packages/bigframes/bigframes/bigquery/_operations/global_namespace/aead_encryption.py (53-55)

medium

The generated type hints exceed the PEP 8 line length limit of 79 characters. Please update the generator script scripts/generate_bigframes_bigquery.py to produce multi-line type hints and simplify redundant nested Union structures.

    keyset: Union[
        T,
        bigframes.core.col.Expression,
        Literal[sentinels.Sentinel.ARGUMENT_DEFAULT],
        bytes,
        dict,
    ],
    ciphertext: Union[
        T,
        bigframes.core.col.Expression,
        Literal[sentinels.Sentinel.ARGUMENT_DEFAULT],
        bytes,
    ],
    additional_data: Union[
        T,
        bigframes.core.col.Expression,
        Literal[sentinels.Sentinel.ARGUMENT_DEFAULT],
        bytes,
    ],
References
  1. PEP 8 recommends a line length limit of 79 characters for Python code. (link)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants