Skip to content

Commit

Permalink
Auto-sync from Azure-Kusto-Service
Browse files Browse the repository at this point in the history
  • Loading branch information
Kusto Build System committed Jun 17, 2024
1 parent 92f459e commit 7e06362
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Kusto.Language/Functions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,13 @@ public partial class Functions
new Parameter("ip", ParameterTypeKind.StringOrDynamic),
new Parameter("ranges", ParameterTypeKind.DynamicArray)))
.WithResultNameKind(ResultNameKind.None);

public static readonly FunctionSymbol Ipv6LookupRanges =
new FunctionSymbol("__ipv6_lookup_ranges",
new Signature(ScalarTypes.DynamicArray,
new Parameter("ip", ParameterTypeKind.StringOrDynamic),
new Parameter("ranges", ParameterTypeKind.DynamicArray)))
.WithResultNameKind(ResultNameKind.None).Hide();
#endregion

private static readonly TypeSymbol ParsePathResult =
Expand Down Expand Up @@ -4008,6 +4015,7 @@ private static TypeSymbol SeriesDecomposeAnomaliesResult(CustomReturnTypeContext
Ipv4IsInRange,
Ipv4IsInAnyRange,
Ipv4NetmaskSuffix,
Ipv6LookupRanges,
#endregion

#region formatting functions
Expand Down
34 changes: 34 additions & 0 deletions src/Kusto.Language/PlugIns.cs
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,39 @@ public static class PlugIns
}
}));

private static readonly Parameter Ipv6_lookup_LookupTable = new Parameter("LookupTable", ParameterTypeKind.Tabular);
private static readonly Parameter Ipv6_lookup_SourceIPv6Key = new Parameter("SourceIPv6Key", ParameterTypeKind.Scalar, ArgumentKind.Column);
private static readonly Parameter Ipv6_lookup_IPv6LookupKey = new Parameter("IPv6LookupKey", ParameterTypeKind.Scalar, ArgumentKind.Column_Parameter0);

public static readonly FunctionSymbol Ipv6_Lookup =
new FunctionSymbol("ipv6_lookup",
new Signature(
context => {
var lookupTable = context.GetArgument(Ipv6_lookup_LookupTable.Name)?.ResultType as TableSymbol;
if (lookupTable != null)
{
var cols = new List<ColumnSymbol>();
cols.AddRange(context.RowScope.Columns);
var combinedColumns = ColumnSymbol.Combine(CombineKind.UniqueNames, cols);
return new TableSymbol(combinedColumns);
}
else
{
// lookup table unknown, so default to input table
return context.RowScope;
}
},
Tabularity.Tabular,
Ipv6_lookup_LookupTable,
Ipv6_lookup_SourceIPv6Key,
Ipv6_lookup_IPv6LookupKey)
.WithLayout((signature, args, parameters) =>
{
parameters.Add(Ipv6_lookup_LookupTable);
parameters.Add(Ipv4_lookup_SourceIPv4Key);
parameters.Add(Ipv6_lookup_IPv6LookupKey);
})).Hide();

public static readonly FunctionSymbol SchemaMerge =
new FunctionSymbol("schema_merge",
new TableSymbol(new[] {
Expand Down Expand Up @@ -754,6 +787,7 @@ private static TableSymbol GetOutputSchema(CustomReturnTypeContext context)
InferStorageSchema,
//InferStorageSchemaWithSuggestions,
Ipv4_Lookup,
Ipv6_Lookup,
Narrow,
NewActivityMetrics,
Pivot,
Expand Down

0 comments on commit 7e06362

Please sign in to comment.