You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tustvold (via GitHub)" <gi...@apache.org> on 2023/05/09 14:28:49 UTC

[GitHub] [arrow-rs] tustvold opened a new pull request, #4184: Add ObjectStoreScheme (#4047)

tustvold opened a new pull request, #4184:
URL: https://github.com/apache/arrow-rs/pull/4184

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes #4047
   
   # Rationale for this change
    
   <!--
   Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
   Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
   -->
   
   Inspired by the work in #4077 I started work on a generic `ObjectStoreBuilder`, however, this ran into a couple of challenges
   
   * Different stores have different configuration APIs, e.g. S3 has ClientOptions, whereas LocalFilesystem has a prefix
   * Some downstreams will want to use environment variables, and some will not
   * Some downstreams will want to filter config to just match those expected by the store, others will want to error
   * There are various valid ways LocalFileSystem and Memory URLs could be interpreted
   * The feature flag plumbing was extremely fiddly, the fact we separate the different stores is a historical artifact from when they brought in different SDKs, downstreams shouldn't need to do this
   
   Whilst this PR does to a certain extent punt the issue onto downstreams, I think this standardises the non-trivial URL recognition logic, whilst allowing downstreams to make their own opinionated decision w.r.t the above.
   
   # What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   # Are there any user-facing changes?
   
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!---
   If there are any breaking changes to public APIs, please add the `breaking change` label.
   -->
   


-- 
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


[GitHub] [arrow-rs] tustvold commented on a diff in pull request #4184: Add ObjectStoreScheme (#4047)

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4184:
URL: https://github.com/apache/arrow-rs/pull/4184#discussion_r1188867550


##########
object_store/src/scheme.rs:
##########
@@ -0,0 +1,130 @@
+// 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 crate::{Error, Result};
+use url::Url;
+
+/// Recognises various URL formats, identifying the relevant [`ObjectStore`](crate::ObjectStore)
+///
+/// This can be combined with the [with_url](crate::aws::AmazonS3Builder::with_url) methods
+/// on the corresponding builder to construct the relevant type of store
+#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
+pub enum ObjectStoreScheme {

Review Comment:
   >  the API here makes a lot of sense
   
   This API is just a trait? It doesn't contain any parsing logic, nor any logic to interpret schemes directly
   
   > The extra value to having a hard coded list of url prefixes seems relatively minimal
   
   It isn't just schemes FWIW
   
   > why you are proposing to add this to the object store crate
   > If I were a user I would want something that took a url like s3://foo-bucket or https://andrew:lamb@foo.com/path and returned an Arc<dyn ObjectStore> 
   
   As explained in the description, because there isn't a way I can see to make such an API that is both coherent and not extremely opinionated...
   



-- 
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


[GitHub] [arrow-rs] alamb commented on a diff in pull request #4184: Add ObjectStoreScheme (#4047)

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #4184:
URL: https://github.com/apache/arrow-rs/pull/4184#discussion_r1188879415


##########
object_store/src/scheme.rs:
##########
@@ -0,0 +1,130 @@
+// 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 crate::{Error, Result};
+use url::Url;
+
+/// Recognises various URL formats, identifying the relevant [`ObjectStore`](crate::ObjectStore)
+///
+/// This can be combined with the [with_url](crate::aws::AmazonS3Builder::with_url) methods
+/// on the corresponding builder to construct the relevant type of store
+#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
+pub enum ObjectStoreScheme {

Review Comment:
   > This API is just a trait? It doesn't contain any parsing logic, nor any logic to interpret schemes directly
   
   The API is a trait but DataFusion provides default parsing logic / scheme interpretation in https://docs.rs/datafusion/latest/datafusion/datasource/object_store/struct.DefaultObjectStoreRegistry.html
   
   
   > As explained in the description, because there isn't a way I can see to make such an API that is both coherent and not extremely opinionated...
   
   I wast trying to suggest an API that let users implement their own opinions while also providing a default implementation that worked for simple cases (with whatever opinions you wanted)



-- 
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


[GitHub] [arrow-rs] tustvold commented on pull request #4184: Add ObjectStoreScheme (#4047)

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on PR #4184:
URL: https://github.com/apache/arrow-rs/pull/4184#issuecomment-1540545527

   I will add a build_with_options method to this


-- 
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


[GitHub] [arrow-rs] alamb commented on a diff in pull request #4184: Add ObjectStoreScheme (#4047)

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #4184:
URL: https://github.com/apache/arrow-rs/pull/4184#discussion_r1188866058


##########
object_store/src/scheme.rs:
##########
@@ -0,0 +1,130 @@
+// 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 crate::{Error, Result};
+use url::Url;
+
+/// Recognises various URL formats, identifying the relevant [`ObjectStore`](crate::ObjectStore)
+///
+/// This can be combined with the [with_url](crate::aws::AmazonS3Builder::with_url) methods
+/// on the corresponding builder to construct the relevant type of store
+#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
+pub enum ObjectStoreScheme {

Review Comment:
   I don't fully understand why you are proposing to add this to the object store crate.
   
   Users of `object_store` would still have to match on the resulting scheme and instantiate a builder / configuration appropriate to whatever they wanted. The extra value to having a hard coded list of url prefixes seems relatively minimal.
   
   Maybe this is just a first step. 
   
   If I were a user I would want something that took a url like `s3://foo-bucket` or `https://andrew:lamb@foo.com/path` and returned an `Arc<dyn ObjectStore>` . 
   
   For convenience the object_store crate could have default interpretations of these urls, but also some way to extend the API;
   
   Basically I think the API here makes a lot of sense https://docs.rs/datafusion/latest/datafusion/datasource/object_store/trait.ObjectStoreRegistry.html 



-- 
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


[GitHub] [arrow-rs] tustvold commented on a diff in pull request #4184: Add ObjectStoreScheme (#4047)

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4184:
URL: https://github.com/apache/arrow-rs/pull/4184#discussion_r1188867550


##########
object_store/src/scheme.rs:
##########
@@ -0,0 +1,130 @@
+// 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 crate::{Error, Result};
+use url::Url;
+
+/// Recognises various URL formats, identifying the relevant [`ObjectStore`](crate::ObjectStore)
+///
+/// This can be combined with the [with_url](crate::aws::AmazonS3Builder::with_url) methods
+/// on the corresponding builder to construct the relevant type of store
+#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
+pub enum ObjectStoreScheme {

Review Comment:
   >  the API here makes a lot of sense
   
   This API is just a trait? It doesn't contain any parsing logic, nor any logic to interpret schemes directly



-- 
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


[GitHub] [arrow-rs] tustvold closed pull request #4184: Add ObjectStoreScheme (#4047)

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold closed pull request #4184: Add ObjectStoreScheme (#4047)
URL: https://github.com/apache/arrow-rs/pull/4184


-- 
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


[GitHub] [arrow-rs] tustvold closed pull request #4184: Add ObjectStoreScheme (#4047)

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold closed pull request #4184: Add ObjectStoreScheme (#4047)
URL: https://github.com/apache/arrow-rs/pull/4184


-- 
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


[GitHub] [arrow-rs] tustvold commented on a diff in pull request #4184: Add ObjectStoreScheme (#4047)

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4184:
URL: https://github.com/apache/arrow-rs/pull/4184#discussion_r1188867550


##########
object_store/src/scheme.rs:
##########
@@ -0,0 +1,130 @@
+// 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 crate::{Error, Result};
+use url::Url;
+
+/// Recognises various URL formats, identifying the relevant [`ObjectStore`](crate::ObjectStore)
+///
+/// This can be combined with the [with_url](crate::aws::AmazonS3Builder::with_url) methods
+/// on the corresponding builder to construct the relevant type of store
+#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
+pub enum ObjectStoreScheme {

Review Comment:
   >  the API here makes a lot of sense
   
   This API is just a trait? It doesn't contain any parsing logic, nor any logic to interpret schemes directly
   
   > The extra value to having a hard coded list of url prefixes seems relatively minimal
   
   It isn't just schema FWIW



##########
object_store/src/scheme.rs:
##########
@@ -0,0 +1,130 @@
+// 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 crate::{Error, Result};
+use url::Url;
+
+/// Recognises various URL formats, identifying the relevant [`ObjectStore`](crate::ObjectStore)
+///
+/// This can be combined with the [with_url](crate::aws::AmazonS3Builder::with_url) methods
+/// on the corresponding builder to construct the relevant type of store
+#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
+pub enum ObjectStoreScheme {

Review Comment:
   >  the API here makes a lot of sense
   
   This API is just a trait? It doesn't contain any parsing logic, nor any logic to interpret schemes directly
   
   > The extra value to having a hard coded list of url prefixes seems relatively minimal
   
   It isn't just schemes FWIW



-- 
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


[GitHub] [arrow-rs] tustvold commented on a diff in pull request #4184: Add ObjectStoreScheme (#4047)

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4184:
URL: https://github.com/apache/arrow-rs/pull/4184#discussion_r1188867550


##########
object_store/src/scheme.rs:
##########
@@ -0,0 +1,130 @@
+// 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 crate::{Error, Result};
+use url::Url;
+
+/// Recognises various URL formats, identifying the relevant [`ObjectStore`](crate::ObjectStore)
+///
+/// This can be combined with the [with_url](crate::aws::AmazonS3Builder::with_url) methods
+/// on the corresponding builder to construct the relevant type of store
+#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
+pub enum ObjectStoreScheme {

Review Comment:
   >  the API here makes a lot of sense
   
   This API is just a trait?



-- 
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