Skip to content

SNOW-3259059: Avoid server-side bug by using CHR(34) instead of lit('"') in concat#4139

Merged
sfc-gh-helmeleegy merged 2 commits intomainfrom
helmeleegy-SNOW-3259059
Mar 26, 2026
Merged

SNOW-3259059: Avoid server-side bug by using CHR(34) instead of lit('"') in concat#4139
sfc-gh-helmeleegy merged 2 commits intomainfrom
helmeleegy-SNOW-3259059

Conversation

@sfc-gh-helmeleegy
Copy link
Copy Markdown
Contributor

  1. Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes SNOW-3259059

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
      • If this test skips Local Testing mode, I'm requesting review from @snowflakedb/local-testing
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am adding new credentials
    • I am adding a new dependency
    • If this is a new feature/behavior, I'm adding the Local Testing parity changes.
    • I acknowledge that I have ensured my changes to be thread-safe. Follow the link for more information: Thread-safe Developer Guidelines
    • If adding any arguments to public Snowpark APIs or creating new public Snowpark APIs, I acknowledge that I have ensured my changes include AST support. Follow the link for more information: AST Support Guidelines
  3. Please describe how your code solves the related issue.

    Fix a Snowflake platform compatibility issue (SNOW-3259059) where concat(lit('"'), ...) could lose the leading quote through some EXCEPT / chained set-operation plans by lowering that literal to CHR(34) in generated SQL.

@sfc-gh-helmeleegy sfc-gh-helmeleegy requested review from a team as code owners March 26, 2026 17:25
@sfc-gh-helmeleegy sfc-gh-helmeleegy changed the title SNOW-3259059: concat lone double-quote via CHR(34) SNOW-3259059: Lower concat(lit('"')) to CHR(34) for set-op / EXCEPT plans Mar 26, 2026
@sfc-gh-helmeleegy sfc-gh-helmeleegy changed the title SNOW-3259059: Lower concat(lit('"')) to CHR(34) for set-op / EXCEPT plans SNOW-3259059: avoid server-side bug by using CHR(34) instead of lit('"') in concat Mar 26, 2026
@sfc-gh-helmeleegy sfc-gh-helmeleegy changed the title SNOW-3259059: avoid server-side bug by using CHR(34) instead of lit('"') in concat SNOW-3259059: Avoid server-side bug by using CHR(34) instead of lit('"') in concat Mar 26, 2026
@sfc-gh-helmeleegy sfc-gh-helmeleegy force-pushed the helmeleegy-SNOW-3259059 branch from 53a529c to cb0def0 Compare March 26, 2026 17:29
Copy link
Copy Markdown
Contributor

@sfc-gh-joshi sfc-gh-joshi left a comment

Choose a reason for hiding this comment

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

@sfc-gh-helmeleegy Do you know what exactly the root cause of the bug here is, and why this workaround is valid? The linked JIRA isn't very clear about it.

Is the bug also present if the concatenated literal has more than just the single double-quote character, like concat(lit('""""xxxxx'), "column")?

Comment on lines +3744 to +3748
columns = [_to_col_if_str(c, "concat") for c in cols]
columns = [
_rewrite_concat_arg_if_double_quote_string_literal(c, _emit_ast=_emit_ast)
for c in columns
]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we combine these into a single list comprehension?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@sfc-gh-helmeleegy
Copy link
Copy Markdown
Contributor Author

@sfc-gh-helmeleegy Do you know what exactly the root cause of the bug here is, and why this workaround is valid? The linked JIRA isn't very clear about it.

Is the bug also present if the concatenated literal has more than just the single double-quote character, like concat(lit('""""xxxxx'), "column")?

The exact root cause on the server side is not clear (to us at least). I'm trying to work with the SQL's team oncall to understand when a mitigation is expected from their side. This PR is meant to unblock the customer using a client-side fix to the issue they faced.

Copy link
Copy Markdown
Collaborator

@sfc-gh-mayliu sfc-gh-mayliu left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for fixing this

@sfc-gh-helmeleegy sfc-gh-helmeleegy merged commit 6ca3b0f into main Mar 26, 2026
26 of 30 checks passed
@sfc-gh-helmeleegy sfc-gh-helmeleegy deleted the helmeleegy-SNOW-3259059 branch March 26, 2026 20:43
@github-actions github-actions bot locked and limited conversation to collaborators Mar 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants