-
Notifications
You must be signed in to change notification settings - Fork 536
Expand file tree
/
Copy pathPartitionedQueryExecutionInfo.cs
More file actions
76 lines (67 loc) · 2.37 KB
/
PartitionedQueryExecutionInfo.cs
File metadata and controls
76 lines (67 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace Microsoft.Azure.Cosmos.Query.Core.QueryPlan
{
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;
using Constants = Documents.Constants;
internal sealed class PartitionedQueryExecutionInfo
{
public PartitionedQueryExecutionInfo()
{
this.Version = Constants.PartitionedQueryExecutionInfo.CurrentVersion;
}
[JsonPropertyName(Constants.Properties.PartitionedQueryExecutionInfoVersion)]
public int Version
{
get;
private set;
}
[JsonPropertyName(Constants.Properties.QueryInfo)]
public QueryInfo QueryInfo
{
get;
set;
}
[JsonPropertyName(Constants.Properties.QueryRanges)]
public List<Documents.Routing.Range<string>> QueryRanges
{
get;
set;
}
// Change to the below after Direct package upgrade
// [JsonProperty(Constants.Properties.HybridSearchQueryInfo)]
[JsonPropertyName("hybridSearchQueryInfo")]
public HybridSearchQueryInfo HybridSearchQueryInfo
{
get;
set;
}
public override string ToString()
{
return System.Text.Json.JsonSerializer.Serialize(this, CosmosSerializerContext.Default.PartitionedQueryExecutionInfo);
}
public static bool TryParse(string serializedQueryPlan, out PartitionedQueryExecutionInfo partitionedQueryExecutionInfo)
{
if (serializedQueryPlan == null)
{
throw new ArgumentNullException(nameof(serializedQueryPlan));
}
try
{
partitionedQueryExecutionInfo = JsonSerializer.Deserialize(
serializedQueryPlan,
CosmosSerializerContext.Default.PartitionedQueryExecutionInfo);
return true;
}
catch (JsonException)
{
partitionedQueryExecutionInfo = default;
return false;
}
}
}
}