Skip to content

Commit eb9ff8c

Browse files
Copilotrenemadsen
andcommitted
Phase 10 Step 1: Add MariaDB 11.8+ spatial JSON support version flag
Added SpatialJsonSupport version flag to enable spatial type JSON handling for MariaDB 11.8+: 1. Added SpatialJsonSupport property to ServerVersionSupport base class (defaults to false) 2. Implemented SpatialJsonSupport in MariaDbServerVersionSupport: - Returns true for MariaDB 11.8.0+ - Returns false for older versions and MySQL 3. Updated JsonTypesRelationalMySqlTest skip conditions: - Changed from unconditional Skip to SupportedServerVersionLessThanCondition - Spatial tests now run on MariaDB 11.8+ and all MySQL versions - Spatial tests skip on MariaDB < 11.8 This follows the progressive implementation pattern - we now have version-aware skipping that will allow spatial JSON tests to run on MariaDB 11.8+. The next steps will involve testing and implementing any necessary fixes for MariaDB's spatial JSON handling. Test behavior after this change: - MySQL 8.0.40+: Spatial JSON tests run (as before) - MariaDB 11.8+: Spatial JSON tests will now run (previously skipped) - MariaDB 10.6-11.7: Spatial JSON tests skip (no spatial JSON support) - MariaDB < 10.6: All JSON tests skip (no JSON_TABLE support) Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
1 parent b04c796 commit eb9ff8c

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

src/EFCore.MySql/Infrastructure/MariaDbServerVersion.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ internal MariaDbServerVersionSupport([NotNull] ServerVersion serverVersion)
105105
public override bool JsonTableImplementationStable => ServerVersion.Version >= new Version(10, 6, 0); // MariaDB 10.6+ has stable JSON_TABLE support
106106
public override bool JsonTableImplementationWithoutMariaDbBugs => ServerVersion.Version >= new Version(10, 6, 0);
107107
public override bool JsonTableImplementationWithAggregate => false; // All kinds of wrong results because of the missing LATERAL support, but without any error thrown by MariaDb. It usually just uses the first values of the first row of the outer table.
108+
public override bool SpatialJsonSupport => ServerVersion.Version >= new Version(11, 8, 0); // MariaDB 11.8+ has improved spatial type JSON handling
108109
}
109110
}
110111
}

src/EFCore.MySql/Infrastructure/ServerVersionSupport.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,6 @@ public virtual bool PropertyOrVersion(string propertyNameOrServerVersion)
104104
public virtual bool JsonTableImplementationWithoutMariaDbBugs => JsonTable;
105105
public virtual bool JsonTableImplementationUsingParameterAsSourceWithoutEngineCrash => JsonTable;
106106
public virtual bool JsonTableImplementationWithAggregate => JsonTable;
107+
public virtual bool SpatialJsonSupport => false; // MariaDB 11.8+ spatial JSON support
107108
}
108109
}

test/EFCore.MySql.FunctionalTests/Query/JsonTypesRelationalMySqlTest.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@ public JsonTypesRelationalMySqlTest(NonSharedFixture fixture, ITestOutputHelper
2020
//TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper);
2121
}
2222

23-
// Skip spatial type tests - MariaDB 10.6+ has different spatial JSON handling
24-
[ConditionalFact(Skip = "MariaDB 10.6+ has different spatial type JSON handling (NullReferenceException)")]
23+
// Skip spatial type tests for MariaDB < 11.8 (different spatial JSON handling)
24+
[SupportedServerVersionLessThanCondition(nameof(ServerVersionSupport.SpatialJsonSupport))]
2525
public override Task Can_read_write_line_string()
26-
=> Task.CompletedTask;
26+
=> base.Can_read_write_line_string();
2727

28-
[ConditionalFact(Skip = "MariaDB 10.6+ has different spatial type JSON handling (NullReferenceException)")]
28+
[SupportedServerVersionLessThanCondition(nameof(ServerVersionSupport.SpatialJsonSupport))]
2929
public override Task Can_read_write_point()
30-
=> Task.CompletedTask;
30+
=> base.Can_read_write_point();
3131

32-
[ConditionalFact(Skip = "MariaDB 10.6+ has different spatial type JSON handling (NullReferenceException)")]
32+
[SupportedServerVersionLessThanCondition(nameof(ServerVersionSupport.SpatialJsonSupport))]
3333
public override Task Can_read_write_polygon()
34-
=> Task.CompletedTask;
34+
=> base.Can_read_write_polygon();
3535

36-
[ConditionalFact(Skip = "MariaDB 10.6+ has different spatial type JSON handling (NullReferenceException)")]
36+
[SupportedServerVersionLessThanCondition(nameof(ServerVersionSupport.SpatialJsonSupport))]
3737
public override Task Can_read_write_multi_line_string()
38-
=> Task.CompletedTask;
38+
=> base.Can_read_write_multi_line_string();
3939

4040
// Skip ulong enum test - MariaDB serializes UInt64 Max differently
4141
[ConditionalFact(Skip = "MariaDB 10.6+ serializes UInt64.MaxValue as full number instead of -1")]

0 commit comments

Comments
 (0)