Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io.unitycatalog.hadoop.internal.fs.CredScopedFileSystem;
import io.unitycatalog.hadoop.internal.fs.CredScopedFs;
import io.unitycatalog.hadoop.internal.id.CredId;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -175,6 +176,20 @@ protected CredPropsBuilder saveAndOverride(String key, String defaultOriginal, S
return this;
}

/**
* Whether the engine's configuration sets {@code key} itself: a value counts as the engine's own
* unless every recorded source is {@code core-default.xml}, which holds Hadoop's own defaults
* such as S3A's default provider list and Hadoop 3.5's GCS conflict-check default.
*/
protected boolean engineSets(String key) {
if (hadoopConf().get(key) == null) {
return false;
}
// No recorded source means we cannot show the value came from defaults, so respect it.
String[] sources = hadoopConf().getPropertySources(key);
return sources == null || !Arrays.stream(sources).allMatch("core-default.xml"::equals);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[AI Assisted] This branch treats a key with no recorded source as engine-set, so a value Hadoop does not attribute is kept rather than replaced. getPropertySources returns null when Hadoop records no source for the key. A one-line comment saying so would make the choice visible.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added a comment: Hadoop records no source for a key it did not load from a resource, so that counts as set.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[AI Assisted] Nit: no test covers this sources == null branch. A test with a Configuration whose getPropertySources returns null, asserting that the HNS key stays true, would cover it. Optional.

}

protected boolean isCredScopedFsEnabled() {
return credScopedFsEnabled;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,33 @@ final class GcsCredPropsBuilder extends CredPropsBuilder {
private static final String GCS_ACCESS_TOKEN_EXPIRATION_KEY =
"fs.gs.auth.access.token.expiration";
private static final String GCS_CONFLICT_CHECK_KEY = "fs.gs.create.items.conflict.check.enable";
private static final String GCS_HNS_FOLDERS_KEY = "fs.gs.hierarchical.namespace.folders.enable";
private static final String GCS_IMPLICIT_DIR_REPAIR_KEY = "fs.gs.implicit.dir.repair.enable";

GcsCredPropsBuilder(Configuration conf) {
super(conf);
set("fs.gs.impl.disable.cache", "true");
// The upstream GCS connector defaults this to true which causes the connector to
// stat every ancestor directory on file creation. With UC-vended downscoped tokens
// (scoped to a table's path prefix) these ancestor stats return 403. Default to
// false; users with broader credentials can opt back in via Hadoop/Spark config.
set(GCS_CONFLICT_CHECK_KEY, conf.get(GCS_CONFLICT_CHECK_KEY, "false"));
// Each setting makes the GCS connector call Google about more than the table's own path, which
// a UC-vended downscoped token (scoped to a table's path prefix) is not allowed to do, so the
// call fails:
// - the conflict check stats every ancestor folder when a file or folder is created; Hadoop
// 3.5's core-default.xml turns it on;
// - the hierarchical namespace lookup reads the bucket's layout when a folder is deleted or
// renamed, which the parquet commit does; the connector turns it on itself, on every Spark
// version;
// - the implicit directory repair looks up the parent folder after a directory delete, such
// as the partition delete of INSERT OVERWRITE on a parquet table; the connector turns it on
// itself.
// Default all three to false; users with broader credentials can opt back in via Hadoop/Spark
// config.
setOffUnlessEngineSets(GCS_CONFLICT_CHECK_KEY);
setOffUnlessEngineSets(GCS_HNS_FOLDERS_KEY);
setOffUnlessEngineSets(GCS_IMPLICIT_DIR_REPAIR_KEY);
}

/** Sets {@code key} to false unless the engine's configuration sets it. */
private void setOffUnlessEngineSets(String key) {
set(key, engineSets(key) ? hadoopConf().get(key) : "false");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,19 +198,6 @@ private boolean vendedKeysSign(String bucket, AwsCredential aws, int credentialC
&& !engineSets(UCHadoopConfConstants.S3A_CREDENTIALS_PROVIDER);
}

/**
* Whether the engine's configuration sets {@code key} itself: a value only from Hadoop's
* defaults, such as S3A's default provider list, which reads the keys set here, is not the
* engine's own.
*/
private boolean engineSets(String key) {
if (hadoopConf().get(key) == null) {
return false;
}
String[] sources = hadoopConf().getPropertySources(key);
return sources == null || !Arrays.stream(sources).allMatch("core-default.xml"::equals);
}

/**
* @return the S3A provider that reads a fixed key pair, with its session token if it has one
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package io.unitycatalog.hadoop.internal;

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.assertj.core.api.Assertions.assertThat;

import io.unitycatalog.hadoop.UCCredentialHadoopConfs;
import io.unitycatalog.hadoop.internal.auth.GcsCredential;
import io.unitycatalog.hadoop.internal.auth.GenericCredential;
import java.io.ByteArrayInputStream;
import java.util.HashMap;
import java.util.Map;
import org.apache.hadoop.conf.Configuration;
Expand All @@ -13,6 +15,8 @@
class GcsCredPropsTest extends CredPropsBaseTest {

private static final String CONFLICT_CHECK_KEY = "fs.gs.create.items.conflict.check.enable";
private static final String HNS_FOLDERS_KEY = "fs.gs.hierarchical.namespace.folders.enable";
private static final String IMPLICIT_DIR_REPAIR_KEY = "fs.gs.implicit.dir.repair.enable";
private static final String STATIC_EXPIRATION_KEY = "fs.gs.auth.access.token.expiration";
private static final String CUSTOM_IMPL = "com.example.CustomGcsFileSystem";
private static final String GHFS = "com.google.cloud.hadoop.fs.gcs.GoogleHadoopFileSystem";
Expand All @@ -37,7 +41,15 @@ GenericCredential vendedCred(Long expirationMillis, String prefix) {

@Override
Map<String, String> defaultKeys() {
return props(CONFLICT_CHECK_KEY, "false", "fs.gs.impl.disable.cache", "true");
return props(
CONFLICT_CHECK_KEY,
"false",
HNS_FOLDERS_KEY,
"false",
IMPLICIT_DIR_REPAIR_KEY,
"false",
"fs.gs.impl.disable.cache",
"true");
}

/**
Expand Down Expand Up @@ -128,8 +140,114 @@ void conflictCheckRespectsUserOverrideToTrue() throws Exception {
assertThat(props).containsEntry(CONFLICT_CHECK_KEY, "true");
}

/**
* Hadoop 3.5 ships {@code fs.gs.create.items.conflict.check.enable=true} in its built-in {@code
* core-default.xml}. That is not the user's choice, so it must not keep the check on. (Hadoop has
* no default for the other GCS keys; the connector's own {@code true} default for the
* hierarchical namespace key is not in the Hadoop configuration at all.)
*/
@Test
void hadoopBuiltInDefaultDoesNotKeepTheGcsChecksOn() throws Exception {
Configuration conf = new Configuration(false);
String defaults =
"<configuration><property><name>"
+ CONFLICT_CHECK_KEY
+ "</name><value>true</value></property></configuration>";
conf.addResource(new ByteArrayInputStream(defaults.getBytes(UTF_8)), "core-default.xml");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[AI Assisted] This fixture puts fs.gs.hierarchical.namespace.folders.enable at true in core-default.xml, and the assertion below it checks that value. Hadoop 3.5.0's core-default.xml has no HNS key. The true default comes from the connector (gcs/CONFIGURATION.md at v4.0.10). Consider removing that entry from the fixture, or saying in a comment where the true comes from.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

You're right. Hadoop 3.5.0's core-default.xml has the conflict key but no HNS key; the true comes from the connector. The fixture now only has the conflict key, asserts the HNS key is absent from the Hadoop conf, and checks both keys come out false. The test javadoc says where the HNS true comes from.

assertThat(conf.get(CONFLICT_CHECK_KEY)).isEqualTo("true");
assertThat(conf.get(HNS_FOLDERS_KEY)).isNull();

assertThat(tableProps(conf))
.containsEntry(CONFLICT_CHECK_KEY, "false")
.containsEntry(HNS_FOLDERS_KEY, "false")
.containsEntry(IMPLICIT_DIR_REPAIR_KEY, "false");
}

/** Values from {@code core-site.xml}, which loads after the defaults, are the user's own. */
@Test
void coreSiteValuesOnTopOfHadoopDefaultsAreRespected() throws Exception {
Configuration conf = new Configuration(false);
String defaults =
"<configuration><property><name>"
+ CONFLICT_CHECK_KEY
+ "</name><value>true</value></property></configuration>";
String site =
"<configuration>"
+ "<property><name>"
+ CONFLICT_CHECK_KEY
+ "</name><value>true</value></property>"
+ "<property><name>"
+ HNS_FOLDERS_KEY
+ "</name><value>true</value></property>"
+ "<property><name>"
+ IMPLICIT_DIR_REPAIR_KEY
+ "</name><value>true</value></property>"
+ "</configuration>";
conf.addResource(new ByteArrayInputStream(defaults.getBytes(UTF_8)), "core-default.xml");
conf.addResource(new ByteArrayInputStream(site.getBytes(UTF_8)), "core-site.xml");

assertThat(tableProps(conf))
.containsEntry(CONFLICT_CHECK_KEY, "true")
.containsEntry(HNS_FOLDERS_KEY, "true")
.containsEntry(IMPLICIT_DIR_REPAIR_KEY, "true");
}

/** Each key is decided on its own: setting one does not change the other two. */
@Test
void eachKeyIsDecidedIndependently() throws Exception {
Map<String, String> expected =
Map.of(
CONFLICT_CHECK_KEY,
"false",
HNS_FOLDERS_KEY,
"false",
IMPLICIT_DIR_REPAIR_KEY,
"false");
for (String key : expected.keySet()) {
Configuration conf = new Configuration(false);
conf.set(key, "true");

Map<String, String> props = tableProps(conf);

expected.forEach((k, v) -> assertThat(props).containsEntry(k, k.equals(key) ? "true" : v));
}
}

@Test
void userValuesWinOverHadoopDefaults() throws Exception {
Configuration conf = new Configuration(false);
String defaults =
"<configuration><property><name>"
+ CONFLICT_CHECK_KEY
+ "</name><value>true</value></property></configuration>";
conf.addResource(new ByteArrayInputStream(defaults.getBytes(UTF_8)), "core-default.xml");
// A user setting, even one that equals Hadoop's default, is respected.
conf.set(CONFLICT_CHECK_KEY, "true");
conf.set(HNS_FOLDERS_KEY, "true");
conf.set(IMPLICIT_DIR_REPAIR_KEY, "true");

assertThat(tableProps(conf))
.containsEntry(CONFLICT_CHECK_KEY, "true")
.containsEntry(HNS_FOLDERS_KEY, "true")
.containsEntry(IMPLICIT_DIR_REPAIR_KEY, "true");
}

private Map<String, String> tableProps(Configuration conf) throws Exception {
return CredPropsUtil.createTableCredProps(
false,
false,
conf,
scheme(),
null,
CATALOG_URI,
tokenProvider(),
TABLE_ID,
UCCredentialHadoopConfs.TableOperation.READ_WRITE,
Map.of());
}

@Test
void conflictCheckDefaultsFalseAcrossPathAndDeltaCredProps() throws Exception {
void gcsChecksDefaultFalseAcrossPathAndDeltaCredProps() throws Exception {
Map<String, String> pathProps =
CredPropsUtil.createPathCredProps(
false,
Expand All @@ -142,7 +260,10 @@ void conflictCheckDefaultsFalseAcrossPathAndDeltaCredProps() throws Exception {
location(),
UCCredentialHadoopConfs.PathOperation.PATH_READ,
Map.of());
assertThat(pathProps).containsEntry(CONFLICT_CHECK_KEY, "false");
assertThat(pathProps)
.containsEntry(CONFLICT_CHECK_KEY, "false")
.containsEntry(HNS_FOLDERS_KEY, "false")
.containsEntry(IMPLICIT_DIR_REPAIR_KEY, "false");

Map<String, String> deltaProps =
CredPropsUtil.createDeltaTableCredProps(
Expand All @@ -157,6 +278,9 @@ void conflictCheckDefaultsFalseAcrossPathAndDeltaCredProps() throws Exception {
location(),
UCCredentialHadoopConfs.TableOperation.READ_WRITE,
Map.of());
assertThat(deltaProps).containsEntry(CONFLICT_CHECK_KEY, "false");
assertThat(deltaProps)
.containsEntry(CONFLICT_CHECK_KEY, "false")
.containsEntry(HNS_FOLDERS_KEY, "false")
.containsEntry(IMPLICIT_DIR_REPAIR_KEY, "false");
}
}
60 changes: 52 additions & 8 deletions docs/integrations/unity-catalog-spark.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,14 @@ your Spark version, plus the cloud storage module that matches the Hadoop versio

| Spark version | Bundled Hadoop | AWS S3 | Azure ADLSgen2 | Google Cloud Storage |
| --- | --- | --- | --- | --- |
| Apache Spark 4.0.x | 3.4.1 | `org.apache.hadoop:hadoop-aws:3.4.1` | `org.apache.hadoop:hadoop-azure:3.4.1` | `gcs-connector-3.0.2-shaded.jar` |
| Apache Spark 4.1.x | 3.4.2 | `org.apache.hadoop:hadoop-aws:3.4.2` | `org.apache.hadoop:hadoop-azure:3.4.2` | `gcs-connector-3.0.2-shaded.jar` |
| Apache Spark 4.2.x | 3.5.0 | `org.apache.hadoop:hadoop-aws:3.5.0` | `org.apache.hadoop:hadoop-azure:3.5.0` | `org.apache.hadoop:hadoop-gcp:3.5.0` |
| Apache Spark 4.0.x | 3.4.1 | `org.apache.hadoop:hadoop-aws:3.4.1` | `org.apache.hadoop:hadoop-azure:3.4.1` | `gcs-connector-4.0.10-shaded.jar` |
| Apache Spark 4.1.x | 3.4.2 | `org.apache.hadoop:hadoop-aws:3.4.2` | `org.apache.hadoop:hadoop-azure:3.4.2` | `gcs-connector-4.0.10-shaded.jar` |
| Apache Spark 4.2.x | 3.5.0 | `org.apache.hadoop:hadoop-aws:3.5.0` | `org.apache.hadoop:hadoop-azure:3.5.0` | `gcs-connector-4.0.10-shaded.jar` |

`hadoop-azure` requires 3.4.1 or later (see [issue #1175](https://github.com/unitycatalog/unitycatalog/issues/1175)).
Hadoop 3.4 has no GCS module, so Spark 4.0.x and 4.1.x load the Google Cloud Storage connector with `--jars`; Spark 4.2.x
uses Hadoop's own `hadoop-gcp` with `--packages`.
Every Spark version loads Google's Google Cloud Storage connector with `--jars`. Hadoop 3.4 has no GCS module of its own,
and the `hadoop-gcp` module in Hadoop 3.5 (Spark 4.2.x) cannot use the access tokens Unity Catalog vends, so Spark 4.2.x
needs Google's connector too, with the `fs.gs.impl` settings shown below.

=== "AWS S3 (Spark 4.0.x)"

Expand Down Expand Up @@ -393,12 +394,14 @@ uses Hadoop's own `hadoop-gcp` with `--packages`.

bin/spark-sql --name "gcs-uc-test" \
--master "local[*]" \
--jars "https://repo1.maven.org/maven2/com/google/cloud/bigdataoss/gcs-connector/3.0.2/gcs-connector-3.0.2-shaded.jar" \
--jars "https://repo1.maven.org/maven2/com/google/cloud/bigdataoss/gcs-connector/4.0.10/gcs-connector-4.0.10-shaded.jar" \
--packages "io.delta:delta-spark_4.0_2.13:4.4.1,io.unitycatalog:unitycatalog-spark_4.0_2.13:0.7.0" \
--conf "spark.sql.extensions=io.delta.sql.DeltaSparkSessionExtension" \
--conf "spark.sql.catalog.spark_catalog=org.apache.spark.sql.delta.catalog.DeltaCatalog" \
--conf "spark.hadoop.fs.gs.impl=com.google.cloud.hadoop.fs.gcs.GoogleHadoopFileSystem" \
--conf "spark.hadoop.fs.AbstractFileSystem.gs.impl=com.google.cloud.hadoop.fs.gcs.GoogleHadoopFS" \
--conf "spark.hadoop.fs.gs.hierarchical.namespace.folders.enable=false" \
--conf "spark.hadoop.fs.gs.implicit.dir.repair.enable=false" \
--conf "spark.sql.catalog.$CATALOG_NAME=io.unitycatalog.spark.UCSingleCatalog" \
--conf "spark.sql.catalog.$CATALOG_NAME.uri=$UC_URI" \
--conf "spark.sql.catalog.$CATALOG_NAME.token=$UC_TOKEN" \
Expand All @@ -414,12 +417,14 @@ uses Hadoop's own `hadoop-gcp` with `--packages`.

bin/spark-sql --name "gcs-uc-test" \
--master "local[*]" \
--jars "https://repo1.maven.org/maven2/com/google/cloud/bigdataoss/gcs-connector/3.0.2/gcs-connector-3.0.2-shaded.jar" \
--jars "https://repo1.maven.org/maven2/com/google/cloud/bigdataoss/gcs-connector/4.0.10/gcs-connector-4.0.10-shaded.jar" \
--packages "io.delta:delta-spark_4.1_2.13:4.4.1,io.unitycatalog:unitycatalog-spark_4.1_2.13:0.7.0" \
--conf "spark.sql.extensions=io.delta.sql.DeltaSparkSessionExtension" \
--conf "spark.sql.catalog.spark_catalog=org.apache.spark.sql.delta.catalog.DeltaCatalog" \
--conf "spark.hadoop.fs.gs.impl=com.google.cloud.hadoop.fs.gcs.GoogleHadoopFileSystem" \
--conf "spark.hadoop.fs.AbstractFileSystem.gs.impl=com.google.cloud.hadoop.fs.gcs.GoogleHadoopFS" \
--conf "spark.hadoop.fs.gs.hierarchical.namespace.folders.enable=false" \
--conf "spark.hadoop.fs.gs.implicit.dir.repair.enable=false" \
--conf "spark.sql.catalog.$CATALOG_NAME=io.unitycatalog.spark.UCSingleCatalog" \
--conf "spark.sql.catalog.$CATALOG_NAME.uri=$UC_URI" \
--conf "spark.sql.catalog.$CATALOG_NAME.token=$UC_TOKEN" \
Expand All @@ -435,15 +440,40 @@ uses Hadoop's own `hadoop-gcp` with `--packages`.

bin/spark-sql --name "gcs-uc-test" \
--master "local[*]" \
--packages "org.apache.hadoop:hadoop-gcp:3.5.0,io.delta:delta-spark_4.2_2.13:4.4.1,io.unitycatalog:unitycatalog-spark_4.2_2.13:0.7.0" \
--jars "https://repo1.maven.org/maven2/com/google/cloud/bigdataoss/gcs-connector/4.0.10/gcs-connector-4.0.10-shaded.jar" \
--packages "io.delta:delta-spark_4.2_2.13:4.4.1,io.unitycatalog:unitycatalog-spark_4.2_2.13:0.7.0" \
--conf "spark.sql.extensions=io.delta.sql.DeltaSparkSessionExtension" \
--conf "spark.sql.catalog.spark_catalog=org.apache.spark.sql.delta.catalog.DeltaCatalog" \
--conf "spark.hadoop.fs.gs.impl=com.google.cloud.hadoop.fs.gcs.GoogleHadoopFileSystem" \
--conf "spark.hadoop.fs.AbstractFileSystem.gs.impl=com.google.cloud.hadoop.fs.gcs.GoogleHadoopFS" \
--conf "spark.hadoop.fs.gs.create.items.conflict.check.enable=false" \
--conf "spark.hadoop.fs.gs.hierarchical.namespace.folders.enable=false" \
--conf "spark.hadoop.fs.gs.implicit.dir.repair.enable=false" \
--conf "spark.sql.catalog.$CATALOG_NAME=io.unitycatalog.spark.UCSingleCatalog" \
--conf "spark.sql.catalog.$CATALOG_NAME.uri=$UC_URI" \
--conf "spark.sql.catalog.$CATALOG_NAME.token=$UC_TOKEN" \
--conf "spark.sql.defaultCatalog=$CATALOG_NAME"
```

!!! note "Unity Catalog Spark connector before 0.8.0"
Three settings of Google's connector touch more than the table's own folder, which the folder-scoped tokens Unity
Catalog vends cannot do, so the call fails with `403`:

- `fs.gs.hierarchical.namespace.folders.enable` reads the bucket's layout when a folder is deleted or renamed. The
connector turns it on itself, on every Spark version. Parquet tables fail because their commit deletes folders;
Delta tables do not.
- `fs.gs.create.items.conflict.check.enable` reads every folder above a new file or folder. Hadoop 3.5 (Spark 4.2.x)
turns it on. Creating a table or writing to it fails.
- `fs.gs.implicit.dir.repair.enable` looks up the parent folder after a folder is deleted. The connector turns it on
itself, and it breaks `INSERT OVERWRITE` on parquet tables.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[AI Assisted] Same point as the comment on GcsCredPropsBuilder.java: the failing call is the parent lookup in folder delete, not the placeholder write. Please name that call, cite the INSERT OVERWRITE path, or drop the example.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Same fix as the constructor comment: the note now says the setting looks up the parent folder after a folder is deleted, and the INSERT OVERWRITE example stays since that path fails in my runs.


From 0.8.0 Unity Catalog turns all three off itself, so the `--conf` lines for them in the commands above can be
dropped. If your credentials are broad enough for those calls (for example on a hierarchical-namespace bucket), set
one to `true` in your Spark config and the connector keeps your value. Hadoop 3.5's own `true` for the conflict check
does not count as setting it, so if you relied on that default, set the key to `true` yourself. With the hierarchical namespace setting off,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[AI Assisted] Nit: this line is 144 characters, much longer than the lines around it. Splitting the Hadoop 3.5 caveat and the hierarchical namespace caveat into separate lines would match the note's wrapping.

folder delete and rename on hierarchical-namespace buckets use the connector's non-native path; setting it to `true`
needs credentials that cover the bucket.

## Querying cloud paths with Unity Catalog credentials

Registered catalog tables already receive vended credentials from `UCSingleCatalog.loadTable`. Spark SQL that names a
Expand Down Expand Up @@ -484,6 +514,20 @@ SELECT 1 AS i, 'a' AS s;
If Unity Catalog cannot vend for a path (not managed by UC, or no permission), Spark falls back to ambient Hadoop
credentials already configured on the session.

## Structured Streaming checkpoints

Unity Catalog vends credentials for the table's own folder, and Delta uses them for the data and commits it writes
there. The `checkpointLocation` of a streaming query is different: Spark writes its offsets and commit log there
itself, not through the table, so Unity Catalog vends nothing for it. The Spark session needs its own access to the
checkpoint location, for example a machine identity or an application default login (on GCS, also set
`spark.hadoop.fs.gs.auth.type=APPLICATION_DEFAULT`). With the default renewing credentials, Unity Catalog sets its own
auth type for each table, so that session-wide setting only applies to locations Unity Catalog does not vend for, such
as the checkpoint.

!!! warning
Limit that login to the checkpoint location. If it can also read the table's storage, Spark can bypass the
short-lived credentials Unity Catalog vends for the table.

## Using Spark SQL to query Unity Catalog schemas and tables

Let’s start by running some quick commands from the Spark SQL and pyspark shells.
Expand Down
Loading