Skip to content

Commit b118dca

Browse files
committed
ref
1 parent 8e21c26 commit b118dca

File tree

2 files changed

+8
-40
lines changed

2 files changed

+8
-40
lines changed

crates/core/src/context.rs

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,9 +1286,9 @@ impl PySessionContext {
12861286
/// explicitly. Supported schemes:
12871287
///
12881288
/// * `http` / `https` – registers an [`HttpStore`] for the URL origin.
1289-
/// * `s3` – registers an [`AmazonS3`] store seeded from environment variables.
1290-
/// When `AWS_SKIP_SIGNATURE=true` is set a credential-free builder is used
1291-
/// so that no EC2 IMDS discovery is attempted (public-bucket anonymous access).
1289+
/// * `s3` – registers an anonymous [`AmazonS3`] store (no credentials / signature).
1290+
/// Users requiring authenticated access should pass an explicit store via the
1291+
/// `object_store` parameter instead.
12921292
/// * `gs` / `gcs` – registers a [`GoogleCloudStorage`] store seeded from
12931293
/// environment variables.
12941294
/// * `az` / `abfss` – registers a [`MicrosoftAzure`] store seeded from
@@ -1322,26 +1322,11 @@ impl PySessionContext {
13221322
},
13231323
"s3" => {
13241324
let bucket = url.host_str().unwrap_or_default();
1325-
// When the caller has set AWS_SKIP_SIGNATURE=true (anonymous /
1326-
// public-bucket access) avoid from_env() so that the default
1327-
// credential chain – which includes EC2 IMDS – is never started.
1328-
let skip_signature = std::env::var("AWS_SKIP_SIGNATURE")
1329-
.map(|v| matches!(v.to_lowercase().as_str(), "true" | "1"))
1330-
.unwrap_or(false);
1331-
let builder = if skip_signature {
1332-
let mut b = AmazonS3Builder::new()
1333-
.with_bucket_name(bucket)
1334-
.with_skip_signature(true);
1335-
if let Ok(region) =
1336-
std::env::var("AWS_DEFAULT_REGION").or_else(|_| std::env::var("AWS_REGION"))
1337-
{
1338-
b = b.with_region(region);
1339-
}
1340-
b
1341-
} else {
1342-
AmazonS3Builder::from_env().with_bucket_name(bucket)
1343-
};
1344-
match builder.build() {
1325+
match AmazonS3Builder::new()
1326+
.with_bucket_name(bucket)
1327+
.with_skip_signature(true)
1328+
.build()
1329+
{
13451330
Ok(s) => Arc::new(s),
13461331
Err(_) => return,
13471332
}

python/tests/test_sql.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -186,23 +186,6 @@ def test_read_s3_parquet_explicit(ctx):
186186
assert "description" in df.schema().names
187187

188188

189-
def test_read_s3_parquet_auto(ctx, monkeypatch):
190-
"""Auto-register an S3 object store from the URL scheme using env vars.
191-
192-
With AWS_SKIP_SIGNATURE=true the auto-registration path in
193-
try_register_url_store() picks up anonymous credentials from the environment
194-
and registers the store automatically - no explicit register_object_store()
195-
call required.
196-
"""
197-
monkeypatch.setenv("AWS_SKIP_SIGNATURE", "true")
198-
monkeypatch.setenv("AWS_EC2_METADATA_DISABLED", "true")
199-
monkeypatch.setenv("AWS_REGION", "us-east-2")
200-
url = "s3://coiled-datasets/airbnb-monogo/description-and-ratings.parquet/part.0.parquet"
201-
df = ctx.read_parquet(url)
202-
assert df.count() == 221
203-
assert "description" in df.schema().names
204-
205-
206189
def test_register_parquet(ctx, tmp_path):
207190
path = helpers.write_parquet(tmp_path / "a.parquet", helpers.data())
208191
ctx.register_parquet("t", path)

0 commit comments

Comments
 (0)