data_pulse
Contributor

@volodymyr_b 

The SQL Server connector reference confirms that UNIQUEIDENTIFIER is automatically converted to STRING, which makes the ordering behaviour you've identified worth investigating.

I ran a few independent test using SQL Server and Databricks serverless.

Using the boundary 38C5A9C6-D111-4182-8A7F-FFE14F608876, I observed that GUID 38DE50FE-2AC8-46E8-91AB-EAB0A9E944B0 satisfies SQL Server's native UNIQUEIDENTIFIER comparison but is excluded when the same comparison is performed using its string representation.

To cross-check this, I ran the equivalent RPAD(Id, 36, ' ') <= boundary filter in Databricks serverless and observed the same GUID being excluded.

Then further tested with a synthetic dataset of 1,000 deterministic, distinct GUIDs in SQL Server and ran the equivalent filter in Databricks. 

Using the boundary 38C5A9C6-D111-4182-8A7F-FFE14F608876, I observed:

  • SQL Server native UNIQUEIDENTIFIER comparison: 1,000 rows matched
  • SQL Server string comparison: 222 rows matched
  • Databricks Spark RPAD(Id, 36, ' ') <= boundary: 222 rows matched

So, for this dataset and boundary, 778 rows satisfy the native GUID comparison but are excluded by the string comparison.

These confirms the ordering difference across both environments and lends further support to your hypothesis about a potential mismatch in the connector's snapshot partitioning logic. Although this doesn't establish how Lakeflow internally calculates partition boundaries, it demonstrates the impact that inconsistent comparison could have.

Regarding question about overriding the snapshot partitioning column, the query-based connector limitations mention that you can contact your Databricks account team to request a partitioning column override when the automatically selected column is unsuitable.