Skip to content

Commit cddf4af

Browse files
author
Jade Wang
committed
test(csharp): detect STATIC ONLY rejection by message on REST/SEA (null SqlState)
d88ac32 broadened the StaticOnly_DirectSql probe's catch to AdbcException but still keyed only on ex.SqlState. On REST/SEA the DatabricksException is built by StatementExecutionClient with just a message, so SqlState is null and the filter never matched — the E2E Tests (rest) merge-queue job kept failing on StaticOnly_DirectSql_RuntimeAcceptsKeyword with SQLSTATE 42601 in the text. Reuse DatabricksException.IsDescTableExtendedUnsupportedException() (which checks SqlState then the "SQLSTATE: 42601/20000" message) for the REST case, keeping the SqlState check for Thrift's HiveServer2Exception. Probe now skips on pre-PR#198486 runtimes on both protocols. Co-authored-by: Isaac
1 parent 5390595 commit cddf4af

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

csharp/test/E2E/FastMetadataQueryE2ETest.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using System;
1212
using System.Collections.Generic;
1313
using System.Threading.Tasks;
14+
using AdbcDrivers.Databricks;
1415
using AdbcDrivers.HiveServer2;
1516
using Apache.Arrow;
1617
using Apache.Arrow.Adbc;
@@ -161,16 +162,19 @@ public async Task StaticOnly_DirectSql_RuntimeAcceptsKeyword()
161162
{
162163
result = await statement.ExecuteQueryAsync();
163164
}
164-
catch (AdbcException ex) when (ex.SqlState == "42601" || ex.SqlState == "20000")
165+
catch (AdbcException ex) when (
166+
ex.SqlState == "42601" || ex.SqlState == "20000"
167+
|| (ex is DatabricksException dbx && dbx.IsDescTableExtendedUnsupportedException()))
165168
{
166169
// Runtime is pre-rollout: it does not yet support the `AS JSON STATIC ONLY`
167170
// modifier (PR #198486). 42601 is the parse-syntax error; some DBRs return
168171
// 20000 (internal error) instead. Catch the AdbcException base so this covers
169-
// both protocols — Thrift surfaces HiveServer2Exception, REST/SEA surfaces
170-
// DatabricksException, and both carry the SQLSTATE. This mirrors the driver's
171-
// own fallback in DatabricksStatement.GetColumnsExtendedAsync, so skip rather
172-
// than fail the merge queue on warehouses where the feature isn't deployed yet.
173-
Skip.If(true, $"Runtime does not support 'AS JSON STATIC ONLY' (SQLSTATE={ex.SqlState}); pre-PR#198486 DBR.");
172+
// both protocols — Thrift surfaces HiveServer2Exception (SqlState populated),
173+
// while REST/SEA surfaces DatabricksException with a null SqlState (the SQL state
174+
// is only in the message), so reuse IsDescTableExtendedUnsupportedException for
175+
// that case. Mirrors the driver's own fallback, so skip rather than fail the
176+
// merge queue on warehouses where the feature isn't deployed yet.
177+
Skip.If(true, $"Runtime does not support 'AS JSON STATIC ONLY' (SQLSTATE={ex.SqlState ?? "in-message"}); pre-PR#198486 DBR.");
174178
return;
175179
}
176180
Assert.NotNull(result.Stream);

0 commit comments

Comments
 (0)