Skip to content

Conversation

DennizSvens
Copy link
Contributor

Related Issues/PRs

Fixes #2380

What changes are proposed in this pull request?

Fixes inconsistent behavior in Azure Search where index creation succeeded with DateType/TimestampType columns but data writing failed due to schema parity check expecting StringType.

Changes:

  • Add automatic date/timestamp to ISO8601 conversion in prepareDF method
  • Handle TimestampType with UTC conversion before formatting
  • Handle DateType as midnight UTC in ISO8601 format
  • Update edmTypeToSparkType mapping: Edm.DateTimeOffsetDateType (was StringType)
  • Add tests for date handling including null values and timezone scenarios

This eliminates the previous two-step workflow where users had to manually convert dates to strings after initial index creation.

How is this patch tested?

  • I have written tests (not required for typo or doc fix) and confirmed the proposed feature/bug-fix/change works.

Tests added:

  • test("Handle date fields correctly") - Basic date/timestamp handling with null values
  • test("Date field conversion handles different timezones correctly") - Timezone conversion scenarios
  • Tests verify both DateType and TimestampType conversion to ISO8601 format
  • Tests confirm Azure Search index maintains correct Edm.DateTimeOffset field types

Does this PR change any dependencies?

  • No. You can skip this section.

Does this PR add a new feature? If so, have you added samples on website?

  • No. You can skip this section.

@DennizSvens DennizSvens requested a review from mhamilton723 as a code owner May 29, 2025 11:13
mhamilton723
mhamilton723 previously approved these changes May 29, 2025
@mhamilton723
Copy link
Collaborator

Nice work!

@mhamilton723
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@codecov-commenter
Copy link

codecov-commenter commented May 29, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 84.58%. Comparing base (5bbbbc7) to head (9ed0bbe).

Files with missing lines Patch % Lines
...azure/synapse/ml/services/search/AzureSearch.scala 80.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2381      +/-   ##
==========================================
+ Coverage   84.57%   84.58%   +0.01%     
==========================================
  Files         331      331              
  Lines       17205    17221      +16     
  Branches     1522     1523       +1     
==========================================
+ Hits        14551    14567      +16     
  Misses       2654     2654              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mhamilton723
Copy link
Collaborator

mhamilton723 commented May 30, 2025

@DennizSvens likewise style issues here and added unit tests tests are failing.

https://microsoft.github.io/SynapseML/docs/Reference/Developer%20Setup/

Will help you set up a local build to make your life easier. You seem like a great dev and we are happy to take whatever fixes you would like to make to this code so long as we can get the builds green!

@mhamilton723
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

mhamilton723
mhamilton723 previously approved these changes Jun 2, 2025
@mhamilton723
Copy link
Collaborator

LGTM and build has passed, please megre your changes and well make sure it stays green @DennizSvens before final merges. Thanks for your work on this!

@mhamilton723
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mhamilton723 mhamilton723 merged commit 04d9dc4 into microsoft:master Jun 4, 2025
63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Azure Search: DateType and TimestampType fields not properly converted to ISO8601 format
3 participants