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

make unparser Dialect trait Send + Sync #11504

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

y-f-u
Copy link
Contributor

@y-f-u y-f-u commented Jul 17, 2024

Which issue does this PR close?

This makes unparser trait Dialect easier to work within DataFusion context for federated queries (datafusion-federation).

Rationale for this change

In federated query context, that could be use cases that a dialect needs to be specified for table providers targeting protocol like flight, odbc because the underlying DBMS may have different sql dialect. Without Send + Sync, it can be tricky to pass the config of dialect down into table provider scan/execute method, etc.

In current design, the dialect is mostly an empty struct so it's safe to change so. The alternative is to pass a fn which create a Arc<dyn Dialect> around which doesn't look great.

Thoughts?

What changes are included in this PR?

Make Unparser Dialect to be Send + Sync

Are these changes tested?

n/a. I don't think it needs one.

Are there any user-facing changes?

n/a

@github-actions github-actions bot added the sql SQL Planner label Jul 17, 2024
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you for this contribution @y-f-u

Another potential option is to pass around Arc<dyn Dialect + Send + Sync> instead of Arc<dyn Dialect> in your code.

However, that sounds annoying and unecessary and doesn't really follow the pattern of the rest of the DataFusion code.

I think it is fine to make this Send+Sync to make it easier for the Rust compiler to use this type in async closures.

I'll leave this PR open for a day in case any other maintainer wants to weigh in

@alamb alamb added the api change Changes the API exposed to users of the crate label Jul 17, 2024
@alamb alamb changed the title make unparser Dialect Send + Sync make unparser Dialect trait Send + Sync Jul 17, 2024
@alamb
Copy link
Contributor

alamb commented Jul 19, 2024

🚀

@alamb alamb merged commit af0d2ba into apache:main Jul 19, 2024
24 checks passed
@alamb
Copy link
Contributor

alamb commented Jul 19, 2024

Thanks again @y-f-u

Lordworms pushed a commit to Lordworms/arrow-datafusion that referenced this pull request Jul 23, 2024
wiedld pushed a commit to influxdata/arrow-datafusion that referenced this pull request Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api change Changes the API exposed to users of the crate sql SQL Planner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants