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-1857250: More fixes to AST generation in functions.py #2793

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sfc-gh-vbudati
Copy link
Contributor

@sfc-gh-vbudati sfc-gh-vbudati commented Dec 19, 2024

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

    Fixes SNOW-1857250

  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
  3. Please describe how your code solves the related issue.

Fixed the AST generation where columns where recorded as literals instead of column parameters and parameters were being rearranged in some cases.

@sfc-gh-vbudati sfc-gh-vbudati requested review from a team as code owners December 19, 2024 22:34
@sfc-gh-vbudati sfc-gh-vbudati added the NO-CHANGELOG-UPDATES This pull request does not need to update CHANGELOG.md label Dec 19, 2024
@@ -656,9 +656,9 @@ df27 = df.select(bitshiftright(col("A"), col("B")), bitshiftright(col("A"), -10)

df28 = df.select(bround("A", 10), bround("A", 2), bround(col("A"), col("B")))

df29 = df.select(convert_timezone(col("A"), col("B")), convert_timezone(col("A"), col("B")), convert_timezone(col("A"), col("B")), convert_timezone(col("A"), col("B")), convert_timezone(col("A"), col("B")), convert_timezone(col("A"), col("A"), col("B")))
df29 = df.select(convert_timezone("A", col("B")), convert_timezone(col("A"), "B"), convert_timezone("A", "B"), convert_timezone(col("A"), col("B")), convert_timezone("A", "B"), convert_timezone("A", "B", "A"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why should col() be removed here? Does it no longer apply to a column reference?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, if you're looking at the original code run:

df29 = df.select(convert_timezone("A", col("B")), convert_timezone(col("A"), "B"), convert_timezone("A", "B"), convert_timezone(col("A"), col("B")), convert_timezone("A","B",None), convert_timezone("A", "B", "A"))

"A" wasn't passed in as a column -- I changed the AST encoder to record what the actual parameter passed in is as opposed to what parameter was given to builtin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NO-CHANGELOG-UPDATES This pull request does not need to update CHANGELOG.md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants