-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
645f647
commit 91093b8
Showing
9 changed files
with
187 additions
and
5 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
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 |
---|---|---|
|
@@ -18,6 +18,7 @@ public enum Feature | |
WideTypes = 512, | ||
Geo = 1024, | ||
Stats = 2048, | ||
Json = 4096, | ||
|
||
All = ~None, // Special value | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Text.Json; | ||
using ClickHouse.Client.Formats; | ||
|
||
namespace ClickHouse.Client.Types | ||
{ | ||
internal class JsonType : ClickHouseType | ||
{ | ||
public override Type FrameworkType => typeof(string); | ||
|
||
public override object Read(ExtendedBinaryReader reader) => reader.ReadString(); | ||
|
||
public override string ToString() => "Json"; | ||
|
||
public override void Write(ExtendedBinaryWriter writer, object value) | ||
{ | ||
if (value is null) throw new ArgumentNullException(nameof(value)); | ||
switch (value) | ||
{ | ||
case string s: | ||
writer.Write(s); break; | ||
case JsonElement e: | ||
writer.Write(e.ToString()); break; | ||
default: | ||
throw new NotImplementedException($"Cannot convert {value.GetType()} to Json"); | ||
} | ||
} | ||
} | ||
} |
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,28 @@ | ||
using System; | ||
using ClickHouse.Client.Formats; | ||
using ClickHouse.Client.Types.Grammar; | ||
|
||
namespace ClickHouse.Client.Types; | ||
|
||
internal class ObjectType : ParameterizedType | ||
{ | ||
public ClickHouseType UnderlyingType { get; set; } | ||
|
||
public override Type FrameworkType => UnderlyingType.FrameworkType; | ||
|
||
public override string Name => "Object"; | ||
|
||
public override ParameterizedType Parse(SyntaxTreeNode node, Func<SyntaxTreeNode, ClickHouseType> parseClickHouseTypeFunc, TypeSettings settings) | ||
{ | ||
return new SimpleAggregateFunctionType | ||
{ | ||
UnderlyingType = parseClickHouseTypeFunc(node.ChildNodes[0]), | ||
}; | ||
} | ||
|
||
public override object Read(ExtendedBinaryReader reader) => UnderlyingType.Read(reader); | ||
|
||
public override string ToString() => $"{Name}({UnderlyingType})"; | ||
|
||
public override void Write(ExtendedBinaryWriter writer, object value) => UnderlyingType.Write(writer, value); | ||
} |
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