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

Guard in QueryCompilerCaster to allow a QC to override casting behavior #7448

Open
sfc-gh-jkew opened this issue Feb 26, 2025 · 1 comment
Open
Labels
new feature/request 💬 Requests and pull requests for new features P1 Important tasks that we should complete soon

Comments

@sfc-gh-jkew
Copy link
Contributor

Sometimes we may want to control how the QueryCompilerCaster behaves on a QC by QC basis. The QueryCompilerCaster is only used for the NativePandas QC; but Snowflake would like to add it to the Snowflake QC as well.

We also want to make sure that users do not accidentally download their entire warehouse, so I would like to propose the following approach:

  1. Implement a function, BaseQueryCompiler::allow_coercion_to(OtherQueryCompiler) which will return true by default and false if coercion should not occur.
  2. In the QueryCompilerCaster we gate the coercion based on the argument's QC
  3. If the argument cannot be coerced ( or casted ) then we emit an error
  4. If the argument can be coerced we perform the cast as normal

This should allow for the same behavior for existing OSS engines, but allow for some more discretion for engines which want prevent downloading an entire warehouse.

Thoughts @anmyachev @devin-petersohn @mvashishtha

I can start work on a PR for this if this seems pretty reasonable.

@sfc-gh-jkew sfc-gh-jkew added new feature/request 💬 Requests and pull requests for new features Triage 🩹 Issues that need triage labels Feb 26, 2025
@sfc-gh-mvashishtha sfc-gh-mvashishtha added P1 Important tasks that we should complete soon and removed Triage 🩹 Issues that need triage labels Feb 26, 2025
@sfc-gh-jkew
Copy link
Contributor Author

The consensus is that we should implement a symmetric version where A op B and B op A will result in the same QC. This will be a bit more work, but doable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature/request 💬 Requests and pull requests for new features P1 Important tasks that we should complete soon
Projects
None yet
Development

No branches or pull requests

2 participants