diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 9871f8b7d29..1447d72a53b 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -51,7 +51,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: "14" - name: Prettier check diff --git a/arrow-schema/src/schema.rs b/arrow-schema/src/schema.rs index 43bbffd0652..b05cfbe3d95 100644 --- a/arrow-schema/src/schema.rs +++ b/arrow-schema/src/schema.rs @@ -57,6 +57,17 @@ impl SchemaBuilder { self.fields.remove(idx) } + /// Get mut FieldRef as index `idx` + /// if index out of bounds, will panic + pub fn field_mut(&mut self, idx: usize) -> &mut FieldRef { + &mut self.fields[idx] + } + + /// Reverse the fileds + pub fn reverse(&mut self) { + self.fields.reverse(); + } + /// Appends a [`FieldRef`] to this [`SchemaBuilder`] checking for collision /// /// If an existing field exists with the same name, calls [`Field::try_merge`] @@ -837,4 +848,34 @@ mod tests { "Could not find expected string '{expected}' in '{res}'" ); } + + #[test] + fn test_schemabuilder_change_field() { + let mut builder = SchemaBuilder::new(); + builder.push(Field::new("a", DataType::Int32, false)); + builder.push(Field::new("b", DataType::Utf8, false)); + *builder.field_mut(1) = Arc::new(Field::new("c", DataType::Int32, false)); + assert_eq!( + builder.fields, + vec![ + Arc::new(Field::new("a", DataType::Int32, false)), + Arc::new(Field::new("c", DataType::Int32, false)) + ] + ); + } + + #[test] + fn test_schemabuilder_reverse() { + let mut builder = SchemaBuilder::new(); + builder.push(Field::new("a", DataType::Int32, false)); + builder.push(Field::new("b", DataType::Utf8, true)); + builder.reverse(); + assert_eq!( + builder.fields, + vec![ + Arc::new(Field::new("b", DataType::Utf8, true)), + Arc::new(Field::new("a", DataType::Int32, false)) + ] + ); + } } diff --git a/object_store/Cargo.toml b/object_store/Cargo.toml index 7928648d170..cb820b509ad 100644 --- a/object_store/Cargo.toml +++ b/object_store/Cargo.toml @@ -46,7 +46,7 @@ walkdir = "2" # Cloud storage support base64 = { version = "0.21", default-features = false, features = ["std"], optional = true } hyper = { version = "0.14", default-features = false, optional = true } -quick-xml = { version = "0.30.0", features = ["serialize", "overlapped-lists"], optional = true } +quick-xml = { version = "0.31.0", features = ["serialize", "overlapped-lists"], optional = true } serde = { version = "1.0", default-features = false, features = ["derive"], optional = true } serde_json = { version = "1.0", default-features = false, optional = true } rand = { version = "0.8", default-features = false, features = ["std", "std_rng"], optional = true } diff --git a/object_store/src/client/mod.rs b/object_store/src/client/mod.rs index 3c968f11be2..77eee7fc92f 100644 --- a/object_store/src/client/mod.rs +++ b/object_store/src/client/mod.rs @@ -193,6 +193,9 @@ impl Default for ClientOptions { // // // Which recommend a connection timeout of 3.1s and a request timeout of 2s + // + // As object store requests may involve the transfer of non-trivial volumes of data + // we opt for a slightly higher default timeout of 30 seconds Self { user_agent: None, content_type_map: Default::default(), @@ -203,7 +206,7 @@ impl Default for ClientOptions { proxy_excludes: None, allow_http: Default::default(), allow_insecure: Default::default(), - timeout: Some(Duration::from_secs(5).into()), + timeout: Some(Duration::from_secs(30).into()), connect_timeout: Some(Duration::from_secs(5).into()), pool_idle_timeout: None, pool_max_idle_per_host: None,