Skip to content
Closed
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
25 changes: 25 additions & 0 deletions csharp/src/Drivers/Databricks/DatabricksConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ internal class DatabricksConnection : SparkHttpConnection
// Identity federation client ID for token exchange
private string? _identityFederationClientId;

// Decimal column scale
private int _decimalColumnScale = 10;

// Default namespace
private TNamespace? _defaultNamespace;

Expand Down Expand Up @@ -386,6 +389,23 @@ private void ValidateProperties()
{
_identityFederationClientId = identityFederationClientId;
}

if (Properties.TryGetValue(DatabricksParameters.DecimalColumnScale, out string? decimalColumnScaleStr))
{
if (int.TryParse(decimalColumnScaleStr, out int decimalColumnScaleValue))
{
if (decimalColumnScaleValue < 0)
{
throw new ArgumentOutOfRangeException(DatabricksParameters.DecimalColumnScale, decimalColumnScaleValue,
"DecimalColumnScale must be positive. Default value is 10.");
}
_decimalColumnScale = decimalColumnScaleValue;
}
else
{
throw new ArgumentException($"Parameter '{DatabricksParameters.DecimalColumnScale}' value '{decimalColumnScaleStr}' could not be parsed. Must be a positive integer.");
}
}
}

/// <summary>
Expand Down Expand Up @@ -448,6 +468,11 @@ protected internal override bool TrySetGetDirectResults(IRequest request)
/// </summary>
public bool RunAsyncInThrift => _runAsyncInThrift;

/// <summary>
/// Gets the decimal column scale value.
/// </summary>
public int DecimalColumnScale => _decimalColumnScale;
Copy link
Contributor

Choose a reason for hiding this comment

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

where will this being used?

Copy link
Contributor Author

@msrathore-db msrathore-db Sep 24, 2025

Choose a reason for hiding this comment

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

As explained in the jira, this param was not actually being used in ODBC and simba JDBC either since thrift already provides a default scale of 0.
I'll run test on different spark versions to see any changes.
Once confirmed for the other DBR versions, I can complete this PR.


/// <summary>
/// Gets a value indicating whether to retry requests that receive a 503 response with a Retry-After header.
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions csharp/src/Drivers/Databricks/DatabricksParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@ public class DatabricksParameters : SparkParameters
/// Default value is false if not specified.
/// </summary>
public const string DriverConfigTakePrecedence = "adbc.databricks.driver_config_take_precedence";

/// <summary>
/// The scale for decimal columns.
/// Default value is 10 if not specified.
/// </summary>
public const string DecimalColumnScale = "adbc.databricks.decimal_column_scale";
}

/// <summary>
Expand Down
Loading