Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1917480: StringType comparison behavior changes in versions > 1.20.0 #2988

Open
samuelsongsr opened this issue Feb 7, 2025 · 2 comments
Labels
bug Something isn't working needs triage Initial RCA is required

Comments

@samuelsongsr
Copy link

Please answer these questions before submitting your issue. Thanks!

  1. What version of Python are you using?

    Python 3.11.9 (main, Sep 20 2024, 13:40:49) [Clang 16.0.0 (clang-1600.0.26.3)]

  2. What operating system and processor architecture are you using?

    macOS-14.7.1-arm64-arm-64bit

  3. What are the component versions in the environment (pip freeze)?

    Issue working in:
    snowflake-connector-python==3.13.2
    snowflake-snowpark-python==1.20.0

    Issue not working in:
    snowflake-connector-python==3.13.2
    snowflake-snowpark-python==1.21.0

  4. What did you do?

from snowflake.snowpark.types import StringType

#  Tests pass in <= v1.20.0
#  Tests fail in > v1.20.0
def test_string_types():
    str_with_length = StringType(length=16777216)
    str_default = StringType()
    assert str_with_length == str_default
  1. What did you expect to see?

    The test to pass in > v1.20.0

@samuelsongsr samuelsongsr added bug Something isn't working needs triage Initial RCA is required labels Feb 7, 2025
@github-actions github-actions bot changed the title StringType comparison behavior changes in versions > 1.20.0 SNOW-1917480: StringType comparison behavior changes in versions > 1.20.0 Feb 7, 2025
@sfc-gh-jrose
Copy link
Contributor

This is an intended change with how StringType objects work after in >= v1.21.0.

By default StringType() is assumed to be a max length string. In versions <= v1.20.0 StringType(length=16777216) was also assumed to be a max length string, but that has since become incorrect depending on the server side configuration. If you'd like to assume that it is still you can do something like this:

def test_string_types():
    str_with_length = StringType(length=16777216, is_max_size=True)
    str_default = StringType()
    assert str_with_length == str_default

Otherwise depending on the session it may or may not be a max length string.

@sfc-gh-yuwang
Copy link
Collaborator

@samuelsongsr Hi, is above comment answered your question? Can we close this issue? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Initial RCA is required
Projects
None yet
Development

No branches or pull requests

3 participants