Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception thrown when parsing function when using Let and Distinct commands #110

Closed
784651 opened this issue Oct 18, 2022 · 2 comments
Closed

Comments

@784651
Copy link

784651 commented Oct 18, 2022

I have a function that is using logic like this:

.create-or-alter function testfunction() { let temp = random_table_with_timestamp | distinct timestamp=bin(timestamp,1m); temp }

When the application attempts to parse the above command it craps out. Debugging a bit, it appears to be an issue with distinct with a column name assignment and/or the bin() function. Regardless, I can work around this by refactoring my code, but has to download code and test locally before I could figure out what the issue was. If other people try to use this and have similar syntax, it breaks. Yes, there are many ways to re-write this query so that I don't have the assignment or the bin function with distinct.. But if it works in Kusto Explorer and on ADX, I think it should work when being valid when parsing.

Fix is probably going to be an upgrade to the Microsoft.Azure.Kusto.Language package...

Full StackTrace

System.InvalidOperationException
HResult=0x80131509
Message=Function body was expected to be surrounded by curly brace but isn't: { let temp = random_table_with_timestamp | distinct timestamp=bin(timestamp,1m
Source=DeltaKustoLib
StackTrace:
at DeltaKustoLib.CommandModel.CreateFunctionCommand.TrimFunctionSchemaBody(String body) in C:\Users\bob\Source\Repos\delta-kusto\code\DeltaKustoLib\CommandModel\CreateFunctionCommand.cs:line 262
at DeltaKustoLib.CommandModel.CreateFunctionCommand.FromCode(SyntaxElement rootElement) in C:\Users\bob\Source\Repos\delta-kusto\code\DeltaKustoLib\CommandModel\CreateFunctionCommand.cs:line 66
at DeltaKustoLib.CommandModel.CommandBase.CreateCommand(String script, KustoCode code, Boolean ignoreUnknownCommands) in C:\Users\bob\Source\Repos\delta-kusto\code\DeltaKustoLib\CommandModel\CommandBase.cs:line 104
at DeltaKustoLib.CommandModel.CommandBase.ParseAndCreateCommand(String script, Boolean ignoreUnknownCommands) in C:\Users\bob\Source\Repos\delta-kusto\code\DeltaKustoLib\CommandModel\CommandBase.cs:line 65

This exception was originally thrown at this call stack:
DeltaKustoLib.CommandModel.CreateFunctionCommand.TrimFunctionSchemaBody(string) in CreateFunctionCommand.cs
DeltaKustoLib.CommandModel.CreateFunctionCommand.FromCode(Kusto.Language.Syntax.SyntaxElement) in CreateFunctionCommand.cs
DeltaKustoLib.CommandModel.CommandBase.CreateCommand(string, Kusto.Language.KustoCode, bool) in CommandBase.cs
DeltaKustoLib.CommandModel.CommandBase.ParseAndCreateCommand(string, bool) in CommandBase.cs

@vplauzon
Copy link
Contributor

vplauzon commented May 2, 2023

Could you please try again with version 0.13.0.120?

@784651
Copy link
Author

784651 commented May 25, 2023

YEAH!!

@784651 784651 closed this as completed May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants