-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #100 from NeilMacMullen/moreFuncs
Add isFinite etc
- Loading branch information
Showing
10 changed files
with
149 additions
and
6 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
28 changes: 28 additions & 0 deletions
28
libraries/KustoLoco.Core/Evaluation/BuiltIns/ScalarFunctions/IsAsciiFunction.cs
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.Linq; | ||
using System.Text; | ||
using System.Text.Unicode; | ||
|
||
namespace KustoLoco.Core.Evaluation.BuiltIns.Impl; | ||
// ReSharper disable PartialTypeWithSinglePart | ||
[KustoImplementation(Keyword = "Functions.IsAscii")] | ||
internal partial class IsAsciiFunction | ||
{ | ||
internal static bool Impl(string s) => Ascii.IsValid(s); | ||
} | ||
|
||
|
||
// ReSharper disable PartialTypeWithSinglePart | ||
[KustoImplementation(Keyword = "Functions.Reverse")] | ||
internal partial class ReverseFunction | ||
{ | ||
internal static string Impl(string s) => new string(s.Reverse().ToArray()); | ||
} | ||
|
||
[KustoImplementation(Keyword = "Functions.IsUtf8")] | ||
internal partial class IsUtf8Function | ||
{ | ||
//it'a a little unclear how this could ever return false. | ||
//In theory we can have some bytes that are not valid utf8, | ||
//but how would the get turned into a string in the tables? | ||
internal static bool Impl(string s) => true; | ||
} |
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
libraries/KustoLoco.Core/Evaluation/BuiltIns/ScalarFunctions/IsFiniteFunction.cs
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 @@ | ||
namespace KustoLoco.Core.Evaluation.BuiltIns.Impl; | ||
|
||
[KustoImplementation(Keyword = "Functions.IsFinite")] | ||
internal partial class IsFiniteFunction | ||
{ | ||
internal static bool Impl(double v) => | ||
double.IsFinite(v); | ||
} |
17 changes: 17 additions & 0 deletions
17
libraries/KustoLoco.Core/Evaluation/BuiltIns/ScalarFunctions/IsInfFunction.cs
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 @@ | ||
namespace KustoLoco.Core.Evaluation.BuiltIns.Impl; | ||
|
||
[KustoImplementation(Keyword = "Functions.IsInf")] | ||
internal partial class IsInfFunction | ||
{ | ||
internal static bool Impl(double v) => | ||
double.IsInfinity(v); | ||
} | ||
|
||
[KustoImplementation(Keyword = "Functions.IsNan")] | ||
internal partial class IsNanFunction | ||
{ | ||
internal static bool Impl(double v) => | ||
double.IsNaN(v); | ||
} | ||
|
||
|
8 changes: 8 additions & 0 deletions
8
libraries/KustoLoco.Core/Evaluation/BuiltIns/ScalarFunctions/IsNotEmptyFunction.cs
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 @@ | ||
namespace KustoLoco.Core.Evaluation.BuiltIns.Impl; | ||
|
||
// ReSharper disable PartialTypeWithSinglePart | ||
[KustoImplementation(Keyword = "Functions.IsNotEmpty")] | ||
internal partial class IsNotEmptyFunction | ||
{ | ||
internal static bool Impl(string s) => s is { Length: > 0 }; | ||
} |
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