You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "eitsupi (via GitHub)" <gi...@apache.org> on 2025/07/24 10:35:35 UTC
[PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver package [arrow-adbc]
eitsupi opened a new pull request, #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197
Part of #3106
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on code in PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#discussion_r2232795451
##########
rust/driver_manager/src/error.rs:
##########
@@ -0,0 +1,90 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt;
+
+use adbc_core::error::Status;
+
+/// An Driver Manager error.
+#[derive(Debug, PartialEq, Eq, Clone)]
+pub enum Error {
Review Comment:
Ah that's right, I forgot about the non-overlapping impls rule.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on code in PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#discussion_r2234076000
##########
rust/driver_manager/src/error.rs:
##########
@@ -0,0 +1,90 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt;
+
+use adbc_core::error::Status;
+
+/// A Driver Manager error.
+#[derive(Debug, PartialEq, Eq, Clone)]
+pub enum Error {
+ Adbc(adbc_core::error::Error),
+ DynamicLibrary(String),
+ Other(String),
+}
Review Comment:
I think we should figure out how to unify the `adbc_core` errors with the driver manager errors. It's weird to have an "adbc error" that needs to be extended to contain errors from the "adbc driver manager". It's all ADBC.
##########
rust/driver_manager/src/error.rs:
##########
@@ -0,0 +1,90 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt;
+
+use adbc_core::error::Status;
+
+/// A Driver Manager error.
+#[derive(Debug, PartialEq, Eq, Clone)]
+pub enum Error {
+ Adbc(adbc_core::error::Error),
+ DynamicLibrary(String),
+ Other(String),
+}
+
+/// Result type wrapping [Error].
+pub type Result<T> = std::result::Result<T, Error>;
Review Comment:
These aliases tend to not be worth the confusion they create.
##########
rust/driver_manager/src/error.rs:
##########
@@ -0,0 +1,90 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt;
+
+use adbc_core::error::Status;
+
+/// A Driver Manager error.
+#[derive(Debug, PartialEq, Eq, Clone)]
+pub enum Error {
+ Adbc(adbc_core::error::Error),
+ DynamicLibrary(String),
+ Other(String),
+}
+
+/// Result type wrapping [Error].
+pub type Result<T> = std::result::Result<T, Error>;
Review Comment:
You can `use std::result::Result;` and repeat `Result<T, Error>` everywhere. If either `T` or the `Error` have long names, then you can alias the T or error type name themselves.
##########
rust/driver_manager/src/error.rs:
##########
@@ -0,0 +1,90 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt;
+
+use adbc_core::error::Status;
+
+/// A Driver Manager error.
+#[derive(Debug, PartialEq, Eq, Clone)]
+pub enum Error {
+ Adbc(adbc_core::error::Error),
+ DynamicLibrary(String),
+ Other(String),
+}
+
+/// Result type wrapping [Error].
+pub type Result<T> = std::result::Result<T, Error>;
+
+impl Error {
+ pub fn with_message_and_status(message: impl Into<String>, status: Status) -> Self {
+ (adbc_core::error::Error {
+ message: message.into(),
+ status,
+ vendor_code: 0,
+ sqlstate: [0; 5],
+ details: None,
+ })
+ .into()
+ }
+}
+
+impl fmt::Display for Error {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ match self {
+ Error::Adbc(e) => write!(f, "ADBC error: {e}"),
+ Error::DynamicLibrary(s) => write!(f, "Error with dynamic library: {s}"),
+ Error::Other(s) => write!(f, "Other error: {s}"),
Review Comment:
These prefixes to errors don't seem necessary, except maybe for the `Other` case where you might want to say "ADBC driver manager: {s}".
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "eitsupi (via GitHub)" <gi...@apache.org>.
eitsupi commented on code in PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#discussion_r2244120953
##########
rust/driver_manager/src/lib.rs:
##########
@@ -720,6 +712,7 @@ fn set_option_database(
ERR_ONLY_STRING_OPT,
Status::NotImplemented,
))?,
+ (_, _) => unreachable!(),
Review Comment:
If there is no need to mark these enums as `non_exhaustive`, then this condition is unnecessary.
https://github.com/apache/arrow-adbc/blob/314f0096b50538df8b4d4b34f95273481c22a7ad/rust/core/src/error.rs#L27-L28
https://github.com/apache/arrow-adbc/blob/314f0096b50538df8b4d4b34f95273481c22a7ad/rust/core/src/options.rs#L102-L103
In my opinion, it would be better if they were not `non_exhaustive`, since if the enums were extended, it would not be noticed downstream.
@lidavidm Any thoughts?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "eitsupi (via GitHub)" <gi...@apache.org>.
eitsupi commented on code in PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#discussion_r2232792672
##########
rust/driver_manager/src/error.rs:
##########
@@ -0,0 +1,90 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt;
+
+use adbc_core::error::Status;
+
+/// An Driver Manager error.
+#[derive(Debug, PartialEq, Eq, Clone)]
+pub enum Error {
Review Comment:
Thanks for taking a look at this.
Indeed, it's mostly a thin wrapper or `adbc_core::error::Error`.
However, due to Rust's limitations, we can't implement something like `impl From<libloading::Error> for adbc_core::error::Error` within that package, so, I thought defining their own Error would be clearer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on code in PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#discussion_r2234073969
##########
rust/driver_manager/src/error.rs:
##########
@@ -0,0 +1,90 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt;
+
+use adbc_core::error::Status;
+
+/// A Driver Manager error.
+#[derive(Debug, PartialEq, Eq, Clone)]
+pub enum Error {
+ Adbc(adbc_core::error::Error),
+ DynamicLibrary(String),
+ Other(String),
+}
+
+/// Result type wrapping [Error].
+pub type Result<T> = std::result::Result<T, Error>;
+
+impl Error {
+ pub fn with_message_and_status(message: impl Into<String>, status: Status) -> Self {
+ (adbc_core::error::Error {
+ message: message.into(),
+ status,
+ vendor_code: 0,
+ sqlstate: [0; 5],
+ details: None,
+ })
+ .into()
+ }
+}
+
+impl fmt::Display for Error {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ match self {
+ Error::Adbc(e) => write!(f, "ADBC error: {e}"),
+ Error::DynamicLibrary(s) => write!(f, "Error with dynamic library: {s}"),
+ Error::Other(s) => write!(f, "Other error: {s}"),
Review Comment:
These prefixes to errors don't seem necessary, except maybe for the `Other` case where you might want to say "ADBC driver manager: {s}".
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "eitsupi (via GitHub)" <gi...@apache.org>.
eitsupi commented on code in PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#discussion_r2238154341
##########
rust/driver_manager/src/error.rs:
##########
@@ -0,0 +1,90 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt;
+
+use adbc_core::error::Status;
+
+/// A Driver Manager error.
+#[derive(Debug, PartialEq, Eq, Clone)]
+pub enum Error {
+ Adbc(adbc_core::error::Error),
+ DynamicLibrary(String),
+ Other(String),
+}
Review Comment:
Thank you both, I'll try to fix it in that direction.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on code in PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#discussion_r2232787065
##########
rust/driver_manager/src/error.rs:
##########
@@ -0,0 +1,90 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt;
+
+use adbc_core::error::Status;
+
+/// An Driver Manager error.
Review Comment:
```suggestion
/// A Driver Manager error.
```
nit
##########
rust/driver_manager/src/error.rs:
##########
@@ -0,0 +1,90 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt;
+
+use adbc_core::error::Status;
+
+/// An Driver Manager error.
+#[derive(Debug, PartialEq, Eq, Clone)]
+pub enum Error {
Review Comment:
Interesting. IMO, it would have been OK to reuse the core errors, since in other languages, the driver manager presents itself as a driver. But maybe Rust users prefer the additional detail here. I suppose this is only used in the driver-manager specific interfaces though so that's probably OK.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on code in PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#discussion_r2244126396
##########
rust/driver_manager/src/lib.rs:
##########
@@ -720,6 +712,7 @@ fn set_option_database(
ERR_ONLY_STRING_OPT,
Status::NotImplemented,
))?,
+ (_, _) => unreachable!(),
Review Comment:
I think it's unlikely Status will change, but AdbcVersion is likely to be extended
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "eitsupi (via GitHub)" <gi...@apache.org>.
eitsupi commented on code in PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#discussion_r2244215273
##########
rust/driver_manager/src/lib.rs:
##########
@@ -720,6 +712,7 @@ fn set_option_database(
ERR_ONLY_STRING_OPT,
Status::NotImplemented,
))?,
+ (_, _) => unreachable!(),
Review Comment:
After some thought, what do you think about the following approach?
1. Currently, the version of adbc_core is `0.y.z`, which is not a stable version, so I think breaking changes due to enum extensions are relatively tolerable.
Therefore, remove the `non_exhaustive` attribute from all enums except for `AdbcVersion`.
2. Leave the `non_exhaustive` attribute only on AdbcVersion, which will obviously be extended in the future.
3. Since it is desirable for adbc_driver_manager to cover all versions, we use the nightly toolchain to have Clippy detect `non_exhaustive_omitted_patterns` to prevent forgetting to update match arms.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "eitsupi (via GitHub)" <gi...@apache.org>.
eitsupi commented on code in PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#discussion_r2244160285
##########
rust/driver_manager/src/lib.rs:
##########
@@ -720,6 +712,7 @@ fn set_option_database(
ERR_ONLY_STRING_OPT,
Status::NotImplemented,
))?,
+ (_, _) => unreachable!(),
Review Comment:
Sorry for the lack of explanation.
Rust's pattern matching will cause a compilation error in the following cases if enum is extended upstream.
```rs
match version {
AdbcVersion::V100 => ...,
AdbcVersion::V110 => ...,
}
```
~~This is the same regardless of whether the `non_exhaustive` attribute is present or not,~~
but if the enum has the `non_exhaustive` attribute, ~~clippy will seem generate an error in the code above and~~ request the addition of a wildcard condition.
```rs
match version {
AdbcVersion::V100 => ...,
AdbcVersion::V110 => ...,
_ => ...,
}
```
If we write code like this, it will compile successfully even if the enum is expanded when the dependent adbc_core is updated.
On the other hand, if there is no wildcard condition, an error will occur at compile time, making it clear that we need to update to a newer version.
```rs
match version {
AdbcVersion::V100 => ...,
AdbcVersion::V110 => ...,
AdbcVersion::V200 => ...,
}
```
I think that Rust developers are usually familiar with pattern matching, so using the `non_exhaustive` attribute here would only delay the discovery of the problem (even if there is no error at compile time, there will eventually be an error at runtime), so I think it would be better not to use it.
Edit: Sorry, I had some misunderstandings, so I've corrected the comment.
It seems that `non_exhaustive_omitted_patterns` needs to be used downstream to avoid missing new pattern.
https://internals.rust-lang.org/t/stabilizing-non-exhaustive-omitted-patterns-or-a-better-alternative/21679
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "eitsupi (via GitHub)" <gi...@apache.org>.
eitsupi commented on PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#issuecomment-3153146955
Thank you, I'm out now so I'll resolve the conflicts tonight.
Please merge if you like then!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv merged PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "eitsupi (via GitHub)" <gi...@apache.org>.
eitsupi commented on code in PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#discussion_r2244136404
##########
rust/driver_manager/src/lib.rs:
##########
@@ -720,6 +712,7 @@ fn set_option_database(
ERR_ONLY_STRING_OPT,
Status::NotImplemented,
))?,
+ (_, _) => unreachable!(),
Review Comment:
Thank you for your reply. (And sorry for the late comment, I was wondering about this a few days ago but forgot to post the question.)
I understand that the version number will be expanded in the future, but I think that if a driver and driver manager combination with an unknown version is encountered, an error will eventually occur.
https://github.com/apache/arrow-adbc/blob/314f0096b50538df8b4d4b34f95273481c22a7ad/rust/core/src/options.rs#L136-L149
This is the same whether the enum is marked with `non_exhaustive` or not, so I think it is better to remove the `non_exhaustive` attribute to make it clear that all versions at the time of release of adbc_core are supported, and to prevent bugs from being introduced during downstream package development.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on code in PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#discussion_r2244142378
##########
rust/driver_manager/src/lib.rs:
##########
@@ -720,6 +712,7 @@ fn set_option_database(
ERR_ONLY_STRING_OPT,
Status::NotImplemented,
))?,
+ (_, _) => unreachable!(),
Review Comment:
I think I might be misunderstanding, but isn't the intent of `non_exhaustive` for downstream users, not our own code? In other words, the intent is to prevent people from writing code like this:
```rust
match version {
AdbcVersion::V100 => ...,
AdbcVersion::V110 => ...,
// No other clauses
}
```
so that they can't complain about broken code when we add a new version. I suppose now that we are splitting the crates, it does mean some redundancy in our own code. But I would argue that since we do plan on expanding this enum, we should be explicit about our plans with the attribute, especially for users outside this repo.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on code in PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#discussion_r2244224068
##########
rust/driver_manager/src/lib.rs:
##########
@@ -720,6 +712,7 @@ fn set_option_database(
ERR_ONLY_STRING_OPT,
Status::NotImplemented,
))?,
+ (_, _) => unreachable!(),
Review Comment:
Ah I see. You want to enforce that all arms are explicitly covered in the driver manager crate, which non_exhaustive gets in the way of. non_exhaustive_omitted_patterns sounds like a good way to handle that. I agree with your proposal (remove non_exhaustive except on AdbcVersion and use non_exhaustive_omitted_patterns option)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on code in PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#discussion_r2236662194
##########
rust/driver_manager/src/error.rs:
##########
@@ -0,0 +1,90 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt;
+
+use adbc_core::error::Status;
+
+/// A Driver Manager error.
+#[derive(Debug, PartialEq, Eq, Clone)]
+pub enum Error {
+ Adbc(adbc_core::error::Error),
+ DynamicLibrary(String),
+ Other(String),
+}
Review Comment:
Yes. That's better than adding another `Error` type into the ADBC libraries. And it let's us think more carefully about what we want to report right where the error has happened.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "eitsupi (via GitHub)" <gi...@apache.org>.
eitsupi commented on code in PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#discussion_r2242168568
##########
rust/driver_manager/src/error.rs:
##########
@@ -0,0 +1,90 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt;
+
+use adbc_core::error::Status;
+
+/// A Driver Manager error.
+#[derive(Debug, PartialEq, Eq, Clone)]
+pub enum Error {
+ Adbc(adbc_core::error::Error),
+ DynamicLibrary(String),
+ Other(String),
+}
Review Comment:
How about 9516b972894ca692526522164ab996d5708c7606?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "eitsupi (via GitHub)" <gi...@apache.org>.
eitsupi commented on code in PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#discussion_r2244160285
##########
rust/driver_manager/src/lib.rs:
##########
@@ -720,6 +712,7 @@ fn set_option_database(
ERR_ONLY_STRING_OPT,
Status::NotImplemented,
))?,
+ (_, _) => unreachable!(),
Review Comment:
Sorry for the lack of explanation.
Rust's pattern matching will cause a compilation error in the following cases if enum is extended upstream.
```rs
match version {
AdbcVersion::V100 => ...,
AdbcVersion::V110 => ...,
}
```
This is the same regardless of whether the `non_exhaustive` attribute is present or not, but if the enum has the `non_exhaustive` attribute, clippy will seem generate an error in the code above and request the addition of a wildcard condition.
```rs
match version {
AdbcVersion::V100 => ...,
AdbcVersion::V110 => ...,
_ => ...,
}
```
If we write code like this, it will compile successfully even if the enum is expanded when the dependent adbc_core is updated.
On the other hand, if there is no wildcard condition, an error will occur at compile time, making it clear that we need to update to a newer version.
```rs
match version {
AdbcVersion::V100 => ...,
AdbcVersion::V110 => ...,
AdbcVersion::V200 => ...,
}
```
I think that Rust developers are usually familiar with pattern matching, so using the `non_exhaustive` attribute here would only delay the discovery of the problem (even if there is no error at compile time, there will eventually be an error at runtime), so I think it would be better not to use it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on code in PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#discussion_r2244238673
##########
rust/driver_manager/src/lib.rs:
##########
@@ -720,6 +712,7 @@ fn set_option_database(
ERR_ONLY_STRING_OPT,
Status::NotImplemented,
))?,
+ (_, _) => unreachable!(),
Review Comment:
LGTM, if you want to open a new PR to make the changes to the enums (or add it here), go ahead
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "eitsupi (via GitHub)" <gi...@apache.org>.
eitsupi commented on code in PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#discussion_r2244242683
##########
rust/driver_manager/src/lib.rs:
##########
@@ -720,6 +712,7 @@ fn set_option_database(
ERR_ONLY_STRING_OPT,
Status::NotImplemented,
))?,
+ (_, _) => unreachable!(),
Review Comment:
Thank you! (Again, sorry if that wasn't clear)
I'll make a follow-up PR later.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#issuecomment-3138500246
I'll let Felipe take another look before I merge
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#issuecomment-3152845683
@eitsupi wanna rebase this, then I can just go ahead and merge?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on code in PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#discussion_r2254968691
##########
rust/driver_manager/src/error.rs:
##########
@@ -0,0 +1,90 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt;
+
+use adbc_core::error::Status;
+
+/// A Driver Manager error.
+#[derive(Debug, PartialEq, Eq, Clone)]
+pub enum Error {
+ Adbc(adbc_core::error::Error),
+ DynamicLibrary(String),
+ Other(String),
+}
Review Comment:
Thank you! Much clearer this way.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(rust/core)!: move the driver_manager feature to the new adbc_driver_manager package [arrow-adbc]
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on code in PR #3197:
URL: https://github.com/apache/arrow-adbc/pull/3197#discussion_r2234182336
##########
rust/driver_manager/src/error.rs:
##########
@@ -0,0 +1,90 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt;
+
+use adbc_core::error::Status;
+
+/// A Driver Manager error.
+#[derive(Debug, PartialEq, Eq, Clone)]
+pub enum Error {
+ Adbc(adbc_core::error::Error),
+ DynamicLibrary(String),
+ Other(String),
+}
Review Comment:
I suppose we can manually transform errors instead of relying on `From`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org