title: Does the Azure Data Explorer optimizer optimize across function calls if your base table is encapsulated in a user defined function?
body: <p>I am optimizing some Kusto code in which the access to base tables is encapsulated in user defined functions, sometimes several layers of function calls. For example, suppose you have a tabular function GetStuff() which in turn invokes a tabular function GetStuff2() which calls the base Kusto table Stuff. 
  My question is: If I write a Kusto query which involves a join with the tabular function GetStuff(), will the Azure Data Explorer optimizer work to optimize the entire call stack that is involved? In other words, will it behave like views in a relational database where it will create and optimize a query plan for the entire query, first decomposing the view definition, or does the optimization only act at the function definition or query level?</p>
  
  <pre><code>.create-or-alter function with (folder = "Stuff", docstring = "Stuff", skipvalidation = "true") GetStuff() {
  
  ABaseTable
  | join GetStuff2()
  | more logic
  …
  }
  
  .create-or-alter function with (folder = "Stuff", docstring = "More Stuff", skipvalidation = "true") GetStuff2() {
  
  AnotherBaseTable
  | join GetStuff 
  | more logic
  …
  }
  </code></pre>
  
  <p>Here is the query:</p>
  
  <pre><code>GetStuff()
  | join YetAnotherBaseTable
  ….
  </code></pre>
  
  <p>This type of query doesn't seem to be optimized.</p>