skip to Main Content

Need some help with Kusto (Azure Data Explorer).

Is it possible to convert this query into a materialized view?

customobject
| join kind=inner (
    customobject
    | summarize max_dp_adf_copy_start_time = max(dp_adf_copy_start_time) by accountId, id
    )
    on
         $left.accountId == $right.accountId
         and $left.id == $right.id
         and $left.dp_adf_copy_start_time == $right.max_dp_adf_copy_start_time

I have tried this, but it comes back with Syntax Error Expected: ):

.create materialized-view mvw_customobject on table customobject
{
customobject 
| join kind=inner (
    customobject
    | summarize max_dp_adf_copy_start_time = max(dp_adf_copy_start_time) by accountId, id
    )
    on
         $left.accountId == $right.accountId
         and $left.id == $right.id
         and $left.dp_adf_copy_start_time == $right.max_dp_adf_copy_start_time
}

Much help would be appreciated!

Best Regards 🙂

2

Answers


  1. Chosen as BEST ANSWER

    I found the solution. To get the result I was looking for, in Kusto (ADX) I did not need the join:

    .create materialized-view mvw_customobject on table customobject
    {
    customobject
        | summarize arg_max(dp_adf_copy_start_time, *) by accountId, id
    }
    

  2. I have reproduced in my environment and below are my observations and followed Microsoft-Document:

    I have got similar as you have at first:

    enter image description here

    Here, in yours and my query the problem was with summarize statement as summarize statement should come as last statement while creating the view and only one summarize statement should be used. When I made similar changes it got executed like below:

    Example1:

    .create materialized-view mvw_customobject5 on table chotu
    {
        chotu
        | join kind = inner (chotu) on $left.EventId==$right.EventId
        |summarize take_any(*) by EventId
    }
    

    enter image description here

    Example2:

    .create materialized-view mvw_customobject00 on table chotu
    {
        chotu
        | join kind = inner (chotu
        |project EventId) on $left.EventId==$right.EventId
        |summarize take_any(*) by EventId
    }
    

    enter image description here

    You can clearly check the document which I have provided, try to follow the examples and do it, you will get view created as I have got mine.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search