diff --git a/Packages.props b/Packages.props index 3017a44718..f694ebaad7 100644 --- a/Packages.props +++ b/Packages.props @@ -24,8 +24,8 @@ - - + + diff --git a/src/Microsoft.Kusto.ServiceLayer/DataSource/Kusto/KustoIntellisenseClient.cs b/src/Microsoft.Kusto.ServiceLayer/DataSource/Kusto/KustoIntellisenseClient.cs index 4929f308bd..5172b56997 100644 --- a/src/Microsoft.Kusto.ServiceLayer/DataSource/Kusto/KustoIntellisenseClient.cs +++ b/src/Microsoft.Kusto.ServiceLayer/DataSource/Kusto/KustoIntellisenseClient.cs @@ -35,7 +35,7 @@ private GlobalState LoadSchemaState(string databaseName, string clusterName) { IEnumerable tableSchemas = Enumerable.Empty(); IEnumerable functionSchemas = Enumerable.Empty(); - var materializedViewSchemas = new ConcurrentBag(); + var materializedViewSchemasAndQueries = new ConcurrentBag<(ShowMaterializedViewSchemaResult Schema, string Query)>(); if (!string.IsNullOrWhiteSpace(databaseName)) { @@ -62,13 +62,13 @@ private GlobalState LoadSchemaState(string databaseName, string clusterName) if (materializedViewSchema != null) { - materializedViewSchemas.Add(materializedViewSchema); + materializedViewSchemasAndQueries.Add((materializedViewSchema, materializedView.Query)); } }); }); } - return AddOrUpdateDatabase(tableSchemas, functionSchemas, materializedViewSchemas, GlobalState.Default, databaseName, + return AddOrUpdateDatabase(tableSchemas, functionSchemas, materializedViewSchemasAndQueries, GlobalState.Default, databaseName, clusterName); } @@ -76,7 +76,7 @@ private GlobalState LoadSchemaState(string databaseName, string clusterName) /// Loads the schema for the specified database and returns a new with the database added or updated. /// private GlobalState AddOrUpdateDatabase(IEnumerable tableSchemas, - IEnumerable functionSchemas, IEnumerable materializedViewSchemas, + IEnumerable functionSchemas, IEnumerable<(ShowMaterializedViewSchemaResult Schema, string Query)> materializedViewSchemasAndQueries, GlobalState globals, string databaseName, string clusterName) { // try and show error from here. @@ -84,7 +84,7 @@ private GlobalState AddOrUpdateDatabase(IEnumerable ta if (databaseName != null) { - databaseSymbol = LoadDatabase(tableSchemas, functionSchemas, materializedViewSchemas, databaseName); + databaseSymbol = LoadDatabase(tableSchemas, functionSchemas, materializedViewSchemasAndQueries, databaseName); } if (databaseSymbol == null) @@ -96,12 +96,12 @@ private GlobalState AddOrUpdateDatabase(IEnumerable ta if (cluster == null) { cluster = new ClusterSymbol(clusterName, new[] { databaseSymbol }, isOpen: true); - globals = globals.AddOrUpdateCluster(cluster); + globals = globals.AddOrReplaceCluster(cluster); } else { cluster = cluster.AddOrUpdateDatabase(databaseSymbol); - globals = globals.AddOrUpdateCluster(cluster); + globals = globals.AddOrReplaceCluster(cluster); } return globals.WithCluster(cluster).WithDatabase(databaseSymbol); @@ -111,7 +111,7 @@ private GlobalState AddOrUpdateDatabase(IEnumerable ta /// Loads the schema for the specified database into a . /// private DatabaseSymbol LoadDatabase(IEnumerable tableSchemas, - IEnumerable functionSchemas, IEnumerable materializedViewSchemas, + IEnumerable functionSchemas, IEnumerable<(ShowMaterializedViewSchemaResult Schema, string Query)> materializedViewSchemasAndQueries, string databaseName) { if (tableSchemas == null) @@ -141,17 +141,17 @@ private DatabaseSymbol LoadDatabase(IEnumerable tableS } } - if (materializedViewSchemas != null) + if (materializedViewSchemasAndQueries != null) { - foreach (var view in materializedViewSchemas) + foreach ((ShowMaterializedViewSchemaResult schema, string query) in materializedViewSchemasAndQueries) { - var columns = view.Schema.Split(',') + var columns = schema.Schema.Split(',') .Select(col => { var nameType = col.Split(':'); return new ColumnSymbol(nameType[0], ScalarTypes.GetSymbol(nameType[1])); }); - var viewSymbol = new TableSymbol(view.TableName, columns); + var viewSymbol = new MaterializedViewSymbol(schema.TableName, columns, query); members.Add(viewSymbol); } }