-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for partitioning expressions (#127)
- Loading branch information
1 parent
05ba0c4
commit 4a20ebc
Showing
14 changed files
with
165 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Arcane.Framework.Services.Models; | ||
|
||
/// <summary> | ||
/// Used to deserialize the stream metadata from the Kubernetes object definition. | ||
/// </summary> | ||
public class DatePartitionMetadataDefinition : PartitionMetadataDefinition | ||
{ | ||
/// <summary> | ||
/// Expression to compute the partition value for each row - overrides FieldName and FieldFormat | ||
/// Expression will be executed on Source side and thus will depend on backend engine the Source streams from. | ||
/// Common use case for this is SQL-based sources, to generate a partition derived from several columns. | ||
/// </summary> | ||
[JsonPropertyName("fieldExpression")] | ||
public string FieldExpression { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/Sources/SqlServer/SqlSnippets/GetSelectAllQuery_date_partitioned.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
declare @currentVersion bigint = CHANGE_TRACKING_CURRENT_VERSION() | ||
|
||
SELECT | ||
{ChangeTrackingColumnsStatement}, | ||
@currentVersion AS 'ChangeTrackingVersion', | ||
lower(convert(nvarchar(128), HashBytes('SHA2_256', {MERGE_EXPRESSION}),2)) as [{MERGE_KEY}], | ||
{DATE_PARTITION_EXPRESSION} as [{DATE_PARTITION_KEY}] | ||
FROM [{dbName}].[{schema}].[{tableName}] tq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/Sources/SqlServer/SqlSnippets/GetSelectDeltaQuery_date_partitioned.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
declare @currentVersion bigint = CHANGE_TRACKING_CURRENT_VERSION() | ||
|
||
SELECT | ||
{ChangeTrackingColumnsStatement}, | ||
@currentVersion AS 'ChangeTrackingVersion', | ||
lower(convert(nvarchar(128), HashBytes('SHA2_256', {MERGE_EXPRESSION}),2)) as [{MERGE_KEY}], | ||
{DATE_PARTITION_EXPRESSION} as [{DATE_PARTITION_KEY}] | ||
FROM [{dbName}].[{schema}].[{tableName}] tq | ||
RIGHT JOIN (SELECT ct.* FROM CHANGETABLE (CHANGES [{dbName}].[{schema}].[{tableName}], {lastId}) ct ) ct ON {ChangeTrackingMatchStatement} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.