diff --git a/.copilot/README.md b/.copilot/README.md index 6b78fd92..ef3e2ced 100644 --- a/.copilot/README.md +++ b/.copilot/README.md @@ -234,7 +234,7 @@ public class MyLibrary : LibraryBase ### 1. Lexical Analysis ``` -"SELECT Name FROM #mydata.source('param')" → Tokens +"SELECT Name FROM @mydata.source('param')" → Tokens ``` ### 2. Parsing @@ -338,7 +338,7 @@ dotnet test --filter "TestCategory=Integration" // Using test infrastructure pattern var schemaProvider = new BasicSchemaProvider(dataSources); var compiledQuery = InstanceCreator.CompileForExecution( - "SELECT Name, Value FROM #schema.table('param')", + "SELECT Name, Value FROM @schema.table('param')", Guid.NewGuid().ToString(), schemaProvider, loggerResolver); @@ -351,8 +351,8 @@ var results = compiledQuery.Run(); ```csharp var query = @" SELECT a.Name, b.Value - FROM #source1.data() a - INNER JOIN #source2.data() b ON a.Id = b.Id + FROM @source1.data() a + INNER JOIN @source2.data() b ON a.Id = b.Id WHERE a.CreatedAt > '2023-01-01' ORDER BY a.Name"; @@ -382,7 +382,7 @@ public class MyFeatureTests : BasicEntityTestBase public void Should_Parse_Complex_Query() { // Arrange - var query = "SELECT Name FROM #test.data()"; + var query = "SELECT Name FROM @test.data()"; // Act var buildItems = CreateBuildItems(query); @@ -410,7 +410,7 @@ public void Should_Execute_Query_With_Results() }; // Act - var vm = CreateAndRunVirtualMachine("SELECT Name FROM #basic.entities()", data); + var vm = CreateAndRunVirtualMachine("SELECT Name FROM @basic.entities()", data); var table = vm.Run(); // Assert diff --git a/.copilot/api-usage-examples.md b/.copilot/api-usage-examples.md index 2c6b782e..31b22901 100644 --- a/.copilot/api-usage-examples.md +++ b/.copilot/api-usage-examples.md @@ -16,7 +16,7 @@ using Musoq.Evaluator; using Musoq.Schema; // Basic query compilation and execution -var query = "SELECT Name, Count(*) FROM #schema.source() GROUP BY Name"; +var query = "SELECT Name, Count(*) FROM @schema.source() GROUP BY Name"; var schemaProvider = new MySchemaProvider(); var loggerResolver = new LoggerResolver(); @@ -349,7 +349,7 @@ public class ParameterizedQueryExample // Use parameters to prevent injection and improve reusability var query = @" SELECT Name, CreatedAt, Status - FROM #system.events() + FROM @system.events() WHERE Name LIKE @userPattern AND CreatedAt BETWEEN @fromDate AND @toDate ORDER BY CreatedAt DESC"; @@ -418,9 +418,9 @@ var results = engine.ExecuteQuery(@" c.CustomerName, p.ProductName, o.Quantity * p.Price as TotalValue - FROM #sales.orders() o - INNER JOIN #users.customers() c ON o.CustomerId = c.Id - INNER JOIN #inventory.products() p ON o.ProductId = p.Id + FROM @sales.orders() o + INNER JOIN @users.customers() c ON o.CustomerId = c.Id + INNER JOIN @inventory.products() p ON o.ProductId = p.Id WHERE o.OrderDate >= '2023-01-01' ORDER BY TotalValue DESC"); ``` @@ -456,7 +456,7 @@ public class StreamingQueryProcessor var processor = new StreamingQueryProcessor(); await foreach (var row in processor.ExecuteStreamingQuery( - "SELECT * FROM #large.dataset() WHERE Status = 'Active'", + "SELECT * FROM @large.dataset() WHERE Status = 'Active'", schemaProvider, cancellationToken)) { @@ -670,7 +670,7 @@ public class ApiUsageTests var query = @" SELECT Department, COUNT(*) as EmployeeCount, AVG(Age) as AverageAge - FROM #test.table('employees') + FROM @test.table('employees') GROUP BY Department ORDER BY EmployeeCount DESC"; diff --git a/.copilot/development-debugging-guide.md b/.copilot/development-debugging-guide.md index d05ef80f..5fdff198 100644 --- a/.copilot/development-debugging-guide.md +++ b/.copilot/development-debugging-guide.md @@ -139,7 +139,7 @@ dotnet run --project Musoq.Benchmarks --configuration Release // Debug parser output public void DebugParseTree() { - var lexer = new Lexer("SELECT Name FROM #test.data()"); + var lexer = new Lexer("SELECT Name FROM @test.data()"); var parser = new Parser(lexer); var rootNode = parser.ComposeAll(); @@ -165,7 +165,7 @@ private void PrintAST(Node node, int depth) // Inspect generated C# code public void DebugCodeGeneration() { - var query = "SELECT Name, Count(*) FROM #test.data() GROUP BY Name"; + var query = "SELECT Name, Count(*) FROM @test.data() GROUP BY Name"; var buildItems = InstanceCreator.CreateForAnalyze( query, Guid.NewGuid().ToString(), @@ -248,7 +248,7 @@ public class CustomParserTests public void Should_Parse_New_Syntax() { // Arrange - var query = "SELECT * FROM #new.syntax('param') WITH OPTIONS"; + var query = "SELECT * FROM @new.syntax('param') WITH OPTIONS"; var lexer = new Lexer(query); var parser = new Parser(lexer); @@ -300,7 +300,7 @@ public class FullQueryIntegrationTests : BasicEntityTestBase var query = @" WITH processed AS ( SELECT Name, ProcessText(Description) as CleanText - FROM #test.data() + FROM @test.data() ) SELECT Name, Count(*) as WordCount FROM processed diff --git a/.copilot/plugin-development-guide.md b/.copilot/plugin-development-guide.md index 6b501dbc..db0b6c02 100644 --- a/.copilot/plugin-development-guide.md +++ b/.copilot/plugin-development-guide.md @@ -558,7 +558,7 @@ public class FileSystemSchemaIntegrationTests : BasicEntityTestBase { // Arrange var schemaProvider = new CustomSchemaProvider(); - var query = "SELECT Name, Size FROM #fs.files('.', false) WHERE Extension = '.txt'"; + var query = "SELECT Name, Size FROM @fs.files('.', false) WHERE Extension = '.txt'"; // Act var compiledQuery = CreateAndRunVirtualMachine(query, schemaProvider: schemaProvider); diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index f786f238..b19ef1ea 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -109,7 +109,7 @@ Each module has corresponding test projects (*.Tests) with comprehensive coverag - **Common usage pattern**: ```csharp var compiledQuery = InstanceCreator.CompileForExecution( - "SELECT Name, Count(*) FROM #test.data() GROUP BY Name", + "SELECT Name, Count(*) FROM @test.data() GROUP BY Name", Guid.NewGuid().ToString(), schemaProvider, loggerResolver); diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index aed49175..c2daf98e 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -261,7 +261,7 @@ Query Engine ←→ Schema Interface ←→ Data Source Plugin ←→ External D ### 1. **Library Integration** ```csharp // Direct API usage -var query = "SELECT * FROM #os.files('/path') WHERE Extension = '.txt'"; +var query = "SELECT * FROM @os.files('/path') WHERE Extension = '.txt'"; var compiledQuery = MusoqQueryCompiler.Compile(query); var results = compiledQuery.Run(); ``` @@ -269,7 +269,7 @@ var results = compiledQuery.Run(); ### 2. **CLI Integration** ```bash # Command-line usage -musoq "SELECT COUNT(*) FROM #git.commits('/repo')" +musoq "SELECT COUNT(*) FROM @git.commits('/repo')" ``` ### 3. **Plugin Development** diff --git a/Musoq.Benchmarks/Components/ExecutionBenchmark.cs b/Musoq.Benchmarks/Components/ExecutionBenchmark.cs index ab043989..241d2db5 100644 --- a/Musoq.Benchmarks/Components/ExecutionBenchmark.cs +++ b/Musoq.Benchmarks/Components/ExecutionBenchmark.cs @@ -53,12 +53,12 @@ public void Cleanup() private CompiledQuery CreateCompiledQueryWithOptions(CompilationOptions compilationOptions) { - var script = "select City, Country, Population from #A.Entities() where Population > 500000"; + var script = "select City, Country, Population from @A.Entities() where Population > 500000"; var contentPath = Path.Combine(AppContext.BaseDirectory, "Data", "countries.json"); var data = DataHelpers.ParseCountryData(contentPath); var sources = new Dictionary> { - {"#A", data} + {"@A", data} }; return CreateForCountryWithOptions(script, sources, compilationOptions); @@ -66,12 +66,12 @@ private CompiledQuery CreateCompiledQueryWithOptions(CompilationOptions compilat private CompiledQuery ComputeProfilesWithOptions(CompilationOptions compilationOptions) { - const string script = "select FirstName, LastName, Email, Gender, IpAddress, Date, Image, Animal, Avatar from #A.Entities() where Email like '%.co.uk'"; + const string script = "select FirstName, LastName, Email, Gender, IpAddress, Date, Image, Animal, Avatar from @A.Entities() where Email like '%.co.uk'"; var contentPath = Path.Combine(AppContext.BaseDirectory, "Data", "profiles.csv"); var data = DataHelpers.ReadProfiles(contentPath); var sources = new Dictionary> { - {"#A", data} + {"@A", data} }; return CreateForProfilesWithOptions(script, sources, compilationOptions); diff --git a/Musoq.Converter.Tests/BuildTests.cs b/Musoq.Converter.Tests/BuildTests.cs index 11d53f01..97b06c39 100644 --- a/Musoq.Converter.Tests/BuildTests.cs +++ b/Musoq.Converter.Tests/BuildTests.cs @@ -13,7 +13,7 @@ public class BuildTests [TestMethod] public void CompileForStoreTest() { - var query = "select 1 from #system.dual()"; + var query = "select 1 from @system.dual()"; var (dllFile, pdbFile) = CreateForStore(query); @@ -27,7 +27,7 @@ public void CompileForStoreTest() [TestMethod] public async Task CompileForStoreAsyncTest() { - var query = "select 1 from #system.dual()"; + var query = "select 1 from @system.dual()"; var arrays = await InstanceCreator.CompileForStoreAsync(query, Guid.NewGuid().ToString(), new SystemSchemaProvider(), new TestsLoggerResolver()); diff --git a/Musoq.Evaluator.Tests/AliasGeneratorQueryTests.cs b/Musoq.Evaluator.Tests/AliasGeneratorQueryTests.cs index 3c703766..39dbe9a8 100644 --- a/Musoq.Evaluator.Tests/AliasGeneratorQueryTests.cs +++ b/Musoq.Evaluator.Tests/AliasGeneratorQueryTests.cs @@ -10,7 +10,7 @@ public class AliasGeneratorQueryTests : BasicEntityTestBase [TestMethod] public void WhenBuildMultipleTimes_AliasesShouldStayTheSame() { - const string query = "select 1 from #A.entities()"; + const string query = "select 1 from @A.entities()"; var firstBuild = CreateBuildItems(query); var secondBuild = CreateBuildItems(query); diff --git a/Musoq.Evaluator.Tests/AliasTests.cs b/Musoq.Evaluator.Tests/AliasTests.cs index 01bb682f..fc992a1c 100644 --- a/Musoq.Evaluator.Tests/AliasTests.cs +++ b/Musoq.Evaluator.Tests/AliasTests.cs @@ -12,7 +12,7 @@ public class AliasTests : MultiSchemaTestBase public void WhenUniqueColumnAcrossJoinedDataSetOccurred_ShouldNotNeedToUseAlias() { //ZeroItem doesn't need an alias as it is unique column within those two data sources - const string query = "select ZeroItem from #schema.first() first inner join #schema.second() second on 1 = 1"; + const string query = "select ZeroItem from @schema.first() first inner join @schema.second() second on 1 = 1"; var vm = CreateAndRunVirtualMachine(query, [ new() @@ -30,7 +30,7 @@ public void WhenUniqueColumnAcrossJoinedDataSetOccurred_ShouldNotNeedToUseAlias( [TestMethod] public void WhenNonExistingAliasUsed_ShouldThrow() { - const string query = "select b.ZeroItem from #schema.first() a"; + const string query = "select b.ZeroItem from @schema.first() a"; Assert.ThrowsException(() => CreateAndRunVirtualMachine(query, [ new() @@ -43,7 +43,7 @@ public void WhenNonExistingAliasUsed_ShouldThrow() public void WhenAmbiguousColumnAcrossJoinedDataSetOccurred_ShouldNeedToUseAlias() { //FirstItem needs an alias as it is ambiguous column within those two data sources - const string query = "select first.FirstItem, second.FirstItem from #schema.first() first inner join #schema.second() second on 1 = 1"; + const string query = "select first.FirstItem, second.FirstItem from @schema.first() first inner join @schema.second() second on 1 = 1"; var vm = CreateAndRunVirtualMachine(query, [ new() @@ -68,8 +68,8 @@ with p as ( select first.FirstItem, second.FirstItem - from #schema.first() first - inner join #schema.second() second on 1 = 1 + from @schema.first() first + inner join @schema.second() second on 1 = 1 ) select [first.FirstItem], [second.FirstItem] from p"; @@ -97,8 +97,8 @@ with p as ( first.FirstItem, second.FirstItem } - from #schema.first() first - inner join #schema.second() second on 1 = 1 + from @schema.first() first + inner join @schema.second() second on 1 = 1 ) select p.[first.FirstItem], p.[second.FirstItem] from p"; @@ -125,8 +125,8 @@ with p as ( select first.FirstItem, second.FirstItem - from #schema.first() first - inner join #schema.second() second on 1 = 1 + from @schema.first() first + inner join @schema.second() second on 1 = 1 ), q as ( select p.[first.FirstItem] as FirstItem, p.[second.FirstItem] as SecondItem from p ) @@ -156,8 +156,8 @@ with p as ( first.FirstItem, second.FirstItem } - from #schema.first() first - inner join #schema.second() second on 1 = 1 + from @schema.first() first + inner join @schema.second() second on 1 = 1 ), q as ( select p.[first.FirstItem], p.[second.FirstItem] from p ) @@ -184,12 +184,12 @@ public void WhenAliasUsedWithinCte_AndSameUsedWithinOuterQuery_AliasesShouldNotC with p as ( select 1 - from #schema.first() first + from @schema.first() first cross apply first.Split('') b ) select 1 -from p inner join #schema.first() first on 1 = 1 +from p inner join @schema.first() first on 1 = 1 cross apply first.Split('') b"; var vm = CreateAndRunVirtualMachine(query, [ @@ -208,7 +208,7 @@ cross apply first.Split('') b [TestMethod] public void WhenSameAliasUsedInFromAndJoin_ShouldThrow() { - const string query = "select a.FirstItem from #schema.first() a inner join #schema.second() a on a.FirstItem = a.FirstItem"; + const string query = "select a.FirstItem from @schema.first() a inner join @schema.second() a on a.FirstItem = a.FirstItem"; Assert.ThrowsException(() => CreateAndRunVirtualMachine(query, [ new(), @@ -224,9 +224,9 @@ public void WhenSameAliasUsedInMultipleJoins_ShouldThrow() { const string query = @" select src.FirstItem - from #schema.first() src - inner join #schema.second() b on src.FirstItem = b.FirstItem - inner join #schema.third() b on b.FirstItem = src.FirstItem"; + from @schema.first() src + inner join @schema.second() b on src.FirstItem = b.FirstItem + inner join @schema.third() b on b.FirstItem = src.FirstItem"; Assert.ThrowsException(() => CreateAndRunVirtualMachine(query, [ new(), @@ -244,10 +244,10 @@ public void WhenSameAliasUsedInCTEAndMainQuery_ShouldThrow() { const string query = @" with src as ( - select FirstItem from #schema.first() + select FirstItem from @schema.first() ) select src.FirstItem - from #schema.second() src + from @schema.second() src inner join src on src.FirstItem = src.FirstItem"; Assert.ThrowsException(() => CreateAndRunVirtualMachine(query, [ @@ -264,8 +264,8 @@ public void WhenSameAliasUsedInCrossApply_ShouldThrow() { const string query = @" select a.FirstItem - from #schema.first() a - cross apply #schema.second() a"; + from @schema.first() a + cross apply @schema.second() a"; Assert.ThrowsException(() => CreateAndRunVirtualMachine(query, [ new(), @@ -281,8 +281,8 @@ public void WhenSameAliasUsedInOuterApply_ShouldThrow() { const string query = @" select a.FirstItem - from #schema.first() a - outer apply #schema.second() a"; + from @schema.first() a + outer apply @schema.second() a"; Assert.ThrowsException(() => CreateAndRunVirtualMachine(query, [ new(), diff --git a/Musoq.Evaluator.Tests/ArrayAccessEdgeCaseTests.cs b/Musoq.Evaluator.Tests/ArrayAccessEdgeCaseTests.cs index b8eb8e07..0b5786c8 100644 --- a/Musoq.Evaluator.Tests/ArrayAccessEdgeCaseTests.cs +++ b/Musoq.Evaluator.Tests/ArrayAccessEdgeCaseTests.cs @@ -12,10 +12,10 @@ public class ArrayAccessEdgeCaseTests : BasicEntityTestBase [TestMethod] public void ArrayAccess_ValidIndex_ShouldReturnValue() { - var query = @"select Self.Array[2] from #A.Entities()"; + var query = @"select Self.Array[2] from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]} + {"@A", [new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -28,10 +28,10 @@ public void ArrayAccess_ValidIndex_ShouldReturnValue() [TestMethod] public void ArrayAccess_OutOfBounds_ShouldReturnDefault() { - var query = @"select Self.Array[10] from #A.Entities()"; + var query = @"select Self.Array[10] from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]} + {"@A", [new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -45,10 +45,10 @@ public void ArrayAccess_OutOfBounds_ShouldReturnDefault() [TestMethod] public void ArrayAccess_NegativeIndex_ShouldReturnLastElement() { - var query = @"select Self.Array[-1] from #A.Entities()"; + var query = @"select Self.Array[-1] from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]} + {"@A", [new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -62,10 +62,10 @@ public void ArrayAccess_NegativeIndex_ShouldReturnLastElement() [TestMethod] public void StringCharacterAccess_ValidIndex_ShouldReturnChar() { - var query = @"select Name[0] from #A.Entities()"; + var query = @"select Name[0] from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("david")]} + {"@A", [new BasicEntity("david")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -78,10 +78,10 @@ public void StringCharacterAccess_ValidIndex_ShouldReturnChar() [TestMethod] public void StringCharacterAccess_OutOfBounds_ShouldReturnDefaultChar() { - var query = @"select Name[100] from #A.Entities()"; + var query = @"select Name[100] from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("david")]} + {"@A", [new BasicEntity("david")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -95,10 +95,10 @@ public void StringCharacterAccess_OutOfBounds_ShouldReturnDefaultChar() [TestMethod] public void StringCharacterAccess_NullString_ShouldReturnDefaultChar() { - var query = @"select Name[0] from #A.Entities()"; + var query = @"select Name[0] from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity() { Name = null }]} + {"@A", [new BasicEntity() { Name = null }]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -112,10 +112,10 @@ public void StringCharacterAccess_NullString_ShouldReturnDefaultChar() [TestMethod] public void DictionaryAccess_ValidKey_ShouldReturnValue() { - var query = @"select Self.Dictionary['A'] from #A.Entities()"; + var query = @"select Self.Dictionary['A'] from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]} + {"@A", [new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -128,10 +128,10 @@ public void DictionaryAccess_ValidKey_ShouldReturnValue() [TestMethod] public void DictionaryAccess_InvalidKey_ShouldReturnNull() { - var query = @"select Self.Dictionary['Z'] from #A.Entities()"; + var query = @"select Self.Dictionary['Z'] from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]} + {"@A", [new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -145,10 +145,10 @@ public void DictionaryAccess_InvalidKey_ShouldReturnNull() [TestMethod] public void StringCharacterAccess_EmptyString_ShouldReturnDefaultChar() { - var query = @"select Name[0] from #A.Entities()"; + var query = @"select Name[0] from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("")]} + {"@A", [new BasicEntity("")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -164,10 +164,10 @@ public void ArrayAccess_ZeroLengthArray_ShouldReturnDefault() { // This test would need a BasicEntity with an empty array property // For now, we'll test with a regular array out-of-bounds case - var query = @"select Self.Array[3] from #A.Entities()"; + var query = @"select Self.Array[3] from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]} // Array is [0, 1, 2], so index 3 is out of bounds + {"@A", [new BasicEntity("001")]} // Array is [0, 1, 2], so index 3 is out of bounds }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -181,10 +181,10 @@ public void ArrayAccess_ZeroLengthArray_ShouldReturnDefault() [TestMethod] public void StringCharacterAccess_AliasedColumn_OutOfBounds_ShouldReturnDefaultChar() { - var query = @"select f.Name[100] from #A.Entities() f"; + var query = @"select f.Name[100] from @A.Entities() f"; var sources = new Dictionary> { - {"#A", [new BasicEntity("david")]} + {"@A", [new BasicEntity("david")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -198,10 +198,10 @@ public void StringCharacterAccess_AliasedColumn_OutOfBounds_ShouldReturnDefaultC [TestMethod] public void ArrayAccess_MultipleDifferentIndices_ShouldHandleCorrectly() { - var query = @"select Self.Array[0], Self.Array[1], Self.Array[2], Self.Array[10] from #A.Entities()"; + var query = @"select Self.Array[0], Self.Array[1], Self.Array[2], Self.Array[10] from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]} + {"@A", [new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -221,10 +221,10 @@ public void ArrayAccess_MultipleDifferentIndices_ShouldHandleCorrectly() [TestMethod] public void ArrayAccess_NegativeIndexWrapping_ShouldHandleCorrectly() { - var query = @"select Self.Array[-1], Self.Array[-2], Self.Array[-3], Self.Array[-100] from #A.Entities()"; + var query = @"select Self.Array[-1], Self.Array[-2], Self.Array[-3], Self.Array[-100] from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]} // Array is [0, 1, 2] with length 3 + {"@A", [new BasicEntity("001")]} // Array is [0, 1, 2] with length 3 }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -244,10 +244,10 @@ public void ArrayAccess_NegativeIndexWrapping_ShouldHandleCorrectly() [TestMethod] public void StringCharacterAccess_SingleNegativeIndex_ShouldReturnLastCharacter() { - var query = @"select Name[-1] from #A.Entities()"; + var query = @"select Name[-1] from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("david")]} // String is "david" with length 5 + {"@A", [new BasicEntity("david")]} // String is "david" with length 5 }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -262,10 +262,10 @@ public void StringCharacterAccess_SingleNegativeIndex_ShouldReturnLastCharacter( [TestMethod] public void StringCharacterAccess_NegativeIndex_ShouldReturnLastCharacter() { - var query = @"select Name[-1], Name[-2] from #A.Entities()"; + var query = @"select Name[-1], Name[-2] from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("david")]} // String is "david" with length 5 + {"@A", [new BasicEntity("david")]} // String is "david" with length 5 }; var vm = CreateAndRunVirtualMachine(query, sources); diff --git a/Musoq.Evaluator.Tests/BuildMetadataAndInferTypesVisitorTests.cs b/Musoq.Evaluator.Tests/BuildMetadataAndInferTypesVisitorTests.cs index d78d1507..93e370e1 100644 --- a/Musoq.Evaluator.Tests/BuildMetadataAndInferTypesVisitorTests.cs +++ b/Musoq.Evaluator.Tests/BuildMetadataAndInferTypesVisitorTests.cs @@ -16,7 +16,7 @@ public class BuildMetadataAndInferTypesVisitorTests [TestMethod] public void WhenPassedToSchemaMethodArgumentMustHaveKnownType_ShouldHave() { - var query = "select 1 from #EnironmentVariables.All() d cross apply #EnvironmentVariables.All(d.Key) e"; + var query = "select 1 from @EnironmentVariables.All() d cross apply @EnvironmentVariables.All(d.Key) e"; var lexer = new Lexer(query, true); var parser = new Musoq.Parser.Parser(lexer); diff --git a/Musoq.Evaluator.Tests/CTECrossApplyTestCases.cs b/Musoq.Evaluator.Tests/CTECrossApplyTestCases.cs index 1234ea65..879dcaf9 100644 --- a/Musoq.Evaluator.Tests/CTECrossApplyTestCases.cs +++ b/Musoq.Evaluator.Tests/CTECrossApplyTestCases.cs @@ -13,7 +13,7 @@ public void CTE_WithCrossApply_ShouldNotThrowKeyNotFoundException() const string query = @" with testX as ( select 'to jest test' as Text - from #schema.first() a + from @schema.first() a ) select t.Text as Text, t2.Value as Value from testX t @@ -49,7 +49,7 @@ public void CTE_WithCrossApply_UsingSystemDual_ShouldNotThrowKeyNotFoundExceptio const string query = @" with testX as ( select 'Hello World' as Text - from #schema.first() + from @schema.first() ) select t.Text as Text, t2.Value as Value from testX t diff --git a/Musoq.Evaluator.Tests/CancellationTests.cs b/Musoq.Evaluator.Tests/CancellationTests.cs index 045927aa..1e9dd85c 100644 --- a/Musoq.Evaluator.Tests/CancellationTests.cs +++ b/Musoq.Evaluator.Tests/CancellationTests.cs @@ -12,10 +12,10 @@ public class CancellationTests : BasicEntityTestBase [TestMethod] public void QueryCancellation() { - var query = @"select Name from #A.Entities()"; + var query = @"select Name from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -27,11 +27,11 @@ public void QueryCancellation() [TestMethod] public void GroupByQueryCancellation() { - var query = @"select Name, Count(Name) from #A.Entities() group by Name having Count(Name) >= 2"; + var query = @"select Name, Count(Name) from @A.Entities() group by Name having Count(Name) >= 2"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("ABBA") ] } @@ -49,13 +49,13 @@ public void UnionQueryCancellation() { var query = @" -select Name from #A.Entities() where Name = '001' +select Name from @A.Entities() where Name = '001' union (Name) -select Name from #A.Entities() where Name = '002'"; +select Name from @A.Entities() where Name = '002'"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -68,28 +68,28 @@ public void UnionQueryCancellation() public void ExceptQueryCancellation() { var query = - @"select City, Sum(Population) from #A.Entities() group by City + @"select City, Sum(Population) from @A.Entities() group by City except (City) -select City, Sum(Population) from #B.Entities() group by City +select City, Sum(Population) from @B.Entities() group by City except (City) -select City, Sum(Population) from #C.Entities() group by City"; +select City, Sum(Population) from @C.Entities() group by City"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("001", "", 100), new BasicEntity("001", "", 100), new BasicEntity("002", "", 500) ] }, { - "#B", + "@B", [ new BasicEntity("003", "", 13), new BasicEntity("003", "", 13), new BasicEntity("003", "", 13) ] }, - {"#C", [new BasicEntity("002", "", 14), new BasicEntity("002", "", 14)]} + {"@C", [new BasicEntity("002", "", 14), new BasicEntity("002", "", 14)]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -102,12 +102,12 @@ public void ExceptQueryCancellation() public void IntersectQueryCancellation() { var query = - @"select Name from #A.Entities() intersect (Name) select Name from #B.Entities() intersect (Name) select Name from #C.Entities()"; + @"select Name from @A.Entities() intersect (Name) select Name from @B.Entities() intersect (Name) select Name from @C.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]}, - {"#B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]}, - {"#C", [new BasicEntity("002"), new BasicEntity("001")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]}, + {"@B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]}, + {"@C", [new BasicEntity("002"), new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -120,11 +120,11 @@ public void IntersectQueryCancellation() [TestMethod] public void UnionAllQueryCancellation() { - var query = @"select Name from #A.Entities() union all (Name) select Name from #B.Entities()"; + var query = @"select Name from @A.Entities() union all (Name) select Name from @B.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]}, - {"#B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]}, + {"@B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -136,12 +136,12 @@ public void UnionAllQueryCancellation() [TestMethod] public void CteQueryCancellation() { - var query = "with p as (select City, Country from #A.entities()) select Country, City from p"; + var query = "with p as (select City, Country from @A.entities()) select Country, City from p"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), diff --git a/Musoq.Evaluator.Tests/CaseWhenTests.cs b/Musoq.Evaluator.Tests/CaseWhenTests.cs index e9eba49e..93951386 100644 --- a/Musoq.Evaluator.Tests/CaseWhenTests.cs +++ b/Musoq.Evaluator.Tests/CaseWhenTests.cs @@ -11,12 +11,12 @@ public class CaseWhenTests : BasicEntityTestBase [TestMethod] public void WhenWhenTrueCaseWhenTest() { - var query = "select (case when 1 = 1 then 1 else 0 end) as Value from #A.entities()"; + var query = "select (case when 1 = 1 then 1 else 0 end) as Value from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500) ] } @@ -32,12 +32,12 @@ public void WhenWhenTrueCaseWhenTest() [TestMethod] public void WhenWhenFalseCaseWhenTest() { - var query = "select (case when 1 = 2 then 1 else 0 end) as Value from #A.entities()"; + var query = "select (case when 1 = 2 then 1 else 0 end) as Value from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500) ] } @@ -53,12 +53,12 @@ public void WhenWhenFalseCaseWhenTest() [TestMethod] public void WhenWhenTrueOnEntityFieldCaseWhenWithElseTest() { - var query = "select (case when e.City = 'WARSAW' then 1 else 0 end) as Value from #A.entities() e"; + var query = "select (case when e.City = 'WARSAW' then 1 else 0 end) as Value from @A.entities() e"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500) ] } @@ -74,12 +74,12 @@ public void WhenWhenTrueOnEntityFieldCaseWhenWithElseTest() [TestMethod] public void WhenWhenTrueOnEntityField_ShouldNotThrowException() { - var query = "select (case when e.City <> 'WROCLAW' then 'TEST' else e.ThrowException() end) as Value from #A.entities() e"; + var query = "select (case when e.City <> 'WROCLAW' then 'TEST' else e.ThrowException() end) as Value from @A.entities() e"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500) ] } @@ -95,12 +95,12 @@ public void WhenWhenTrueOnEntityField_ShouldNotThrowException() [TestMethod] public void WhenWhenTrueOnEntityFieldWithAndCondition_ShouldNotThrowException() { - var query = "select (case when e.City <> 'WROCLAW' AND e.City <> 'KRAKOW' then 'TEST' else e.ThrowException() end) as Value from #A.entities() e"; + var query = "select (case when e.City <> 'WROCLAW' AND e.City <> 'KRAKOW' then 'TEST' else e.ThrowException() end) as Value from @A.entities() e"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500) ] } @@ -116,12 +116,12 @@ public void WhenWhenTrueOnEntityFieldWithAndCondition_ShouldNotThrowException() [TestMethod] public void WhenWhenTrueOnEntityFieldWithOrCondition_ShouldNotThrowException() { - var query = "select (case when e.City = 'WROCLAW' OR e.City = 'KRAKOW' then 'TEST' else e.ThrowException() end) as Value from #A.entities() e"; + var query = "select (case when e.City = 'WROCLAW' OR e.City = 'KRAKOW' then 'TEST' else e.ThrowException() end) as Value from @A.entities() e"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("KRAKOW", "POLAND", 500) ] } @@ -137,12 +137,12 @@ public void WhenWhenTrueOnEntityFieldWithOrCondition_ShouldNotThrowException() [TestMethod] public void WhenWhenFalseOnEntityField_ShouldThrowException() { - var query = "select (case when e.City = 'WROCLAW' then 'TEST' else e.ThrowException() end) as Value from #A.entities() e"; + var query = "select (case when e.City = 'WROCLAW' then 'TEST' else e.ThrowException() end) as Value from @A.entities() e"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500) ] } diff --git a/Musoq.Evaluator.Tests/ColumnsTests.cs b/Musoq.Evaluator.Tests/ColumnsTests.cs index 579919f0..76019b09 100644 --- a/Musoq.Evaluator.Tests/ColumnsTests.cs +++ b/Musoq.Evaluator.Tests/ColumnsTests.cs @@ -13,12 +13,12 @@ public class ColumnsTests : BasicEntityTestBase [TestMethod] public void WhenComplexObjectAccessNonExistingProperty_ShouldFail() { - const string query = @"select Self.NonExistingProperty from #A.entities()"; + const string query = @"select Self.NonExistingProperty from @A.entities()"; var sources = new Dictionary> { { - "#A", Array.Empty() + "@A", Array.Empty() } }; @@ -28,12 +28,12 @@ public void WhenComplexObjectAccessNonExistingProperty_ShouldFail() [TestMethod] public void WhenComplexObjectAccessOnProperty_ShouldPass() { - const string query = @"select Self.Name from #A.entities()"; + const string query = @"select Self.Name from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new("Karol") ] } @@ -53,12 +53,12 @@ public void WhenComplexObjectAccessOnProperty_ShouldPass() [TestMethod] public void WhenChainedComplexObjectAccessOnProperty_ShouldPass() { - const string query = @"select Self.Self.Name from #A.entities()"; + const string query = @"select Self.Self.Name from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new("Karol") ] } @@ -78,12 +78,12 @@ public void WhenChainedComplexObjectAccessOnProperty_ShouldPass() [TestMethod] public void WhenEntityDoesNotImplementIndexer_ShouldFail() { - const string query = @"select Self['NonExistingProperty'] from #A.entities()"; + const string query = @"select Self['NonExistingProperty'] from @A.entities()"; var sources = new Dictionary> { { - "#A", Array.Empty() + "@A", Array.Empty() } }; @@ -93,12 +93,12 @@ public void WhenEntityDoesNotImplementIndexer_ShouldFail() [TestMethod] public void WhenNestedObjectDoesNotImplementIndexer_ShouldFail() { - const string query = @"select Self.Other['NonExistingProperty'] from #A.entities()"; + const string query = @"select Self.Other['NonExistingProperty'] from @A.entities()"; var sources = new Dictionary> { { - "#A", Array.Empty() + "@A", Array.Empty() } }; @@ -108,12 +108,12 @@ public void WhenNestedObjectDoesNotImplementIndexer_ShouldFail() [TestMethod] public void WhenNestedObjectUsesNotSupportedConstruction_ShouldFail() { - const string query = @"select Self.Other[NonExistingProperty] from #A.entities()"; + const string query = @"select Self.Other[NonExistingProperty] from @A.entities()"; var sources = new Dictionary> { { - "#A", Array.Empty() + "@A", Array.Empty() } }; @@ -123,12 +123,12 @@ public void WhenNestedObjectUsesNotSupportedConstruction_ShouldFail() [TestMethod] public void WhenObjectIsNotArray_ShouldFail() { - const string query = @"select Self[0] from #A.entities()"; + const string query = @"select Self[0] from @A.entities()"; var sources = new Dictionary> { { - "#A", Array.Empty() + "@A", Array.Empty() } }; @@ -138,12 +138,12 @@ public void WhenObjectIsNotArray_ShouldFail() [TestMethod] public void WhenNestedObjectIsNotArray_ShouldFail() { - const string query = @"select Self.Other[0] from #A.entities()"; + const string query = @"select Self.Other[0] from @A.entities()"; var sources = new Dictionary> { { - "#A", Array.Empty() + "@A", Array.Empty() } }; @@ -153,12 +153,12 @@ public void WhenNestedObjectIsNotArray_ShouldFail() [TestMethod] public void WhenNestedObjectMightBeTreatAsArray_ShouldPass() { - const string query = @"select Self.Name[0] from #A.entities()"; + const string query = @"select Self.Name[0] from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("Karol") ] } @@ -178,12 +178,12 @@ public void WhenNestedObjectMightBeTreatAsArray_ShouldPass() [TestMethod] public void WhenDoubleNestedObjectMightBeTreatAsArray_ShouldPass() { - const string query = @"select Self.Self.Name[0] from #A.entities()"; + const string query = @"select Self.Self.Name[0] from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("Karol") ] } @@ -203,12 +203,12 @@ public void WhenDoubleNestedObjectMightBeTreatAsArray_ShouldPass() [TestMethod] public void WhenObjectIsNotArrayAndIndexIsNotNumber_ShouldPass() { - const string query = @"select Self.Dictionary['AA'] from #A.entities()"; + const string query = @"select Self.Dictionary['AA'] from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity() ] } diff --git a/Musoq.Evaluator.Tests/ComparisonTests.cs b/Musoq.Evaluator.Tests/ComparisonTests.cs index c2ee6e31..fcf440b9 100644 --- a/Musoq.Evaluator.Tests/ComparisonTests.cs +++ b/Musoq.Evaluator.Tests/ComparisonTests.cs @@ -11,12 +11,12 @@ public class ComparisonTests : BasicEntityTestBase [TestMethod] public void ArithmeticOpsGreaterTest() { - var query = "select City from #A.entities() where Population > 400d"; + var query = "select City from @A.entities() where Population > 400d"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -39,12 +39,12 @@ public void ArithmeticOpsGreaterTest() [TestMethod] public void ArithmeticOpsGreaterEqualTest() { - var query = "select City from #A.entities() where Population >= 400d"; + var query = "select City from @A.entities() where Population >= 400d"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -69,12 +69,12 @@ public void ArithmeticOpsGreaterEqualTest() [TestMethod] public void ArithmeticOpsEqualsTest() { - var query = "select City from #A.entities() where Population = 250d"; + var query = "select City from @A.entities() where Population = 250d"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -98,12 +98,12 @@ public void ArithmeticOpsEqualsTest() [TestMethod] public void ArithmeticOpsLessTest() { - var query = "select City from #A.entities() where Population < 350d"; + var query = "select City from @A.entities() where Population < 350d"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -129,12 +129,12 @@ public void ArithmeticOpsLessTest() [TestMethod] public void ArithmeticOpsLessEqualTest() { - var query = "select City from #A.entities() where Population <= 350d"; + var query = "select City from @A.entities() where Population <= 350d"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), diff --git a/Musoq.Evaluator.Tests/CouplingSyntaxTests.cs b/Musoq.Evaluator.Tests/CouplingSyntaxTests.cs index 8c881d8a..741b0607 100644 --- a/Musoq.Evaluator.Tests/CouplingSyntaxTests.cs +++ b/Musoq.Evaluator.Tests/CouplingSyntaxTests.cs @@ -21,13 +21,13 @@ public void WhenSingleValueTableIsCoupledWithSchema_ShouldHaveAppropriateTypesTe const string query = "table DummyTable {" + " Name 'System.String'" + "};" + - "couple #A.Entities with table DummyTable as SourceOfDummyRows;" + + "couple @A.Entities with table DummyTable as SourceOfDummyRows;" + "select Name from SourceOfDummyRows();"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("ABCAACBA"), new BasicEntity("AAeqwgQEW"), @@ -70,13 +70,13 @@ public void WhenTwoValuesTableIsCoupledWithSchema_ShouldHaveAppropriateTypesTest " Country 'System.String'," + " Population 'System.Decimal'" + "};" + - "couple #A.Entities with table DummyTable as SourceOfDummyRows;" + + "couple @A.Entities with table DummyTable as SourceOfDummyRows;" + "select Country, Population from SourceOfDummyRows();"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("ABCAACBA", 10), new BasicEntity("AAeqwgQEW", 20), @@ -125,14 +125,14 @@ public void WhenTwoTablesAreCoupledWithSchemas_ShouldHaveAppropriateTypesTest() "table SecondTable {" + " Name 'System.String'," + "};" + - "couple #A.Entities with table FirstTable as SourceOfFirstTableRows;" + - "couple #B.Entities with table SecondTable as SourceOfSecondTableRows;" + + "couple @A.Entities with table FirstTable as SourceOfFirstTableRows;" + + "couple @B.Entities with table SecondTable as SourceOfSecondTableRows;" + "select s2.Name from SourceOfFirstTableRows() s1 inner join SourceOfSecondTableRows() s2 on s1.Country = s2.Name"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("ABCAACBA", 10), new BasicEntity("AAeqwgQEW", 20), @@ -141,7 +141,7 @@ public void WhenTwoTablesAreCoupledWithSchemas_ShouldHaveAppropriateTypesTest() ] }, { - "#B", + "@B", [ new BasicEntity("ABCAACBA"), new BasicEntity("AAeqwgQEW"), @@ -183,7 +183,7 @@ public void WhenArgumentPassedToAliasedSchema_ShouldBeProperlyRecognized() " Parameter0 'System.Boolean'," + " Parameter1 'System.String'" + "};" + - "couple #A.Entities with table DummyTable as SourceOfDummyRows;" + + "couple @A.Entities with table DummyTable as SourceOfDummyRows;" + "select Parameter0, Parameter1 from SourceOfDummyRows(true, 'test');"; var vm = CreateAndRunVirtualMachine(query, null, new ParametersSchemaProvider()); @@ -209,9 +209,9 @@ public void WhenDataSourceIsBasedOnAnotherDataSource_ShouldPass() "table Values {" + " Text 'System.String'" + "};" + - "couple #unknown.others with table Values as SourceOfValues;" + + "couple @unknown.others with table Values as SourceOfValues;" + "with Anything as (" + - " select Text from #unknown.anything()" + + " select Text from @unknown.anything()" + ")" + "select Text from SourceOfValues(Anything)"; diff --git a/Musoq.Evaluator.Tests/CrossApplyBugTestCases.cs b/Musoq.Evaluator.Tests/CrossApplyBugTestCases.cs index 5bed799a..cd5c4c72 100644 --- a/Musoq.Evaluator.Tests/CrossApplyBugTestCases.cs +++ b/Musoq.Evaluator.Tests/CrossApplyBugTestCases.cs @@ -25,7 +25,7 @@ private class TestClass2 public void CrossApply_WithNullParameter_ShouldHandleGracefully() { // Test case where the parameter passed to cross apply is null - const string query = "select a.Key, a.Value, b.FilterKey, b.Amount from #schema.first() a cross apply #schema.second(a.Key) b"; + const string query = "select a.Key, a.Value, b.FilterKey, b.Amount from @schema.first() a cross apply @schema.second(a.Key) b"; var firstSource = new List { @@ -65,7 +65,7 @@ public void CrossApply_WithNullParameter_ShouldHandleGracefully() public void CrossApply_WithEmptySecondSource_ShouldReturnEmpty() { // Test case where the second source returns no rows for some parameters - const string query = "select a.Key, a.Value, b.FilterKey, b.Amount from #schema.first() a cross apply #schema.second(a.Key) b"; + const string query = "select a.Key, a.Value, b.FilterKey, b.Amount from @schema.first() a cross apply @schema.second(a.Key) b"; var firstSource = new List { @@ -104,7 +104,7 @@ public void CrossApply_WithEmptySecondSource_ShouldReturnEmpty() public void CrossApply_WithComplexParameterTypes_ShouldHandleGracefully() { // Test more complex parameter scenarios that might cause issues - const string query = "select a.Key, a.Value, b.FilterKey, b.Amount from #schema.first() a cross apply #schema.second(a.Key, a.Value) b"; + const string query = "select a.Key, a.Value, b.FilterKey, b.Amount from @schema.first() a cross apply @schema.second(a.Key, a.Value) b"; var firstSource = new List { @@ -145,7 +145,7 @@ public void CrossApply_WithNullRowsFromFunction_ShouldHandleNullGracefully() { // This test demonstrates the bug fix: when the cross apply function returns a source with null Rows // The fix ensures null Rows are converted to empty enumerable instead of causing NullReferenceException - const string query = "select a.Key, a.Value, b.FilterKey, b.Amount from #schema.first() a cross apply #schema.second(a.Key) b"; + const string query = "select a.Key, a.Value, b.FilterKey, b.Amount from @schema.first() a cross apply @schema.second(a.Key) b"; var firstSource = new List { @@ -174,7 +174,7 @@ public void CrossApply_WithNullRowsFromFunction_ShouldHandleNullGracefully() public void CrossApply_WithThrowingFunction_ShouldPropagateException() { // Test what happens when the cross apply function throws an exception - const string query = "select a.Key, a.Value, b.FilterKey, b.Amount from #schema.first() a cross apply #schema.second(a.Key) b"; + const string query = "select a.Key, a.Value, b.FilterKey, b.Amount from @schema.first() a cross apply @schema.second(a.Key) b"; var firstSource = new List { @@ -200,7 +200,7 @@ public void CrossApply_WithThrowingFunction_ShouldPropagateException() public void CrossApply_WithParameterTypeMismatch_ShouldHandleGracefully() { // Test what happens when parameter types don't match expected types - const string query = "select a.Key, a.Value, b.FilterKey, b.Amount from #schema.first() a cross apply #schema.second(a.Key) b"; + const string query = "select a.Key, a.Value, b.FilterKey, b.Amount from @schema.first() a cross apply @schema.second(a.Key) b"; var firstSource = new List { diff --git a/Musoq.Evaluator.Tests/CrossApplyCteTests.cs b/Musoq.Evaluator.Tests/CrossApplyCteTests.cs index aa650e85..8ae6e3d0 100644 --- a/Musoq.Evaluator.Tests/CrossApplyCteTests.cs +++ b/Musoq.Evaluator.Tests/CrossApplyCteTests.cs @@ -46,7 +46,7 @@ public void WhenSchemaMethodCrossAppliedWithAnotherSchema_WithinCte_ShouldPass() { const string query = @" with p as ( - select a.City, a.Country, a.Population, b.Country, b.Money, b.Month from #schema.first() a cross apply #schema.second(a.Country) b + select a.City, a.Country, a.Population, b.Country, b.Money, b.Month from @schema.first() a cross apply @schema.second(a.Country) b ) select [a.City], [a.Country], [a.Population], [b.Country], [b.Money], [b.Month] from p"; @@ -125,9 +125,9 @@ with p as ( f.City as City, f.Country as Country, f.Population as Population - from #schema.first() f + from @schema.first() f ) -select a.City, a.Country, a.Population, b.Country, b.Money, b.Month from p a cross apply #schema.second(a.Country) b"; +select a.City, a.Country, a.Population, b.Country, b.Money, b.Month from p a cross apply @schema.second(a.Country) b"; var firstSource = new List { @@ -216,7 +216,7 @@ public void WhenSchemaMethodCrossAppliedSelfProperty_WithinCte_ShouldPass() { const string query = @" with p as ( - select a.Name, b.Value from #schema.first() a cross apply a.Skills b + select a.Name, b.Value from @schema.first() a cross apply a.Skills b ) select [a.Name], [b.Value] from p"; @@ -286,7 +286,7 @@ public void WhenSchemaMethodCrossAppliedSelfProperty_UsesCte_ShouldPass() { const string query = @" with first as ( - select a.Name as Name, a.Skills as Skills from #schema.first() a + select a.Name as Name, a.Skills as Skills from @schema.first() a ) select a.Name, b.Value from first a cross apply a.Skills b"; @@ -333,7 +333,7 @@ with first as ( select r.AggregateValues(r.Name) as Name1, r.AggregateValues(r.Name) as Name2 - from #schema.first() r + from @schema.first() r cross apply r.JustReturnArrayOfString() b cross apply r.JustReturnArrayOfString() c group by 'fake' @@ -343,7 +343,7 @@ group by 'fake' b.Name2, p.Value from first b - inner join #schema.first() r on 1 = 1 + inner join @schema.first() r on 1 = 1 cross apply r.MethodArrayOfStrings(r.TestMethodWithInjectEntityAndParameter(b.Name1), r.TestMethodWithInjectEntityAndParameter(b.Name2)) p """; @@ -373,7 +373,7 @@ public void WhenCrossApplyAndMethodWithDefaultParameterUsed_ShouldPass() select p.Value, np.Value - from #schema.first() sln + from @schema.first() sln cross apply sln.Skills p cross apply p.MethodArrayOfStringsWithDefaultParameter() np """; @@ -408,7 +408,7 @@ public void WhenCrossApplyAndMethodWithExplicitParameterUsed_ShouldPass() select p.Value, np.Value - from #schema.first() sln + from @schema.first() sln cross apply sln.Skills p cross apply p.MethodArrayOfStringsWithDefaultParameter(true) np """; @@ -443,7 +443,7 @@ public void WhenCrossApplyAndMethodWithOneParameterAndDefaultParameterUsed_Shoul select p.Value, np.Value - from #schema.first() sln + from @schema.first() sln cross apply sln.Skills p cross apply p.MethodArrayOfStringsWithOneParamAndDefaultParameter('value') np """; @@ -478,7 +478,7 @@ public void WhenCrossApplyAndMethodWithOneParameterAndExplicitParameterUsed_Shou select p.Value, np.Value - from #schema.first() sln + from @schema.first() sln cross apply sln.Skills p cross apply p.MethodArrayOfStringsWithOneParamAndDefaultParameter('value', true) np """; diff --git a/Musoq.Evaluator.Tests/CrossApplyMethodTests.cs b/Musoq.Evaluator.Tests/CrossApplyMethodTests.cs index 3ecb48da..d5a29215 100644 --- a/Musoq.Evaluator.Tests/CrossApplyMethodTests.cs +++ b/Musoq.Evaluator.Tests/CrossApplyMethodTests.cs @@ -30,7 +30,7 @@ private class CrossApplyClass3 [TestMethod] public void CrossApplyProperty_NoMatch_ShouldPass() { - const string query = "select b.Value from #schema.first() a cross apply a.Split(a.Value2, ' ') as b"; + const string query = "select b.Value from @schema.first() a cross apply a.Split(a.Value2, ' ') as b"; var firstSource = new List { @@ -54,7 +54,7 @@ public void CrossApplyProperty_NoMatch_ShouldPass() [TestMethod] public void CrossApplyProperty_SplitStringToWords_ShouldPass() { - const string query = "select b.Value from #schema.first() a cross apply a.Split(a.Text, ' ') as b"; + const string query = "select b.Value from @schema.first() a cross apply a.Split(a.Text, ' ') as b"; var firstSource = new List { @@ -91,7 +91,7 @@ public void CrossApplyProperty_MultipleSplitWords_ShouldPass() select b.Value, c.Value - from #schema.first() a cross apply a.Split(a.Text, ' ') as b cross apply a.Split(a.Text, ' ') as c"; + from @schema.first() a cross apply a.Split(a.Text, ' ') as b cross apply a.Split(a.Text, ' ') as c"; string[] words = ["Lorem", "ipsum", "dolor", "sit", "amet,", "consectetur", "adipiscing", "elit."]; @@ -155,7 +155,7 @@ from secondWord in words [TestMethod] public void CrossApplyProperty_SplitWithMultipleProperties_ShouldPass() { - const string query = "select b.Value, c.Value from #schema.first() a cross apply a.Split(a.Numbers, ',') as b cross apply a.Split(a.Words, ' ') as c"; + const string query = "select b.Value, c.Value from @schema.first() a cross apply a.Split(a.Numbers, ',') as b cross apply a.Split(a.Words, ' ') as c"; string[] words = ["Lorem", "ipsum", "dolor", "sit", "amet,", "consectetur", "adipiscing", "elit."]; @@ -229,7 +229,7 @@ public void CrossApplyProperty_SplitWithMultipleProperties_ShouldPass() [TestMethod] public void CrossApplyProperty_SplitWithMultipleProperties_ShouldPass2() { - const string query = "select b.Value, c.Value from #schema.first() a cross apply a.Split(a.Words, ' ') as b cross apply b.ToCharArray(b.Value) as c"; + const string query = "select b.Value, c.Value from @schema.first() a cross apply a.Split(a.Words, ' ') as b cross apply b.ToCharArray(b.Value) as c"; string[] words = ["Lorem", "ipsum", "dolor", "sit", "amet,", "consectetur", "adipiscing", "elit."]; @@ -296,7 +296,7 @@ public void CrossApplyProperty_SplitWithMultipleProperties_ShouldPass2() [TestMethod] public void CrossApplyProperty_SkipAfterSplit_ShouldPass() { - const string query = "select b.Value from #schema.first() a cross apply a.Skip(a.Split(a.Text, ' '), 1) as b"; + const string query = "select b.Value from @schema.first() a cross apply a.Skip(a.Split(a.Text, ' '), 1) as b"; var inputText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."; var firstSource = new List @@ -353,7 +353,7 @@ public void CrossApplyProperty_SkipAfterSplit_ShouldPass() [TestMethod] public void CrossApplyProperty_TakeSkipAfterSplit_ShouldPass() { - const string query = "select b.Value from #schema.first() a cross apply a.Take(a.Skip(a.Split(a.Text, ' '), 1), 6) as b"; + const string query = "select b.Value from @schema.first() a cross apply a.Take(a.Skip(a.Split(a.Text, ' '), 1), 6) as b"; var firstSource = new List { @@ -382,7 +382,7 @@ public void CrossApplyProperty_TakeSkipAfterSplit_ShouldPass() [TestMethod] public void CrossApplyProperty_WhereCondition_ShouldPass() { - const string query = "select b.Value from #schema.first() a cross apply a.Split(a.Text, ' ') as b where b.Value.Length > 5"; + const string query = "select b.Value from @schema.first() a cross apply a.Split(a.Text, ' ') as b where b.Value.Length > 5"; var firstSource = new List { @@ -420,7 +420,7 @@ public void CrossApplyProperty_WhereCondition_ShouldPass() [TestMethod] public void CrossApplyProperty_GroupBy_ShouldPass() { - const string query = "select b.Length(b.Value), b.Count(Length(b.Value)) from #schema.first() a cross apply a.Split(a.Text, ' ') as b group by b.Length(b.Value)"; + const string query = "select b.Length(b.Value), b.Count(Length(b.Value)) from @schema.first() a cross apply a.Split(a.Text, ' ') as b group by b.Length(b.Value)"; var firstSource = new List { diff --git a/Musoq.Evaluator.Tests/CrossApplyMixedTests.cs b/Musoq.Evaluator.Tests/CrossApplyMixedTests.cs index 93d1d531..3a297abd 100644 --- a/Musoq.Evaluator.Tests/CrossApplyMixedTests.cs +++ b/Musoq.Evaluator.Tests/CrossApplyMixedTests.cs @@ -42,8 +42,8 @@ public void CrossApply_SchemaAndProperty_WithNestedProperty() b.Country, c.StreetName, c.HouseNumber - from #schema.first() a - cross apply #schema.second(a.Country) b + from @schema.first() a + cross apply @schema.second(a.Country) b cross apply b.Addresses c"; var firstSource = new CrossApplyClass1[] @@ -155,8 +155,8 @@ public void CrossApply_SchemaAndMethod_WithComplexObjects() b.Name, b.Salary, c.Value - from #schema.first() a - cross apply #schema.second(a.Department) b + from @schema.first() a + cross apply @schema.second(a.Department) b cross apply b.Distinct(b.Skills) c"; var firstSource = new CrossApplyClass3[] @@ -296,7 +296,7 @@ public void CrossApply_PropertyAndMethod_WithFiltering() a.Department, b.Name, c.Value - from #schema.first() a + from @schema.first() a cross apply a.Employees b cross apply a.Distinct(b.Skills) c where a.Budget > 400000"; @@ -364,7 +364,7 @@ public void CrossApply_PropertyAndMethod_GroupBy_WithFiltering() select a.Department, Count(a.Department) - from #schema.first() a + from @schema.first() a cross apply a.Employees b cross apply a.Distinct(b.Skills) c where a.Budget > 400000 @@ -442,8 +442,8 @@ public void CrossApply_InnerJoinAndUseProperty_ShouldPass() a.Name, a.Surname, c.Value - from #schema.first() a - inner join #schema.second() b on a.Id = b.Id + from @schema.first() a + inner join @schema.second() b on a.Id = b.Id cross apply b.Skills c"; var firstSource = new CrossApplyClass6[] @@ -513,8 +513,8 @@ public void CrossApply_LeftJoinAndUseProperty_ShouldPass() a.Name, a.Surname, c.Value - from #schema.first() a - left outer join #schema.second() b on a.Id = b.Id + from @schema.first() a + left outer join @schema.second() b on a.Id = b.Id cross apply b.Skills c"; var firstSource = new CrossApplyClass6[] @@ -601,7 +601,7 @@ public class SpecialCaseComplexType2 [TestMethod] public void CrossApply_WhenTwoMethodsReturnsEntities_AndThenUseColumnOfEntity_ShouldPass() { - const string query = @"select a.Value, d.Name from #schema.first() a cross apply a.GetOne() b cross apply a.GetSpecialCaseComplexType2(b.Value) c cross apply c.Employees d"; + const string query = @"select a.Value, d.Name from @schema.first() a cross apply a.GetOne() b cross apply a.GetSpecialCaseComplexType2(b.Value) c cross apply c.Employees d"; var vm = CreateAndRunVirtualMachine(query, [new SpecialCaseEmptyType()]); @@ -626,7 +626,7 @@ public void CrossApply_WhenTwoMethodsReturnsEntities_AndThenUseColumnOfEntity_Sh [TestMethod] public void WhenCteHasTheSameAliasWithinDifferentQueries_ShouldNotThrow() { - const string query = "with p as (select 1 from #schema.first() a cross apply a.Split('a,b', ',') b), r as (select 1 from #schema.first() a cross apply a.Split('a,b', ',') b) select * from p"; + const string query = "with p as (select 1 from @schema.first() a cross apply a.Split('a,b', ',') b), r as (select 1 from @schema.first() a cross apply a.Split('a,b', ',') b) select * from p"; var firstSource = System.Array.Empty(); var vm = CreateAndRunVirtualMachine( query, diff --git a/Musoq.Evaluator.Tests/CrossApplySelfPropertyTests.cs b/Musoq.Evaluator.Tests/CrossApplySelfPropertyTests.cs index 9b3ea3d9..2209f776 100644 --- a/Musoq.Evaluator.Tests/CrossApplySelfPropertyTests.cs +++ b/Musoq.Evaluator.Tests/CrossApplySelfPropertyTests.cs @@ -103,7 +103,7 @@ public class ComplexType6 [TestMethod] public void CrossApplyProperty_NoMatch_ShouldPass() { - const string query = "select a.City, b.Value from #schema.first() a cross apply a.Values as b"; + const string query = "select a.City, b.Value from @schema.first() a cross apply a.Values as b"; var firstSource = new List { @@ -127,7 +127,7 @@ public void CrossApplyProperty_NoMatch_ShouldPass() [TestMethod] public void CrossApplyProperty_WithPrimitiveArray_ShouldPass() { - const string query = "select a.City, b.Value from #schema.first() a cross apply a.Values as b"; + const string query = "select a.City, b.Value from @schema.first() a cross apply a.Values as b"; var firstSource = new List { @@ -183,7 +183,7 @@ public void CrossApplyProperty_WithPrimitiveArray_ShouldPass() [TestMethod] public void CrossApplyProperty_WithPrimitiveList_ShouldPass() { - const string query = "select a.City, b.Value from #schema.first() a cross apply a.Values as b"; + const string query = "select a.City, b.Value from @schema.first() a cross apply a.Values as b"; var firstSource = new List { @@ -239,7 +239,7 @@ public void CrossApplyProperty_WithPrimitiveList_ShouldPass() [TestMethod] public void CrossApplyProperty_WithComplexArray_ShouldPass() { - const string query = "select a.City, b.Value1, b.Value2 from #schema.first() a cross apply a.Values as b"; + const string query = "select a.City, b.Value1, b.Value2 from @schema.first() a cross apply a.Values as b"; var firstSource = new List { @@ -287,7 +287,7 @@ public void CrossApplyProperty_WithComplexArray_ShouldPass() [TestMethod] public void CrossApplyProperty_WithComplexList_ShouldPass() { - const string query = "select a.City, b.Value1, b.Value2 from #schema.first() a cross apply a.Values as b"; + const string query = "select a.City, b.Value1, b.Value2 from @schema.first() a cross apply a.Values as b"; var firstSource = new List { @@ -353,7 +353,7 @@ public void CrossApplyProperty_WithComplexList_ShouldPass() [TestMethod] public void CrossApplyProperty_MultiplePrimitiveArrays_ShouldPass() { - const string query = "select b.Value, c.Value from #schema.first() a cross apply a.Values1 as b cross apply a.Values2 as c"; + const string query = "select b.Value, c.Value from @schema.first() a cross apply a.Values1 as b cross apply a.Values2 as c"; var firstSource = new List { @@ -438,7 +438,7 @@ public void CrossApplyProperty_MultiplePrimitiveArrays_ShouldPass() [TestMethod] public void CrossApplyProperty_MultipleComplexArrays_ShouldPass() { - const string query = "select d.Value from #schema.first() a cross apply a.Values as b cross apply b.Values as c cross apply c.Values as d"; + const string query = "select d.Value from @schema.first() a cross apply a.Values as b cross apply b.Values as c cross apply c.Values as d"; var firstSource = new List { @@ -509,9 +509,9 @@ public void CrossApplyProperty_AliasClashingWithCte_ShouldThrow() const string query = """ with a as ( - select 1 from #schema.first() + select 1 from @schema.first() ) - select d.Value from #schema.first() a cross apply a.Values as b cross apply b.Values as c cross apply c.Values as d + select d.Value from @schema.first() a cross apply a.Values as b cross apply b.Values as c cross apply c.Values as d """; var firstSource = new List().ToArray(); @@ -533,7 +533,7 @@ public void WhenApplyChainedProperty_WithPrimitiveList_ShouldPass() const string query = """ select b.Value - from #schema.first() a + from @schema.first() a cross apply a.ComplexType.PrimitiveValues as b """; @@ -566,7 +566,7 @@ public void WhenApplyChainedProperty_WithComplexList_ShouldPass() const string query = """ select b.Value - from #schema.first() a + from @schema.first() a cross apply a.ComplexType.ComplexValues as b """; @@ -601,7 +601,7 @@ public void WhenGroupByAndOrderByWithAccessMethod_ShouldPass() const string query = """ select b.GetTypeName(b.Value) - from #schema.first() a + from @schema.first() a cross apply a.ComplexType.ComplexValues as b group by b.GetTypeName(b.Value) order by b.GetTypeName(b.Value) diff --git a/Musoq.Evaluator.Tests/CrossApplyTests.cs b/Musoq.Evaluator.Tests/CrossApplyTests.cs index 4fc3f667..91e650ce 100644 --- a/Musoq.Evaluator.Tests/CrossApplyTests.cs +++ b/Musoq.Evaluator.Tests/CrossApplyTests.cs @@ -36,7 +36,7 @@ private class CrossApplyClass3 [TestMethod] public void WhenSchemaMethodCrossAppliedWithAnotherSchema_UsesValuesOfSchemaMethodWithinTableValue_ShouldPass() { - const string query = "select a.City, a.Country, a.Population, b.Country, b.Money, b.Month from #schema.first() a cross apply #schema.second(a.Country) b"; + const string query = "select a.City, a.Country, a.Population, b.Country, b.Money, b.Month from @schema.first() a cross apply @schema.second(a.Country) b"; var firstSource = new List { @@ -122,7 +122,7 @@ public void WhenSchemaMethodCrossAppliedWithAnotherSchema_UsesValuesOfSchemaMeth [TestMethod] public void WhenSchemaMethodCrossAppliedWithAnotherSchema_UsesValuesOfSchemaMethodWithinTableValue_UseOnlyValuesOfCrossApplySchemaMethod_ShouldPass() { - const string query = "select b.Country, b.Money, b.Month from #schema.first() a cross apply #schema.second(a.Country) b"; + const string query = "select b.Country, b.Money, b.Month from @schema.first() a cross apply @schema.second(a.Country) b"; var firstSource = new List { @@ -193,7 +193,7 @@ public void WhenSchemaMethodCrossAppliedWithAnotherSchema_UsesValuesOfSchemaMeth [TestMethod] public void WhenSchemaMethodCrossAppliedWithAnotherSchema_UsesValuesOfSchemaMethodWithinTableValue_FilterWithAValue_ShouldPass() { - const string query = "select b.Country, b.Money, b.Month from #schema.first() a cross apply #schema.second(a.Country) b where a.Country = 'Country2'"; + const string query = "select b.Country, b.Money, b.Month from @schema.first() a cross apply @schema.second(a.Country) b where a.Country = 'Country2'"; var firstSource = new List { @@ -238,7 +238,7 @@ public void WhenSchemaMethodCrossAppliedWithAnotherSchema_UsesValuesOfSchemaMeth [TestMethod] public void WhenSchemaMethodCrossAppliedWithAnotherSameSchemas_UsesValuesOfSchemaMethodWithinTableValue_ShouldPass() { - const string query = "select b.Country, b.Money, b.Month from #schema.first() a cross apply #schema.second(a.Country) b cross apply #schema.third(b.Country) c"; + const string query = "select b.Country, b.Money, b.Month from @schema.first() a cross apply @schema.second(a.Country) b cross apply @schema.third(b.Country) c"; var firstSource = new List { @@ -306,7 +306,7 @@ public void WhenSchemaMethodCrossAppliedWithAnotherSameSchemas_UsesValuesOfSchem [TestMethod] public void WhenSchemaMethodCrossAppliedWithAnotherSameSchemas_GroupedByCountry_ShouldPass() { - const string query = "select b.Country from #schema.first() a cross apply #schema.second(a.Country) b cross apply #schema.third(b.Country) c group by b.Country"; + const string query = "select b.Country from @schema.first() a cross apply @schema.second(a.Country) b cross apply @schema.third(b.Country) c group by b.Country"; var firstSource = new List { @@ -356,7 +356,7 @@ public void WhenSchemaMethodCrossAppliedWithAnotherSameSchemas_GroupedByCountry_ [TestMethod] public void WhenSchemaMethodCrossAppliedWithAnotherSameSchemas_WithFilterAndGroupBy_ShouldPass() { - const string query = "select b.Country from #schema.first() a cross apply #schema.second(a.Country) b cross apply #schema.third(b.Country) c where b.Country = 'Country1' group by b.Country"; + const string query = "select b.Country from @schema.first() a cross apply @schema.second(a.Country) b cross apply @schema.third(b.Country) c where b.Country = 'Country1' group by b.Country"; var firstSource = new List { @@ -408,7 +408,7 @@ public void WhenSchemaMethodCrossAppliedWithAnotherSchema_UsesValuesOfSchemaMeth const string query = """ with rows as ( - select b.Country as Country, b.Money as Money, b.Month as Month from #schema.first() a cross apply #schema.second(a.Country) b + select b.Country as Country, b.Money as Money, b.Month as Month from @schema.first() a cross apply @schema.second(a.Country) b ) select Country, Money, Month from rows as p """; diff --git a/Musoq.Evaluator.Tests/CteTests.cs b/Musoq.Evaluator.Tests/CteTests.cs index 76730290..e6c85897 100644 --- a/Musoq.Evaluator.Tests/CteTests.cs +++ b/Musoq.Evaluator.Tests/CteTests.cs @@ -13,12 +13,12 @@ public class CteTests : BasicEntityTestBase [TestMethod] public void SimpleCteTest() { - var query = "with p as (select City, Country from #A.entities()) select Country, City from p"; + var query = "with p as (select City, Country from @A.entities()) select Country, City from p"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -64,12 +64,12 @@ public void SimpleCteTest() [TestMethod] public void SimpleCteWithStarTest() { - var query = "with p as (select City, Country from #A.entities()) select * from p"; + var query = "with p as (select City, Country from @A.entities()) select * from p"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -118,12 +118,12 @@ public void SimpleCteWithStarTest() public void SimpleCteWithGroupingTest() { var query = - "with p as (select Country, Sum(Population) from #A.entities() group by Country) select * from p"; + "with p as (select Country, Sum(Population) from @A.entities() group by Country) select * from p"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -157,12 +157,12 @@ public void SimpleCteWithGroupingTest() public void WhenSameAliasesUsedWithinCteInnerExpression_ShouldThrow() { var query = - "with p as (select 1 from #A.entities() a inner join #A.entities() a on 1 = 1) select * from p"; + "with p as (select 1 from @A.entities() a inner join @A.entities() a on 1 = 1) select * from p"; var sources = new Dictionary> { { - "#A", [] + "@A", [] } }; @@ -179,14 +179,14 @@ with p as ( select Population, Country - from #A.entities() + from @A.entities() ) select Country, Sum(Population) from p group by Country"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -220,19 +220,19 @@ with p as ( public void SimpleCteWithUnionTest() { var query = - "with p as (select City, Country from #A.entities() union (Country, City) select City, Country from #B.entities()) select City, Country from p"; + "with p as (select City, Country from @A.entities() union (Country, City) select City, Country from @B.entities()) select City, Country from p"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400) ] }, { - "#B", + "@B", [ new BasicEntity("KATOWICE", "POLAND", 250), new BasicEntity("BERLIN", "GERMANY", 250), @@ -265,19 +265,19 @@ public void SimpleCteWithUnionTest() public void SimpleCteWithUnionAllTest() { var query = - "with p as (select City, Country from #A.entities() union all (Country) select City, Country from #B.entities()) select City, Country from p"; + "with p as (select City, Country from @A.entities() union all (Country) select City, Country from @B.entities()) select City, Country from p"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400) ] }, { - "#B", + "@B", [ new BasicEntity("KATOWICE", "POLAND", 250), new BasicEntity("BERLIN", "GERMANY", 250), @@ -325,12 +325,12 @@ public void SimpleCteWithUnionAllTest() public void SimpleCteWithExceptTest() { var query = - "with p as (select City, Country from #A.entities() except (Country) select City, Country from #B.entities()) select City, Country from p"; + "with p as (select City, Country from @A.entities() except (Country) select City, Country from @B.entities()) select City, Country from p"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("HELSINKI", "FINLAND", 500), new BasicEntity("WARSAW", "POLAND", 500), @@ -338,7 +338,7 @@ public void SimpleCteWithExceptTest() ] }, { - "#B", + "@B", [ new BasicEntity("KATOWICE", "POLAND", 250), new BasicEntity("BERLIN", "GERMANY", 250), @@ -366,12 +366,12 @@ public void SimpleCteWithExceptTest() public void SimpleCteWithIntersectTest() { var query = - "with p as (select City, Country from #A.entities() intersect (Country, City) select City, Country from #B.entities()) select City, Country from p"; + "with p as (select City, Country from @A.entities() intersect (Country, City) select City, Country from @B.entities()) select City, Country from p"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("HELSINKI", "FINLAND", 500), new BasicEntity("WARSAW", "POLAND", 500), @@ -379,7 +379,7 @@ public void SimpleCteWithIntersectTest() ] }, { - "#B", + "@B", [ new BasicEntity("WARSAW", "POLAND", 250), new BasicEntity("BERLIN", "GERMANY", 250), @@ -408,15 +408,15 @@ public void CteWithSetOperatorTest() { var query = @" with p as ( - select City, Country from #A.entities() intersect (Country, City) - select City, Country from #B.entities() + select City, Country from @A.entities() intersect (Country, City) + select City, Country from @B.entities() ) select City, Country from p"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("HELSINKI", "FINLAND", 500), new BasicEntity("WARSAW", "POLAND", 500), @@ -424,7 +424,7 @@ with p as ( ] }, { - "#B", + "@B", [ new BasicEntity("WARSAW", "POLAND", 250), new BasicEntity("BERLIN", "GERMANY", 250), @@ -459,15 +459,15 @@ public void CteWithTwoOuterExpressionTest() { var query = @" with p as ( - select City, Country from #A.entities() + select City, Country from @A.entities() ) select City, Country from p union (City, Country) -select City, Country from #B.entities()"; +select City, Country from @B.entities()"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("HELSINKI", "FINLAND", 500), new BasicEntity("WARSAW", "POLAND", 500), @@ -475,7 +475,7 @@ with p as ( ] }, { - "#B", + "@B", [ new BasicEntity("WARSAW", "POLAND", 250), new BasicEntity("BERLIN", "GERMANY", 250), @@ -525,15 +525,15 @@ public void SimpleCteWithMultipleOuterExpressionsTest() { var query = @" with p as ( - select City, Country from #A.entities() intersect (Country, City) - select City, Country from #B.entities() + select City, Country from @A.entities() intersect (Country, City) + select City, Country from @B.entities() ) select City, Country from p where Country = 'FINLAND' union (Country, City) select City, Country from p where Country = 'POLAND'"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("HELSINKI", "FINLAND", 500), new BasicEntity("WARSAW", "POLAND", 500), @@ -541,7 +541,7 @@ with p as ( ] }, { - "#B", + "@B", [ new BasicEntity("WARSAW", "POLAND", 250), new BasicEntity("BERLIN", "GERMANY", 250), @@ -577,16 +577,16 @@ public void CteWithSetInInnerOuterExpressionTest() { var query = @" with p as ( - select City, Country from #A.entities() intersect (Country, City) - select City, Country from #B.entities() + select City, Country from @A.entities() intersect (Country, City) + select City, Country from @B.entities() ) select City, Country from p union (City, Country) -select City, Country from #C.Entities()"; +select City, Country from @C.Entities()"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("HELSINKI", "FINLAND", 500), new BasicEntity("WARSAW", "POLAND", 500), @@ -594,7 +594,7 @@ with p as ( ] }, { - "#B", + "@B", [ new BasicEntity("WARSAW", "POLAND", 250), new BasicEntity("BERLIN", "GERMANY", 250), @@ -603,7 +603,7 @@ with p as ( ] }, { - "#C", + "@C", [ new BasicEntity("NEW YORK", "USA", 250) ] @@ -640,13 +640,13 @@ public void MultipleCteExpressionsTest() { const string query = @" with p as ( - select City, Country from #A.entities() + select City, Country from @A.entities() ), c as ( - select City, Country from #B.entities() + select City, Country from @B.entities() ), d as ( select City, Country from p where City = 'HELSINKI' ), f as ( - select City, Country from #B.entities() where City = 'WARSAW' + select City, Country from @B.entities() where City = 'WARSAW' ) select City, Country from p union (City, Country) select City, Country from c union (City, Country) @@ -656,7 +656,7 @@ with p as ( var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("HELSINKI", "FINLAND", 500), new BasicEntity("WARSAW", "POLAND", 500), @@ -664,7 +664,7 @@ with p as ( ] }, { - "#B", + "@B", [ new BasicEntity("WARSAW", "POLAND", 250), new BasicEntity("BERLIN", "GERMANY", 250), @@ -714,24 +714,24 @@ public void WhenMixedQueriesGroupingAreUsed_Variant1_ShouldPass() { var query = @" with first as ( - select 1 as Test from #A.entities() + select 1 as Test from @A.entities() ), second as ( - select 2 as Test from #B.entities() group by 'fake' + select 2 as Test from @B.entities() group by 'fake' ) select c.GetBytes(c.Name) from first a - inner join #A.entities() c on 1 = 1 + inner join @A.entities() c on 1 = 1 inner join second b on 1 = 1"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("First") ] }, { - "#B", + "@B", [ new BasicEntity("Second") ] @@ -752,26 +752,26 @@ public void WhenMixedQueriesGroupingAreUsed_Variant2_ShouldPass() { var query = @" with first as ( - select Name from #A.entities() + select Name from @A.entities() ), second as ( - select Name from #B.entities() group by Name + select Name from @B.entities() group by Name ) select c.GetBytes(c.Name) from first a - inner join #A.entities() c on 1 = 1 + inner join @A.entities() c on 1 = 1 inner join second b on 1 = 1"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("First") ] }, { - "#B", + "@B", [ new BasicEntity("Second") ] @@ -790,28 +790,28 @@ public void WhenMixedQueriesGroupingAreUsed_Variant3_ShouldPass() { var query = @" with first as ( - select Name from #A.entities() + select Name from @A.entities() ), second as ( - select Name from #B.entities() group by Name + select Name from @B.entities() group by Name ) select a.Name, b.Name, c.GetBytes(c.Name) from first a - inner join #A.entities() c on 1 = 1 + inner join @A.entities() c on 1 = 1 inner join second b on 1 = 1"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("First") ] }, { - "#B", + "@B", [ new BasicEntity("Second") ] @@ -832,16 +832,16 @@ public void WhenMixedQueriesGroupingAreUsed_Variant4_ShouldPass() { var query = @" with first as ( - select a.Name as Name from #A.entities() a group by a.Name having Count(a.Name) > 0 + select a.Name as Name from @A.entities() a group by a.Name having Count(a.Name) > 0 ), second as ( - select b.Name() as Name from #B.entities() b inner join first a on 1 = 1 + select b.Name() as Name from @B.entities() b inner join first a on 1 = 1 ), third as ( select b.Name as Name from second b group by b.Name having Count(b.Name) > 0 ), fourth as ( select c.Name() as Name from second b - inner join #A.entities() c on 1 = 1 + inner join @A.entities() c on 1 = 1 inner join third d on 1 = 1 ) select @@ -851,19 +851,19 @@ c.Name as Name var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("First") ] }, { - "#B", + "@B", [ new BasicEntity("Second") ] }, { - "#C", + "@C", [ new BasicEntity("Third") ] diff --git a/Musoq.Evaluator.Tests/DateTimeOffsetTests.cs b/Musoq.Evaluator.Tests/DateTimeOffsetTests.cs index e0a29da2..7cd7810a 100644 --- a/Musoq.Evaluator.Tests/DateTimeOffsetTests.cs +++ b/Musoq.Evaluator.Tests/DateTimeOffsetTests.cs @@ -16,7 +16,7 @@ public void MinDateTimeOffsetTest() const string query = "table Dates {" + " Date 'System.DateTimeOffset'" + "};" + - "couple #test.whatever with table Dates as Dates; " + + "couple @test.whatever with table Dates as Dates; " + "select MinDateTimeOffset(Date) from Dates()"; dynamic first = new ExpandoObject(); @@ -46,7 +46,7 @@ public void MaxDateTimeOffsetTest() const string query = "table Dates {" + " Date 'System.DateTimeOffset'" + "};" + - "couple #test.whatever with table Dates as Dates; " + + "couple @test.whatever with table Dates as Dates; " + "select MaxDateTimeOffset(Date) from Dates()"; dynamic first = new ExpandoObject(); @@ -77,7 +77,7 @@ public void SubtractDateTimeOffsetsTest() " Date1 'System.DateTimeOffset'," + " Date2 'System.DateTimeOffset'" + "};" + - "couple #test.whatever with table Dates as Dates; " + + "couple @test.whatever with table Dates as Dates; " + "select SubtractDateTimeOffsets(Date1, Date2) from Dates()"; dynamic first = new ExpandoObject(); @@ -106,7 +106,7 @@ public void SubtractDateTimeOffsets_MinusOperatorTest() " Date1 'System.DateTimeOffset'," + " Date2 'System.DateTimeOffset'" + "};" + - "couple #test.whatever with table Dates as Dates; " + + "couple @test.whatever with table Dates as Dates; " + "select Date1 - Date2 from Dates()"; dynamic first = new ExpandoObject(); diff --git a/Musoq.Evaluator.Tests/DynamicSourceQueryTests.cs b/Musoq.Evaluator.Tests/DynamicSourceQueryTests.cs index 3f95b0a5..5de34a5e 100644 --- a/Musoq.Evaluator.Tests/DynamicSourceQueryTests.cs +++ b/Musoq.Evaluator.Tests/DynamicSourceQueryTests.cs @@ -13,7 +13,7 @@ public class DynamicSourceQueryTests : DynamicQueryTestsBase [TestMethod] public void WithDynamicSource_DescDynamicObjectWithSimpleColumns_ShouldPass() { - const string query = "desc #dynamic.all()"; + const string query = "desc @dynamic.all()"; var sources = new List() { @@ -39,7 +39,7 @@ public void WithDynamicSource_DescDynamicObjectWithSimpleColumns_ShouldPass() [TestMethod] public void WithDynamicSource_SimpleQuery_ShouldPass() { - const string query = "select Id, Name from #dynamic.all()"; + const string query = "select Id, Name from @dynamic.all()"; var sources = new List { @@ -65,7 +65,7 @@ public void WithDynamicSource_SimpleQuery_ShouldPass() [TestMethod] public void WithDynamicSource_DescDynamicObjectWithComplexColumns_ShouldPass() { - const string query = "desc #dynamic.all()"; + const string query = "desc @dynamic.all()"; var sources = new List() { CreateExpandoObject(CreateExpandoObject(1, "Test1")) @@ -84,7 +84,7 @@ public void WithDynamicSource_DescDynamicObjectWithComplexColumns_ShouldPass() [TestMethod] public void WithDynamicSource_AccessComplexObjectProperties_ShouldPass() { - const string query = "select Complex.Id, Complex.Name from #dynamic.all()"; + const string query = "select Complex.Id, Complex.Name from @dynamic.all()"; var sources = new List() { CreateExpandoObject(CreateExpandoObject(1, "Test1")) @@ -110,7 +110,7 @@ public void WithDynamicSource_AccessComplexObjectProperties_ShouldPass() [TestMethod] public void WithDynamicSource_AccessComplexChainedObjectProperties_ShouldPass() { - const string query = "select Complex.Complex.Id, Complex.Complex.Name from #dynamic.all()"; + const string query = "select Complex.Complex.Id, Complex.Complex.Name from @dynamic.all()"; var sources = new List() { CreateExpandoObject(CreateExpandoObject(CreateExpandoObject(1, "Test1"))) @@ -136,7 +136,7 @@ public void WithDynamicSource_AccessComplexChainedObjectProperties_ShouldPass() [TestMethod] public void WithDynamicSource_AccessArray_ShouldPass() { - const string query = "select Complex.Array[0], Complex.Array[1] from #dynamic.all()"; + const string query = "select Complex.Array[0], Complex.Array[1] from @dynamic.all()"; var sources = new List() { CreateExpandoObject(CreateExpandoObject([1, 2])) @@ -162,7 +162,7 @@ public void WithDynamicSource_AccessArray_ShouldPass() [TestMethod] public void WithDynamicSource_AccessExpandoObjectArray_ShouldPass() { - const string query = "select Complex.Array[0].Id, Complex.Array[0].Name from #dynamic.all()"; + const string query = "select Complex.Array[0].Id, Complex.Array[0].Name from @dynamic.all()"; var sources = new List() { CreateExpandoObject(CreateExpandoObject([ @@ -191,7 +191,7 @@ public void WithDynamicSource_AccessExpandoObjectArray_ShouldPass() [TestMethod] public void WithDynamicSource_IncrementAccessedProperty_ShouldPass() { - const string query = "select Increment(Complex.Array[0].Id) from #dynamic.all()"; + const string query = "select Increment(Complex.Array[0].Id) from @dynamic.all()"; var sources = new List() { CreateExpandoObject(CreateExpandoObject([ @@ -222,8 +222,8 @@ public void WithRedundantColumn_ShouldBeTrimmed_ShouldPass() weather.Location as 'City', weather.TemperatureInCelsiusDegree as 'TemperatureInCelsiusDegree', location.Name as 'Location' -from #weather.all() weather -inner join #location.all() location on weather.Location = location.Name +from @weather.all() weather +inner join @location.all() location on weather.Location = location.Name "; dynamic weather = new ExpandoObject(); weather.Location = "London"; @@ -251,8 +251,8 @@ location.Name as 'Location' }; var vm = CreateAndRunVirtualMachine(query, [ - ("#weather", (IReadOnlyCollection)weatherSource, (IReadOnlyDictionary)weatherSchema), - ("#location", locationSource, locationSchema) + ("@weather", (IReadOnlyCollection)weatherSource, (IReadOnlyDictionary)weatherSchema), + ("@location", locationSource, locationSchema) ]); var table = vm.Run(); @@ -268,7 +268,7 @@ location.Name as 'Location' [TestMethod] public void WithDynamicSource_SyntaxKeywordAsColumnNameUSed_ShouldPass() { - const string query = "select [case], [end] from #dynamic.all()"; + const string query = "select [case], [end] from @dynamic.all()"; IDictionary expando = new ExpandoObject(); expando.Add("case", "case"); diff --git a/Musoq.Evaluator.Tests/DynamicSourceWithDynamicAndDefaultTypeHinting.cs b/Musoq.Evaluator.Tests/DynamicSourceWithDynamicAndDefaultTypeHinting.cs index ad9ed54a..f7237e4c 100644 --- a/Musoq.Evaluator.Tests/DynamicSourceWithDynamicAndDefaultTypeHinting.cs +++ b/Musoq.Evaluator.Tests/DynamicSourceWithDynamicAndDefaultTypeHinting.cs @@ -14,7 +14,7 @@ public class DynamicSourceWithDynamicAndDefaultTypeHinting : DynamicQueryTestsBa [TestMethod] public void WithDynamicSource_AccessComplexObjectProperties_ShouldPass() { - const string query = "select Multiform.AsInt, Multiform.AsDouble from #dynamic.all()"; + const string query = "select Multiform.AsInt, Multiform.AsDouble from @dynamic.all()"; var sources = new List { CreateExpandoObject(new MultiformType(2.99d)) diff --git a/Musoq.Evaluator.Tests/DynamicSourceWithDynamicTypeHinting.cs b/Musoq.Evaluator.Tests/DynamicSourceWithDynamicTypeHinting.cs index 971a1955..999c0c05 100644 --- a/Musoq.Evaluator.Tests/DynamicSourceWithDynamicTypeHinting.cs +++ b/Musoq.Evaluator.Tests/DynamicSourceWithDynamicTypeHinting.cs @@ -14,7 +14,7 @@ public class DynamicSourceWithDynamicTypeHinting : DynamicQueryTestsBase [TestMethod] public void WithDynamicSource_DescDynamicObjectWithSimpleColumns_ShouldPass() { - const string query = "desc #dynamic.all()"; + const string query = "desc @dynamic.all()"; var sources = new List { @@ -41,7 +41,7 @@ public void WithDynamicSource_DescDynamicObjectWithSimpleColumns_ShouldPass() [TestMethod] public void WithDynamicSource_SimpleQuery_ShouldPass() { - const string query = "select Id, Name from #dynamic.all()"; + const string query = "select Id, Name from @dynamic.all()"; var sources = new List { @@ -77,7 +77,7 @@ public void WithDynamicSource_SimpleQuery_ShouldPass() [TestMethod] public void WithDynamicSource_DescDynamicObjectWithComplexColumns_ShouldPass() { - const string query = "desc #dynamic.all()"; + const string query = "desc @dynamic.all()"; var sources = new List { new ComplexExpandoType(new ComplexType(1, "Test1")) @@ -99,7 +99,7 @@ public void WithDynamicSource_DescDynamicObjectWithComplexColumns_ShouldPass() [TestMethod] public void WithDynamicSource_AccessComplexObjectProperties_ShouldPass() { - const string query = "select Complex.Id, Complex.Name from #dynamic.all()"; + const string query = "select Complex.Id, Complex.Name from @dynamic.all()"; var sources = new List { CreateExpandoObject(new ComplexType(1, "Test1")) @@ -125,7 +125,7 @@ public void WithDynamicSource_AccessComplexObjectProperties_ShouldPass() [TestMethod] public void WithDynamicSource_AccessArray_ShouldPass() { - const string query = "select Complex.Array[0], Complex.Array[1] from #dynamic.all()"; + const string query = "select Complex.Array[0], Complex.Array[1] from @dynamic.all()"; var sources = new List { CreateExpandoObject(new ComplexArrayOfShortsType([1, 2])) @@ -151,7 +151,7 @@ public void WithDynamicSource_AccessArray_ShouldPass() [TestMethod] public void WithDynamicSource_AccessExpandoObjectArray_ShouldPass() { - const string query = "select Complex.Array[0].Id, Complex.Array[0].Name from #dynamic.all()"; + const string query = "select Complex.Array[0].Id, Complex.Array[0].Name from @dynamic.all()"; var sources = new List() { CreateExpandoObject(new ComplexArrayOfComplexTypeType([ @@ -180,7 +180,7 @@ public void WithDynamicSource_AccessExpandoObjectArray_ShouldPass() [TestMethod] public void WithDynamicSource_IncrementAccessedProperty_ShouldPass() { - const string query = "select Increment(Complex.Array[0].Id) from #dynamic.all()"; + const string query = "select Increment(Complex.Array[0].Id) from @dynamic.all()"; var sources = new List() { CreateExpandoObject(new ComplexArrayOfComplexTypeType([ @@ -206,7 +206,7 @@ public void WithDynamicSource_IncrementAccessedProperty_ShouldPass() [TestMethod] public void WithDynamicSource_IncrementAccessedProperty_ShouldPass2() { - const string query = "select TrueWhenCalled() from #dynamic.all()"; + const string query = "select TrueWhenCalled() from @dynamic.all()"; var sources = new List() { new ComplexType(1, "test1") diff --git a/Musoq.Evaluator.Tests/EnvironmentVariablesTests.cs b/Musoq.Evaluator.Tests/EnvironmentVariablesTests.cs index ad25ee08..a6a929f4 100644 --- a/Musoq.Evaluator.Tests/EnvironmentVariablesTests.cs +++ b/Musoq.Evaluator.Tests/EnvironmentVariablesTests.cs @@ -13,7 +13,7 @@ public class EnvironmentVariablesTests : EnvironmentVariablesTestBase [TestMethod] public void WhenDescEnvironmentVariables_ShouldListAllColumns() { - var query = "desc #EnvironmentVariables.All()"; + var query = "desc @EnvironmentVariables.All()"; var sources = new Dictionary> { { @@ -38,7 +38,7 @@ public void WhenDescEnvironmentVariables_ShouldListAllColumns() [TestMethod] public void WhenPassedEnvironmentVariables_ShouldListThemAll() { - var query = "select Key, Value from #EnvironmentVariables.All()"; + var query = "select Key, Value from @EnvironmentVariables.All()"; var sources = new Dictionary> { @@ -65,7 +65,7 @@ public void WhenPassedEnvironmentVariables_ShouldListThemAll() [TestMethod] public void WhenPassedEnvironmentVariables_JoinedDataSources_ShouldListThemAll() { - var query = "select e1.Key, e1.Value, e2.Value from #EnvironmentVariables.All() e1 inner join #EnvironmentVariables.All() e2 on e1.Key = e2.Key"; + var query = "select e1.Key, e1.Value, e2.Value from @EnvironmentVariables.All() e1 inner join @EnvironmentVariables.All() e2 on e1.Key = e2.Key"; var sources = new Dictionary> { { @@ -105,7 +105,7 @@ public void WhenPassedEnvironmentVariables_JoinedDataSources_ShouldListThemAll() [TestMethod] public void WhenPassedEnvironmentVariables_UnionDataSources_ShouldListThemAll() { - var query = "select Key, Value from #EnvironmentVariables.All() union all (Key) select Key, Value from #EnvironmentVariables.All()"; + var query = "select Key, Value from @EnvironmentVariables.All() union all (Key) select Key, Value from @EnvironmentVariables.All()"; var sources = new Dictionary> { { @@ -155,14 +155,14 @@ public void WhenPreviouslyCteExpressionSaw_ShouldPass() { const string query = @" with p as ( - select 1 from #A.entities() + select 1 from @A.entities() ) -select Key, Value from #EnvironmentVariables.All()"; +select Key, Value from @EnvironmentVariables.All()"; var basicEntitiesSource = new Dictionary> { { - "#A", + "@A", Array.Empty() } }; @@ -170,7 +170,7 @@ with p as ( var environmentVariablesEntitiesSource = new Dictionary> { { - "#EnvironmentVariables", + "@EnvironmentVariables", [ new("KEY_1", "VALUE_1"), new("KEY_2", "VALUE_2") diff --git a/Musoq.Evaluator.Tests/EscapeTests.cs b/Musoq.Evaluator.Tests/EscapeTests.cs index 2894d82e..931bb2c9 100644 --- a/Musoq.Evaluator.Tests/EscapeTests.cs +++ b/Musoq.Evaluator.Tests/EscapeTests.cs @@ -11,7 +11,7 @@ public class EscapeTests : BasicEntityTestBase [TestMethod] public void WhenBackslashEscaped_ShouldBePresent() { - const string query = """select '\\' from #A.entities()"""; + const string query = """select '\\' from @A.entities()"""; var sources = CreateSource(); var vm = CreateAndRunVirtualMachine(query, sources); @@ -24,7 +24,7 @@ public void WhenBackslashEscaped_ShouldBePresent() [TestMethod] public void WhenDoubleBackslashEscaped_ShouldBeSingleBackslash() { - const string query = """select '\\\\' from #A.entities()"""; + const string query = """select '\\\\' from @A.entities()"""; var sources = CreateSource(); var vm = CreateAndRunVirtualMachine(query, sources); @@ -37,7 +37,7 @@ public void WhenDoubleBackslashEscaped_ShouldBeSingleBackslash() [TestMethod] public void WhenQuoteEscaped_ShouldBePresent() { - const string query = """select '\'' from #A.entities()"""; + const string query = """select '\'' from @A.entities()"""; var sources = CreateSource(); var vm = CreateAndRunVirtualMachine(query, sources); @@ -50,7 +50,7 @@ public void WhenQuoteEscaped_ShouldBePresent() [TestMethod] public void WhenNewlineEscaped_ShouldBePresent() { - const string query = """select '\n' from #A.entities()"""; + const string query = """select '\n' from @A.entities()"""; var sources = CreateSource(); var vm = CreateAndRunVirtualMachine(query, sources); @@ -63,7 +63,7 @@ public void WhenNewlineEscaped_ShouldBePresent() [TestMethod] public void WhenTabEscaped_ShouldBePresent() { - const string query = """select '\t' from #A.entities()"""; + const string query = """select '\t' from @A.entities()"""; var sources = CreateSource(); var vm = CreateAndRunVirtualMachine(query, sources); @@ -76,7 +76,7 @@ public void WhenTabEscaped_ShouldBePresent() [TestMethod] public void WhenCarriageReturnEscaped_ShouldBePresent() { - const string query = """select '\r' from #A.entities()"""; + const string query = """select '\r' from @A.entities()"""; var sources = CreateSource(); var vm = CreateAndRunVirtualMachine(query, sources); @@ -89,7 +89,7 @@ public void WhenCarriageReturnEscaped_ShouldBePresent() [TestMethod] public void WhenUnicodeEscaped_ShouldBePresent() { - const string query = """select '\u0041' from #A.entities()"""; + const string query = """select '\u0041' from @A.entities()"""; var sources = CreateSource(); var vm = CreateAndRunVirtualMachine(query, sources); @@ -102,7 +102,7 @@ public void WhenUnicodeEscaped_ShouldBePresent() [TestMethod] public void WhenHexEscaped_ShouldBePresent() { - const string query = """select '\x41' from #A.entities()"""; + const string query = """select '\x41' from @A.entities()"""; var sources = CreateSource(); var vm = CreateAndRunVirtualMachine(query, sources); @@ -115,7 +115,7 @@ public void WhenHexEscaped_ShouldBePresent() [TestMethod] public void WhenComplexMixedEscapes_ShouldBePresent() { - const string query = """select 'Hello\nWorld\t\u0394\\test' from #A.entities()"""; + const string query = """select 'Hello\nWorld\t\u0394\\test' from @A.entities()"""; var sources = CreateSource(); var vm = CreateAndRunVirtualMachine(query, sources); @@ -128,7 +128,7 @@ public void WhenComplexMixedEscapes_ShouldBePresent() [TestMethod] public void WhenEscapeAtStartAndEnd_ShouldBePresent() { - const string query = """select '\\test\\' from #A.entities()"""; + const string query = """select '\\test\\' from @A.entities()"""; var sources = CreateSource(); var vm = CreateAndRunVirtualMachine(query, sources); @@ -141,7 +141,7 @@ public void WhenEscapeAtStartAndEnd_ShouldBePresent() [TestMethod] public void WhenMultipleConsecutiveBackslashes_ShouldBePresent() { - const string query = """select '\\\\\\\\' from #A.entities()"""; + const string query = """select '\\\\\\\\' from @A.entities()"""; var sources = CreateSource(); var vm = CreateAndRunVirtualMachine(query, sources); @@ -154,7 +154,7 @@ public void WhenMultipleConsecutiveBackslashes_ShouldBePresent() [TestMethod] public void WhenSpecialCharactersEscaped_ShouldBePresent() { - const string query = """select '\0\b\f\e' from #A.entities()"""; + const string query = """select '\0\b\f\e' from @A.entities()"""; var sources = CreateSource(); var vm = CreateAndRunVirtualMachine(query, sources); @@ -167,7 +167,7 @@ public void WhenSpecialCharactersEscaped_ShouldBePresent() [TestMethod] public void WhenUnknownEscapeSequence_ShouldRemoveBackslash() { - const string query = """select '\z\y\x' from #A.entities()"""; + const string query = """select '\z\y\x' from @A.entities()"""; var sources = CreateSource(); var vm = CreateAndRunVirtualMachine(query, sources); @@ -181,7 +181,7 @@ public void WhenUnknownEscapeSequence_ShouldRemoveBackslash() public void WhenQuoteWithBackslashCombinations_ShouldBePresent() { // Testing various combinations of quotes and backslashes - const string query = """select '\\\'' from #A.entities()"""; // Escaped backslash followed by escaped quote + const string query = """select '\\\'' from @A.entities()"""; // Escaped backslash followed by escaped quote var sources = CreateSource(); var vm = CreateAndRunVirtualMachine(query, sources); @@ -195,7 +195,7 @@ public void WhenQuoteWithBackslashCombinations_ShouldBePresent() public void WhenInvalidUnicodeSequences_ShouldHandleGracefully() { // Incomplete or invalid unicode sequences - const string query = """select '\u123' from #A.entities()"""; // Incomplete unicode + const string query = """select '\u123' from @A.entities()"""; // Incomplete unicode var sources = CreateSource(); var vm = CreateAndRunVirtualMachine(query, sources); @@ -208,7 +208,7 @@ public void WhenInvalidUnicodeSequences_ShouldHandleGracefully() [TestMethod] public void WhenMultipleEscapedColumns_ShouldAllBeHandledCorrectly() { - const string query = """select '\\', '\n', '\u0041' from #A.entities()"""; + const string query = """select '\\', '\n', '\u0041' from @A.entities()"""; var sources = CreateSource(); var vm = CreateAndRunVirtualMachine(query, sources); @@ -223,7 +223,7 @@ public void WhenMultipleEscapedColumns_ShouldAllBeHandledCorrectly() [TestMethod] public void WhenConcatenatingEscapedStrings_ShouldBeHandledCorrectly() { - const string query = """select '\\' + '\n' + '\u0041' from #A.entities()"""; + const string query = """select '\\' + '\n' + '\u0041' from @A.entities()"""; var sources = CreateSource(); var vm = CreateAndRunVirtualMachine(query, sources); @@ -237,7 +237,7 @@ public void WhenConcatenatingEscapedStrings_ShouldBeHandledCorrectly() public void WhenUsingExtendedUnicode_ShouldBeHandledCorrectly() { // Testing surrogate pairs and other special Unicode characters - const string query = """select '\u0001\uFFFF\u0000' from #A.entities()"""; + const string query = """select '\u0001\uFFFF\u0000' from @A.entities()"""; var sources = CreateSource(); var vm = CreateAndRunVirtualMachine(query, sources); @@ -251,7 +251,7 @@ public void WhenUsingExtendedUnicode_ShouldBeHandledCorrectly() public void WhenUsingLongStringWithEscapes_ShouldBeHandledCorrectly() { var longString = string.Join("", Enumerable.Repeat(@"\\\'\n\t", 1000)); - var query = $"""select '{longString}' from #A.entities()"""; + var query = $"""select '{longString}' from @A.entities()"""; var sources = CreateSource(); var vm = CreateAndRunVirtualMachine(query, sources); @@ -265,7 +265,7 @@ private static Dictionary> CreateSource() return new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("test") ] } diff --git a/Musoq.Evaluator.Tests/GroupByTests.cs b/Musoq.Evaluator.Tests/GroupByTests.cs index 2be77f1b..f3095fe7 100644 --- a/Musoq.Evaluator.Tests/GroupByTests.cs +++ b/Musoq.Evaluator.Tests/GroupByTests.cs @@ -12,11 +12,11 @@ public class GroupByTests : BasicEntityTestBase [TestMethod] public void GroupByWithParentSumTest() { - var query = @"select SumIncome(Money, 1), SumOutcome(Money, 1) from #A.Entities() group by Month, City"; + var query = @"select SumIncome(Money, 1), SumOutcome(Money, 1) from @A.Entities() group by Month, City"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("cracow", "jan", Convert.ToDecimal(-200)) @@ -40,11 +40,11 @@ public void GroupByWithParentSumTest() public void GroupBySubtractGroupsTest() { var query = - @"select SumIncome(Money), SumOutcome(Money), SumIncome(Money) - Abs(SumOutcome(Money)) from #A.Entities() group by Month"; + @"select SumIncome(Money), SumOutcome(Money), SumIncome(Money) - Abs(SumOutcome(Money)) from @A.Entities() group by Month"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("jan", Convert.ToDecimal(400)), new BasicEntity("jan", Convert.ToDecimal(300)), new BasicEntity("jan", Convert.ToDecimal(-200)) @@ -64,11 +64,11 @@ public void GroupBySubtractGroupsTest() [TestMethod] public void SimpleGroupByTest() { - var query = @"select Name, Count(Name) from #A.Entities() group by Name having Count(Name) >= 2"; + var query = @"select Name, Count(Name) from @A.Entities() group by Name having Count(Name) >= 2"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("ABBA"), new BasicEntity("ABBA"), new BasicEntity("BABBA"), @@ -106,11 +106,11 @@ public void SimpleGroupByTest() [TestMethod] public void SimpleRowNumberForGroupByTest() { - var query = @"select Name, Count(Name), RowNumber() from #A.Entities() group by Name"; + var query = @"select Name, Count(Name), RowNumber() from @A.Entities() group by Name"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("ABBA"), new BasicEntity("ABBA"), new BasicEntity("BABBA"), @@ -163,11 +163,11 @@ public void SimpleRowNumberForGroupByTest() [TestMethod] public void SimpleGroupByWithSkipTest() { - var query = @"select Name, Count(Name) from #A.Entities() group by Name skip 2"; + var query = @"select Name, Count(Name) from @A.Entities() group by Name skip 2"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("ABBA"), new BasicEntity("ABBA"), new BasicEntity("BABBA"), @@ -196,11 +196,11 @@ public void SimpleGroupByWithSkipTest() [TestMethod] public void SimpleGroupByWithTakeTest() { - var query = @"select Name, Count(Name) from #A.Entities() group by Name take 2"; + var query = @"select Name, Count(Name) from @A.Entities() group by Name take 2"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("ABBA"), new BasicEntity("ABBA"), new BasicEntity("BABBA"), @@ -231,11 +231,11 @@ public void SimpleGroupByWithTakeTest() [TestMethod] public void SimpleGroupByWithSkipTakeTest() { - var query = @"select Name, Count(Name) from #A.Entities() group by Name skip 2 take 1"; + var query = @"select Name, Count(Name) from @A.Entities() group by Name skip 2 take 1"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("ABBA"), new BasicEntity("ABBA"), new BasicEntity("BABBA"), @@ -264,11 +264,11 @@ public void SimpleGroupByWithSkipTakeTest() [TestMethod] public void GroupByWithValueTest() { - var query = @"select Country, Sum(Population) from #A.Entities() group by Country"; + var query = @"select Country, Sum(Population) from @A.Entities() group by Country"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("ABBA", 200), new BasicEntity("ABBA", 500), new BasicEntity("BABBA", 100), @@ -309,11 +309,11 @@ public void GroupByWithValueTest() [TestMethod] public void GroupByMultipleColumnsTest() { - var query = @"select Country, City, Count(Country), Count(City) from #A.Entities() group by Country, City"; + var query = @"select Country, City, Count(Country), Count(City) from @A.Entities() group by Country, City"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("POLAND", "WARSAW"), new BasicEntity("POLAND", "CZESTOCHOWA"), new BasicEntity("UK", "LONDON"), @@ -363,11 +363,11 @@ public void GroupByMultipleColumnsTest() public void GroupBySubstrTest() { var query = - @"select Substring(Name, 0, 2), Count(Substring(Name, 0, 2)) from #A.Entities() group by Substring(Name, 0, 2)"; + @"select Substring(Name, 0, 2), Count(Substring(Name, 0, 2)) from @A.Entities() group by Substring(Name, 0, 2)"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("AA:1"), new BasicEntity("AA:2"), new BasicEntity("AA:3"), @@ -409,11 +409,11 @@ public void GroupBySubstrTest() public void GroupByWithSelectedConstantModifiedByFunctionTest() { var query = - @"select Name, Count(Name), Inc(10d), 1 from #A.Entities() group by Name having Count(Name) >= 2"; + @"select Name, Count(Name), Inc(10d), 1 from @A.Entities() group by Name having Count(Name) >= 2"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("ABBA"), new BasicEntity("ABBA"), new BasicEntity("BABBA"), @@ -464,14 +464,14 @@ public void GroupByColumnSubstringTest() Substring(City, IndexOf(City, ':')) as 'City', Count(City) as 'Count', Sum(Population) as 'Sum' -from #A.Entities() +from @A.Entities() group by Substring(City, IndexOf(City, ':')), Country """; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW:TARGOWEK", "POLAND", 500), new BasicEntity("WARSAW:URSYNOW", "POLAND", 500), new BasicEntity("KATOWICE:ZAWODZIE", "POLAND", 250) @@ -513,12 +513,12 @@ group by Substring(City, IndexOf(City, ':')), Country public void GroupByWithParentCountTest() { var query = - "select Country, City as 'City', Count(City, 1), Count(City) as 'CountOfCities' from #A.Entities() group by Country, City"; + "select Country, City as 'City', Count(City, 1), Count(City) as 'CountOfCities' from @A.Entities() group by Country, City"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -583,12 +583,12 @@ public void GroupByWithParentCountTest() public void GroupByForFakeWindowTest() { var query = - "select Window(Population) from #A.Entities() group by 'fake'"; + "select Window(Population) from @A.Entities() group by 'fake'"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -619,12 +619,12 @@ public void GroupByForFakeWindowTest() public void GroupByForCountriesWideWindowTest() { var query = - "select Window(Population) from #A.Entities() group by Country"; + "select Window(Population) from @A.Entities() group by Country"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -664,12 +664,12 @@ public void GroupByForCountriesWideWindowTest() public void GroupByWithWhereTest() { var query = - "select Country, City as 'City', Count(City, 1), Count(City) as 'CountOfCities' from #A.Entities() where Country = 'POLAND' group by Country, City"; + "select Country, City as 'City', Count(City, 1), Count(City) as 'CountOfCities' from @A.Entities() where Country = 'POLAND' group by Country, City"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -720,12 +720,12 @@ public void GroupByWithWhereTest() public void ReorderedGroupByWithWhereAndSkipTakeTest() { var query = - "from #A.Entities() where Country = 'POLAND' group by Country, City select Country, City as 'City', Count(City, 1), Count(City) as 'CountOfCities' skip 1 take 1"; + "from @A.Entities() where Country = 'POLAND' group by Country, City select Country, City as 'City', Count(City, 1), Count(City) as 'CountOfCities' skip 1 take 1"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -757,12 +757,12 @@ public void ReorderedGroupByWithWhereAndSkipTakeTest() [TestMethod] public void GroupWasNotListedTest() { - var query = "select Count(Country) from #A.entities() group by Country"; + var query = "select Count(Country) from @A.entities() group by Country"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -788,12 +788,12 @@ public void GroupWasNotListedTest() [TestMethod] public void CountWithFakeGroupByTest() { - var query = "select Count(Country) from #A.entities() group by 'fake'"; + var query = "select Count(Country) from @A.entities() group by 'fake'"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -817,12 +817,12 @@ public void CountWithFakeGroupByTest() [TestMethod] public void CountWithoutGroupByTest() { - var query = "select Count(Country), Sum(Population) from #A.entities()"; + var query = "select Count(Country), Sum(Population) from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -868,12 +868,12 @@ public void CountWithoutGroupByTest() [TestMethod] public void CountWithRowNumberAndWithoutGroupByTest() { - var query = "select Count(Country), RowNumber() from #A.entities()"; + var query = "select Count(Country), RowNumber() from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -901,12 +901,12 @@ public void CountWithRowNumberAndWithoutGroupByTest() [TestMethod] public void SumWithoutGroupByAndWithNoGroupingField() { - var query = "select Sum(Population) from #A.entities()"; + var query = "select Sum(Population) from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -931,11 +931,11 @@ public void SumWithoutGroupByAndWithNoGroupingField() [TestMethod] public void GroupBySimpleAccessTest() { - var query = @"select Month from #A.Entities() group by Month"; + var query = @"select Month from @A.Entities() group by Month"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("cracow", "jan", Convert.ToDecimal(-200)) @@ -953,11 +953,11 @@ public void GroupBySimpleAccessTest() [TestMethod] public void GroupByComplexObjectAccessTest() { - var query = @"select Self.Month from #A.Entities() group by Self.Month"; + var query = @"select Self.Month from @A.Entities() group by Self.Month"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("cracow", "jan", Convert.ToDecimal(-200)) @@ -975,11 +975,11 @@ public void GroupByComplexObjectAccessTest() [TestMethod] public void GroupByComplexObjectAccessWithSumTest() { - var query = @"select Self.Month, Sum(Self.Money) from #A.Entities() group by Self.Month"; + var query = @"select Self.Month, Sum(Self.Money) from @A.Entities() group by Self.Month"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("cracow", "jan", Convert.ToDecimal(-200)), @@ -1007,12 +1007,12 @@ public void GroupByComplexObjectAccessWithSumTest() [TestMethod] public void GroupByWithCaseWhenInSelectTest() { - var query = @"select (case when Self.Month = 'jan' then 'JANUARY' when Self.Month = 'feb' then 'FEBRUARY' else 'NONE' end) from #A.Entities() group by Self.Month"; + var query = @"select (case when Self.Month = 'jan' then 'JANUARY' when Self.Month = 'feb' then 'FEBRUARY' else 'NONE' end) from @A.Entities() group by Self.Month"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("cracow", "jan", Convert.ToDecimal(-200)), @@ -1035,12 +1035,12 @@ public void GroupByWithCaseWhenInSelectTest() [TestMethod] public void GroupByWithCaseWhenAsGroupingResultFunctionTest() { - var query = @"select (case when e.Month = e.Month then e.Month else '' end), Count(case when e.Month = e.Month then e.Month else '' end) from #A.Entities() e group by (case when e.Month = e.Month then e.Month else '' end)"; + var query = @"select (case when e.Month = e.Month then e.Month else '' end), Count(case when e.Month = e.Month then e.Month else '' end) from @A.Entities() e group by (case when e.Month = e.Month then e.Month else '' end)"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("cracow", "jan", Convert.ToDecimal(-200)), @@ -1069,12 +1069,12 @@ public void GroupByWithCaseWhenAsGroupingResultFunctionTest() [TestMethod] public void GroupByWithFieldLinkSyntaxTest() { - var query = @"select ::1, Count(::1), ::2 from #A.Entities() e group by (case when e.Month = e.Month then e.Month else '' end), 'fake'"; + var query = @"select ::1, Count(::1), ::2 from @A.Entities() e group by (case when e.Month = e.Month then e.Month else '' end), 'fake'"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("cracow", "jan", Convert.ToDecimal(-200)), @@ -1109,12 +1109,12 @@ public void GroupByWithFieldLinkSyntaxTest() [TestMethod] public void GroupByWithFieldLinkSyntaxAndCustomColumnNamingTest() { - var query = @"select ::1 as firstColumn, Count(::1) as secondColumn, ::2 as thirdColumn from #A.Entities() e group by (case when e.Month = e.Month then e.Month else '' end), 'fake'"; + var query = @"select ::1 as firstColumn, Count(::1) as secondColumn, ::2 as thirdColumn from @A.Entities() e group by (case when e.Month = e.Month then e.Month else '' end), 'fake'"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("cracow", "jan", Convert.ToDecimal(-200)), @@ -1152,21 +1152,21 @@ public void WhenGroupByUsedWithJoinsByMethodInvocation_ShouldRetrieveValues() select countries.GetCountry() as Country, population.Sum(population.GetPopulation()) as Population -from #A.entities() countries -inner join #B.entities() cities on countries.GetCountry() = cities.GetCountry() -inner join #C.entities() population on cities.GetCity() = population.GetCity() +from @A.entities() countries +inner join @B.entities() cities on countries.GetCountry() = cities.GetCountry() +inner join @C.entities() population on cities.GetCity() = population.GetCity() group by countries.GetCountry()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity {Country = "Poland"}, new BasicEntity {Country = "Germany"} ] }, { - "#B", [ + "@B", [ new BasicEntity {Country = "Poland", City = "Krakow"}, new BasicEntity {Country = "Poland", City = "Wroclaw"}, new BasicEntity {Country = "Poland", City = "Warszawa"}, @@ -1175,7 +1175,7 @@ public void WhenGroupByUsedWithJoinsByMethodInvocation_ShouldRetrieveValues() ] }, { - "#C", [ + "@C", [ new BasicEntity {City = "Krakow", Population = 400}, new BasicEntity {City = "Wroclaw", Population = 500}, new BasicEntity {City = "Warszawa", Population = 1000}, @@ -1208,20 +1208,20 @@ public void WhenGroupByWithWhereUsed_WhereUsesFieldThatWillBeUsedInResultingTabl select a.Country, b.AggregateValues(b.City) -from #A.entities() a -inner join #B.entities() b on a.Country = b.Country +from @A.entities() a +inner join @B.entities() b on a.Country = b.Country where a.Country = 'Poland' group by a.Country"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity {Country = "Poland"} ] }, { - "#B", [ + "@B", [ new BasicEntity {City = "Warsaw", Country = "Poland"}, new BasicEntity {City = "Gdansk", Country = "Poland"} ] @@ -1243,20 +1243,20 @@ public void WhenGroupByWithWhereUsed_WhereUsesFieldThatWontBeUsedInResultingTabl select a.Country, b.AggregateValues(b.City) -from #A.entities() a -inner join #B.entities() b on a.Country = b.Country +from @A.entities() a +inner join @B.entities() b on a.Country = b.Country where b.Population > 200 group by a.Country"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity {Country = "Poland"} ] }, { - "#B", [ + "@B", [ new BasicEntity {City = "Warsaw", Country = "Poland", Population = 200}, new BasicEntity {City = "Gdansk", Country = "Poland", Population = 300} ] @@ -1279,13 +1279,13 @@ public void WhenAccessingTheFirstLetterWithMethodCallInsideAggregation_ShouldSuc select a.Country, AggregateValues(GetElementAt(a.Country, 0)) -from #A.entities() a +from @A.entities() a group by a.Country"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity {Country = "Poland"}, new BasicEntity {Country = "Brazil"} ] @@ -1317,13 +1317,13 @@ public void WhenAccessingTheFirstLetterWithIndexerInsideAggregation_ShouldSuccee select a.Country, AggregateValues(a.Country[0]) -from #A.entities() a +from @A.entities() a group by a.Country"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity {Country = "Poland"}, new BasicEntity {Country = "Brazil"} ] diff --git a/Musoq.Evaluator.Tests/InTests.cs b/Musoq.Evaluator.Tests/InTests.cs index b86cd381..78235ab3 100644 --- a/Musoq.Evaluator.Tests/InTests.cs +++ b/Musoq.Evaluator.Tests/InTests.cs @@ -11,12 +11,12 @@ public class InTests : BasicEntityTestBase [TestMethod] public void SimpleInOperator() { - var query = "select Population from #A.Entities() where Population in (100, 400)"; + var query = "select Population from @A.Entities() where Population in (100, 400)"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("A", 100), new BasicEntity("AB", 200), @@ -38,12 +38,12 @@ public void SimpleInOperator() [TestMethod] public void SimpleNotInOperator() { - var query = "select Population from #A.Entities() where Population not in (100, 400)"; + var query = "select Population from @A.Entities() where Population not in (100, 400)"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("A", 100), new BasicEntity("AB", 200), @@ -65,12 +65,12 @@ public void SimpleNotInOperator() [TestMethod] public void InWithArgumentFromSourceOperator() { - var query = "select Country from #A.Entities() where City in (Country, 'Warsaw')"; + var query = "select Country from @A.Entities() where City in (Country, 'Warsaw')"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("Poland", "Warsaw"), new BasicEntity("Berlin", "Germany"), @@ -94,12 +94,12 @@ public void InWithArgumentFromSourceOperator() [TestMethod] public void NotInWithArgumentFromSourceOperator() { - var query = "select Country from #A.Entities() where City not in (Country, 'Warsaw')"; + var query = "select Country from @A.Entities() where City not in (Country, 'Warsaw')"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("Poland", "Warsaw"), new BasicEntity("Berlin", "Germany"), diff --git a/Musoq.Evaluator.Tests/JoinTests.cs b/Musoq.Evaluator.Tests/JoinTests.cs index a6e5c61f..ce6932cc 100644 --- a/Musoq.Evaluator.Tests/JoinTests.cs +++ b/Musoq.Evaluator.Tests/JoinTests.cs @@ -15,20 +15,20 @@ public void WhenSomeColumnsAreUsedAndNotEveryUsedTableHasUsedOwnColumns_MustNotT const string query = @" select countries.Country -from #A.entities() countries -inner join #B.entities() cities on 1 = 1 -inner join #C.entities() population on 1 = 1"; +from @A.entities() countries +inner join @B.entities() cities on 1 = 1 +inner join @C.entities() population on 1 = 1"; var sources = new Dictionary> { { - "#A", Array.Empty() + "@A", Array.Empty() }, { - "#B", Array.Empty() + "@B", Array.Empty() }, { - "#C", Array.Empty() + "@C", Array.Empty() } }; @@ -47,20 +47,20 @@ public void SimpleJoinTest() countries.Country, cities.City, population.Population -from #A.entities() countries -inner join #B.entities() cities on countries.Country = cities.Country -inner join #C.entities() population on cities.City = population.City"; +from @A.entities() countries +inner join @B.entities() cities on countries.Country = cities.Country +inner join @C.entities() population on cities.City = population.City"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Germany", "Berlin") ] }, { - "#B", [ + "@B", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Poland", "Wroclaw"), new BasicEntity("Poland", "Warszawa"), @@ -69,7 +69,7 @@ public void SimpleJoinTest() ] }, { - "#C", [ + "@C", [ new BasicEntity {City = "Krakow", Population = 400}, new BasicEntity {City = "Wroclaw", Population = 500}, new BasicEntity {City = "Warszawa", Population = 1000}, @@ -137,20 +137,20 @@ public void JoinWithCaseWhen2Test() countries.Country, (case when population.Population > 400 then cities.ToUpperInvariant(cities.City) else cities.City end) as 'cities.City', population.Population -from #A.entities() countries -inner join #B.entities() cities on countries.Country = cities.Country -inner join #C.entities() population on cities.City = population.City"; +from @A.entities() countries +inner join @B.entities() cities on countries.Country = cities.Country +inner join @C.entities() population on cities.City = population.City"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Germany", "Berlin") ] }, { - "#B", [ + "@B", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Poland", "Wroclaw"), new BasicEntity("Poland", "Warszawa"), @@ -159,7 +159,7 @@ public void JoinWithCaseWhen2Test() ] }, { - "#C", [ + "@C", [ new BasicEntity {City = "Krakow", Population = 400}, new BasicEntity {City = "Wroclaw", Population = 500}, new BasicEntity {City = "Warszawa", Population = 1000}, @@ -222,18 +222,18 @@ public void JoinWithCaseWhen2Test() public void JoinWithCaseWhenTest() { var query = - "select countries.Country, (case when population.Population >= 500 then 'big' else 'low' end), population.Population from #A.entities() countries inner join #B.entities() cities on countries.Country = cities.Country inner join #C.entities() population on cities.City = population.City"; + "select countries.Country, (case when population.Population >= 500 then 'big' else 'low' end), population.Population from @A.entities() countries inner join @B.entities() cities on countries.Country = cities.Country inner join @C.entities() population on cities.City = population.City"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Germany", "Berlin") ] }, { - "#B", [ + "@B", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Poland", "Wroclaw"), new BasicEntity("Poland", "Warszawa"), @@ -242,7 +242,7 @@ public void JoinWithCaseWhenTest() ] }, { - "#C", [ + "@C", [ new BasicEntity {City = "Krakow", Population = 400}, new BasicEntity {City = "Wroclaw", Population = 500}, new BasicEntity {City = "Warszawa", Population = 1000}, @@ -297,21 +297,21 @@ public void JoinWithGroupByTest() select cities.Country, countries.Sum(population.Population) -from #A.entities() countries -inner join #B.entities() cities on countries.Country = cities.Country -inner join #C.entities() population on cities.City = population.City +from @A.entities() countries +inner join @B.entities() cities on countries.Country = cities.Country +inner join @C.entities() population on cities.City = population.City group by cities.Country"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Germany", "Berlin") ] }, { - "#B", [ + "@B", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Poland", "Wroclaw"), new BasicEntity("Poland", "Warszawa"), @@ -320,7 +320,7 @@ public void JoinWithGroupByTest() ] }, { - "#C", [ + "@C", [ new BasicEntity {City = "Krakow", Population = 400}, new BasicEntity {City = "Wroclaw", Population = 500}, new BasicEntity {City = "Warszawa", Population = 1000}, @@ -360,21 +360,21 @@ public void JoinWithGroupByAndOrderByTest() var query = @" select cities.GetTypeName(cities.Country) -from #A.entities() countries -inner join #B.entities() cities on countries.Country = cities.Country +from @A.entities() countries +inner join @B.entities() cities on countries.Country = cities.Country group by cities.GetTypeName(cities.Country) order by cities.GetTypeName(cities.Country)"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Germany", "Berlin") ] }, { - "#B", [ + "@B", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Poland", "Wroclaw"), new BasicEntity("Poland", "Warszawa"), @@ -403,20 +403,20 @@ public void JoinWithOrderByTest() var query = @" select cities.Country -from #A.entities() countries -inner join #B.entities() cities on countries.Country = cities.Country +from @A.entities() countries +inner join @B.entities() cities on countries.Country = cities.Country order by cities.GetTypeName(cities.Country)"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Germany", "Berlin") ] }, { - "#B", [ + "@B", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Poland", "Wroclaw"), new BasicEntity("Poland", "Warszawa"), @@ -436,26 +436,26 @@ public void JoinWithExceptTest() const string query = @" select countries.Country, cities.City, population.Population -from #A.entities() countries -inner join #B.entities() cities on countries.Country = cities.Country -inner join #C.entities() population on cities.City = population.City +from @A.entities() countries +inner join @B.entities() cities on countries.Country = cities.Country +inner join @C.entities() population on cities.City = population.City except (countries.Country, cities.City, population.Population) select countries.Country, cities.City, population.Population -from #A.entities() countries -inner join #B.entities() cities on countries.Country = cities.Country -inner join #C.entities() population on cities.City = population.City"; +from @A.entities() countries +inner join @B.entities() cities on countries.Country = cities.Country +inner join @C.entities() population on cities.City = population.City"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Germany", "Berlin") ] }, { - "#B", [ + "@B", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Poland", "Wroclaw"), new BasicEntity("Poland", "Warszawa"), @@ -464,7 +464,7 @@ public void JoinWithExceptTest() ] }, { - "#C", [ + "@C", [ new BasicEntity {City = "Krakow", Population = 400}, new BasicEntity {City = "Wroclaw", Population = 500}, new BasicEntity {City = "Warszawa", Population = 1000}, @@ -501,26 +501,26 @@ public void JoinWithUnionTest() @" select countries.Country, cities.City, population.Population -from #A.entities() countries -inner join #B.entities() cities on countries.Country = cities.Country -inner join #C.entities() population on cities.City = population.City +from @A.entities() countries +inner join @B.entities() cities on countries.Country = cities.Country +inner join @C.entities() population on cities.City = population.City union (countries.Country, cities.City, population.Population) select countries.Country, cities.City, population.Population -from #A.entities() countries -inner join #B.entities() cities on countries.Country = cities.Country -inner join #C.entities() population on cities.City = population.City"; +from @A.entities() countries +inner join @B.entities() cities on countries.Country = cities.Country +inner join @C.entities() population on cities.City = population.City"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Germany", "Berlin") ] }, { - "#B", [ + "@B", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Poland", "Wroclaw"), new BasicEntity("Poland", "Warszawa"), @@ -529,7 +529,7 @@ public void JoinWithUnionTest() ] }, { - "#C", [ + "@C", [ new BasicEntity {City = "Krakow", Population = 400}, new BasicEntity {City = "Wroclaw", Population = 500}, new BasicEntity {City = "Warszawa", Population = 1000}, @@ -578,26 +578,26 @@ public void JoinWithUnionAllTest() @" select countries.Country, cities.City, population.Population -from #A.entities() countries -inner join #B.entities() cities on countries.Country = cities.Country -inner join #C.entities() population on cities.City = population.City +from @A.entities() countries +inner join @B.entities() cities on countries.Country = cities.Country +inner join @C.entities() population on cities.City = population.City union all (countries.Country, cities.City, population.Population) select countries.Country, cities.City, population.Population -from #A.entities() countries -inner join #B.entities() cities on countries.Country = cities.Country -inner join #C.entities() population on cities.City = population.City"; +from @A.entities() countries +inner join @B.entities() cities on countries.Country = cities.Country +inner join @C.entities() population on cities.City = population.City"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Germany", "Berlin") ] }, { - "#B", [ + "@B", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Poland", "Wroclaw"), new BasicEntity("Poland", "Warszawa"), @@ -606,7 +606,7 @@ union all (countries.Country, cities.City, population.Population) ] }, { - "#C", [ + "@C", [ new BasicEntity {City = "Krakow", Population = 400}, new BasicEntity {City = "Wroclaw", Population = 500}, new BasicEntity {City = "Warszawa", Population = 1000}, @@ -671,23 +671,23 @@ public void InnerJoinCteTablesTest() { var query = @" with p as ( - select Country, City, Id from #A.entities() + select Country, City, Id from @A.entities() ), x as ( - select Country, City, Id from #B.entities() + select Country, City, Id from @B.entities() ) select p.Id, x.Id from p inner join x on p.Country = x.Country"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("Poland", "Krakow") {Id = 0}, new BasicEntity("Germany", "Berlin") {Id = 1}, new BasicEntity("Russia", "Moscow") {Id = 2} ] }, { - "#B", [ + "@B", [ new BasicEntity("Poland", "Krakow") {Id = 0}, new BasicEntity("Poland", "Wroclaw") {Id = 1}, new BasicEntity("Poland", "Warszawa") {Id = 2}, @@ -714,7 +714,7 @@ public void InnerJoinCteSelfJoinTest() { var query = @" with p as ( - select Country, City, Id from #A.entities() + select Country, City, Id from @A.entities() ), x as ( select Country, City, Id from p ) @@ -723,7 +723,7 @@ with p as ( var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("Poland", "Krakow") {Id = 0}, new BasicEntity("Germany", "Berlin") {Id = 1}, new BasicEntity("Russia", "Moscow") {Id = 2} @@ -757,7 +757,7 @@ public void ComplexCteIssue1Test() with p as ( select Country - from #A.entities() + from @A.entities() ), x as ( select Country @@ -769,7 +769,7 @@ from p group by Country var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("Poland", "Krakow") {Id = 0}, new BasicEntity("Germany", "Berlin") {Id = 1}, new BasicEntity("Russia", "Moscow") {Id = 2} @@ -794,7 +794,7 @@ public void ComplexCteIssue1WithGroupByTest() with p as ( select Country - from #A.entities() + from @A.entities() ), x as ( select Country @@ -806,7 +806,7 @@ from p group by Country var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("Poland", "Krakow") {Id = 0}, new BasicEntity("Poland", "Krakow") {Id = 0}, new BasicEntity("Germany", "Berlin") {Id = 1}, @@ -828,17 +828,17 @@ from p group by Country [TestMethod] public void SimpleLeftJoinTest() { - var query = "select a.Id, b.Id from #A.entities() a left outer join #B.entities() b on a.Id = b.Id"; + var query = "select a.Id, b.Id from @A.entities() a left outer join @B.entities() b on a.Id = b.Id"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("xX") { Id = 1 } ] }, { - "#B", + "@B", [ ] @@ -868,17 +868,17 @@ public void SimpleLeftJoinTest() [TestMethod] public void MultipleLeftJoinTest() { - const string query = "select a.Id, b.Id, c.Id from #A.entities() a left outer join #B.entities() b on a.Id = b.Id left outer join #B.entities() c on b.Id = c.Id"; + const string query = "select a.Id, b.Id, c.Id from @A.entities() a left outer join @B.entities() b on a.Id = b.Id left outer join @B.entities() c on b.Id = c.Id"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("xX") { Id = 1 } ] }, { - "#B", + "@B", [ ] @@ -914,23 +914,23 @@ public void MultipleLeftJoinTest() [TestMethod] public void MultipleLeftJoinWithCTriesMatchBButFailTest() { - var query = "select a.Id, b.Id, c.Id from #A.entities() a left outer join #B.entities() b on a.Id = b.Id left outer join #C.entities() c on b.Id = c.Id"; + var query = "select a.Id, b.Id, c.Id from @A.entities() a left outer join @B.entities() b on a.Id = b.Id left outer join @C.entities() c on b.Id = c.Id"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("xX") { Id = 1 } ] }, { - "#B", + "@B", [ ] }, { - "#C", + "@C", [ new("xX") { Id = 1 } ] @@ -966,24 +966,24 @@ public void MultipleLeftJoinWithCTriesMatchBButFailTest() [TestMethod] public void MultipleLeftJoinWithCTriesMatchBAndSucceedTest() { - var query = "select a.Id, b.Id, c.Id from #A.entities() a left outer join #B.entities() b on a.Id = b.Id left outer join #C.entities() c on b.Id = c.Id"; + var query = "select a.Id, b.Id, c.Id from @A.entities() a left outer join @B.entities() b on a.Id = b.Id left outer join @C.entities() c on b.Id = c.Id"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("xX") { Id = 1 }, new BasicEntity("xX") { Id = 2 } ] }, { - "#B", + "@B", [ new("xX") { Id = 1 } ] }, { - "#C", + "@C", [ new("xX") { Id = 1 } ] @@ -1029,16 +1029,16 @@ public void MultipleLeftJoinWithCTriesMatchBAndSucceedTest() [TestMethod] public void SimpleRightJoinTest() { - var query = "select a.Id, b.Id from #A.entities() a right outer join #B.entities() b on a.Id = b.Id"; + var query = "select a.Id, b.Id from @A.entities() a right outer join @B.entities() b on a.Id = b.Id"; var sources = new Dictionary> { { - "#A", [ + "@A", [ ] }, { - "#B", + "@B", [ new("xX") { Id = 1 } ] @@ -1068,23 +1068,23 @@ public void SimpleRightJoinTest() [TestMethod] public void MultipleRightJoinWithCTriesMatchBAndSucceedForASingleTest() { - var query = "select a.Id, b.Id, c.Id from #A.entities() a right outer join #B.entities() b on a.Id = b.Id right outer join #C.entities() c on b.Id = c.Id"; + var query = "select a.Id, b.Id, c.Id from @A.entities() a right outer join @B.entities() b on a.Id = b.Id right outer join @C.entities() c on b.Id = c.Id"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("xX") { Id = 1 } ] }, { - "#B", + "@B", [ new("xX") { Id = 1 } ] }, { - "#C", + "@C", [ new("xX") { Id = 1 }, new("xX") { Id = 2 } @@ -1132,23 +1132,23 @@ public void MultipleRightJoinWithCTriesMatchBAndSucceedForASingleTest() public void RightOuterJoinPassMethodContextTest() { - var query = "select a.ToDecimal(a.Id), b.ToDecimal(b.Id), c.ToDecimal(c.Id) from #A.entities() a right outer join #B.entities() b on 1 = 1 right outer join #C.entities() c on 1 = 1"; + var query = "select a.ToDecimal(a.Id), b.ToDecimal(b.Id), c.ToDecimal(c.Id) from @A.entities() a right outer join @B.entities() b on 1 = 1 right outer join @C.entities() c on 1 = 1"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("xX") { Id = 1 } ] }, { - "#B", + "@B", [ new("xX") { Id = 2 } ] }, { - "#C", + "@C", [ new("xX") { Id = 3 } ] @@ -1170,25 +1170,25 @@ public void LeftOuterJoinPassMethodContextTest() var query = @" select a.ToDecimal(a.Id), b.ToDecimal(b.Id), c.ToDecimal(c.Id) -from #A.entities() a -left outer join #B.entities() b on 1 = 1 -left outer join #C.entities() c on 1 = 1"; +from @A.entities() a +left outer join @B.entities() b on 1 = 1 +left outer join @C.entities() c on 1 = 1"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("xX") { Id = 1 } ] }, { - "#B", + "@B", [ new("xX") { Id = 2 } ] }, { - "#C", + "@C", [ new("xX") { Id = 3 } ] @@ -1210,32 +1210,32 @@ public void LeftOuterJoinWithFourOtherJoinsTest() var query = @" select a.ToDecimal(a.Id), b.ToDecimal(b.Id), c.ToDecimal(c.Id), d.ToDecimal(d.Id) -from #A.entities() a -left outer join #B.entities() b on 1 = 1 -left outer join #C.entities() c on 1 = 1 -left outer join #D.entities() d on 1 = 1"; +from @A.entities() a +left outer join @B.entities() b on 1 = 1 +left outer join @C.entities() c on 1 = 1 +left outer join @D.entities() d on 1 = 1"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("xX") { Id = 1 } ] }, { - "#B", + "@B", [ new("xX") { Id = 2 } ] }, { - "#C", + "@C", [ new("xX") { Id = 3 } ] }, { - "#D", + "@D", [ new("xX") { Id = 4 } ] @@ -1256,23 +1256,23 @@ select a.ToDecimal(a.Id), b.ToDecimal(b.Id), c.ToDecimal(c.Id), d.ToDecimal(d.Id public void LeftOuterRightOuterJoinPassMethodContextTest() { - var query = "select a.ToDecimal(a.Id), b.ToDecimal(b.Id), c.ToDecimal(c.Id) from #A.entities() a left outer join #B.entities() b on 1 = 1 right outer join #C.entities() c on 1 = 1"; + var query = "select a.ToDecimal(a.Id), b.ToDecimal(b.Id), c.ToDecimal(c.Id) from @A.entities() a left outer join @B.entities() b on 1 = 1 right outer join @C.entities() c on 1 = 1"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("xX") { Id = 1 } ] }, { - "#B", + "@B", [ new("xX") { Id = 2 } ] }, { - "#C", + "@C", [ new("xX") { Id = 3 } ] @@ -1292,23 +1292,23 @@ public void LeftOuterRightOuterJoinPassMethodContextTest() public void RightOuterLeftOuterJoinPassMethodContextTest() { - var query = "select a.ToDecimal(a.Id), b.ToDecimal(b.Id), c.ToDecimal(c.Id) from #A.entities() a right outer join #B.entities() b on 1 = 1 left outer join #C.entities() c on 1 = 1"; + var query = "select a.ToDecimal(a.Id), b.ToDecimal(b.Id), c.ToDecimal(c.Id) from @A.entities() a right outer join @B.entities() b on 1 = 1 left outer join @C.entities() c on 1 = 1"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("xX") { Id = 1 } ] }, { - "#B", + "@B", [ new("xX") { Id = 2 } ] }, { - "#C", + "@C", [ new("xX") { Id = 3 } ] @@ -1333,23 +1333,23 @@ public void InnerJoinJoinPassMethodContextTest() a.ToDecimal(a.Id), b.ToDecimal(b.Id), c.ToDecimal(c.Id) -from #A.entities() a inner join #B.entities() b on 1 = 1 inner join #C.entities() c on 1 = 1"; +from @A.entities() a inner join @B.entities() b on 1 = 1 inner join @C.entities() c on 1 = 1"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("xX") { Id = 1 } ] }, { - "#B", + "@B", [ new("xX") { Id = 2 } ] }, { - "#C", + "@C", [ new("xX") { Id = 3 } ] @@ -1374,20 +1374,20 @@ public void WhenJoinedByMethodInvocations_ShouldRetrieveValues() countries.GetCountry(), cities.GetCity(), population.GetPopulation() -from #A.entities() countries -inner join #B.entities() cities on countries.GetCountry() = cities.GetCountry() -inner join #C.entities() population on cities.GetCity() = population.GetCity()"; +from @A.entities() countries +inner join @B.entities() cities on countries.GetCountry() = cities.GetCountry() +inner join @C.entities() population on cities.GetCity() = population.GetCity()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Germany", "Berlin") ] }, { - "#B", [ + "@B", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Poland", "Wroclaw"), new BasicEntity("Poland", "Warszawa"), @@ -1396,7 +1396,7 @@ public void WhenJoinedByMethodInvocations_ShouldRetrieveValues() ] }, { - "#C", [ + "@C", [ new BasicEntity {City = "Krakow", Population = 400}, new BasicEntity {City = "Wroclaw", Population = 500}, new BasicEntity {City = "Warszawa", Population = 1000}, @@ -1445,14 +1445,14 @@ public void WhenSelfJoined_ShouldRetrieveValues() select countries.GetCountry(), cities.GetCity() -from #A.entities() countries -inner join #A.entities() cities on countries.Country = cities.Country +from @A.entities() countries +inner join @A.entities() cities on countries.Country = cities.Country "; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Germany", "Berlin") ] @@ -1485,14 +1485,14 @@ public void WhenSelfJoined_WithMethodUsedModifyJoinedValues_ShouldPass() select t.Country, t2.City -from #A.entities() t -inner join #A.entities() t2 on t.Trim(t.Country) = t2.Trim(t2.Country) +from @A.entities() t +inner join @A.entities() t2 on t.Trim(t.Country) = t2.Trim(t2.Country) "; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity(" Poland ", " Krakow"), new BasicEntity("Germany ", " Berlin") ] @@ -1523,9 +1523,9 @@ public void WhenMultipleAliasesAroundCteQuery_LeftOuterJoin_ShouldRetrieveValues var query = @" with first as ( - select a.Country as Country from #A.entities() a + select a.Country as Country from @A.entities() a ), second as ( - select a.Country as Country from #A.entities() a + select a.Country as Country from @A.entities() a ), third as ( select a.Country, @@ -1538,7 +1538,7 @@ with first as ( var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Germany", "Berlin") ] @@ -1575,9 +1575,9 @@ public void WhenMultipleAliasesAroundCteQuery_RightOuterJoin_ShouldRetrieveValue var query = @" with first as ( - select a.Country as Country from #A.entities() a + select a.Country as Country from @A.entities() a ), second as ( - select a.Country as Country from #A.entities() a + select a.Country as Country from @A.entities() a ), third as ( select a.Country, @@ -1590,7 +1590,7 @@ with first as ( var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("Poland", "Krakow"), new BasicEntity("Germany", "Berlin") ] diff --git a/Musoq.Evaluator.Tests/MethodInvocationTests.cs b/Musoq.Evaluator.Tests/MethodInvocationTests.cs index 4cc37e61..6bff22fe 100644 --- a/Musoq.Evaluator.Tests/MethodInvocationTests.cs +++ b/Musoq.Evaluator.Tests/MethodInvocationTests.cs @@ -12,12 +12,12 @@ public class MethodInvocationTests : BasicEntityTestBase [TestMethod] public void MethodInvocationOnAliasFinishedWithNumber_ShouldPass() { - var query = "select population2.GetPopulation() from #A.entities() population2"; + var query = "select population2.GetPopulation() from @A.entities() population2"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -40,12 +40,12 @@ public void MethodInvocationOnAliasFinishedWithNumber_ShouldPass() [TestMethod] public void WhenNullableBooleanFieldWithFullSyntaxApplied_ShouldPass() { - var query = "select City from #A.entities() population2 where Contains(City, 'W') = true"; + var query = "select City from @A.entities() population2 where Contains(City, 'W') = true"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -68,12 +68,12 @@ public void WhenNullableBooleanFieldWithFullSyntaxApplied_ShouldPass() [TestMethod] public void WhenNullableBooleanFieldWithShortenedSyntaxApplied_ShouldPass() { - var query = "select City from #A.entities() population2 where Contains(City, 'W')"; + var query = "select City from @A.entities() population2 where Contains(City, 'W')"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -96,12 +96,12 @@ public void WhenNullableBooleanFieldWithShortenedSyntaxApplied_ShouldPass() [TestMethod] public void WhenNullableBooleanFields_ForBinaryOperator_WithFullSyntaxApplied_ShouldPass() { - var query = "select City from #A.entities() population2 where Contains(City, 'W') = true and Contains(City, 'A') = true"; + var query = "select City from @A.entities() population2 where Contains(City, 'W') = true and Contains(City, 'A') = true"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -124,12 +124,12 @@ public void WhenNullableBooleanFields_ForBinaryOperator_WithFullSyntaxApplied_Sh [TestMethod] public void WhenNullableBooleanFields_ForBinaryOperator_WithShortenedSyntaxApplied_ShouldPass() { - var query = "select City from #A.entities() population2 where Contains(City, 'W') and Contains(City, 'A')"; + var query = "select City from @A.entities() population2 where Contains(City, 'W') and Contains(City, 'A')"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -152,12 +152,12 @@ public void WhenNullableBooleanFields_ForBinaryOperator_WithShortenedSyntaxAppli [TestMethod] public void WhenNullableBooleanFields_ForBinaryOperator_WithMixedSyntaxApplied_FirstExpression_ShouldPass() { - var query = "select City from #A.entities() population2 where Contains(City, 'W') = true and Contains(City, 'A')"; + var query = "select City from @A.entities() population2 where Contains(City, 'W') = true and Contains(City, 'A')"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -180,12 +180,12 @@ public void WhenNullableBooleanFields_ForBinaryOperator_WithMixedSyntaxApplied_F [TestMethod] public void WhenNullableBooleanFields_ForBinaryOperator_WithMixedSyntaxApplied_SecondExpression_ShouldPass() { - var query = "select City from #A.entities() population2 where Contains(City, 'W') and Contains(City, 'A') = true"; + var query = "select City from @A.entities() population2 where Contains(City, 'W') and Contains(City, 'A') = true"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 400), new BasicEntity("KATOWICE", "POLAND", 250), @@ -209,15 +209,15 @@ public void WhenNullableBooleanFields_ForBinaryOperator_WithMixedSyntaxApplied_S [TestMethod] public void WhenMethodCallDoesNotHaveAlias_ShouldThrows() { - var query = "select Contains(first.City, 'W') from #A.entities() first inner join #B.entities() second on first.Country = second.Country"; + var query = "select Contains(first.City, 'W') from @A.entities() first inner join @B.entities() second on first.Country = second.Country"; var sources = new Dictionary> { { - "#A", [] + "@A", [] }, { - "#B", [] + "@B", [] } }; @@ -231,20 +231,20 @@ public void WhenContextsOfInnerCteShouldTurnContextOfResultingTable_ShouldPass() with first as ( select x.Name as Name - from #A.entities() x + from @A.entities() x cross apply x.JustReturnArrayOfString() b ) select p.Value from first b - inner join #A.entities() r on 1 = 1 + inner join @A.entities() r on 1 = 1 cross apply r.MethodArrayOfStrings(r.TestMethodWithInjectEntityAndParameter(b.Name), r.TestMethodWithInjectEntityAndParameter(b.Name)) p """; var sources = new Dictionary>() { { - "#A", [ + "@A", [ new BasicEntity("TEST") ] } diff --git a/Musoq.Evaluator.Tests/MultipleSchemasEvaluatorTests.cs b/Musoq.Evaluator.Tests/MultipleSchemasEvaluatorTests.cs index afdbe0ee..73e0d68e 100644 --- a/Musoq.Evaluator.Tests/MultipleSchemasEvaluatorTests.cs +++ b/Musoq.Evaluator.Tests/MultipleSchemasEvaluatorTests.cs @@ -10,7 +10,7 @@ public class MultipleSchemasEvaluatorTests : MultiSchemaTestBase [TestMethod] public void WhenCompilerMustDecideWhichOneOfTheMethodsUse_ShouldChoseTheFirstOne() { - const string query = "select first.MethodA() from #schema.first() first inner join #schema.second() second on 1 = 1"; + const string query = "select first.MethodA() from @schema.first() first inner join @schema.second() second on 1 = 1"; var vm = CreateAndRunVirtualMachine(query, [ new() @@ -28,7 +28,7 @@ public void WhenCompilerMustDecideWhichOneOfTheMethodsUse_ShouldChoseTheFirstOne [TestMethod] public void WhenCompilerMustDecideWhichOneOfTheMethodsUse_ShouldChoseTheSecondOne() { - const string query = "select second.MethodA() from #schema.first() first inner join #schema.second() second on 1 = 1"; + const string query = "select second.MethodA() from @schema.first() first inner join @schema.second() second on 1 = 1"; var vm = CreateAndRunVirtualMachine(query, [ new() @@ -46,7 +46,7 @@ public void WhenCompilerMustDecideWhichOneOfTheMethodsUse_ShouldChoseTheSecondOn [TestMethod] public void WhenCompilerMustDecideWhichOneOfTheMethodsUse_ShouldChoseFirstOne() { - const string query = "select first.MethodA() from #schema.second() second inner join #schema.first() first on 1 = 1"; + const string query = "select first.MethodA() from @schema.second() second inner join @schema.first() first on 1 = 1"; var vm = CreateAndRunVirtualMachine(query, [ new() @@ -64,7 +64,7 @@ public void WhenCompilerMustDecideWhichOneOfTheMethodsUse_ShouldChoseFirstOne() [TestMethod] public void WhenCompilerMustDecideWhichOneOfTheMethodsUse_TheMethodHasAdditionalArgument_ShouldChoseTheSecondOne() { - const string query = "select second.MethodB('abc') from #schema.second() second inner join #schema.first() first on 1 = 1"; + const string query = "select second.MethodB('abc') from @schema.second() second inner join @schema.first() first on 1 = 1"; var vm = CreateAndRunVirtualMachine(query, [ new() @@ -82,7 +82,7 @@ public void WhenCompilerMustDecideWhichOneOfTheMethodsUse_TheMethodHasAdditional [TestMethod] public void WhenCompilerMustDecideWhichOneOfTheMethodsUse_TheMethodHasAdditionalArgument_ShouldChoseFirstOne() { - const string query = "select first.MethodB('abc') from #schema.first() first inner join #schema.second() second on 1 = 1"; + const string query = "select first.MethodB('abc') from @schema.first() first inner join @schema.second() second on 1 = 1"; var vm = CreateAndRunVirtualMachine(query, [ new() @@ -100,7 +100,7 @@ public void WhenCompilerMustDecideWhichOneOfTheMethodsUse_TheMethodHasAdditional [TestMethod] public void WhenMultipleInjectsWithinMethod_ShouldNotThrow() { - const string query = "select AggregateMethodA() from #schema.first()"; + const string query = "select AggregateMethodA() from @schema.first()"; var vm = CreateAndRunVirtualMachine(query, [ new() @@ -114,7 +114,7 @@ public void WhenMultipleInjectsWithinMethod_ShouldNotThrow() [TestMethod] public void WhenInjectingEntityUsesCommonInterfaceWithMethod_ShouldMatchMethodAndCall() { - const string query = "select MethodC() from #schema.first()"; + const string query = "select MethodC() from @schema.first()"; var vm = CreateAndRunVirtualMachine(query, [ new() @@ -130,7 +130,7 @@ public void WhenInjectingEntityUsesCommonInterfaceWithMethod_ShouldMatchMethodAn [TestMethod] public void WhenMissingAliasButBothObjectsAreTheSame_ShouldNotThrow() { - var query = @"select FirstItem from #schema.first() first inner join #schema.first() second on 1 = 1"; + var query = @"select FirstItem from @schema.first() first inner join @schema.first() second on 1 = 1"; CreateAndRunVirtualMachine(query, [ new() @@ -140,7 +140,7 @@ public void WhenMissingAliasButBothObjectsAreTheSame_ShouldNotThrow() [TestMethod] public void WhenMissingAlias_ShouldThrow() { - var query = @"select FirstItem from #schema.first() first inner join #schema.second() second on 1 = 1"; + var query = @"select FirstItem from @schema.first() first inner join @schema.second() second on 1 = 1"; Assert.ThrowsException(() => CreateAndRunVirtualMachine(query, [ new() diff --git a/Musoq.Evaluator.Tests/NullabilityTests.cs b/Musoq.Evaluator.Tests/NullabilityTests.cs index 694cc985..bb1d0aca 100644 --- a/Musoq.Evaluator.Tests/NullabilityTests.cs +++ b/Musoq.Evaluator.Tests/NullabilityTests.cs @@ -11,12 +11,12 @@ public class NullabilityTests : BasicEntityTestBase [TestMethod] public void QueryWithWhereWithNullableValueResultTest() { - var query = "select NullableValue from #A.Entities() where NullableValue is not null and NullableValue <> 5"; + var query = "select NullableValue from @A.Entities() where NullableValue is not null and NullableValue <> 5"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity{NullableValue = 1}, new BasicEntity{NullableValue = null}, @@ -35,12 +35,12 @@ public void QueryWithWhereWithNullableValueResultTest() [TestMethod] public void WhenOneOfResultsAreExplicitlyNull_ShouldInferNullabilityTypeFromQueryContext() { - var query = "select (case when NullableValue is null then 0 else null end) from #A.Entities()"; + var query = "select (case when NullableValue is null then 0 else null end) from @A.Entities()"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity{NullableValue = null}, new BasicEntity{NullableValue = 125} @@ -60,12 +60,12 @@ public void WhenOneOfResultsAreExplicitlyNull_ShouldInferNullabilityTypeFromQuer [TestMethod] public void QueryWithWhereWithNullableMethodResultTest() { - var query = "select NullableValue from #A.Entities() where NullableMethod(NullableValue) is not null and NullableMethod(NullableValue) <> 5"; + var query = "select NullableValue from @A.Entities() where NullableMethod(NullableValue) is not null and NullableMethod(NullableValue) <> 5"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity{ NullableValue = 1 }, new BasicEntity{ NullableValue = null }, @@ -86,11 +86,11 @@ public void QueryWithWhereWithNullableMethodResultTest() [TestMethod] public void GroupBySingleColumnWithNullGroupTest() { - var query = @"select Name from #A.Entities() group by Name"; + var query = @"select Name from @A.Entities() group by Name"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("ABBA"), new BasicEntity("ABBA"), new BasicEntity("BABBA"), @@ -122,11 +122,11 @@ public void GroupBySingleColumnWithNullGroupTest() [TestMethod] public void GroupByMultiColumnWithNullGroupTest() { - var query = @"select Country, City from #A.Entities() group by Country, City"; + var query = @"select Country, City from @A.Entities() group by Country, City"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("POLAND", "WARSAW"), new BasicEntity("POLAND", null), new BasicEntity("UK", "LONDON"), @@ -178,12 +178,12 @@ public void GroupByMultiColumnWithNullGroupTest() [TestMethod] public void IsNotNullReferenceTypeTest() { - var query = @"select Name from #A.Entities() where Name is not null"; + var query = @"select Name from @A.Entities() where Name is not null"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("001"), new BasicEntity(null), new BasicEntity("003"), new BasicEntity(null), new BasicEntity("005"), new BasicEntity("006") @@ -204,12 +204,12 @@ public void IsNotNullReferenceTypeTest() [TestMethod] public void IsNullReferenceTypeTest() { - var query = @"select City from #A.Entities() where Country is null"; + var query = @"select City from @A.Entities() where Country is null"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("Poland", "Gdansk"), new BasicEntity(null, "Warsaw"), new BasicEntity("France", "Paris"), new BasicEntity(null, "Bratislava") ] @@ -229,12 +229,12 @@ public void IsNullReferenceTypeTest() [TestMethod] public void IsNotNullValueTypeTest() { - var query = @"select Population from #A.Entities() where Population is not null"; + var query = @"select Population from @A.Entities() where Population is not null"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("ABC", 100), new BasicEntity("CBA", 200), new BasicEntity("aaa") ] @@ -262,12 +262,12 @@ public void IsNotNullValueTypeTest() [TestMethod] public void IsNullValueTypeTest() { - var query = @"select Population from #A.Entities() where Population is null"; + var query = @"select Population from @A.Entities() where Population is null"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("ABC", 100), new BasicEntity("CBA", 200), @@ -285,12 +285,12 @@ public void IsNullValueTypeTest() [TestMethod] public void OrOperator_WhenLeftFieldIsNull_ShouldShowLeftNull() { - var query = @"select Country, City from #A.Entities() where City is null or Country = 'England'"; + var query = @"select Country, City from @A.Entities() where City is null or Country = 'England'"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("Poland", "Warsaw"), new BasicEntity("England", "London"), @@ -325,12 +325,12 @@ public void OrOperator_WhenLeftFieldIsNull_ShouldShowLeftNull() [TestMethod] public void OrOperator_WhenRightFieldIsNull_ShouldShowLeftNull() { - var query = @"select Country, City from #A.Entities() where Country = 'Poland' or Country is null"; + var query = @"select Country, City from @A.Entities() where Country = 'Poland' or Country is null"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("Poland", "Warsaw"), new BasicEntity("England", "London"), @@ -365,12 +365,12 @@ public void OrOperator_WhenRightFieldIsNull_ShouldShowLeftNull() [TestMethod] public void OrOperator_WhenBothFieldsAreNull_ShouldShowThreeRows() { - var query = @"select Country, City from #A.Entities() where City is null or Country is null"; + var query = @"select Country, City from @A.Entities() where City is null or Country is null"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("Poland", "Warsaw"), new BasicEntity("England", "London"), @@ -405,12 +405,12 @@ public void OrOperator_WhenBothFieldsAreNull_ShouldShowThreeRows() [TestMethod] public void AndOperator_WhenLeftFieldIsNull_ShouldShowLeftNull() { - var query = @"select Country, City from #A.Entities() where City is null and Country = 'Brazil'"; + var query = @"select Country, City from @A.Entities() where City is null and Country = 'Brazil'"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("Poland", "Warsaw"), new BasicEntity("England", "London"), @@ -433,12 +433,12 @@ public void AndOperator_WhenLeftFieldIsNull_ShouldShowLeftNull() [TestMethod] public void AndOperator_WhenRightFieldIsNull_ShouldShowLeftNull() { - var query = @"select Country, City from #A.Entities() where City = 'Bratislava' and Country is null"; + var query = @"select Country, City from @A.Entities() where City = 'Bratislava' and Country is null"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("Poland", "Warsaw"), new BasicEntity("England", "London"), @@ -461,12 +461,12 @@ public void AndOperator_WhenRightFieldIsNull_ShouldShowLeftNull() [TestMethod] public void AndOperator_WhenBothFieldsAreNull_ShouldShowThreeRows() { - var query = @"select Country, City from #A.Entities() where City is null and Country is null"; + var query = @"select Country, City from @A.Entities() where City is null and Country is null"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("Poland", "Warsaw"), new BasicEntity("England", "London"), @@ -489,12 +489,12 @@ public void AndOperator_WhenBothFieldsAreNull_ShouldShowThreeRows() [TestMethod] public void WhenMethodCalledWithNullValue_ShouldReturnNull() { - var query = @"select NullableMethod(null) from #A.Entities()"; + var query = @"select NullableMethod(null) from @A.Entities()"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity{ NullableValue = 1 }, new BasicEntity{ NullableValue = null }, diff --git a/Musoq.Evaluator.Tests/OrderByTests.cs b/Musoq.Evaluator.Tests/OrderByTests.cs index 867b8047..d5d559ee 100644 --- a/Musoq.Evaluator.Tests/OrderByTests.cs +++ b/Musoq.Evaluator.Tests/OrderByTests.cs @@ -12,11 +12,11 @@ public class OrderByTests : BasicEntityTestBase [TestMethod] public void WhenOrderByColumn_ShouldSucceed() { - var query = @"select City from #A.Entities() order by Money"; + var query = @"select City from @A.Entities() order by Money"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("cracow", "jan", Convert.ToDecimal(-200)) @@ -36,11 +36,11 @@ public void WhenOrderByColumn_ShouldSucceed() [TestMethod] public void WhenOrderByDescColumn_ShouldSucceed() { - var query = @"select City from #A.Entities() order by Money desc"; + var query = @"select City from @A.Entities() order by Money desc"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), new BasicEntity("cracow", "jan", Convert.ToDecimal(-200)) @@ -60,11 +60,11 @@ public void WhenOrderByDescColumn_ShouldSucceed() [TestMethod] public void WhenOrderByMultipleColumnFirstDesc_ShouldSucceed() { - var query = @"select City from #A.Entities() order by Money desc, Name"; + var query = @"select City from @A.Entities() order by Money desc, Name"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), new BasicEntity("cracow", "jan", Convert.ToDecimal(-200)) @@ -84,11 +84,11 @@ public void WhenOrderByMultipleColumnFirstDesc_ShouldSucceed() [TestMethod] public void WhenOrderByMultipleColumns_ShoulSucceed() { - var query = @"select City from #A.Entities() order by Money, Name"; + var query = @"select City from @A.Entities() order by Money, Name"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), new BasicEntity("cracow", "jan", Convert.ToDecimal(-200)) @@ -108,11 +108,11 @@ public void WhenOrderByMultipleColumns_ShoulSucceed() [TestMethod] public void WhenOrderByMultipleColumnsBothDesc_ShouldSucceed() { - var query = @"select City from #A.Entities() order by Money desc, Name desc"; + var query = @"select City from @A.Entities() order by Money desc, Name desc"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), new BasicEntity("cracow", "jan", Convert.ToDecimal(-200)) @@ -132,11 +132,11 @@ public void WhenOrderByMultipleColumnsBothDesc_ShouldSucceed() [TestMethod] public void WhenOrderByMultipleColumnsSecondColumnDesc_ShouldSucceed() { - var query = @"select City + '-' + ToString(Money) from #A.Entities() order by City, Money desc"; + var query = @"select City + '-' + ToString(Money) from @A.Entities() order by City, Money desc"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("katowice", "feb", Convert.ToDecimal(100)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), @@ -158,11 +158,11 @@ public void WhenOrderByMultipleColumnsSecondColumnDesc_ShouldSucceed() [TestMethod] public void WhenOrderByAfterGroupBy_ShouldSuccess() { - var query = @"select City from #A.Entities() group by City order by City"; + var query = @"select City from @A.Entities() group by City order by City"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("katowice", "feb", Convert.ToDecimal(100)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), @@ -183,11 +183,11 @@ public void WhenOrderByAfterGroupBy_ShouldSuccess() [TestMethod] public void WhenOrderByWithDescAfterGroupBy_ShouldSucceed() { - var query = @"select City from #A.Entities() group by City order by City desc"; + var query = @"select City from @A.Entities() group by City order by City desc"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("katowice", "feb", Convert.ToDecimal(100)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), @@ -208,11 +208,11 @@ public void WhenOrderByWithDescAfterGroupBy_ShouldSucceed() [TestMethod] public void WhenOrderByWithGroupByMultipleColumnAndFirstDesc_ShouldSucceed() { - var query = @"select City, Money from #A.Entities() group by City, Money order by City desc, Money"; + var query = @"select City, Money from @A.Entities() group by City, Money order by City desc, Money"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("katowice", "feb", Convert.ToDecimal(100)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), @@ -238,11 +238,11 @@ public void WhenOrderByWithGroupByMultipleColumnAndFirstDesc_ShouldSucceed() [TestMethod] public void WhenOrderByAfterGroupByMultipleColumnBothDesc_ShouldSucceed() { - var query = @"select City, Money from #A.Entities() group by City, Money order by City desc, Money desc"; + var query = @"select City, Money from @A.Entities() group by City, Money order by City desc, Money desc"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("katowice", "feb", Convert.ToDecimal(100)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), @@ -268,11 +268,11 @@ public void WhenOrderByAfterGroupByMultipleColumnBothDesc_ShouldSucceed() [TestMethod] public void WhenOrderByAfterGroupByHaving_ShouldSucceed() { - var query = @"select City, Sum(Money) from #A.Entities() group by City having Sum(Money) >= 400 order by City"; + var query = @"select City, Sum(Money) from @A.Entities() group by City having Sum(Money) >= 400 order by City"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("katowice", "feb", Convert.ToDecimal(100)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), @@ -294,11 +294,11 @@ public void WhenOrderByAfterGroupByHaving_ShouldSucceed() [TestMethod] public void WhenOrderByDescAfterGroupByHaving_ShouldSucceed() { - var query = @"select City, Sum(Money) from #A.Entities() group by City having Sum(Money) >= 400 order by City desc"; + var query = @"select City, Sum(Money) from @A.Entities() group by City having Sum(Money) >= 400 order by City desc"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("katowice", "feb", Convert.ToDecimal(100)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), @@ -320,12 +320,12 @@ public void WhenOrderByDescAfterGroupByHaving_ShouldSucceed() [TestMethod] public void WhenOrderByClauseWithOperation_ShouldSucceed() { - const string query = @"select Money from #A.Entities() order by Money * -1"; + const string query = @"select Money from @A.Entities() order by Money * -1"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("katowice", "feb", Convert.ToDecimal(100)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), @@ -350,12 +350,12 @@ public void WhenOrderByClauseWithOperation_ShouldSucceed() [TestMethod] public void WhenOrderByClauseWithOperationDesc_ShouldSucceed() { - var query = @"select Money from #A.Entities() order by Money * -1 desc"; + var query = @"select Money from @A.Entities() order by Money * -1 desc"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("katowice", "feb", Convert.ToDecimal(100)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), @@ -380,12 +380,12 @@ public void WhenOrderByClauseWithOperationDesc_ShouldSucceed() [TestMethod] public void WhenOrderByWithinCteExpression_ShouldSucceed() { - const string query = @"with cte as ( select City, Money from #A.Entities() order by Money ) select City from cte"; + const string query = @"with cte as ( select City, Money from @A.Entities() order by Money ) select City from cte"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("katowice", "feb", Convert.ToDecimal(100)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), @@ -419,12 +419,12 @@ public void WhenOrderByWithinCteExpression_ShouldSucceed() [TestMethod] public void WhenOrderByDescWithinCteExpression_ShouldSucceed() { - const string query = @"with cte as ( select City, Money from #A.Entities() order by Money desc ) select City from cte"; + const string query = @"with cte as ( select City, Money from @A.Entities() order by Money desc ) select City from cte"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("katowice", "feb", Convert.ToDecimal(100)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), @@ -449,12 +449,12 @@ public void WhenOrderByDescWithinCteExpression_ShouldSucceed() [TestMethod] public void WhenOrderByWithMultipleColumnsFirstDescWithinCteExpression_ShouldSucceed() { - const string query = @"with cte as ( select City, Money from #A.Entities() order by Money desc, City ) select City from cte"; + const string query = @"with cte as ( select City, Money from @A.Entities() order by Money desc, City ) select City from cte"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("katowice", "feb", Convert.ToDecimal(100)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), @@ -480,12 +480,12 @@ public void WhenOrderByWithMultipleColumnsFirstDescWithinCteExpression_ShouldSuc [TestMethod] public void WhenOrderByWithMultipleColumnsBothDescWithinCteExpression_ShouldSucceed() { - const string query = @"with cte as ( select City, Money from #A.Entities() order by Money desc, City desc ) select City from cte"; + const string query = @"with cte as ( select City, Money from @A.Entities() order by Money desc, City desc ) select City from cte"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("katowice", "feb", Convert.ToDecimal(100)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), @@ -514,12 +514,12 @@ public void WhenOrderByWithMultipleColumnsBothDescWithinCteExpression_ShouldSucc [TestMethod] public void WhenOrderByWithMultipleColumnsBothDescWithinCteExpression_BothRetrieved_ShouldSucceed() { - const string query = @"with cte as ( select City, Money from #A.Entities() order by Money desc, City desc ) select City, Money from cte"; + const string query = @"with cte as ( select City, Money from @A.Entities() order by Money desc, City desc ) select City, Money from cte"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("katowice", "feb", Convert.ToDecimal(100)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), @@ -562,12 +562,12 @@ public void WhenOrderByWithMultipleColumnsBothDescWithinCteExpression_BothRetrie [TestMethod] public void WhenOrderByCaseWhenExpression_ShouldSucceed() { - var query = @"select City from #A.Entities() order by case when Money > 0 then Money else 0d end"; + var query = @"select City from @A.Entities() order by case when Money > 0 then Money else 0d end"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("katowice", "feb", Convert.ToDecimal(100)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), @@ -592,12 +592,12 @@ public void WhenOrderByCaseWhenExpression_ShouldSucceed() [TestMethod] public void WhenOrderByCaseWhenDescExpression_ShouldSucceed() { - var query = @"select City from #A.Entities() order by case when Money > 0 then Money else 0d end desc"; + var query = @"select City from @A.Entities() order by case when Money > 0 then Money else 0d end desc"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("katowice", "feb", Convert.ToDecimal(100)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), @@ -622,12 +622,12 @@ public void WhenOrderByCaseWhenDescExpression_ShouldSucceed() [TestMethod] public void WhenOrderByMultipleColumnsFirstOneIsCaseWhenExpression_ShouldSucceed() { - var query = @"select City from #A.Entities() order by case when Money > 0 then Money else 0d end, City"; + var query = @"select City from @A.Entities() order by case when Money > 0 then Money else 0d end, City"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("katowice", "feb", Convert.ToDecimal(100)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), @@ -652,12 +652,12 @@ public void WhenOrderByMultipleColumnsFirstOneIsCaseWhenExpression_ShouldSucceed [TestMethod] public void WhenOrderByMultipleColumnsFirstOneIsCaseWhenDescExpression_ShouldSucceed() { - var query = @"select City from #A.Entities() order by case when Money > 0 then Money else 0d end desc, City desc"; + var query = @"select City from @A.Entities() order by case when Money > 0 then Money else 0d end desc, City desc"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("katowice", "feb", Convert.ToDecimal(100)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), @@ -682,12 +682,12 @@ public void WhenOrderByMultipleColumnsFirstOneIsCaseWhenDescExpression_ShouldSuc [TestMethod] public void WhenOrderByWithInnerJoin_ShouldSucceed() { - var query = @"select a.City from #A.Entities() a inner join #A.Entities() b on a.City = b.City order by a.Money"; + var query = @"select a.City from @A.Entities() a inner join @A.Entities() b on a.City = b.City order by a.Money"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), new BasicEntity("cracow", "jan", Convert.ToDecimal(10)), @@ -710,12 +710,12 @@ public void WhenOrderByWithInnerJoin_ShouldSucceed() [TestMethod] public void WhenOrderByDescendingWithInnerJoin_ShouldSucceed() { - var query = @"select a.City from #A.Entities() a inner join #A.Entities() b on a.City = b.City order by a.Money desc"; + var query = @"select a.City from @A.Entities() a inner join @A.Entities() b on a.City = b.City order by a.Money desc"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), new BasicEntity("cracow", "jan", Convert.ToDecimal(10)), @@ -738,12 +738,12 @@ public void WhenOrderByDescendingWithInnerJoin_ShouldSucceed() [TestMethod] public void WhenOrderByWithInnerJoinAndGroupBy_ShouldSucceed() { - var query = @"select a.City from #A.Entities() a inner join #A.Entities() b on a.City = b.City group by a.City order by a.City"; + var query = @"select a.City from @A.Entities() a inner join @A.Entities() b on a.City = b.City group by a.City order by a.City"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), new BasicEntity("cracow", "jan", Convert.ToDecimal(10)), @@ -766,12 +766,12 @@ public void WhenOrderByWithInnerJoinAndGroupBy_ShouldSucceed() [TestMethod] public void WhenOrderByDescendingWithInnerJoinAndGroupBy_ShouldSucceed() { - var query = @"select a.City from #A.Entities() a inner join #A.Entities() b on a.City = b.City group by a.City order by a.City desc"; + var query = @"select a.City from @A.Entities() a inner join @A.Entities() b on a.City = b.City group by a.City order by a.City desc"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("katowice", "jan", Convert.ToDecimal(300)), new BasicEntity("czestochowa", "jan", Convert.ToDecimal(400)), new BasicEntity("cracow", "jan", Convert.ToDecimal(10)), @@ -798,14 +798,14 @@ public void WhenOrderByWithGroupBy_ShouldSucceed() select a.GetTypeName(a.Name), a.Count(a.Name) - from #A.Entities() a + from @A.Entities() a group by a.GetTypeName(a.Name) order by a.GetTypeName(a.Name) """; var sources = new Dictionary> { { - "#A", [new BasicEntity("a"), new BasicEntity("b"), new BasicEntity("c")] + "@A", [new BasicEntity("a"), new BasicEntity("b"), new BasicEntity("c")] } }; diff --git a/Musoq.Evaluator.Tests/OuterApplyCteTests.cs b/Musoq.Evaluator.Tests/OuterApplyCteTests.cs index d3b8e898..d8da2313 100644 --- a/Musoq.Evaluator.Tests/OuterApplyCteTests.cs +++ b/Musoq.Evaluator.Tests/OuterApplyCteTests.cs @@ -40,7 +40,7 @@ public void WhenSchemaMethodOuterAppliedWithAnotherSchema_WithinCte_ShouldPass() { const string query = @" with p as ( - select a.City, a.Country, a.Population, b.Country, b.Money, b.Month from #schema.first() a outer apply #schema.second(a.Country) b + select a.City, a.Country, a.Population, b.Country, b.Money, b.Month from @schema.first() a outer apply @schema.second(a.Country) b ) select [a.City], [a.Country], [a.Population], [b.Country], [b.Money], [b.Month] from p"; @@ -129,9 +129,9 @@ with p as ( f.City as City, f.Country as Country, f.Population as Population - from #schema.first() f + from @schema.first() f ) -select a.City, a.Country, a.Population, b.Country, b.Money, b.Month from p a outer apply #schema.second(a.Country) b"; +select a.City, a.Country, a.Population, b.Country, b.Money, b.Month from p a outer apply @schema.second(a.Country) b"; var firstSource = new List { @@ -214,7 +214,7 @@ public void WhenSchemaMethodOuterAppliedSelfProperty_WithinCte_ShouldPass() { const string query = @" with p as ( - select a.Name, b.Value from #schema.first() a outer apply a.Skills b + select a.Name, b.Value from @schema.first() a outer apply a.Skills b ) select [a.Name], [b.Value] from p"; @@ -294,7 +294,7 @@ public void WhenSchemaMethodOuterAppliedSelfProperty_UsesCte_ShouldPass() { const string query = @" with first as ( - select a.Name as Name, a.Skills as Skills from #schema.first() a + select a.Name as Name, a.Skills as Skills from @schema.first() a ) select a.Name, b.Value from first a outer apply a.Skills b"; diff --git a/Musoq.Evaluator.Tests/OuterApplyMethodTests.cs b/Musoq.Evaluator.Tests/OuterApplyMethodTests.cs index 0e451ca5..8419baf8 100644 --- a/Musoq.Evaluator.Tests/OuterApplyMethodTests.cs +++ b/Musoq.Evaluator.Tests/OuterApplyMethodTests.cs @@ -23,7 +23,7 @@ private class OuterApplyClass2 [TestMethod] public void OuterApplyProperty_NoMatch_ShouldPass() { - const string query = "select b.Value from #schema.first() a outer apply a.Split(a.Value2, ' ') as b"; + const string query = "select b.Value from @schema.first() a outer apply a.Split(a.Value2, ' ') as b"; var firstSource = new List { @@ -49,7 +49,7 @@ public void OuterApplyProperty_NoMatch_ShouldPass() [TestMethod] public void OuterApplyProperty_SplitStringToWords_ShouldPass() { - const string query = "select b.Value from #schema.first() a outer apply a.Split(a.Text, ' ') as b"; + const string query = "select b.Value from @schema.first() a outer apply a.Split(a.Text, ' ') as b"; var firstSource = new List { @@ -78,7 +78,7 @@ public void OuterApplyProperty_SplitStringToWords_ShouldPass() [TestMethod] public void OuterApplyProperty_SkipAfterSplit_ShouldPass() { - const string query = "select b.Value from #schema.first() a outer apply a.Skip(a.Split(a.Text, ' '), 1) as b"; + const string query = "select b.Value from @schema.first() a outer apply a.Skip(a.Split(a.Text, ' '), 1) as b"; var firstSource = new List { @@ -110,7 +110,7 @@ public void OuterApplyProperty_SkipAfterSplit_ShouldPass() [TestMethod] public void OuterApplyProperty_TakeSkipAfterSplit_ShouldPass() { - const string query = "select b.Value from #schema.first() a outer apply a.Take(a.Skip(a.Split(a.Text, ' '), 1), 6) as b"; + const string query = "select b.Value from @schema.first() a outer apply a.Take(a.Skip(a.Split(a.Text, ' '), 1), 6) as b"; var firstSource = new List { @@ -141,7 +141,7 @@ public void OuterApplyProperty_TakeSkipAfterSplit_ShouldPass() [TestMethod] public void OuterApplyProperty_WhereCondition_ShouldPass() { - const string query = "select b.Value from #schema.first() a outer apply a.Split(a.Text, ' ') as b where b.Value.Length > 5"; + const string query = "select b.Value from @schema.first() a outer apply a.Split(a.Text, ' ') as b where b.Value.Length > 5"; var firstSource = new List { @@ -168,7 +168,7 @@ public void OuterApplyProperty_WhereCondition_ShouldPass() [TestMethod] public void OuterApplyProperty_GroupBy_ShouldPass() { - const string query = "select b.Length(b.Value), b.Count(b.Length(b.Value)) from #schema.first() a outer apply a.Split(a.Text, ' ') as b group by b.Length(b.Value)"; + const string query = "select b.Length(b.Value), b.Count(b.Length(b.Value)) from @schema.first() a outer apply a.Split(a.Text, ' ') as b group by b.Length(b.Value)"; var firstSource = new List { @@ -214,7 +214,7 @@ public void OuterApplyProperty_GroupBy_ShouldPass() [TestMethod] public void OuterApplyProperty_MultipleSplitWords_ShouldPass() { - const string query = "select b.Value, c.Value from #schema.first() a outer apply a.Split(a.Text, ' ') as b outer apply a.Split(a.Text, ' ') as c"; + const string query = "select b.Value, c.Value from @schema.first() a outer apply a.Split(a.Text, ' ') as b outer apply a.Split(a.Text, ' ') as c"; string[] words = ["Lorem", "ipsum", "dolor", "sit", "amet,", "consectetur", "adipiscing", "elit."]; diff --git a/Musoq.Evaluator.Tests/OuterApplyMixedTests.cs b/Musoq.Evaluator.Tests/OuterApplyMixedTests.cs index caee2297..09ddfcc2 100644 --- a/Musoq.Evaluator.Tests/OuterApplyMixedTests.cs +++ b/Musoq.Evaluator.Tests/OuterApplyMixedTests.cs @@ -41,8 +41,8 @@ public void OuterApply_SchemaAndProperty_WithNestedProperty_ShouldPass() b.Country, c.StreetName, c.HouseNumber - from #schema.first() a - outer apply #schema.second(a.Country) b + from @schema.first() a + outer apply @schema.second(a.Country) b outer apply b.Addresses c"; var firstSource = new OuterApplyClass1[] @@ -150,8 +150,8 @@ public void OuterApply_SchemaAndMethod_WithComplexObjects_ShouldPass() b.Name, b.Salary, c.Value - from #schema.first() a - outer apply #schema.second(a.Department) b + from @schema.first() a + outer apply @schema.second(a.Department) b outer apply b.Distinct(b.Skills) c"; var firstSource = new OuterApplyClass3[] @@ -239,7 +239,7 @@ public void OuterApply_PropertyAndMethod_WithFiltering_ShouldPass() a.Department, b.Name, c.Value - from #schema.first() a + from @schema.first() a outer apply a.Employees b outer apply a.Distinct(b.Skills) c where a.Budget > 400000"; @@ -302,7 +302,7 @@ public void OuterApply_PropertyAndMethod_GroupBy_WithFiltering_ShouldPass() select a.Department, Count(a.Department) - from #schema.first() a + from @schema.first() a outer apply a.Employees b outer apply a.Distinct(b.Skills) c where a.Budget > 400000 @@ -378,8 +378,8 @@ public void OuterApply_InnerJoinAndUseProperty_ShouldPass() a.Name, a.Surname, c.Value - from #schema.first() a - inner join #schema.second() b on a.Id = b.Id + from @schema.first() a + inner join @schema.second() b on a.Id = b.Id outer apply b.Skills c"; var firstSource = new OuterApplyClass6[] @@ -454,8 +454,8 @@ public void OuterApply_LeftJoinAndUseProperty_ShouldPass() a.Name, a.Surname, c.Value - from #schema.first() a - left outer join #schema.second() b on a.Id = b.Id + from @schema.first() a + left outer join @schema.second() b on a.Id = b.Id outer apply b.Skills c"; var firstSource = new OuterApplyClass6[] diff --git a/Musoq.Evaluator.Tests/OuterApplySelfPropertyTests.cs b/Musoq.Evaluator.Tests/OuterApplySelfPropertyTests.cs index c237ec31..2c57cb2c 100644 --- a/Musoq.Evaluator.Tests/OuterApplySelfPropertyTests.cs +++ b/Musoq.Evaluator.Tests/OuterApplySelfPropertyTests.cs @@ -79,7 +79,7 @@ public class ComplexType6 [TestMethod] public void OuterApplyProperty_NoMatch_ShouldPass() { - const string query = "select a.City, b.Value from #schema.first() a outer apply a.Values as b"; + const string query = "select a.City, b.Value from @schema.first() a outer apply a.Values as b"; var firstSource = new List { @@ -106,7 +106,7 @@ public void OuterApplyProperty_NoMatch_ShouldPass() [TestMethod] public void OuterApplyProperty_WithPrimitiveArray_ShouldPass() { - const string query = "select a.City, b.Value from #schema.first() a outer apply a.Values as b"; + const string query = "select a.City, b.Value from @schema.first() a outer apply a.Values as b"; var firstSource = new List { @@ -149,7 +149,7 @@ public void OuterApplyProperty_WithPrimitiveArray_ShouldPass() [TestMethod] public void OuterApplyProperty_WithWhere_ShouldPass() { - const string query = "select a.City, b.Value from #schema.first() a outer apply a.Values as b where b.Value >= 2"; + const string query = "select a.City, b.Value from @schema.first() a outer apply a.Values as b where b.Value >= 2"; var firstSource = new List { @@ -200,7 +200,7 @@ public void OuterApplyProperty_WithWhere_ShouldPass() [TestMethod] public void OuterApplyProperty_WithGroupBy_ShouldPass() { - const string query = "select a.City, a.Sum(b.Value) from #schema.first() a outer apply a.Values as b group by a.City"; + const string query = "select a.City, a.Sum(b.Value) from @schema.first() a outer apply a.Values as b group by a.City"; var firstSource = new List { @@ -240,7 +240,7 @@ public void OuterApplyProperty_WithGroupBy_ShouldPass() [TestMethod] public void OuterApplyProperty_WithPrimitiveList_ShouldPass() { - const string query = "select a.City, b.Value from #schema.first() a outer apply a.Values as b"; + const string query = "select a.City, b.Value from @schema.first() a outer apply a.Values as b"; var firstSource = new List { @@ -296,7 +296,7 @@ public void OuterApplyProperty_WithPrimitiveList_ShouldPass() [TestMethod] public void OuterApplyProperty_WithComplexArray_ShouldPass() { - const string query = "select a.City, b.Value1, b.Value2 from #schema.first() a outer apply a.Values as b"; + const string query = "select a.City, b.Value1, b.Value2 from @schema.first() a outer apply a.Values as b"; var firstSource = new List { @@ -362,7 +362,7 @@ public void OuterApplyProperty_WithComplexArray_ShouldPass() [TestMethod] public void OuterApplyProperty_WithComplexList_ShouldPass() { - const string query = "select a.City, b.Value1, b.Value2 from #schema.first() a outer apply a.Values as b"; + const string query = "select a.City, b.Value1, b.Value2 from @schema.first() a outer apply a.Values as b"; var firstSource = new List { @@ -428,7 +428,7 @@ public void OuterApplyProperty_WithComplexList_ShouldPass() [TestMethod] public void OuterApplyProperty_MultiplePrimitiveArrays_ShouldPass() { - const string query = "select b.Value, c.Value from #schema.first() a outer apply a.Values1 as b outer apply a.Values2 as c"; + const string query = "select b.Value, c.Value from @schema.first() a outer apply a.Values1 as b outer apply a.Values2 as c"; var firstSource = new List { @@ -502,7 +502,7 @@ public void WhenApplyChainedProperty_WithPrimitiveList_ShouldPass() const string query = """ select b.Value - from #schema.first() a + from @schema.first() a outer apply a.ComplexType.PrimitiveValues as b """; @@ -542,7 +542,7 @@ public void WhenApplyChainedProperty_WithComplexList_ShouldPass() const string query = """ select b.Value - from #schema.first() a + from @schema.first() a outer apply a.ComplexType.ComplexValues as b """; diff --git a/Musoq.Evaluator.Tests/OuterApplyTests.cs b/Musoq.Evaluator.Tests/OuterApplyTests.cs index 98f2afa8..aa92e476 100644 --- a/Musoq.Evaluator.Tests/OuterApplyTests.cs +++ b/Musoq.Evaluator.Tests/OuterApplyTests.cs @@ -36,7 +36,7 @@ private class OuterApplyClass3 [TestMethod] public void OuterApply_NoMatchesShouldReturnNull_ShouldPass() { - const string query = "select a.City, a.Country, a.Population, b.Country, b.Money, b.Month from #schema.first() a outer apply #schema.second(a.Country) b"; + const string query = "select a.City, a.Country, a.Population, b.Country, b.Money, b.Month from @schema.first() a outer apply @schema.second(a.Country) b"; var firstSource = new List { @@ -108,7 +108,7 @@ public void OuterApply_NoMatchesShouldReturnNull_ShouldPass() [TestMethod] public void OuterApply_MultipleMatches_ShouldPass() { - const string query = "select a.City, a.Country, b.Money, b.Month from #schema.first() a outer apply #schema.second(a.Country) b"; + const string query = "select a.City, a.Country, b.Money, b.Month from @schema.first() a outer apply @schema.second(a.Country) b"; var firstSource = new List { @@ -162,7 +162,7 @@ public void OuterApply_MultipleMatches_ShouldPass() [TestMethod] public void OuterApply_NoMatches_ShouldPass() { - const string query = "select a.City, a.Country, b.Money, b.Month from #schema.first() a outer apply #schema.second(a.Country) b"; + const string query = "select a.City, a.Country, b.Money, b.Month from @schema.first() a outer apply @schema.second(a.Country) b"; var firstSource = new List { @@ -204,9 +204,9 @@ public void OuterApply_TripleApply_ShouldPass() { const string query = @" select a.City, a.Country, b.Money, b.Month, c.Address - from #schema.first() a - outer apply #schema.second(a.Country) b - outer apply #schema.third(a.Country) c"; + from @schema.first() a + outer apply @schema.second(a.Country) b + outer apply @schema.third(a.Country) c"; var firstSource = new List { @@ -271,8 +271,8 @@ public void OuterApply_WithAggregation_ShouldPass() { const string query = @" select a.Country, b.Sum(b.Money) as TotalMoney, b.Count(b.Money) as TransactionCount - from #schema.first() a - outer apply #schema.second(a.Country) b + from @schema.first() a + outer apply @schema.second(a.Country) b group by a.Country"; var firstSource = new List @@ -332,8 +332,8 @@ public void OuterApply_WithWhereClause_ShouldPass() { const string query = @" select a.City, a.Country, b.Money, b.Month - from #schema.first() a - outer apply #schema.second(a.Country) b + from @schema.first() a + outer apply @schema.second(a.Country) b where b.Money > 1500 or b.Money is null"; var firstSource = new List diff --git a/Musoq.Evaluator.Tests/PassInferredColumnsTests.cs b/Musoq.Evaluator.Tests/PassInferredColumnsTests.cs index 508570df..e1cab617 100644 --- a/Musoq.Evaluator.Tests/PassInferredColumnsTests.cs +++ b/Musoq.Evaluator.Tests/PassInferredColumnsTests.cs @@ -12,7 +12,7 @@ public class PassInferredColumnsTests : UnknownQueryTestsBase [TestMethod] public void PassInferredColumnsTest() { - var query = "select Name, Surname, ContactNumber from #test.whatever() where Country = 'Poland'"; + var query = "select Name, Surname, ContactNumber from @test.whatever() where Country = 'Poland'"; dynamic first = new ExpandoObject(); first.Name = "Roland"; @@ -55,7 +55,7 @@ public void PassInferredColumnsBasedOnCouplingSyntaxTest() " Age 'System.Int32'," + " Country 'System.String'" + "};" + - "couple #test.whatever with table Persons as SourceOfPersons;" + + "couple @test.whatever with table Persons as SourceOfPersons;" + "select Name, Age from SourceOfPersons() where Country = 'Poland';"; dynamic first = new ExpandoObject(); @@ -96,7 +96,7 @@ public void PassInferredColumnsWithJoinBetweenTwoCoupledTables() " Age 'System.Int32'," + " Country 'System.String'" + "};" + - "couple #test.whatever with table Persons as SourceOfPersons;" + + "couple @test.whatever with table Persons as SourceOfPersons;" + "select p1.Name, p1.Age, p2.Name, p2.Age from SourceOfPersons() p1 inner join SourceOfPersons() p2 on p1.Country = p2.Country " + "where p1.Country = 'Poland' and p1.Name <> p2.Name;"; @@ -160,7 +160,7 @@ public void PassInferredColumnsWithSetOfCoupledTables() " Age 'System.Int32'," + " Country 'System.String'" + "};" + - "couple #test.whatever with table Persons as SourceOfPersons;" + + "couple @test.whatever with table Persons as SourceOfPersons;" + "select Name, Age from SourceOfPersons() where Country = 'Poland' " + "union all (Name, Age) " + "select Name, Age from SourceOfPersons() where Country = 'USA';"; diff --git a/Musoq.Evaluator.Tests/PassPrimitiveTypesTests.cs b/Musoq.Evaluator.Tests/PassPrimitiveTypesTests.cs index 2223f3b8..81e6bac5 100644 --- a/Musoq.Evaluator.Tests/PassPrimitiveTypesTests.cs +++ b/Musoq.Evaluator.Tests/PassPrimitiveTypesTests.cs @@ -18,7 +18,7 @@ public class PassPrimitiveTypesTests : BasicEntityTestBase [TestMethod] public void GetSchemaTableAndRowSourcePassedPrimitiveArgumentsTest() { - var query = "select 1 from #test.whatever(1, 2d, true, false, 'text')"; + var query = "select 1 from @test.whatever(1, 2d, true, false, 'text')"; var vm = CreateAndRunVirtualMachine(query, new List(), (passedParams) => { @@ -35,7 +35,7 @@ public void GetSchemaTableAndRowSourcePassedPrimitiveArgumentsTest() [TestMethod] public void CallWithPrimitiveArgumentsTest() { - var query = "select PrimitiveArgumentsMethod(1, 2d, true, false, 'text') from #test.whatever()"; + var query = "select PrimitiveArgumentsMethod(1, 2d, true, false, 'text') from @test.whatever()"; var vm = CreateAndRunVirtualMachine(query, new List(), (passedParams) => { diff --git a/Musoq.Evaluator.Tests/RewriteWhereExpressionToPassItToDataSourceTests.cs b/Musoq.Evaluator.Tests/RewriteWhereExpressionToPassItToDataSourceTests.cs index 969692c6..92a7787a 100644 --- a/Musoq.Evaluator.Tests/RewriteWhereExpressionToPassItToDataSourceTests.cs +++ b/Musoq.Evaluator.Tests/RewriteWhereExpressionToPassItToDataSourceTests.cs @@ -10,7 +10,7 @@ public class RewriteWhereExpressionToPassItToDataSourceTests : BasicEntityTestBa [TestMethod] public void WhenWhereExpressionIsNotRewritten_ShouldPass() { - var query = "select 1 from #A.entities() a where a.Population > 0"; + var query = "select 1 from @A.entities() a where a.Population > 0"; var buildItems = CreateBuildItems(query); @@ -29,7 +29,7 @@ public void WhenWhereExpressionIsNotRewritten_ShouldPass() [TestMethod] public void WhenLikeExpressionIsRewritten_ShouldPass() { - var query = "select 1 from #A.entities() a where a.City like '%abc%'"; + var query = "select 1 from @A.entities() a where a.City like '%abc%'"; var buildItems = CreateBuildItems(query); @@ -48,7 +48,7 @@ public void WhenLikeExpressionIsRewritten_ShouldPass() [TestMethod] public void WhenRLikeExpressionIsRewritten_ShouldPass() { - var query = "select 1 from #A.entities() a where a.City rlike '%abc%'"; + var query = "select 1 from @A.entities() a where a.City rlike '%abc%'"; var buildItems = CreateBuildItems(query); @@ -67,7 +67,7 @@ public void WhenRLikeExpressionIsRewritten_ShouldPass() [TestMethod] public void WhenContainsExpressionIsNotRewritten_ShouldPass() { - var query = "select 1 from #A.entities() a where a.City contains ('abc', 'def')"; + var query = "select 1 from @A.entities() a where a.City contains ('abc', 'def')"; var buildItems = CreateBuildItems(query); @@ -86,7 +86,7 @@ public void WhenContainsExpressionIsNotRewritten_ShouldPass() [TestMethod] public void WhenContainsExpressionIsRewritten_ShouldPass() { - var query = "select 1 from #A.entities() a where a.City contains (DoNothing('abc'), 'def')"; + var query = "select 1 from @A.entities() a where a.City contains (DoNothing('abc'), 'def')"; var buildItems = CreateBuildItems(query); @@ -105,7 +105,7 @@ public void WhenContainsExpressionIsRewritten_ShouldPass() [TestMethod] public void WhenWhereExpressionIsNotRewrittenAndUsesConditionOnTwoColumns_ShouldPass() { - var query = "select 1 from #A.entities() a where a.Population > a.Population"; + var query = "select 1 from @A.entities() a where a.Population > a.Population"; var buildItems = CreateBuildItems(query); @@ -124,7 +124,7 @@ public void WhenWhereExpressionIsNotRewrittenAndUsesConditionOnTwoColumns_Should [TestMethod] public void WhenWhereExpressionUsesMustBeRewrittenForBothDataSources_ShouldPass() { - var query = "select 1 from #A.entities() a inner join #B.entities() b on a.City = b.City where a.Population > 0"; + var query = "select 1 from @A.entities() a inner join @B.entities() b on a.City = b.City where a.Population > 0"; var buildItems = CreateBuildItems(query); @@ -148,7 +148,7 @@ public void WhenWhereExpressionUsesMustBeRewrittenForBothDataSources_ShouldPass( [TestMethod] public void WhenWhereExpressionMustBeRewrittenDueToExchangingColumnsBetweenTwoSources_ShouldPass() { - var query = "select 1 from #A.entities() a inner join #B.entities() b on a.City = b.City where a.Population > b.Population"; + var query = "select 1 from @A.entities() a inner join @B.entities() b on a.City = b.City where a.Population > b.Population"; var buildItems = CreateBuildItems(query); @@ -172,7 +172,7 @@ public void WhenWhereExpressionMustBeRewrittenDueToExchangingColumnsBetweenTwoSo [TestMethod] public void WhenWhereExpressionMustBeRewrittenDueToExchangingColumnsBetweenThreeSources_ShouldPass() { - var query = "select 1 from #A.entities() a inner join #B.entities() b on a.City = b.City inner join #C.entities() c on b.City = c.City where a.Population > b.Population and c.Population = 200d"; + var query = "select 1 from @A.entities() a inner join @B.entities() b on a.City = b.City inner join @C.entities() c on b.City = c.City where a.Population > b.Population and c.Population = 200d"; var buildItems = CreateBuildItems(query); @@ -203,9 +203,9 @@ public void WhenCteUsedWithExchangeParametersBetweenSources_ShouldPass() { var query = @" with a as ( - select City, Population from #A.entities() x where x.Population > 100d + select City, Population from @A.entities() x where x.Population > 100d ) -select 1 from a firstTable inner join #B.entities() b on firstTable.City = b.City inner join #C.entities() c on b.City = c.City where firstTable.Population > b.Population and c.Population = 200d"; +select 1 from a firstTable inner join @B.entities() b on firstTable.City = b.City inner join @C.entities() c on b.City = c.City where firstTable.Population > b.Population and c.Population = 200d"; var buildItems = CreateBuildItems(query); diff --git a/Musoq.Evaluator.Tests/RowNumberTests.cs b/Musoq.Evaluator.Tests/RowNumberTests.cs index d2b97017..96e84818 100644 --- a/Musoq.Evaluator.Tests/RowNumberTests.cs +++ b/Musoq.Evaluator.Tests/RowNumberTests.cs @@ -11,12 +11,12 @@ public class RowNumberTests : BasicEntityTestBase [TestMethod] public void WhenRowNumberSimpleTest_ShouldPass() { - var query = "select RowNumber() from #A.entities()"; + var query = "select RowNumber() from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity {Country = "Poland"}, new BasicEntity {Country = "Brazil"} ] @@ -48,12 +48,12 @@ public void WhenRowNumberSimpleTest_ShouldPass() [TestMethod] public void WhenRowNumberWithOrderBySimpleTest_ShouldPass() { - var query = "select Country, RowNumber() from #A.entities() order by Country"; + var query = "select Country, RowNumber() from @A.entities() order by Country"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity {Country = "Poland"}, new BasicEntity {Country = "Germany"} ] @@ -75,12 +75,12 @@ public void WhenRowNumberWithOrderBySimpleTest_ShouldPass() [TestMethod] public void WhenRowNumberWithWhereTest_ShouldPass() { - var query = "select Country, RowNumber() from #A.entities() where Country = 'Poland'"; + var query = "select Country, RowNumber() from @A.entities() where Country = 'Poland'"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity {Country = "Poland"}, new BasicEntity {Country = "Germany"}, new BasicEntity {Country = "Poland"} @@ -100,12 +100,12 @@ public void WhenRowNumberWithWhereTest_ShouldPass() [TestMethod] public void WhenRowNumberWithSkipTest_ShouldPass() { - var query = "select Country, RowNumber() from #A.entities() where Country = 'Poland' skip 1"; + var query = "select Country, RowNumber() from @A.entities() where Country = 'Poland' skip 1"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity {Country = "Poland"}, new BasicEntity {Country = "Germany"}, new BasicEntity {Country = "Poland"} @@ -140,12 +140,12 @@ public void WhenRowNumberWithSkipTest_ShouldPass() [TestMethod] public void WhenRowNumberWithGroupByAndSkipTest_ShouldPass() { - var query = "select Country, RowNumber() from #A.entities() group by Country order by Country skip 1"; + var query = "select Country, RowNumber() from @A.entities() group by Country order by Country skip 1"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity {Country = "Poland"}, new BasicEntity {Country = "Germany"}, new BasicEntity {Country = "Poland"} @@ -180,12 +180,12 @@ public void WhenRowNumberWithGroupByAndSkipTest_ShouldPass() [TestMethod] public void WhenRowNumberWithGroupByAndTakeTest_ShouldPass() { - var query = "select Country, RowNumber() from #A.entities() group by Country order by Country take 1"; + var query = "select Country, RowNumber() from @A.entities() group by Country order by Country take 1"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity {Country = "Poland"}, new BasicEntity {Country = "Germany"}, new BasicEntity {Country = "Poland"} diff --git a/Musoq.Evaluator.Tests/Schema/Basic/BasicEntityTestBase.cs b/Musoq.Evaluator.Tests/Schema/Basic/BasicEntityTestBase.cs index 464f1629..3aeb1299 100644 --- a/Musoq.Evaluator.Tests/Schema/Basic/BasicEntityTestBase.cs +++ b/Musoq.Evaluator.Tests/Schema/Basic/BasicEntityTestBase.cs @@ -79,10 +79,10 @@ protected void TestMethodTemplate(string operation, TResult score) protected Table TestResultMethodTemplate(string operation) { - var query = $"select {operation} from #A.Entities()"; + var query = $"select {operation} from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("ABCAACBA")]} + {"@A", [new BasicEntity("ABCAACBA")]} }; var vm = CreateAndRunVirtualMachine(query, sources); diff --git a/Musoq.Evaluator.Tests/Schema/Generic/GenericEntityTestBase.cs b/Musoq.Evaluator.Tests/Schema/Generic/GenericEntityTestBase.cs index 9b7005a5..a9749e55 100644 --- a/Musoq.Evaluator.Tests/Schema/Generic/GenericEntityTestBase.cs +++ b/Musoq.Evaluator.Tests/Schema/Generic/GenericEntityTestBase.cs @@ -120,7 +120,7 @@ private CompiledQuery CreateAndRunVirtualMachine( Guid.NewGuid().ToString(), new GenericSchemaProvider(new Dictionary() { - {"#schema", schema} + {"@schema", schema} }), LoggerResolver); } diff --git a/Musoq.Evaluator.Tests/Schema/Multi/MultiQueryTestBase.cs b/Musoq.Evaluator.Tests/Schema/Multi/MultiQueryTestBase.cs index 157c23c8..7954345f 100644 --- a/Musoq.Evaluator.Tests/Schema/Multi/MultiQueryTestBase.cs +++ b/Musoq.Evaluator.Tests/Schema/Multi/MultiQueryTestBase.cs @@ -51,7 +51,7 @@ private CompiledQuery CreateAndRunVirtualMachine( Guid.NewGuid().ToString(), new MultiSchemaProvider(new Dictionary() { - {"#schema", schema} + {"@schema", schema} }), LoggerResolver); } diff --git a/Musoq.Evaluator.Tests/SetsOperatorsTests.cs b/Musoq.Evaluator.Tests/SetsOperatorsTests.cs index e864d1a1..a7e74de9 100644 --- a/Musoq.Evaluator.Tests/SetsOperatorsTests.cs +++ b/Musoq.Evaluator.Tests/SetsOperatorsTests.cs @@ -13,11 +13,11 @@ public class SetsOperatorsTests : BasicEntityTestBase [TestMethod] public void UnionWithDifferentColumnsAsAKeyTest() { - var query = @"select Name from #A.Entities() union (Name) select City as Name from #B.Entities()"; + var query = @"select Name from @A.Entities() union (Name) select City as Name from @B.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]}, - {"#B", [new BasicEntity("003", "", 0), new BasicEntity("004", "", 0)]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]}, + {"@B", [new BasicEntity("003", "", 0), new BasicEntity("004", "", 0)]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -39,18 +39,18 @@ public void AliasedUnionWithDifferentColumnsAsAKeyTest() select a.Name as a1, b.Value -from #A.Entities() a +from @A.Entities() a cross apply a.ToCharArray(a.Name) b union (Name) select a.Name as a1, b.Value -from #A.Entities() a +from @A.Entities() a cross apply a.ToCharArray(a.Name) b """; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]}, + {"@A", [new BasicEntity("001"), new BasicEntity("002")]}, }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -60,11 +60,11 @@ cross apply a.ToCharArray(a.Name) b [TestMethod] public void UnionWithSkipTest() { - var query = @"select Name from #A.Entities() skip 1 union (Name) select Name from #B.Entities() skip 2"; + var query = @"select Name from @A.Entities() skip 1 union (Name) select Name from @B.Entities() skip 2"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]}, - {"#B", [new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("005")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]}, + {"@B", [new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("005")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -79,11 +79,11 @@ public void UnionWithSkipTest() [TestMethod] public void UnionAllWithSkipTest() { - var query = @"select Name from #A.Entities() skip 1 union all (Name) select Name from #B.Entities() skip 2"; + var query = @"select Name from @A.Entities() skip 1 union all (Name) select Name from @B.Entities() skip 2"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("005")]}, - {"#B", [new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("005")]} + {"@A", [new BasicEntity("001"), new BasicEntity("005")]}, + {"@B", [new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("005")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -98,15 +98,15 @@ public void UnionAllWithSkipTest() public void MultipleUnionAllTest() { var query = @" -select Name from #A.Entities() union all (Name) -select Name from #A.Entities() union all (Name) -select Name from #A.Entities() union all (Name) -select Name from #A.Entities() union all (Name) -select Name from #A.Entities()"; +select Name from @A.Entities() union all (Name) +select Name from @A.Entities() union all (Name) +select Name from @A.Entities() union all (Name) +select Name from @A.Entities() union all (Name) +select Name from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("005")]} + {"@A", [new BasicEntity("005")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -124,18 +124,18 @@ public void UnionAllWhenMultipleSelectsCombinedWithUnionAllWithinCteExpression_S { var query = @" with p as ( - select 1 as Id, 'EMPTY' as Name from #A.Entities() + select 1 as Id, 'EMPTY' as Name from @A.Entities() union all (Name) - select 2 as Id, 'EMPTY2' as Name from #A.Entities() + select 2 as Id, 'EMPTY2' as Name from @A.Entities() union all (Name) - select 3 as Id, 'EMPTY3' as Name from #A.Entities() + select 3 as Id, 'EMPTY3' as Name from @A.Entities() ) select Id, Name from p "; var sources = new Dictionary> { - {"#A", [new BasicEntity("005")]} + {"@A", [new BasicEntity("005")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -164,18 +164,18 @@ public void UnionWhenMultipleSelectsCombinedWithUnionWithinCteExpression_ShouldS { var query = @" with p as ( - select 1 as Id, 'EMPTY' as Name from #A.Entities() + select 1 as Id, 'EMPTY' as Name from @A.Entities() union (Name) - select 2 as Id, 'EMPTY2' as Name from #A.Entities() + select 2 as Id, 'EMPTY2' as Name from @A.Entities() union (Name) - select 3 as Id, 'EMPTY3' as Name from #A.Entities() + select 3 as Id, 'EMPTY3' as Name from @A.Entities() ) select Id, Name from p "; var sources = new Dictionary> { - {"#A", [new BasicEntity("005")]} + {"@A", [new BasicEntity("005")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -203,17 +203,17 @@ with p as ( public void MultipleUnionAllWithSkipTest() { var query = @" -select Name from #A.Entities() skip 1 +select Name from @A.Entities() skip 1 union all (Name) -select Name from #B.Entities() skip 2 +select Name from @B.Entities() skip 2 union all (Name) -select Name from #C.Entities() skip 3"; +select Name from @C.Entities() skip 3"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("005")]}, - {"#B", [new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("005")]}, + {"@A", [new BasicEntity("001"), new BasicEntity("005")]}, + {"@B", [new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("005")]}, { - "#C", + "@C", [ new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("004"), new BasicEntity("005") ] @@ -231,11 +231,11 @@ union all (Name) [TestMethod] public void UnionWithoutDuplicatedKeysTest() { - var query = @"select Name from #A.Entities() union (Name) select Name from #B.Entities()"; + var query = @"select Name from @A.Entities() union (Name) select Name from @B.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]}, - {"#B", [new BasicEntity("003"), new BasicEntity("004")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]}, + {"@B", [new BasicEntity("003"), new BasicEntity("004")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -253,11 +253,11 @@ public void UnionWithoutDuplicatedKeysTest() [TestMethod] public void UnionWithDuplicatedKeysTest() { - var query = @"select Name from #A.Entities() union (Name) select Name from #B.Entities()"; + var query = @"select Name from @A.Entities() union (Name) select Name from @B.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]}, - {"#B", [new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("005")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]}, + {"@B", [new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("005")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -274,12 +274,12 @@ public void UnionWithDuplicatedKeysTest() public void MultipleUnionsWithDuplicatedKeysTest() { var query = - @"select Name from #A.Entities() union (Name) select Name from #B.Entities() union (Name) select Name from #C.Entities()"; + @"select Name from @A.Entities() union (Name) select Name from @B.Entities() union (Name) select Name from @C.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]}, - {"#B", [new BasicEntity("001"), new BasicEntity("002")]}, - {"#C", [new BasicEntity("005")]} + {"@A", [new BasicEntity("001")]}, + {"@B", [new BasicEntity("001"), new BasicEntity("002")]}, + {"@C", [new BasicEntity("005")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -296,12 +296,12 @@ public void MultipleUnionsWithDuplicatedKeysTest() public void MultipleUnionsWithoutDuplicatedKeysTest() { var query = - @"select Name from #A.Entities() union (Name) select Name from #B.Entities() union (Name) select Name from #C.Entities()"; + @"select Name from @A.Entities() union (Name) select Name from @B.Entities() union (Name) select Name from @C.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]}, - {"#B", [new BasicEntity("002")]}, - {"#C", [new BasicEntity("005")]} + {"@A", [new BasicEntity("001")]}, + {"@B", [new BasicEntity("002")]}, + {"@C", [new BasicEntity("005")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -319,17 +319,17 @@ public void MultipleUnionsComplexTest() { var query = @" -select Name from #A.Entities() union (Name) -select Name from #B.Entities() union (Name) -select Name from #C.Entities() union (Name) -select Name from #D.Entities()"; +select Name from @A.Entities() union (Name) +select Name from @B.Entities() union (Name) +select Name from @C.Entities() union (Name) +select Name from @D.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]}, - {"#B", [new BasicEntity("002")]}, - {"#C", [new BasicEntity("005")]}, - {"#D", [new BasicEntity("007"), new BasicEntity("001")]} + {"@A", [new BasicEntity("001")]}, + {"@B", [new BasicEntity("002")]}, + {"@C", [new BasicEntity("005")]}, + {"@D", [new BasicEntity("007"), new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -346,11 +346,11 @@ public void MultipleUnionsComplexTest() [TestMethod] public void UnionAllWithDuplicatedKeysTest() { - var query = @"select Name from #A.Entities() union all (Name) select Name from #B.Entities()"; + var query = @"select Name from @A.Entities() union all (Name) select Name from @B.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]}, - {"#B", [new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("005")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]}, + {"@B", [new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("005")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -369,12 +369,12 @@ public void UnionAllWithDuplicatedKeysTest() public void MultipleUnionsAllWithDuplicatedKeysTest() { var query = - @"select Name from #A.Entities() union all (Name) select Name from #B.Entities() union all (Name) select Name from #C.Entities()"; + @"select Name from @A.Entities() union all (Name) select Name from @B.Entities() union all (Name) select Name from @C.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]}, - {"#B", [new BasicEntity("001"), new BasicEntity("002")]}, - {"#C", [new BasicEntity("005")]} + {"@A", [new BasicEntity("001")]}, + {"@B", [new BasicEntity("001"), new BasicEntity("002")]}, + {"@C", [new BasicEntity("005")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -391,12 +391,12 @@ public void MultipleUnionsAllWithDuplicatedKeysTest() public void MultipleUnionsAllWithoutDuplicatedKeysTest() { var query = - @"select Name from #A.Entities() union all (Name) select Name from #B.Entities() union all (Name) select Name from #C.Entities()"; + @"select Name from @A.Entities() union all (Name) select Name from @B.Entities() union all (Name) select Name from @C.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]}, - {"#B", [new BasicEntity("002")]}, - {"#C", [new BasicEntity("005")]} + {"@A", [new BasicEntity("001")]}, + {"@B", [new BasicEntity("002")]}, + {"@C", [new BasicEntity("005")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -413,16 +413,16 @@ public void MultipleUnionsAllComplexTest() { var query = @" -select Name from #A.Entities() union all (Name) -select Name from #B.Entities() union all (Name) -select Name from #C.Entities() union all (Name) -select Name from #D.Entities()"; +select Name from @A.Entities() union all (Name) +select Name from @B.Entities() union all (Name) +select Name from @C.Entities() union all (Name) +select Name from @D.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]}, - {"#B", [new BasicEntity("002")]}, - {"#C", [new BasicEntity("005")]}, - {"#D", [new BasicEntity("007"), new BasicEntity("001")]} + {"@A", [new BasicEntity("001")]}, + {"@B", [new BasicEntity("002")]}, + {"@C", [new BasicEntity("005")]}, + {"@D", [new BasicEntity("007"), new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -440,11 +440,11 @@ public void MultipleUnionsAllComplexTest() [TestMethod] public void UnionAllWithoutDuplicatedKeysTest() { - var query = @"select Name from #A.Entities() union all (Name) select Name from #B.Entities()"; + var query = @"select Name from @A.Entities() union all (Name) select Name from @B.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]}, - {"#B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]}, + {"@B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -462,11 +462,11 @@ public void UnionAllWithoutDuplicatedKeysTest() [TestMethod] public void ExceptDoubleSourceTest() { - var query = @"select Name from #A.Entities() except (Name) select Name from #B.Entities()"; + var query = @"select Name from @A.Entities() except (Name) select Name from @B.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]}, - {"#B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]}, + {"@B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -479,11 +479,11 @@ public void ExceptDoubleSourceTest() [TestMethod] public void ExceptWithSkipDoubleSourceTest() { - var query = @"select Name from #A.Entities() skip 1 except (Name) select Name from #B.Entities() skip 2"; + var query = @"select Name from @A.Entities() skip 1 except (Name) select Name from @B.Entities() skip 2"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("010")]}, - {"#B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("002")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("010")]}, + {"@B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("002")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -497,12 +497,12 @@ public void ExceptWithSkipDoubleSourceTest() public void ExceptTripleSourcesTest() { var query = - @"select Name from #A.Entities() except (Name) select Name from #B.Entities() except (Name) select Name from #C.Entities()"; + @"select Name from @A.Entities() except (Name) select Name from @B.Entities() except (Name) select Name from @C.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]}, - {"#B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]}, - {"#C", [new BasicEntity("002")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]}, + {"@B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]}, + {"@C", [new BasicEntity("002")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -515,14 +515,14 @@ public void ExceptTripleSourcesTest() public void ExceptWithSkipTripleSourcesTest() { var query = - @"select Name from #A.Entities() skip 1 except (Name) -select Name from #B.Entities() skip 2 except (Name) -select Name from #C.Entities() skip 3"; + @"select Name from @A.Entities() skip 1 except (Name) +select Name from @B.Entities() skip 2 except (Name) +select Name from @C.Entities() skip 3"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]}, - {"#B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]}, - {"#C", [new BasicEntity("005")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]}, + {"@B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]}, + {"@C", [new BasicEntity("005")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -537,22 +537,22 @@ public void ExceptMultipleSourcesTest() { var query = @" -select Name from #A.Entities() except (Name) -select Name from #B.Entities() except (Name) -select Name from #C.Entities() except (Name) -select Name from #D.Entities()"; +select Name from @A.Entities() except (Name) +select Name from @B.Entities() except (Name) +select Name from @C.Entities() except (Name) +select Name from @D.Entities()"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("007"), new BasicEntity("008") ] }, - {"#B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]}, - {"#C", [new BasicEntity("005")]}, - {"#D", [new BasicEntity("007")]} + {"@B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]}, + {"@C", [new BasicEntity("005")]}, + {"@D", [new BasicEntity("007")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -566,11 +566,11 @@ public void ExceptMultipleSourcesTest() [TestMethod] public void IntersectDoubleSourceTest() { - var query = @"select Name from #A.Entities() intersect (Name) select Name from #B.Entities()"; + var query = @"select Name from @A.Entities() intersect (Name) select Name from @B.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]}, - {"#B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]}, + {"@B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -583,12 +583,12 @@ public void IntersectDoubleSourceTest() [TestMethod] public void IntersectWithSkipDoubleSourceTest() { - var query = @"select Name from #A.Entities() skip 1 intersect (Name) select Name from #B.Entities() skip 2"; + var query = @"select Name from @A.Entities() skip 1 intersect (Name) select Name from @B.Entities() skip 2"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("005")]}, + {"@A", [new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("005")]}, { - "#B", + "@B", [ new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001"), new BasicEntity("005") ] @@ -606,12 +606,12 @@ public void IntersectWithSkipDoubleSourceTest() public void IntersectTripleSourcesTest() { var query = - @"select Name from #A.Entities() intersect (Name) select Name from #B.Entities() intersect (Name) select Name from #C.Entities()"; + @"select Name from @A.Entities() intersect (Name) select Name from @B.Entities() intersect (Name) select Name from @C.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]}, - {"#B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]}, - {"#C", [new BasicEntity("002"), new BasicEntity("001")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]}, + {"@B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]}, + {"@C", [new BasicEntity("002"), new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -626,20 +626,20 @@ public void IntersectWithSkipTripleSourcesTest() { var query = @" -select Name from #A.Entities() skip 1 intersect (Name) -select Name from #B.Entities() skip 2 intersect (Name) -select Name from #C.Entities()"; +select Name from @A.Entities() skip 1 intersect (Name) +select Name from @B.Entities() skip 2 intersect (Name) +select Name from @C.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("005")]}, + {"@A", [new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("005")]}, { - "#B", + "@B", [ new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001"), new BasicEntity("005") ] }, - {"#C", [new BasicEntity("002"), new BasicEntity("001"), new BasicEntity("005")]} + {"@C", [new BasicEntity("002"), new BasicEntity("001"), new BasicEntity("005")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -654,22 +654,22 @@ public void IntersectMultipleSourcesTest() { var query = @" -select Name from #A.Entities() intersect (Name) -select Name from #B.Entities() intersect (Name) -select Name from #C.Entities() intersect (Name) -select Name from #D.Entities()"; +select Name from @A.Entities() intersect (Name) +select Name from @B.Entities() intersect (Name) +select Name from @C.Entities() intersect (Name) +select Name from @D.Entities()"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("007"), new BasicEntity("008") ] }, - {"#B", [new BasicEntity("003"), new BasicEntity("007"), new BasicEntity("001")]}, - {"#C", [new BasicEntity("005"), new BasicEntity("007"), new BasicEntity("001")]}, - {"#D", [new BasicEntity("008"), new BasicEntity("007"), new BasicEntity("001")]} + {"@B", [new BasicEntity("003"), new BasicEntity("007"), new BasicEntity("001")]}, + {"@C", [new BasicEntity("005"), new BasicEntity("007"), new BasicEntity("001")]}, + {"@D", [new BasicEntity("008"), new BasicEntity("007"), new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -685,17 +685,17 @@ public void IntersectMultipleSourcesTest() public void MixedSourcesExceptUnionScenarioTest() { var query = - @"select Name from #A.Entities() + @"select Name from @A.Entities() except (Name) -select Name from #B.Entities() +select Name from @B.Entities() union (Name) -select Name from #C.Entities()"; +select Name from @C.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]}, - {"#B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]}, - {"#C", [new BasicEntity("002"), new BasicEntity("001")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]}, + {"@B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]}, + {"@C", [new BasicEntity("002"), new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -711,17 +711,17 @@ public void MixedSourcesExceptUnionScenarioTest() public void MixedSourcesExceptUnionScenario1Test() { var query = - @"select Name from #A.Entities() + @"select Name from @A.Entities() except (Name) -select Name from #B.Entities() +select Name from @B.Entities() union (Name) -select Name from #C.Entities()"; +select Name from @C.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]}, - {"#B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]}, - {"#C", [new BasicEntity("002"), new BasicEntity("001")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]}, + {"@B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]}, + {"@C", [new BasicEntity("002"), new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -737,17 +737,17 @@ public void MixedSourcesExceptUnionScenario1Test() public void MixedSourcesWithSkipExceptUnionWithConditionsScenarioTest() { var query = - @"select Name from #A.Entities() skip 1 + @"select Name from @A.Entities() skip 1 except (Name) -select Name from #B.Entities() skip 2 +select Name from @B.Entities() skip 2 union (Name) -select Name from #C.Entities() skip 3"; +select Name from @C.Entities() skip 3"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]}, - {"#B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]}, - {"#C", [new BasicEntity("002"), new BasicEntity("001")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]}, + {"@B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]}, + {"@C", [new BasicEntity("002"), new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -761,18 +761,18 @@ public void MixedSourcesWithSkipExceptUnionWithConditionsScenarioTest() public void MixedSourcesWithSkipIntersectUnionScenarioTest() { var query = - @"select Name from #A.Entities() skip 1 + @"select Name from @A.Entities() skip 1 intersect (Name) -select Name from #B.Entities() skip 2 +select Name from @B.Entities() skip 2 union (Name) -select Name from #C.Entities() skip 3"; +select Name from @C.Entities() skip 3"; var sources = new Dictionary> { - {"#A", [new BasicEntity("002"), new BasicEntity("001")]}, - {"#B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]}, + {"@A", [new BasicEntity("002"), new BasicEntity("001")]}, + {"@B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]}, { - "#C", + "@C", [ new BasicEntity("002"), new BasicEntity("001"), new BasicEntity("003"), new BasicEntity("006") ] @@ -792,17 +792,17 @@ public void MixedSourcesWithSkipIntersectUnionScenarioTest() public void MixedSourcesExceptUnionWithMultipleColumnsScenarioTest() { var query = - @"select Name, RandomNumber() from #A.Entities() + @"select Name, RandomNumber() from @A.Entities() except (Name) -select Name, RandomNumber() from #B.Entities() +select Name, RandomNumber() from @B.Entities() union (Name) -select Name, RandomNumber() from #C.Entities()"; +select Name, RandomNumber() from @C.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]}, - {"#B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]}, - {"#C", [new BasicEntity("002"), new BasicEntity("001")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]}, + {"@B", [new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("001")]}, + {"@C", [new BasicEntity("002"), new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -819,22 +819,22 @@ public void MixedMultipleSourcesTest() { var query = @" -select Name from #A.Entities() union (Name) -select Name from #B.Entities() except (Name) -select Name from #C.Entities() intersect (Name) -select Name from #D.Entities()"; +select Name from @A.Entities() union (Name) +select Name from @B.Entities() except (Name) +select Name from @C.Entities() intersect (Name) +select Name from @D.Entities()"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("007"), new BasicEntity("008") ] }, - {"#B", [new BasicEntity("003"), new BasicEntity("007"), new BasicEntity("001")]}, - {"#C", [new BasicEntity("005"), new BasicEntity("007")]}, - {"#D", [new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("003")]} + {"@B", [new BasicEntity("003"), new BasicEntity("007"), new BasicEntity("001")]}, + {"@C", [new BasicEntity("005"), new BasicEntity("007")]}, + {"@D", [new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("003")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -851,22 +851,22 @@ public void MixedMultipleSourcesTest() public void UnionSourceGroupByTest() { var query = - @"select City, Sum(Population) from #A.Entities() group by City + @"select City, Sum(Population) from @A.Entities() group by City union (City) -select City, Sum(Population) from #B.Entities() group by City +select City, Sum(Population) from @B.Entities() group by City union (City) -select City, Sum(Population) from #C.Entities() group by City"; +select City, Sum(Population) from @C.Entities() group by City"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001", "", 100), new BasicEntity("001", "", 100)]}, + {"@A", [new BasicEntity("001", "", 100), new BasicEntity("001", "", 100)]}, { - "#B", + "@B", [ new BasicEntity("003", "", 13), new BasicEntity("003", "", 13), new BasicEntity("003", "", 13) ] }, - {"#C", [new BasicEntity("002", "", 14), new BasicEntity("002", "", 14)]} + {"@C", [new BasicEntity("002", "", 14), new BasicEntity("002", "", 14)]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -894,22 +894,22 @@ public void UnionSourceGroupByTest() public void UnionAllSourceGroupByTest() { var query = - @"select City, Sum(Population) from #A.Entities() group by City + @"select City, Sum(Population) from @A.Entities() group by City union all (City) -select City, Sum(Population) from #B.Entities() group by City +select City, Sum(Population) from @B.Entities() group by City union all (City) -select City, Sum(Population) from #C.Entities() group by City"; +select City, Sum(Population) from @C.Entities() group by City"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001", "", 100), new BasicEntity("001", "", 100)]}, + {"@A", [new BasicEntity("001", "", 100), new BasicEntity("001", "", 100)]}, { - "#B", + "@B", [ new BasicEntity("003", "", 13), new BasicEntity("003", "", 13), new BasicEntity("003", "", 13) ] }, - {"#C", [new BasicEntity("002", "", 14), new BasicEntity("002", "", 14)]} + {"@C", [new BasicEntity("002", "", 14), new BasicEntity("002", "", 14)]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -938,28 +938,28 @@ union all (City) public void ExceptSourceGroupByTest() { var query = - @"select City, Sum(Population) from #A.Entities() group by City + @"select City, Sum(Population) from @A.Entities() group by City except (City) -select City, Sum(Population) from #B.Entities() group by City +select City, Sum(Population) from @B.Entities() group by City except (City) -select City, Sum(Population) from #C.Entities() group by City"; +select City, Sum(Population) from @C.Entities() group by City"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("001", "", 100), new BasicEntity("001", "", 100), new BasicEntity("002", "", 500) ] }, { - "#B", + "@B", [ new BasicEntity("003", "", 13), new BasicEntity("003", "", 13), new BasicEntity("003", "", 13) ] }, - {"#C", [new BasicEntity("002", "", 14), new BasicEntity("002", "", 14)]} + {"@C", [new BasicEntity("002", "", 14), new BasicEntity("002", "", 14)]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -977,28 +977,28 @@ public void ExceptSourceGroupByTest() public void IntersectSourceGroupByTest() { var query = - @"select City, Sum(Population) from #A.Entities() group by City + @"select City, Sum(Population) from @A.Entities() group by City except (City) -select City, Sum(Population) from #B.Entities() group by City +select City, Sum(Population) from @B.Entities() group by City except (City) -select City, Sum(Population) from #C.Entities() group by City"; +select City, Sum(Population) from @C.Entities() group by City"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("001", "", 100), new BasicEntity("001", "", 100), new BasicEntity("002", "", 500) ] }, { - "#B", + "@B", [ new BasicEntity("003", "", 13), new BasicEntity("003", "", 13), new BasicEntity("003", "", 13) ] }, - {"#C", [new BasicEntity("002", "", 14), new BasicEntity("002", "", 14)]} + {"@C", [new BasicEntity("002", "", 14), new BasicEntity("002", "", 14)]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -1014,13 +1014,13 @@ public void UnionSameSourceTest() { var query = @" -select Name from #A.Entities() where Name = '001' +select Name from @A.Entities() where Name = '001' union (Name) -select Name from #A.Entities() where Name = '002'"; +select Name from @A.Entities() where Name = '002'"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -1037,20 +1037,20 @@ public void UnionMultipleTimesSameSourceTest() { var query = @" -select Name from #A.Entities() where Name = '001' +select Name from @A.Entities() where Name = '001' union (Name) -select Name from #A.Entities() where Name = '002' +select Name from @A.Entities() where Name = '002' union (Name) -select Name from #A.Entities() where Name = '003' +select Name from @A.Entities() where Name = '003' union (Name) -select Name from #A.Entities() where Name = '004' +select Name from @A.Entities() where Name = '004' union (Name) -select Name from #A.Entities() where Name = '005'"; +select Name from @A.Entities() where Name = '005'"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("005") @@ -1073,10 +1073,10 @@ public void UnionMultipleTimesSameSourceTest() [TestMethod] public void WhenWrongTypeBetweenUnions_ShouldFail() { - var query = @"select Name from #A.Entities() union (Name) select 1 as Name from #A.Entities()"; + var query = @"select Name from @A.Entities() union (Name) select 1 as Name from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]} + {"@A", [new BasicEntity("001")]} }; Assert.ThrowsException(() => CreateAndRunVirtualMachine(query, sources)); @@ -1085,10 +1085,10 @@ public void WhenWrongTypeBetweenUnions_ShouldFail() [TestMethod] public void WhenWrongTypeBetweenUnionAll_ShouldFail() { - var query = @"select Name from #A.Entities() union all (Name) select 1 as Name from #A.Entities()"; + var query = @"select Name from @A.Entities() union all (Name) select 1 as Name from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]} + {"@A", [new BasicEntity("001")]} }; Assert.ThrowsException(() => CreateAndRunVirtualMachine(query, sources)); @@ -1097,10 +1097,10 @@ public void WhenWrongTypeBetweenUnionAll_ShouldFail() [TestMethod] public void WhenWrongTypeBetweenExcept_ShouldFail() { - var query = @"select Name from #A.Entities() except (Name) select 1 as Name from #A.Entities()"; + var query = @"select Name from @A.Entities() except (Name) select 1 as Name from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]} + {"@A", [new BasicEntity("001")]} }; Assert.ThrowsException(() => CreateAndRunVirtualMachine(query, sources)); @@ -1109,10 +1109,10 @@ public void WhenWrongTypeBetweenExcept_ShouldFail() [TestMethod] public void WhenWrongTypeBetweenIntersect_ShouldFail() { - var query = @"select Name from #A.Entities() intersect (Name) select 1 as Name from #A.Entities()"; + var query = @"select Name from @A.Entities() intersect (Name) select 1 as Name from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]} + {"@A", [new BasicEntity("001")]} }; Assert.ThrowsException(() => CreateAndRunVirtualMachine(query, sources)); @@ -1121,10 +1121,10 @@ public void WhenWrongTypeBetweenIntersect_ShouldFail() [TestMethod] public void WhenUnionDoesNotHaveAKey_ShouldFail() { - var query = @"select Name from #A.Entities() union () select Name as Name from #A.Entities()"; + var query = @"select Name from @A.Entities() union () select Name as Name from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]} + {"@A", [new BasicEntity("001")]} }; Assert.ThrowsException(() => CreateAndRunVirtualMachine(query, sources)); @@ -1133,10 +1133,10 @@ public void WhenUnionDoesNotHaveAKey_ShouldFail() [TestMethod] public void WhenUnionAllDoesNotHaveAKey_ShouldFail() { - var query = @"select Name from #A.Entities() union all () select Name from #A.Entities()"; + var query = @"select Name from @A.Entities() union all () select Name from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]} + {"@A", [new BasicEntity("001")]} }; Assert.ThrowsException(() => CreateAndRunVirtualMachine(query, sources)); @@ -1145,10 +1145,10 @@ public void WhenUnionAllDoesNotHaveAKey_ShouldFail() [TestMethod] public void WhenExceptDoesNotHaveAKey_ShouldFail() { - var query = @"select Name from #A.Entities() except () select Name from #A.Entities()"; + var query = @"select Name from @A.Entities() except () select Name from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]} + {"@A", [new BasicEntity("001")]} }; Assert.ThrowsException(() => CreateAndRunVirtualMachine(query, sources)); @@ -1157,10 +1157,10 @@ public void WhenExceptDoesNotHaveAKey_ShouldFail() [TestMethod] public void WhenIntersectDoesNotHaveAKey_ShouldFail() { - var query = @"select Name from #A.Entities() intersect () select Name from #A.Entities()"; + var query = @"select Name from @A.Entities() intersect () select Name from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]} + {"@A", [new BasicEntity("001")]} }; Assert.ThrowsException(() => CreateAndRunVirtualMachine(query, sources)); diff --git a/Musoq.Evaluator.Tests/SingleSchemaEvaluatorTests.cs b/Musoq.Evaluator.Tests/SingleSchemaEvaluatorTests.cs index 48b05070..b9bc432b 100644 --- a/Musoq.Evaluator.Tests/SingleSchemaEvaluatorTests.cs +++ b/Musoq.Evaluator.Tests/SingleSchemaEvaluatorTests.cs @@ -15,11 +15,11 @@ public class SingleSchemaEvaluatorTests : BasicEntityTestBase [TestMethod] public void WhenMissingSchema_ShouldFail() { - var query = "select Name from #B.Entities()"; + var query = "select Name from @B.Entities()"; var sources = new Dictionary> { { - "#A", [] + "@A", [] } }; @@ -29,11 +29,11 @@ public void WhenMissingSchema_ShouldFail() [TestMethod] public void LikeOperatorTest() { - var query = "select Name from #A.Entities() where Name like '%AA%'"; + var query = "select Name from @A.Entities() where Name like '%AA%'"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("ABCAACBA"), new BasicEntity("AAeqwgQEW"), @@ -68,11 +68,11 @@ public void LikeOperatorTest() [TestMethod] public void NotLikeOperatorTest() { - var query = "select Name from #A.Entities() where Name not like '%AA%'"; + var query = "select Name from @A.Entities() where Name not like '%AA%'"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("ABCAACBA"), new BasicEntity("AAeqwgQEW"), new BasicEntity("XXX"), new BasicEntity("dadsqqAA") @@ -94,12 +94,12 @@ public void NotLikeOperatorTest() [TestMethod] public void WrongColumnNameWithHintTest() { - var query = "select Namre from #A.Entities()"; + var query = "select Namre from @A.Entities()"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("ABCAACBA"), new BasicEntity("AAeqwgQEW"), new BasicEntity("XXX"), new BasicEntity("dadsqqAA") @@ -113,11 +113,11 @@ public void WrongColumnNameWithHintTest() [TestMethod] public void RLikeOperatorTest() { - var query = @"select Name from #A.Entities() where Name rlike '^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$'"; + var query = @"select Name from @A.Entities() where Name rlike '^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$'"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("12@hostname.com"), new BasicEntity("ma@hostname.comcom"), @@ -144,11 +144,11 @@ public void RLikeOperatorTest() [TestMethod] public void NotRLikeOperatorTest() { - var query = @"select Name from #A.Entities() where Name not rlike '^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$'"; + var query = @"select Name from @A.Entities() where Name not rlike '^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$'"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("12@hostname.com"), new BasicEntity("ma@hostname.comcom"), @@ -172,11 +172,11 @@ public void NotRLikeOperatorTest() [TestMethod] public void FirstLetterOfColumnTest() { - var query = @"select Name from #A.Entities() where Name[0] = 'd'"; + var query = @"select Name from @A.Entities() where Name[0] = 'd'"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("12@hostname.com"), new BasicEntity("ma@hostname.comcom"), @@ -200,11 +200,11 @@ public void FirstLetterOfColumnTest() [TestMethod] public void FirstLetterOfColumnTest2() { - var query = @"select Name from #A.Entities() f where f.Name[0] = 'd'"; + var query = @"select Name from @A.Entities() f where f.Name[0] = 'd'"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("12@hostname.com"), new BasicEntity("ma@hostname.comcom"), @@ -229,12 +229,12 @@ public void FirstLetterOfColumnTest2() public void WrongColumnNameTest() { var query = - $"select Populationr from #A.Entities()"; + $"select Populationr from @A.Entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500) ] } @@ -247,12 +247,12 @@ public void WrongColumnNameTest() public void EmptyStringTest() { var query = - $"select '' from #A.Entities()"; + $"select '' from @A.Entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500) ] } @@ -272,12 +272,12 @@ public void EmptyStringTest() public void NullColumnTest() { var query = - "select null from #A.Entities()"; + "select null from @A.Entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500) ] } @@ -297,12 +297,12 @@ public void NullColumnTest() public void CaseWhenWithEmptyStringTest() { var query = - $"select (case when 1 = 2 then 'test' else '' end) from #A.Entities()"; + $"select (case when 1 = 2 then 'test' else '' end) from @A.Entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500) ] } @@ -322,12 +322,12 @@ public void CaseWhenWithEmptyStringTest() public void CaseWhenWithNullTest() { var query = - $"select (case when 1 = 2 then 'test' else null end) from #A.Entities()"; + $"select (case when 1 = 2 then 'test' else null end) from @A.Entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500) ] } @@ -347,12 +347,12 @@ public void CaseWhenWithNullTest() public void ComplexWhere1Test() { var query = - $"select Population from #A.Entities() where Population > 0 and Population - 100 > -1.5d and Population - 100 < 1.5d"; + $"select Population from @A.Entities() where Population > 0 and Population - 100 > -1.5d and Population - 100 < 1.5d"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("WARSAW", "POLAND", 500), new BasicEntity("CZESTOCHOWA", "POLAND", 99), new BasicEntity("KATOWICE", "POLAND", 101), @@ -378,11 +378,11 @@ public void ComplexWhere1Test() public void MultipleAndOperatorTest() { var query = - "select Name from #A.Entities() where IndexOf(Name, 'A') = 0 and IndexOf(Name, 'B') = 1 and IndexOf(Name, 'C') = 2"; + "select Name from @A.Entities() where IndexOf(Name, 'A') = 0 and IndexOf(Name, 'B') = 1 and IndexOf(Name, 'C') = 2"; var sources = new Dictionary> { { - "#A", + "@A", [new BasicEntity("A"), new BasicEntity("AB"), new BasicEntity("ABC"), new BasicEntity("ABCD")] } }; @@ -403,11 +403,11 @@ public void MultipleAndOperatorTest() [TestMethod] public void MultipleOrOperatorTest() { - var query = "select Name from #A.Entities() where Name = 'ABC' or Name = 'ABCD' or Name = 'A'"; + var query = "select Name from @A.Entities() where Name = 'ABC' or Name = 'ABCD' or Name = 'A'"; var sources = new Dictionary> { { - "#A", + "@A", [new BasicEntity("A"), new BasicEntity("AB"), new BasicEntity("ABC"), new BasicEntity("ABCD")] } }; @@ -429,10 +429,10 @@ public void MultipleOrOperatorTest() [TestMethod] public void AddOperatorWithStringsTurnsIntoConcatTest() { - var query = "select 'abc' + 'cda' from #A.Entities()"; + var query = "select 'abc' + 'cda' from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("ABCAACBA")]} + {"@A", [new BasicEntity("ABCAACBA")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -449,11 +449,11 @@ public void AddOperatorWithStringsTurnsIntoConcatTest() [TestMethod] public void ContainsStringsTest() { - var query = "select Name from #A.Entities() where Name contains ('ABC', 'CdA', 'CDA', 'DDABC')"; + var query = "select Name from @A.Entities() where Name contains ('ABC', 'CdA', 'CDA', 'DDABC')"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("ABC"), new BasicEntity("XXX"), @@ -480,11 +480,11 @@ public void ContainsStringsTest() [TestMethod] public void CanPassComplexArgumentToFunctionTest() { - var query = "select NothingToDo(Self) from #A.Entities()"; + var query = "select NothingToDo(Self) from @A.Entities()"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("001") { @@ -513,11 +513,11 @@ public void CanPassComplexArgumentToFunctionTest() [TestMethod] public void TableShouldReturnComplexTypeTest() { - var query = "select Self from #A.Entities()"; + var query = "select Self from @A.Entities()"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("001") { @@ -558,10 +558,10 @@ public void SimpleShowAllColumnsTest() Id = 5, NullableValue = null }; - var query = "select 1, *, Name as Name2, ToString(Self) as SelfString from #A.Entities()"; + var query = "select 1, *, Name as Name2, ToString(Self) as SelfString from @A.Entities()"; var sources = new Dictionary> { - {"#A", [entity]} + {"@A", [entity]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -639,10 +639,10 @@ public void SimpleShowAllColumnsTest() [TestMethod] public void SimpleAccessArrayTest() { - var query = @"select Self.Array[2] from #A.Entities()"; + var query = @"select Self.Array[2] from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -659,10 +659,10 @@ public void SimpleAccessArrayTest() [TestMethod] public void SimpleAccessObjectTest() { - var query = @"select Self.Array from #A.Entities()"; + var query = @"select Self.Array from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]} + {"@A", [new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -677,10 +677,10 @@ public void SimpleAccessObjectTest() [TestMethod] public void AccessObjectTest() { - var query = @"select Self.Self.Array from #A.Entities()"; + var query = @"select Self.Self.Array from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001")]} + {"@A", [new BasicEntity("001")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -695,10 +695,10 @@ public void AccessObjectTest() [TestMethod] public void SimpleAccessObjectIncrementTest() { - var query = @"select Inc(Self.Array[2]) from #A.Entities()"; + var query = @"select Inc(Self.Array[2]) from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -715,10 +715,10 @@ public void SimpleAccessObjectIncrementTest() [TestMethod] public void WhereWithOrTest() { - var query = @"select Name from #A.Entities() where Name = '001' or Name = '005'"; + var query = @"select Name from @A.Entities() where Name = '001' or Name = '005'"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("005")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("005")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -733,10 +733,10 @@ public void WhereWithOrTest() [TestMethod] public void SimpleQueryTest() { - var query = @"select Name as 'x1' from #A.Entities()"; + var query = @"select Name as 'x1' from @A.Entities()"; var sources = new Dictionary> { - {"#A", [new BasicEntity("001"), new BasicEntity("002")]} + {"@A", [new BasicEntity("001"), new BasicEntity("002")]} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -756,11 +756,11 @@ public void SimpleQueryTest() [TestMethod] public void SimpleSkipTest() { - var query = @"select Name from #A.Entities() skip 2"; + var query = @"select Name from @A.Entities() skip 2"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("005"), new BasicEntity("006") @@ -782,11 +782,11 @@ public void SimpleSkipTest() [TestMethod] public void SimpleTakeTest() { - var query = @"select Name from #A.Entities() take 2"; + var query = @"select Name from @A.Entities() take 2"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("001"), new BasicEntity("002"), @@ -810,11 +810,11 @@ public void SimpleTakeTest() [TestMethod] public void GetHexTest() { - var query = @"select ToHex(GetBytes(5), '|') as hexValue from #A.Entities()"; + var query = @"select ToHex(GetBytes(5), '|') as hexValue from @A.Entities()"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("001") ] @@ -831,11 +831,11 @@ public void GetHexTest() [TestMethod] public void SimpleSkipTakeTest() { - var query = @"select Name from #A.Entities() skip 1 take 2"; + var query = @"select Name from @A.Entities() skip 1 take 2"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("005"), new BasicEntity("006") @@ -855,11 +855,11 @@ public void SimpleSkipTakeTest() [TestMethod] public void SimpleSkipAboveTableAmountTest() { - var query = @"select Name from #A.Entities() skip 100"; + var query = @"select Name from @A.Entities() skip 100"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("005"), new BasicEntity("006") @@ -876,11 +876,11 @@ public void SimpleSkipAboveTableAmountTest() [TestMethod] public void SimpleTakeAboveTableAmountTest() { - var query = @"select Name from #A.Entities() take 100"; + var query = @"select Name from @A.Entities() take 100"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("005"), new BasicEntity("006") @@ -903,11 +903,11 @@ public void SimpleTakeAboveTableAmountTest() [TestMethod] public void SimpleSkipTakeAboveTableAmountTest() { - var query = @"select Name from #A.Entities() skip 100 take 100"; + var query = @"select Name from @A.Entities() skip 100 take 100"; var sources = new Dictionary> { { - "#A", + "@A", [ new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("003"), new BasicEntity("004"), new BasicEntity("005"), new BasicEntity("006") @@ -925,10 +925,10 @@ public void SimpleSkipTakeAboveTableAmountTest() public void ColumnNamesSimpleTest() { var query = - @"select Name as TestName, GetOne(), GetOne() as TestColumn, GetTwo(4d, 'test') from #A.Entities()"; + @"select Name as TestName, GetOne(), GetOne() as TestColumn, GetTwo(4d, 'test') from @A.Entities()"; var sources = new Dictionary> { - {"#A", []} + {"@A", []} }; var vm = CreateAndRunVirtualMachine(query, sources); @@ -951,11 +951,11 @@ public void ColumnNamesSimpleTest() [TestMethod] public void CallMethodWithTwoParametersTest() { - var query = @"select Concat(Country, ToString(Population)) from #A.Entities()"; + var query = @"select Concat(Country, ToString(Population)) from @A.Entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("ABBA", 200) ] } @@ -975,12 +975,12 @@ public void CallMethodWithTwoParametersTest() [TestMethod] public void ColumnTypeDateTimeTest() { - var query = "select Time from #A.entities()"; + var query = "select Time from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity(DateTime.MinValue) ] } @@ -999,11 +999,11 @@ public void ColumnTypeDateTimeTest() [TestMethod] public void SimpleRowNumberStatTest() { - var query = @"select RowNumber() from #A.Entities()"; + var query = @"select RowNumber() from @A.Entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("001"), new BasicEntity("002"), new BasicEntity("003"), @@ -1030,12 +1030,12 @@ public void SimpleRowNumberStatTest() [TestMethod] public void SelectDecimalWithoutMarkingNumberExplicitlyTest() { - var query = "select 1.0, -1.0 from #A.entities()"; + var query = "select 1.0, -1.0 from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("xX") ] } @@ -1058,12 +1058,12 @@ public void SelectDecimalWithoutMarkingNumberExplicitlyTest() [TestMethod] public void DescEntityTest() { - var query = "desc #A.entities()"; + var query = "desc @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("xX") ] } @@ -1097,12 +1097,12 @@ public void DescEntityTest() [TestMethod] public void DescMethodTest() { - var query = "desc #A.entities"; + var query = "desc @A.entities"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("xX") ] } @@ -1119,12 +1119,12 @@ public void DescMethodTest() [TestMethod] public void DescSchemaTest() { - var query = "desc #A"; + var query = "desc @A"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("xX") ] } @@ -1143,12 +1143,12 @@ public void DescSchemaTest() [TestMethod] public void AggregateValuesTest() { - var query = @"select AggregateValues(Name) from #A.entities() a group by Name"; + var query = @"select AggregateValues(Name) from @A.entities() a group by Name"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("A"), new BasicEntity("B") ] @@ -1168,12 +1168,12 @@ public void AggregateValuesTest() [TestMethod] public void AggregateValuesParentTest() { - var query = @"select AggregateValues(Name, 1) from #A.entities() a group by Name"; + var query = @"select AggregateValues(Name, 1) from @A.entities() a group by Name"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("A"), new BasicEntity("B") ] @@ -1189,12 +1189,12 @@ public void AggregateValuesParentTest() [TestMethod] public void CoalesceTest() { - var query = @"select Coalesce('a', 'b', 'c', 'e', 'f') from #A.entities()"; + var query = @"select Coalesce('a', 'b', 'c', 'e', 'f') from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("A") ] } @@ -1209,12 +1209,12 @@ public void CoalesceTest() [TestMethod] public void ChooseTest() { - var query = @"select Choose(2, 'a', 'b', 'c', 'e', 'f') from #A.entities()"; + var query = @"select Choose(2, 'a', 'b', 'c', 'e', 'f') from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("A") ] } @@ -1229,12 +1229,12 @@ public void ChooseTest() [TestMethod] public void MatchWithRegexTest() { - var query = @"select Match('\d{7}', Name) from #A.entities()"; + var query = @"select Match('\d{7}', Name) from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("3213213") ] } @@ -1249,12 +1249,12 @@ public void MatchWithRegexTest() [TestMethod] public void HeadWithStringTest() { - var query = "select Head('ABCDEF', 2) from #A.entities()"; + var query = "select Head('ABCDEF', 2) from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("3213213") ] } @@ -1269,12 +1269,12 @@ public void HeadWithStringTest() [TestMethod] public void TailWithStringTest() { - var query = "select Tail('ABCDEF', 2) from #A.entities()"; + var query = "select Tail('ABCDEF', 2) from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("3213213") ] } @@ -1289,12 +1289,12 @@ public void TailWithStringTest() [TestMethod] public void SubtractTwoAliasedValuesTest() { - var query = "select a.Money - a.Money from #A.entities() a"; + var query = "select a.Money - a.Money from @A.entities() a"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("may", 2512m) ] } @@ -1309,12 +1309,12 @@ public void SubtractTwoAliasedValuesTest() [TestMethod] public void SubtractThreeAliasedValuesTest() { - var query = "select (a.Money - a.Population) / a.Money from #A.entities() a"; + var query = "select (a.Money - a.Population) / a.Money from @A.entities() a"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("may", 100m) { Population = 10 } ] } @@ -1329,12 +1329,12 @@ public void SubtractThreeAliasedValuesTest() [TestMethod] public void FilterByComplexObjectAccessInWhereTest() { - var query = "select Population from #A.entities() where Self.Money > 100"; + var query = "select Population from @A.entities() where Self.Money > 100"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("may", 100m) { Population = 10 }, new BasicEntity("june", 200m) { Population = 20 } ] @@ -1351,12 +1351,12 @@ public void FilterByComplexObjectAccessInWhereTest() [TestMethod] public void ComputeStDevTest() { - var query = "select StDev(Population) from #A.entities()"; + var query = "select StDev(Population) from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("may", 100m) { Population = 10 }, new BasicEntity("june", 200m) { Population = 20 } ] @@ -1378,12 +1378,12 @@ public void CaseWhenSimpleTest() " then true" + " else false" + " end)" + - "from #A.entities()"; + "from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("may", 100m) { Population = 100 }, new BasicEntity("june", 200m) { Population = 200 } ] @@ -1408,12 +1408,12 @@ public void CaseWhenWithLibraryMethodCallTest() " then entities.GetOne()" + " else entities.Inc(entities.GetOne())" + " end)" + - "from #A.entities() entities"; + "from @A.entities() entities"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("may", 100m) { Population = 100 }, new BasicEntity("june", 200m) { Population = 200 } ] @@ -1444,12 +1444,12 @@ public void MultipleCaseWhenWithLibraryMethodCallTest() " then entities.GetOne()" + " else entities.Inc(entities.GetOne())" + " end)" + - "from #A.entities() entities"; + "from @A.entities() entities"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("may", 100m) { Population = 100 }, new BasicEntity("june", 200m) { Population = 200 } ] @@ -1475,12 +1475,12 @@ public void MultipleCaseWhenWithLibraryMethodCallTest() [TestMethod] public void QueryWithTimeSpanTest() { - var query = "select ToTimeSpan('00:12:15') from #A.entities()"; + var query = "select ToTimeSpan('00:12:15') from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("may", 100m) { Population = 100 } ] } @@ -1496,12 +1496,12 @@ public void QueryWithTimeSpanTest() [TestMethod] public void QueryWithToDateTimeTest() { - var query = "select ToDateTime('2012/01/13') from #A.entities()"; + var query = "select ToDateTime('2012/01/13') from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("may", 100m) { Population = 100 } ] } @@ -1517,12 +1517,12 @@ public void QueryWithToDateTimeTest() [TestMethod] public void QueryWithToDateTimeAndTimeSpanAdditionTest() { - var query = "select ToDateTime('2012/01/13') + ToTimeSpan('00:12:15') from #A.entities()"; + var query = "select ToDateTime('2012/01/13') + ToTimeSpan('00:12:15') from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("may", 100m) { Population = 100 } ] } @@ -1538,12 +1538,12 @@ public void QueryWithToDateTimeAndTimeSpanAdditionTest() [TestMethod] public void QueryWithTimeSpansAdditionTest() { - var query = "select ToTimeSpan('00:12:15') + ToTimeSpan('00:12:15') from #A.entities()"; + var query = "select ToTimeSpan('00:12:15') + ToTimeSpan('00:12:15') from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("may", 100m) { Population = 100 } ] } @@ -1559,12 +1559,12 @@ public void QueryWithTimeSpansAdditionTest() [TestMethod] public void RegexMatchesIntegrationTest() { - var query = @"select RegexMatches('\d+', Name) from #A.entities()"; + var query = @"select RegexMatches('\d+', Name) from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("Test 123 and 456") ] } diff --git a/Musoq.Evaluator.Tests/StarTests.cs b/Musoq.Evaluator.Tests/StarTests.cs index 8dbbb0ec..61082722 100644 --- a/Musoq.Evaluator.Tests/StarTests.cs +++ b/Musoq.Evaluator.Tests/StarTests.cs @@ -11,12 +11,12 @@ public class StarTests : BasicEntityTestBase [TestMethod] public void WhenStarUnfoldToMultipleColumns_AndExplicitColumnIsUsedWithinWhere_ShouldPass() { - const string query = @"select * from #A.entities() a where a.Month = 'january'"; + const string query = @"select * from @A.entities() a where a.Month = 'january'"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("january", 50m), new BasicEntity("february", 100m), new BasicEntity("march", 150m) @@ -38,12 +38,12 @@ public void WhenStarUnfoldToMultipleColumns_AndExplicitColumnIsUsedWithinWhere_S [TestMethod] public void WhenMultipleStarsUnfoldToMultipleColumns_ShouldPass() { - const string query = @"select *, * from #A.entities() a where a.Month = 'january'"; + const string query = @"select *, * from @A.entities() a where a.Month = 'january'"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("january", 50m), new BasicEntity("february", 100m), new BasicEntity("march", 150m) @@ -71,12 +71,12 @@ public void WhenMultipleStarsUnfoldToMultipleColumns_ShouldPass() [TestMethod] public void WhenStarUnfoldToMultipleColumns_AndExplicitColumnIsUsedAsAnotherColumn_ShouldPass() { - const string query = @"select *, a.Month, Month from #A.entities() a where a.Month = 'january'"; + const string query = @"select *, a.Month, Month from @A.entities() a where a.Month = 'january'"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("january", 50m), new BasicEntity("february", 100m), new BasicEntity("march", 150m) @@ -104,12 +104,12 @@ public void WhenStarUnfoldToMultipleColumns_AndExplicitColumnIsUsedAsAnotherColu [TestMethod] public void WhenAliasedStarUnfoldToMultipleColumns_ShouldPass() { - const string query = @"select a.* from #A.entities() a"; + const string query = @"select a.* from @A.entities() a"; var sources = new Dictionary> { { - "#A", [] + "@A", [] } }; @@ -124,12 +124,12 @@ public void WhenAliasedStarUnfoldToMultipleColumns_ShouldPass() [TestMethod] public void WhenAliasedStarsUnfoldToMultipleColumns_ShouldPass() { - const string query = @"select a.*, a.* from #A.entities() a"; + const string query = @"select a.*, a.* from @A.entities() a"; var sources = new Dictionary> { { - "#A", [] + "@A", [] } }; @@ -144,12 +144,12 @@ public void WhenAliasedStarsUnfoldToMultipleColumns_ShouldPass() [TestMethod] public void WhenAliasedStarUnfoldToMultipleColumns_AndExplicitColumnUsed_ShouldPass() { - const string query = @"select a.*, a.Month from #A.entities() a"; + const string query = @"select a.*, a.Month from @A.entities() a"; var sources = new Dictionary> { { - "#A", [] + "@A", [] } }; @@ -167,17 +167,17 @@ public void WhenAliasedStarUnfoldToMultipleColumns_AndExplicitColumnUsed_ShouldP [TestMethod] public void WhenStarUnfoldToMultipleOfTwoTablesColumns_TwoTablesUsed_ShouldPass() { - const string query = @"select * from #A.entities() a inner join #B.entities() b on a.Month = b.Month"; + const string query = @"select * from @A.entities() a inner join @B.entities() b on a.Month = b.Month"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("january", 50m) ] }, { - "#B", [ + "@B", [ new BasicEntity("january", 150m) ] } @@ -200,17 +200,17 @@ public void WhenStarUnfoldToMultipleOfTwoTablesColumns_TwoTablesUsed_ShouldPass( [TestMethod] public void WhenAliasedStarUnfoldToMultipleColumns_TwoTablesUsed_ShouldPass() { - const string query = @"select a.*, b.* from #A.entities() a inner join #B.entities() b on a.Month = b.Month"; + const string query = @"select a.*, b.* from @A.entities() a inner join @B.entities() b on a.Month = b.Month"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("january", 50m) ] }, { - "#B", [ + "@B", [ new BasicEntity("january", 150m) ] } @@ -233,17 +233,17 @@ public void WhenAliasedStarUnfoldToMultipleColumns_TwoTablesUsed_ShouldPass() [TestMethod] public void WhenAliasedStarUnfoldToMultipleColumns_FirstTableUnfolded_ShouldPass() { - const string query = @"select a.* from #A.entities() a inner join #B.entities() b on a.Month = b.Month"; + const string query = @"select a.* from @A.entities() a inner join @B.entities() b on a.Month = b.Month"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("january", 50m) ] }, { - "#B", [ + "@B", [ new BasicEntity("january", 150m) ] } @@ -266,17 +266,17 @@ public void WhenAliasedStarUnfoldToMultipleColumns_FirstTableUnfolded_ShouldPass [TestMethod] public void WhenAliasedStarUnfoldToMultipleColumns_SecondTableUnfolded_ShouldPass() { - const string query = @"select b.* from #A.entities() a inner join #B.entities() b on a.Month = b.Month"; + const string query = @"select b.* from @A.entities() a inner join @B.entities() b on a.Month = b.Month"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("january", 50m) ] }, { - "#B", [ + "@B", [ new BasicEntity("january", 150m) ] } @@ -300,17 +300,17 @@ public void WhenAliasedStarUnfoldToMultipleColumns_SecondTableUnfolded_ShouldPas public void WhenAliasedStarUnfoldToMultipleColumns_AndExplicitColumnUsed_TwoTablesUsed_ShouldPass() { const string query = - @"select a.*, a.Month, b.*, b.Month from #A.entities() a inner join #B.entities() b on a.Month = b.Month"; + @"select a.*, a.Month, b.*, b.Month from @A.entities() a inner join @B.entities() b on a.Month = b.Month"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("january", 50m) ] }, { - "#B", [ + "@B", [ new BasicEntity("january", 150m) ] } @@ -344,12 +344,12 @@ public void WhenAliasedStarUnfoldToMultipleColumns_AndExplicitColumnUsed_TwoTabl [TestMethod] public void WhenStarUnfoldToMultipleColumns_AndStarIsUsedWithinSelect_ShouldPass() { - const string query = @"with p as (select * from #A.entities() a where a.Month = 'january') select * from p"; + const string query = @"with p as (select * from @A.entities() a where a.Month = 'january') select * from p"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("january", 50m), new BasicEntity("february", 100m), new BasicEntity("march", 150m) @@ -371,12 +371,12 @@ public void WhenStarUnfoldToMultipleColumns_AndStarIsUsedWithinSelect_ShouldPass [TestMethod] public void WhenAliasedStarUnfoldToMultipleColumns_AndStarIsUsedWithinSelect_ShouldPass() { - const string query = @"with p as (select a.* from #A.entities() a where a.Month = 'january') select * from p"; + const string query = @"with p as (select a.* from @A.entities() a where a.Month = 'january') select * from p"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("january", 50m), new BasicEntity("february", 100m), new BasicEntity("march", 150m) @@ -398,12 +398,12 @@ public void WhenAliasedStarUnfoldToMultipleColumns_AndStarIsUsedWithinSelect_Sho [TestMethod] public void WhenAliasedStarUnfoldToMultipleColumns_AndAliasedStarIsUsedWithinSelect_ShouldPass() { - const string query = @"with p as (select a.* from #A.entities() a where a.Month = 'january') select p.* from p"; + const string query = @"with p as (select a.* from @A.entities() a where a.Month = 'january') select p.* from p"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("january", 50m), new BasicEntity("february", 100m), new BasicEntity("march", 150m) @@ -425,12 +425,12 @@ public void WhenAliasedStarUnfoldToMultipleColumns_AndAliasedStarIsUsedWithinSel [TestMethod] public void WhenAliasedStarUnfoldToMultipleColumns_AndAliasedStarIsUsedWithinAliasedFrom_ShouldPass() { - const string query = @"with p as (select a.* from #A.entities() a where a.Month = 'january') select p.* from p p"; + const string query = @"with p as (select a.* from @A.entities() a where a.Month = 'january') select p.* from p p"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("january", 50m), new BasicEntity("february", 100m), new BasicEntity("march", 150m) diff --git a/Musoq.Evaluator.Tests/StringifyTests.cs b/Musoq.Evaluator.Tests/StringifyTests.cs index e5d329c2..a849bf6b 100644 --- a/Musoq.Evaluator.Tests/StringifyTests.cs +++ b/Musoq.Evaluator.Tests/StringifyTests.cs @@ -9,67 +9,67 @@ namespace Musoq.Evaluator.Tests; public class StringifyTests : BasicEntityTestBase { [TestMethod] - [DataRow("select 1 as X from #A.entities()")] - [DataRow("select 1 as X, 2 as Y from #A.entities()")] - [DataRow("select 1 as X, 2 as Y, 3 as Z from #A.entities()")] - [DataRow("select some.Thing from #A.entities()")] - [DataRow("select 1 from #A.entities() a inner join #B.entities() b on a.Id = b.Id")] - [DataRow("select 1 from #A.entities() a left outer join #B.entities() b on a.Id = b.Id")] - [DataRow("select 1 from #A.entities() a right outer join #B.entities() b on a.Id = b.Id")] - [DataRow("select 1 from #A.entities() a inner join #B.entities() b on a.Id = b.Id inner join #C.entities() c on a.Id = c.Id")] - [DataRow("select 1 from #A.entities() a inner join #B.entities() b on a.Id = b.Id left outer join #C.entities() c on a.Id = c.Id")] - [DataRow("select 1 from #A.entities() a inner join #B.entities() b on a.Id = b.Id right outer join #C.entities() c on a.Id = c.Id")] - [DataRow("select c.ContainerName, c2.ImageName, c.ContainerId from #stdin.text('Ollama', 'llama3.1') c inner join #stdin.text('Ollama', 'llama3.1') c2 on c.ContainerId = c2.ContainerId")] + [DataRow("select 1 as X from @A.entities()")] + [DataRow("select 1 as X, 2 as Y from @A.entities()")] + [DataRow("select 1 as X, 2 as Y, 3 as Z from @A.entities()")] + [DataRow("select some.Thing from @A.entities()")] + [DataRow("select 1 from @A.entities() a inner join @B.entities() b on a.Id = b.Id")] + [DataRow("select 1 from @A.entities() a left outer join @B.entities() b on a.Id = b.Id")] + [DataRow("select 1 from @A.entities() a right outer join @B.entities() b on a.Id = b.Id")] + [DataRow("select 1 from @A.entities() a inner join @B.entities() b on a.Id = b.Id inner join @C.entities() c on a.Id = c.Id")] + [DataRow("select 1 from @A.entities() a inner join @B.entities() b on a.Id = b.Id left outer join @C.entities() c on a.Id = c.Id")] + [DataRow("select 1 from @A.entities() a inner join @B.entities() b on a.Id = b.Id right outer join @C.entities() c on a.Id = c.Id")] + [DataRow("select c.ContainerName, c2.ImageName, c.ContainerId from @stdin.text('Ollama', 'llama3.1') c inner join @stdin.text('Ollama', 'llama3.1') c2 on c.ContainerId = c2.ContainerId")] [DataRow("table Example {};")] [DataRow("table Example { Id 'System.Int32' };")] [DataRow("table Example { Id 'System.Int32', Name 'System.String' };")] - [DataRow("table Example { Id 'System.Int32', Name 'System.String' };\ncouple #a.b with table Example as SourceOfExamples;\nselect 1 from SourceOfExamples('a', 'b')")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s where s.Column1 = 4")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s group by s.Column2")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s order by s.Column1 desc")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s skip 10")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s take 5")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s where s.Column1 > 10 group by s.Column2")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s where s.Column2 = 'Test' order by s.Column1")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s where s.Column1 < 20 skip 5")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s where s.Column2 <> 'Example' take 3")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s group by s.Column1, s.Column2 order by s.Column1")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s group by s.Column2 skip 15")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s group by s.Column1 take 8")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s order by s.Column2, s.Column1 desc skip 7")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s order by s.Column1 take 12")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s skip 20 take 10")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s where s.Column1 >= 5 group by s.Column2 order by s.Column1")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s where s.Column2 like '%test%' group by s.Column1 skip 3")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s where s.Column1 <= 15 group by s.Column2 take 6")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s where s.Column2 is not null order by s.Column1 skip 8")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s where s.Column1 = 10 order by s.Column2 take 4")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s where s.Column1 in (1, 2, 3) skip 2 take 5")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s group by s.Column1, s.Column2 order by s.Column1 skip 10")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s group by s.Column2 order by s.Column1 desc take 7")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s group by s.Column1 skip 5 take 15")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s order by s.Column2, s.Column1 skip 12 take 8")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s where s.Column1 <> 0 group by s.Column2 order by s.Column1 skip 6")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s where s.Column2 = 'Value' group by s.Column1 order by s.Column2 take 9")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s where s.Column1 > 100 group by s.Column2 skip 3 take 7")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s where s.Column2 like 'A%' order by s.Column1 skip 4 take 8")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s group by s.Column1, s.Column2 order by s.Column1 skip 5 take 10")] - [DataRow("select s.Column1, s.Column2 from #some.thing() s where s.Column1 > 0 group by s.Column2 order by s.Column1 skip 2 take 5")] - [DataRow("select t.Name, Count(t.Name) from #some.thing(true) t group by t.Name having Count(t.Name) > 1")] - [DataRow("select t.* from #some.thing(true) t")] - [DataRow("select somethingVeryLong.* from #some.thing(true) somethingVeryLong")] - [DataRow("select somethingVeryLong2.* from #some.thing(true) somethingVeryLong2")] - [DataRow("select b.* from #some.thing() a cross apply #some.thing() b")] - [DataRow("select b.* from #some.thing() a cross apply #some.thing(a.Column) b")] - [DataRow("select b.* from #some.thing() a cross apply #some.thing(a.Column, true) b")] - [DataRow("select b.* from #some.thing() a cross apply #some.thing(a.Column, true, 10) b")] - [DataRow("select b.* from #some.thing() a cross apply a.TestMethod(a.Column) b")] - [DataRow("select b.* from #some.thing() a cross apply a.Column b")] - [DataRow("select b.* from #some.thing() a outer apply a.Column b")] - [DataRow("select b.* from #some.thing() a outer apply #some.thing() b")] - [DataRow("select b.* from #some.thing() a outer apply #some.thing(a.Column) b")] - [DataRow("select b.* from #some.thing() a outer apply a.TestMethod(b.Column) b")] - [DataRow("select b.* from #some.thing() a outer apply a.TestMethod(b.Column, true, 10) b")] + [DataRow("table Example { Id 'System.Int32', Name 'System.String' };\ncouple @a.b with table Example as SourceOfExamples;\nselect 1 from SourceOfExamples('a', 'b')")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s where s.Column1 = 4")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s group by s.Column2")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s order by s.Column1 desc")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s skip 10")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s take 5")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s where s.Column1 > 10 group by s.Column2")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s where s.Column2 = 'Test' order by s.Column1")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s where s.Column1 < 20 skip 5")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s where s.Column2 <> 'Example' take 3")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s group by s.Column1, s.Column2 order by s.Column1")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s group by s.Column2 skip 15")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s group by s.Column1 take 8")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s order by s.Column2, s.Column1 desc skip 7")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s order by s.Column1 take 12")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s skip 20 take 10")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s where s.Column1 >= 5 group by s.Column2 order by s.Column1")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s where s.Column2 like '%test%' group by s.Column1 skip 3")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s where s.Column1 <= 15 group by s.Column2 take 6")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s where s.Column2 is not null order by s.Column1 skip 8")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s where s.Column1 = 10 order by s.Column2 take 4")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s where s.Column1 in (1, 2, 3) skip 2 take 5")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s group by s.Column1, s.Column2 order by s.Column1 skip 10")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s group by s.Column2 order by s.Column1 desc take 7")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s group by s.Column1 skip 5 take 15")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s order by s.Column2, s.Column1 skip 12 take 8")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s where s.Column1 <> 0 group by s.Column2 order by s.Column1 skip 6")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s where s.Column2 = 'Value' group by s.Column1 order by s.Column2 take 9")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s where s.Column1 > 100 group by s.Column2 skip 3 take 7")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s where s.Column2 like 'A%' order by s.Column1 skip 4 take 8")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s group by s.Column1, s.Column2 order by s.Column1 skip 5 take 10")] + [DataRow("select s.Column1, s.Column2 from @some.thing() s where s.Column1 > 0 group by s.Column2 order by s.Column1 skip 2 take 5")] + [DataRow("select t.Name, Count(t.Name) from @some.thing(true) t group by t.Name having Count(t.Name) > 1")] + [DataRow("select t.* from @some.thing(true) t")] + [DataRow("select somethingVeryLong.* from @some.thing(true) somethingVeryLong")] + [DataRow("select somethingVeryLong2.* from @some.thing(true) somethingVeryLong2")] + [DataRow("select b.* from @some.thing() a cross apply @some.thing() b")] + [DataRow("select b.* from @some.thing() a cross apply @some.thing(a.Column) b")] + [DataRow("select b.* from @some.thing() a cross apply @some.thing(a.Column, true) b")] + [DataRow("select b.* from @some.thing() a cross apply @some.thing(a.Column, true, 10) b")] + [DataRow("select b.* from @some.thing() a cross apply a.TestMethod(a.Column) b")] + [DataRow("select b.* from @some.thing() a cross apply a.Column b")] + [DataRow("select b.* from @some.thing() a outer apply a.Column b")] + [DataRow("select b.* from @some.thing() a outer apply @some.thing() b")] + [DataRow("select b.* from @some.thing() a outer apply @some.thing(a.Column) b")] + [DataRow("select b.* from @some.thing() a outer apply a.TestMethod(b.Column) b")] + [DataRow("select b.* from @some.thing() a outer apply a.TestMethod(b.Column, true, 10) b")] public void WhenToStringCalled_ShouldReturnSameQuery(string query) { diff --git a/Musoq.Evaluator.Tests/StringsTests.cs b/Musoq.Evaluator.Tests/StringsTests.cs index 50626634..02d71151 100644 --- a/Musoq.Evaluator.Tests/StringsTests.cs +++ b/Musoq.Evaluator.Tests/StringsTests.cs @@ -11,12 +11,12 @@ public class StringsTests : BasicEntityTestBase [TestMethod] public void WhenQuoteUsed_MustNotThrow() { - var query = """select '"' from #A.entities()"""; + var query = """select '"' from @A.entities()"""; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("test") ] } @@ -37,12 +37,12 @@ public void WhenQuoteUsed_MustNotThrow() [TestMethod] public void WhenQuotePrecededByTextUsed_MustNotThrow() { - var query = """select 'text "' from #A.entities()"""; + var query = """select 'text "' from @A.entities()"""; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("test") ] } @@ -63,12 +63,12 @@ public void WhenQuotePrecededByTextUsed_MustNotThrow() [TestMethod] public void WhenQuoteFollowedByTextUsed_MustNotThrow() { - var query = """select '"text' from #A.entities()"""; + var query = """select '"text' from @A.entities()"""; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("test") ] } @@ -89,12 +89,12 @@ public void WhenQuoteFollowedByTextUsed_MustNotThrow() [TestMethod] public void WhenQuoteFollowedAndPrecededByTextUsed_MustNotThrow() { - var query = """select '"text"' from #A.entities()"""; + var query = """select '"text"' from @A.entities()"""; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("test") ] } @@ -115,12 +115,12 @@ public void WhenQuoteFollowedAndPrecededByTextUsed_MustNotThrow() [TestMethod] public void WhenEscapeCharacterUsed_MustNotThrow() { - const string query = """select '\'' from #A.entities()"""; + const string query = """select '\'' from @A.entities()"""; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("test") ] } @@ -137,12 +137,12 @@ public void WhenEscapeCharacterUsed_MustNotThrow() [TestMethod] public void WhenEscapeCharacterUsedInText_MustNotThrow() { - const string query = """select 'text \'' from #A.entities()"""; + const string query = """select 'text \'' from @A.entities()"""; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("test") ] } @@ -159,12 +159,12 @@ public void WhenEscapeCharacterUsedInText_MustNotThrow() [TestMethod] public void WhenMultipleEscapeCharactersUsedInText_MustNotThrow() { - const string query = """select 'lorem\' ipsum dolor\'' from #A.entities()"""; + const string query = """select 'lorem\' ipsum dolor\'' from @A.entities()"""; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("test") ] } @@ -181,12 +181,12 @@ public void WhenMultipleEscapeCharactersUsedInText_MustNotThrow() [TestMethod] public void WhenMultipleEscapeCharactersUsedInTextWithQuote_MustNotThrow() { - const string query = """select 'lorem\' " ipsum dolor\'' from #A.entities()"""; + const string query = """select 'lorem\' " ipsum dolor\'' from @A.entities()"""; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("test") ] } @@ -234,12 +234,12 @@ public void WhenMultipleEscapeCharactersUsedInTextWithQuote_MustNotThrow() [DataTestMethod] public void WhenSpecialCharacterStartBracketUsedInTextWith_MustNotThrow(char specialCharacter) { - var query = $"select '{specialCharacter}' from #A.entities()"; + var query = $"select '{specialCharacter}' from @A.entities()"; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity("test") ] } @@ -257,12 +257,12 @@ public void WhenSpecialCharacterStartBracketUsedInTextWith_MustNotThrow(char spe [TestMethod] public void WhenIndexOfCalled_ShouldReturnFirstIndex() { - const string query = """select IndexOf('a/b/c', '/') from #A.entities()"""; + const string query = """select IndexOf('a/b/c', '/') from @A.entities()"""; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity(string.Empty) ] } @@ -278,12 +278,12 @@ public void WhenIndexOfCalled_ShouldReturnFirstIndex() [TestMethod] public void WhenNthIndexOfCalled_ShouldReturnSecondIndex() { - const string query = """select NthIndexOf('a/b/c', '/', 1) from #A.entities()"""; + const string query = """select NthIndexOf('a/b/c', '/', 1) from @A.entities()"""; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity(string.Empty) ] } @@ -299,12 +299,12 @@ public void WhenNthIndexOfCalled_ShouldReturnSecondIndex() [TestMethod] public void WhenLastIndexOfCalled_ShouldReturnLastIndex() { - const string query = """select LastIndexOf('a/b/c', '/') from #A.entities()"""; + const string query = """select LastIndexOf('a/b/c', '/') from @A.entities()"""; var sources = new Dictionary> { { - "#A", [ + "@A", [ new BasicEntity(string.Empty) ] } diff --git a/Musoq.Evaluator.Tests/TimeSpanTests.cs b/Musoq.Evaluator.Tests/TimeSpanTests.cs index 2bb378db..074e92af 100644 --- a/Musoq.Evaluator.Tests/TimeSpanTests.cs +++ b/Musoq.Evaluator.Tests/TimeSpanTests.cs @@ -16,7 +16,7 @@ public void SumTimeSpanTest() const string query = "table Periods {" + " Period 'System.TimeSpan'" + "};" + - "couple #test.whatever with table Periods as Periods; " + + "couple @test.whatever with table Periods as Periods; " + "select SumTimeSpan(Period) from Periods()"; dynamic first = new ExpandoObject(); @@ -48,7 +48,7 @@ public void MinTimeSpanTest() const string query = "table Periods {" + " Period 'System.TimeSpan'" + "};" + - "couple #test.whatever with table Periods as Periods; " + + "couple @test.whatever with table Periods as Periods; " + "select MinTimeSpan(Period) from Periods()"; dynamic first = new ExpandoObject(); @@ -80,7 +80,7 @@ public void MaxTimeSpanTest() const string query = "table Periods {" + " Period 'System.TimeSpan'" + "};" + - "couple #test.whatever with table Periods as Periods; " + + "couple @test.whatever with table Periods as Periods; " + "select MaxTimeSpan(Period) from Periods()"; dynamic first = new ExpandoObject(); @@ -113,7 +113,7 @@ public void AddTimeSpansTest() " Period1 'System.TimeSpan'" + " Period2 'System.TimeSpan'" + "};" + - "couple #test.whatever with table Periods as Periods; " + + "couple @test.whatever with table Periods as Periods; " + "select AddTimeSpans(Period1, Period2) from Periods()"; dynamic first = new ExpandoObject(); @@ -144,7 +144,7 @@ public void SubtractTimeSpansTest() " Period1 'System.TimeSpan'" + " Period2 'System.TimeSpan'" + "};" + - "couple #test.whatever with table Periods as Periods; " + + "couple @test.whatever with table Periods as Periods; " + "select SubtractTimeSpans(Period1, Period2) from Periods()"; dynamic first = new ExpandoObject(); diff --git a/Musoq.Evaluator.Tests/UsedColumnsTests.cs b/Musoq.Evaluator.Tests/UsedColumnsTests.cs index b7d01e78..a28320d3 100644 --- a/Musoq.Evaluator.Tests/UsedColumnsTests.cs +++ b/Musoq.Evaluator.Tests/UsedColumnsTests.cs @@ -10,7 +10,7 @@ public class UsedColumnsTests : BasicEntityTestBase [TestMethod] public void WhenColumnsUsedAsSourceOfMethod_ShouldPass() { - var query = "select DoNothing(a.City) from #A.entities() a"; + var query = "select DoNothing(a.City) from @A.entities() a"; var buildItems = CreateBuildItems(query); @@ -30,9 +30,9 @@ public void WhenCteWithSameAliasExist2_ShouldPass() { const string query = @" with q1 as ( - select a.City as City from #A.entities() a where a.City = 'Warsaw' + select a.City as City from @A.entities() a where a.City = 'Warsaw' ), q2 as ( - select a.Population as Population from #A.entities() a where a.Population = 200d + select a.Population as Population from @A.entities() a where a.Population = 200d ) select City from q1"; var buildItems = CreateBuildItems(query); @@ -60,9 +60,9 @@ public void WhenCteWithSameAliasExist_ShouldPass() { const string query = @" with q1 as ( - select a.City as City from #A.entities('1') a + select a.City as City from @A.entities('1') a ), q2 as ( - select a.Population as Population from #A.entities('2') a + select a.Population as Population from @A.entities('2') a ) select City from q1"; var buildItems = CreateBuildItems(query); @@ -89,7 +89,7 @@ with q1 as ( [TestMethod] public void WhenColumnsUsedAsSourceOfMethodAndUsedInWhere_ShouldPass() { - var query = "select a.City from #A.entities() a where DoNothing(a.Population) = 400d"; + var query = "select a.City from @A.entities() a where DoNothing(a.Population) = 400d"; var buildItems = CreateBuildItems(query); @@ -108,7 +108,7 @@ public void WhenColumnsUsedAsSourceOfMethodAndUsedInWhere_ShouldPass() [TestMethod] public void WhenColumnsUsedAsSourceOfMethodAndUsedInWhereAndUsedInSelect_ShouldPass() { - var query = "select a.City, DoNothing(a.Population) from #A.entities() a where DoNothing(a.Population) = 400d"; + var query = "select a.City, DoNothing(a.Population) from @A.entities() a where DoNothing(a.Population) = 400d"; var buildItems = CreateBuildItems(query); @@ -127,7 +127,7 @@ public void WhenColumnsUsedAsSourceOfMethodAndUsedInWhereAndUsedInSelect_ShouldP [TestMethod] public void WhenColumnsUsedAsSourceOfMethodAndUsedInWhereAndUsedInSelectAndUsedInGroupBy_ShouldPass() { - var query = "select a.City, DoNothing(a.Population) from #A.entities() a where DoNothing(a.Population) = 400d group by a.Month"; + var query = "select a.City, DoNothing(a.Population) from @A.entities() a where DoNothing(a.Population) = 400d group by a.Month"; var buildItems = CreateBuildItems(query); @@ -147,7 +147,7 @@ public void WhenColumnsUsedAsSourceOfMethodAndUsedInWhereAndUsedInSelectAndUsedI [TestMethod] public void WhenColumnsUsedAsSourceOfMethodAndUsedInWhereAndUsedInSelectAndUsedInGroupByWithHaving_ShouldPass() { - var query = "select a.City from #A.entities() a group by a.Month having a.Population > 100d"; + var query = "select a.City from @A.entities() a group by a.Month having a.Population > 100d"; var buildItems = CreateBuildItems(query); @@ -167,7 +167,7 @@ public void WhenColumnsUsedAsSourceOfMethodAndUsedInWhereAndUsedInSelectAndUsedI [TestMethod] public void WhenColumnsUsedInJoinQuery_ShouldPass() { - var query = "select a.City, b.City from #A.entities() a inner join #B.entities() b on a.City = b.City"; + var query = "select a.City, b.City from @A.entities() a inner join @B.entities() b on a.City = b.City"; var buildItems = CreateBuildItems(query); @@ -193,7 +193,7 @@ public void WhenColumnsUsedInJoinQuery_ShouldPass() [TestMethod] public void WhenGroupByAndOrderByUsed_ShouldPass() { - var query = "select 1 from #A.entities() a inner join #B.entities() b on a.Population = b.Population group by a.City"; + var query = "select 1 from @A.entities() a inner join @B.entities() b on a.Population = b.Population group by a.City"; var buildItems = CreateBuildItems(query); diff --git a/Musoq.Evaluator/Visitors/BuildMetadataAndInferTypesVisitor.cs b/Musoq.Evaluator/Visitors/BuildMetadataAndInferTypesVisitor.cs index 23fb5930..f298e7c6 100644 --- a/Musoq.Evaluator/Visitors/BuildMetadataAndInferTypesVisitor.cs +++ b/Musoq.Evaluator/Visitors/BuildMetadataAndInferTypesVisitor.cs @@ -471,7 +471,7 @@ public void Visit(AllColumnsNode node) var tableSymbol = _currentScope.ScopeSymbolTable.GetSymbol(identifier); if (!string.IsNullOrWhiteSpace(node.Alias) /* r.* */ || - (!tableSymbol.IsCompoundTable && string.IsNullOrWhiteSpace(node.Alias)) /* * from #abc.cda() */) + (!tableSymbol.IsCompoundTable && string.IsNullOrWhiteSpace(node.Alias)) /* * from @abc.cda() */) { ProcessSingleTable(node, tableSymbol, identifier); } diff --git a/Musoq.Parser.Tests/ParserTests.cs b/Musoq.Parser.Tests/ParserTests.cs index f64a2757..79478d44 100644 --- a/Musoq.Parser.Tests/ParserTests.cs +++ b/Musoq.Parser.Tests/ParserTests.cs @@ -11,7 +11,7 @@ public class ParserTests public void CheckReorderedQueryWithJoin_ShouldConstructQuery() { var query = - "from #some.a() s1 inner join #some.b() s2 on s1.col = s2.col where s1.col2 = '1' group by s2.col3 select s1.col4, s2.col4 skip 1 take 1"; + "from @some.a() s1 inner join @some.b() s2 on s1.col = s2.col where s1.col2 = '1' group by s2.col3 select s1.col4, s2.col4 skip 1 take 1"; var lexer = new Lexer(query, true); var parser = new Parser(lexer); @@ -22,7 +22,7 @@ public void CheckReorderedQueryWithJoin_ShouldConstructQuery() [TestMethod] public void CouplingSyntax_ComposeSchemaMethodWithKeywordAsMethod_ShouldParse() { - var query = "couple #some.table with table Test as SourceOfTestValues;"; + var query = "couple @some.table with table Test as SourceOfTestValues;"; var lexer = new Lexer(query, true); var parser = new Parser(lexer); @@ -33,7 +33,7 @@ public void CouplingSyntax_ComposeSchemaMethodWithKeywordAsMethod_ShouldParse() [TestMethod] public void CouplingSyntax_ComposeSchemaMethodWithWordAsMethod_ShouldParse() { - var query = "couple #some.something with table Test as SourceOfTestValues;"; + var query = "couple @some.something with table Test as SourceOfTestValues;"; var lexer = new Lexer(query, true); var parser = new Parser(lexer); @@ -44,7 +44,7 @@ public void CouplingSyntax_ComposeSchemaMethodWithWordAsMethod_ShouldParse() [TestMethod] public void CouplingSyntax_ComposeSchemaMethodWithWordFinishedWithNumberAsMethod_ShouldParse() { - var query = "couple #some.something4 with table Test as SourceOfTestValues;"; + var query = "couple @some.something4 with table Test as SourceOfTestValues;"; var lexer = new Lexer(query, true); var parser = new Parser(lexer); @@ -55,7 +55,7 @@ public void CouplingSyntax_ComposeSchemaMethodWithWordFinishedWithNumberAsMethod [TestMethod] public void SelectWithUnnecessaryFirstComma_ShouldFail() { - var query = "select ,1, 2, 3 from #some.a()"; + var query = "select ,1, 2, 3 from @some.a()"; var lexer = new Lexer(query, true); var parser = new Parser(lexer); @@ -66,7 +66,7 @@ public void SelectWithUnnecessaryFirstComma_ShouldFail() [TestMethod] public void SelectWithUnnecessaryLastComma_ShouldFail() { - var query = "select 1, from #some.a()"; + var query = "select 1, from @some.a()"; var lexer = new Lexer(query, true); var parser = new Parser(lexer); @@ -77,7 +77,7 @@ public void SelectWithUnnecessaryLastComma_ShouldFail() [TestMethod] public void SelectTwoCommas_ShouldFail() { - var query = "select ,, from #some.a()"; + var query = "select ,, from @some.a()"; var lexer = new Lexer(query, true); var parser = new Parser(lexer); @@ -88,7 +88,7 @@ public void SelectTwoCommas_ShouldFail() [TestMethod] public void GroupByWithUnnecessaryFirstComma_ShouldParse() { - var query = "select 1 from #some.a() group by ,1"; + var query = "select 1 from @some.a() group by ,1"; var lexer = new Lexer(query, true); var parser = new Parser(lexer); @@ -99,7 +99,7 @@ public void GroupByWithUnnecessaryFirstComma_ShouldParse() [TestMethod] public void GroupByWithUnnecessaryLastComma_ShouldFail() { - var query = "select 1 from #some.a() group by 1,"; + var query = "select 1 from @some.a() group by 1,"; var lexer = new Lexer(query, true); var parser = new Parser(lexer); @@ -110,7 +110,7 @@ public void GroupByWithUnnecessaryLastComma_ShouldFail() [TestMethod] public void SelectTypo_ShouldFail() { - var query = "sleect 1 from #some.a() group by 1,"; + var query = "sleect 1 from @some.a() group by 1,"; var lexer = new Lexer(query, true); var parser = new Parser(lexer); @@ -121,20 +121,20 @@ public void SelectTypo_ShouldFail() [TestMethod] public void FromTypo_ShouldFail() { - var query = "select 1 form #some.a() group by 1"; + var query = "select 1 form @some.a() group by 1"; var lexer = new Lexer(query, true); var parser = new Parser(lexer); var exc = Assert.ThrowsException(() => parser.ComposeAll()); - Assert.AreEqual("select 1 form #some.", exc.QueryPart); + Assert.AreEqual("select 1 form @some.", exc.QueryPart); } [TestMethod] public void SemicolonAtTheEnd_ShouldPass() { - var query = "select 1 from #some.a() order by x;"; + var query = "select 1 from @some.a() order by x;"; var lexer = new Lexer(query, true); var parser = new Parser(lexer); @@ -145,7 +145,7 @@ public void SemicolonAtTheEnd_ShouldPass() [TestMethod] public void WhenCaseWhenWithMissingEnd_ShouldFail() { - var query = "select case when 1 = 1 then 1 else 0 from #some.a()"; + var query = "select case when 1 = 1 then 1 else 0 from @some.a()"; var lexer = new Lexer(query, true); var parser = new Parser(lexer); @@ -160,7 +160,7 @@ public void WhenCommentAtTheBegining_ShouldParse() --some comment select 1 - from #some.a() --some comment + from @some.a() --some comment """; var lexer = new Lexer(query, true); @@ -175,7 +175,7 @@ public void WhenCommentAfterColumn_ShouldParse() var query = """ select 1 --some comment - from #some.a() + from @some.a() """; var lexer = new Lexer(query, true); @@ -190,7 +190,7 @@ public void WhenCommentAfterQuery_ShouldParse() var query = """ select 1 - from #some.a() --some comment + from @some.a() --some comment """; var lexer = new Lexer(query, true); @@ -205,7 +205,7 @@ public void WhenCommentAtTheNewLineAfterQuery_ShouldParse() var query = """ select 1 - from #some.a() + from @some.a() --some comment """; @@ -222,7 +222,7 @@ public void WhenCommentAfterColumnAndAtTheNextLine_ShouldParse() select 1 --some comment --some comment - from #some.a() + from @some.a() """; var lexer = new Lexer(query, true); @@ -237,7 +237,7 @@ public void WhenCommentBetweenKeywords_ShouldParse() var query = """ select --some comment 1 - from #some.a() + from @some.a() """; var lexer = new Lexer(query, true); @@ -252,7 +252,7 @@ public void WhenMultipleCommentsOnSameLine_ShouldParse() var query = """ select --first comment --second comment 1 - from #some.a() + from @some.a() """; var lexer = new Lexer(query, true); @@ -267,7 +267,7 @@ public void WhenCommentContainsSpecialCharacters_ShouldParse() var query = """ select 1 - from #some.a() --comment with !@#$%^&*() + from @some.a() --comment with !@#$%^&*() """; var lexer = new Lexer(query, true); @@ -282,7 +282,7 @@ public void WhenCommentContainsSQLKeywords_ShouldParse() var query = """ select 1 - from #some.a() --comment containing SELECT FROM WHERE + from @some.a() --comment containing SELECT FROM WHERE """; var lexer = new Lexer(query, true); @@ -297,7 +297,7 @@ public void WhenEmptyComment_ShouldParse() var query = """ select 1 -- - from #some.a() + from @some.a() """; var lexer = new Lexer(query, true); @@ -312,7 +312,7 @@ public void WhenCommentHasLeadingSpaces_ShouldParse() var query = """ select 1 -- spaced comment - from #some.a() + from @some.a() """; var lexer = new Lexer(query, true); @@ -327,8 +327,8 @@ public void WhenCommentsAroundJoins_ShouldParse() var query = """ select 1 - from #some.a() a--comment before join - inner join #some.b() b--comment after join + from @some.a() a--comment before join + inner join @some.b() b--comment after join on a.id = b.id """; @@ -344,7 +344,7 @@ public void WhenCommentContainsDoubleHyphen_ShouldParse() var query = """ select 1 -- comment with -- inside - from #some.a() + from @some.a() """; var lexer = new Lexer(query, true); @@ -354,9 +354,9 @@ public void WhenCommentContainsDoubleHyphen_ShouldParse() } [TestMethod] - [DataRow("select 1 from #some.thing() r cross apply r.Prop.Nested c")] - [DataRow("select 1 from #some.thing() r cross apply r.Prop.Nested c cross apply c.Prop.Nested2 d")] - [DataRow("select 1 from #some.thing() r cross apply r.Prop.Nested.Deeply c")] + [DataRow("select 1 from @some.thing() r cross apply r.Prop.Nested c")] + [DataRow("select 1 from @some.thing() r cross apply r.Prop.Nested c cross apply c.Prop.Nested2 d")] + [DataRow("select 1 from @some.thing() r cross apply r.Prop.Nested.Deeply c")] public void WhenNestedPropertyUsedWithCrossApply_ShouldPass(string query) { var lexer = new Lexer(query, true); diff --git a/Musoq.Parser/Lexing/Lexer.cs b/Musoq.Parser/Lexing/Lexer.cs index 238246c0..49adafe0 100644 --- a/Musoq.Parser/Lexing/Lexer.cs +++ b/Musoq.Parser/Lexing/Lexer.cs @@ -285,7 +285,7 @@ public static class TokenRegexDefinition public static readonly string KSelect = Format(Keyword, SelectToken.TokenText); public static readonly string KFrom = Format(Keyword, FromToken.TokenText); public static readonly string KColumn = @"\[[^\]]+\]|(\w+)|(\*)"; - public static readonly string KHFrom = @"#[\w*?_]{1,}"; + public static readonly string KHFrom = @"@[\w*?_]{1,}"; public static readonly string KLike = Format(Keyword, LikeToken.TokenText); public static readonly string KNotLike = @"(?<=[\s]{1,}|^)not[\s]{1,}like(?=[\s]{1,}|$)"; public static readonly string KRLike = Format(Keyword, RLikeToken.TokenText); diff --git a/README.md b/README.md index 32f653f1..3f3fd89f 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ View the [practilcal examples and applications](https://puchaczov.github.io/Muso select c.AuthorEmail, Count(c.Sha) as CommitCount -from #git.repository('/path/to/repo') r +from @git.repository('/path/to/repo') r cross apply r.Commits c group by c.AuthorEmail having Count(c.Sha) > 10 @@ -77,7 +77,7 @@ select c.Name as ClassName, m.Name as MethodName, Max(m.CyclomaticComplexity) as HighestComplexity -from #csharp.solution('/some/path/Musoq.sln') s +from @csharp.solution('/some/path/Musoq.sln') s cross apply s.Projects p cross apply p.Documents d cross apply d.Classes c @@ -95,7 +95,7 @@ SELECT Extension, Round(Sum(Length) / 1024 / 1024 / 1024, 1) as SpaceOccupiedInGB, Count(Extension) as FileCount -FROM #os.files('/some/directory', true) +FROM @os.files('/some/directory', true) GROUP BY Extension HAVING Round(Sum(Length) / 1024 / 1024 / 1024, 1) > 0 ORDER BY SpaceOccupiedInGB DESC @@ -105,12 +105,12 @@ ORDER BY SpaceOccupiedInGB DESC ```sql -- Extract structured data from unstructured text -select s.Who, s.Age from #stdin.text('from-text-extraction-model') s +select s.Who, s.Age from @stdin.text('from-text-extraction-model') s where ToInt32(s.Age) > 26 and ToInt32(s.Age) < 75 -- Extract product info from receipt images select s.Shop, s.ProductName, s.Price -from #stdin.image('from-image-extraction-model') s +from @stdin.image('from-image-extraction-model') s ``` ## 🤔 When to Use Musoq @@ -213,7 +213,7 @@ Musoq is licensed under the MIT License - see the [LICENSE](LICENSE) file for de -- How many commits does the repository have select Count(1) as CommitsCount -from #git.repository('D:\repos\efcore') r +from @git.repository('D:\repos\efcore') r cross apply r.Commits c group by 'fake' ``` @@ -225,7 +225,7 @@ group by 'fake' select Sum(c.LinesOfCode) as TotalLinesOfCode, Sum(c.MethodsCount) as TotalMethodsCount -from #csharp.solution('/some/path/Musoq.sln') s +from @csharp.solution('/some/path/Musoq.sln') s cross apply s.Projects p cross apply p.Documents d cross apply d.Classes c @@ -238,8 +238,8 @@ select c.Name, m.Name, g.ToBase64(g.GetBytes(g.LlmPerform('You are C# developer. Your task is to extract SQL query without any markdown characters. If no sql, then return empty string', m.Body))) as QueryBase64 -from #csharp.solution('/some/path/Musoq.sln') s -inner join #openai.gpt('gpt-4o') g on 1 = 1 +from @csharp.solution('/some/path/Musoq.sln') s +inner join @openai.gpt('gpt-4o') g on 1 = 1 cross apply s.Projects p cross apply p.Documents d cross apply d.Classes c @@ -254,7 +254,7 @@ where a.Name = 'TestClassAttribute' -- Find large files SELECT FullName -FROM #os.files('/some/path', true) +FROM @os.files('/some/path', true) WHERE ToDecimal(Length) / 1024 / 1024 / 1024 > 1 -- Query image EXIF metadata @@ -263,7 +263,7 @@ SELECT m.DirectoryName, m.TagName, m.Description -FROM #os.files('./Images', false) f CROSS APPLY #os.metadata(f.FullName) m +FROM @os.files('./Images', false) f CROSS APPLY @os.metadata(f.FullName) m WHERE f.Extension = '.jpg' -- Compare directories @@ -276,7 +276,7 @@ SELECT THEN 'The Same' ELSE State END) AS Status -FROM #os.dirscompare('E:\DiffDirsTests\A', 'E:\DiffDirsTests\B') +FROM @os.dirscompare('E:\DiffDirsTests\A', 'E:\DiffDirsTests\B') ``` ### Archive Exploration @@ -288,11 +288,11 @@ table PeopleDetails { Surname 'System.String', Age 'System.Int32' }; -couple #separatedvalues.comma with table PeopleDetails as SourceOfPeopleDetails; +couple @separatedvalues.comma with table PeopleDetails as SourceOfPeopleDetails; with Files as ( select a.Key as InZipPath - from #archives.file('./Files/Example2/archive.zip') a + from @archives.file('./Files/Example2/archive.zip') a where a.IsDirectory = false and a.Contains(a.Key, '/') = false and @@ -303,7 +303,7 @@ select b.Name, b.Surname, b.Age -from #archives.file('./Files/Example2/archive.zip') a +from @archives.file('./Files/Example2/archive.zip') a inner join Files f on f.InZipPath = a.Key cross apply SourceOfPeopleDetails(a.GetStreamContent(), true, 0) as b; ``` @@ -315,7 +315,7 @@ cross apply SourceOfPeopleDetails(a.GetStreamContent(), true, 0) as b; with p as ( select Replace(Replace(ToLowerInvariant(w.Value), '.', ''), ',', '') as Word - from #flat.file('/some/path/to/text/file.txt') f cross apply f.Split(f.Line, ' ') w + from @flat.file('/some/path/to/text/file.txt') f cross apply f.Split(f.Line, ' ') w ) select Count(p.Word, 1) as AllWordsCount, @@ -336,7 +336,7 @@ with Events as ( '.proto";', '' ) as Namespace - from #flat.file('/path/to/file.proto') f + from @flat.file('/path/to/file.proto') f where Length(Line) > 6 and Head(Line, 6) = 'import' and @@ -368,14 +368,14 @@ from Events e SELECT llava.DescribeImage(photo.Base64File()), photo.FullName -FROM #os.files('/path/to/directory', false) photo -INNER JOIN #ollama.models('llava:13b', 0.0) llava ON 1 = 1 +FROM @os.files('/path/to/directory', false) photo +INNER JOIN @ollama.models('llava:13b', 0.0) llava ON 1 = 1 -- Count tokens in files SELECT SUM(gpt.CountTokens(f.GetFileContent())) AS TokensCount -FROM #os.files('/path/to/directory', true) f -INNER JOIN #openai.gpt('gpt-4') gpt ON 1 = 1 +FROM @os.files('/path/to/directory', true) f +INNER JOIN @openai.gpt('gpt-4') gpt ON 1 = 1 WHERE f.Extension IN ('.md', '.c') -- Sentiment analysis on comments @@ -384,8 +384,8 @@ SELECT csv.Comment, gpt.Sentiment(csv.Comment) as Sentiment, csv.Date -FROM #separatedvalues.csv('/home/somebody/comments_sample.csv', true, 0) csv -INNER JOIN #openai.gpt('gpt-4-1106-preview') gpt on 1 = 1 +FROM @separatedvalues.csv('/home/somebody/comments_sample.csv', true, 0) csv +INNER JOIN @openai.gpt('gpt-4-1106-preview') gpt on 1 = 1 ``` ### Domain Specific Analysis @@ -411,7 +411,7 @@ select s.Maximum, s.Unit, s.Comment as SignalsComment -from #can.messages('@qfs/Model3CAN.dbc') m cross apply m.Signals s +from @can.messages('@qfs/Model3CAN.dbc') m cross apply m.Signals s ``` ## 🏗 Architecture diff --git a/docs/architecture.md b/docs/architecture.md index 7d8a8956..b9446aa2 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -180,7 +180,7 @@ public interface IRunnable ```csharp // Input: SQL string -var sql = "SELECT Name FROM #os.files('/path') WHERE Extension = '.txt'"; +var sql = "SELECT Name FROM @os.files('/path') WHERE Extension = '.txt'"; // Lexical analysis var lexer = new Lexer(sql); diff --git a/docs/cli.md b/docs/cli.md index a36605cd..402d147a 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -32,10 +32,10 @@ Once your server is up and running, run queries directly: ```bash # Windows -Musoq.exe run query "select 1 from #system.dual()" +Musoq.exe run query "select 1 from @system.dual()" # Linux -Musoq run query "select 1 from #system.dual()" +Musoq run query "select 1 from @system.dual()" ``` ### Help and Options @@ -69,13 +69,13 @@ Musoq quit ```bash # Specify output format -Musoq run query "select 1 from #system.dual()" --format [raw|csv|json|interpreted_json] +Musoq run query "select 1 from @system.dual()" --format [raw|csv|json|interpreted_json] ``` #### Raw ```bash -Musoq run query "select Value from #system.range(1, 3)" --format raw +Musoq run query "select Value from @system.range(1, 3)" --format raw ``` Output: ``` @@ -87,7 +87,7 @@ Rows: #### CSV ```bash -Musoq run query "select Value from #system.range(1, 3)" --format csv +Musoq run query "select Value from @system.range(1, 3)" --format csv ``` Output: ```csv @@ -99,7 +99,7 @@ Value #### JSON ```bash -Musoq run query "select Value from #system.range(1, 3)" --format json +Musoq run query "select Value from @system.range(1, 3)" --format json ``` Output: ```json @@ -108,7 +108,7 @@ Output: #### Interpreted JSON ```bash -Musoq run query "select Value as 'obj.Number', NewId() as 'obj.Id' from #system.range(0, 10)" --format interpreted-json +Musoq run query "select Value as 'obj.Number', NewId() as 'obj.Id' from @system.range(0, 10)" --format interpreted-json ``` Output: ```json @@ -132,13 +132,13 @@ Musoq csharp solution load --solution "path/to/solution.sln" --bucket mybucket Do the first query ```bash -Musoq run query "select p.Name from #csharp.solution('path/to/solution.sln') s cross apply s.Projects p" --bucket mybucket +Musoq run query "select p.Name from @csharp.solution('path/to/solution.sln') s cross apply s.Projects p" --bucket mybucket ``` Then do another ```bash -Musoq run query "select p.Name from #csharp.solution('path/to/solution.sln') s cross apply s.Projects p where p.Name like '%Tests'" --bucket mybucket +Musoq run query "select p.Name from @csharp.solution('path/to/solution.sln') s cross apply s.Projects p where p.Name like '%Tests'" --bucket mybucket ``` This way, you load the solution once and then reuse it in multiple queries. After you're done, you can clean up: @@ -158,7 +158,7 @@ Musoq bucket delete mybucket Musoq can process tables resulted from other commands. This allows for easy integration with other tools. You can treat table as a data source and process it with Musoq. ```powershell -wmic process get name,processid,workingsetsize | Musoq.exe run query "select t.Name, Count(t.Name) from #stdin.table(true) t group by t.Name having Count(t.Name) > 1" +wmic process get name,processid,workingsetsize | Musoq.exe run query "select t.Name, Count(t.Name) from @stdin.table(true) t group by t.Name having Count(t.Name) > 1" ``` Or join them with other data sources: @@ -168,7 +168,7 @@ Or join them with other data sources: docker image ls; .\Musoq.exe separator; docker container ls -} | ./Musoq.exe run query "select t.IMAGE_ID, t.REPOSITORY, t.SIZE, t.TAG, t2.CONTAINER_ID, t2.CREATED, t2.STATUS from #stdin.table(true) t inner join #stdin.table(true) t2 on t.IMAGE_ID = t2.IMAGE" +} | ./Musoq.exe run query "select t.IMAGE_ID, t.REPOSITORY, t.SIZE, t.TAG, t2.CONTAINER_ID, t2.CREATED, t2.STATUS from @stdin.table(true) t inner join @stdin.table(true) t2 on t.IMAGE_ID = t2.IMAGE" ``` Or use AI models to extract data from text: @@ -206,11 +206,11 @@ Customer is a premium subscriber and requests urgent assistance due to lost data ``` ```bash -Get-Content "C:\Tickets\ticket.txt" | ./Musoq.exe run query "select t.TicketNumber, t.TicketDate, t.CustomerName, t.CustomerEmail, t.Product, t.OperatingSystem, t.Subject, t.ImpactLevel, t.ErrorCode, t.DataLossAmount, t.DeviceCount, case when ToLowerInvariant(t.SubscriptionType) like '%premium%' then 'PREMIUM' else 'STANDARD' end from #stdin.text('Ollama', 'llama3.1') t" +Get-Content "C:\Tickets\ticket.txt" | ./Musoq.exe run query "select t.TicketNumber, t.TicketDate, t.CustomerName, t.CustomerEmail, t.Product, t.OperatingSystem, t.Subject, t.ImpactLevel, t.ErrorCode, t.DataLossAmount, t.DeviceCount, case when ToLowerInvariant(t.SubscriptionType) like '%premium%' then 'PREMIUM' else 'STANDARD' end from @stdin.text('Ollama', 'llama3.1') t" ``` Or use it to extract informations from receipt: ```bash -Musoq image encode "/some/image/receipt.jpg" | ./Musoq.exe run query "select s.Shop, s.ProductName, s.Price from #stdin.image('OpenAi', 'gpt-4o') s" +Musoq image encode "/some/image/receipt.jpg" | ./Musoq.exe run query "select s.Shop, s.ProductName, s.Price from @stdin.image('OpenAi', 'gpt-4o') s" ``` \ No newline at end of file diff --git a/docs/data-sources/Airtable/alpine-x64.md b/docs/data-sources/Airtable/alpine-x64.md index a60be948..a9fd56d9 100644 --- a/docs/data-sources/Airtable/alpine-x64.md +++ b/docs/data-sources/Airtable/alpine-x64.md @@ -8,7 +8,7 @@ parent: Airtable Provides interface to work with Airtable API. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### airtable.bases() diff --git a/docs/data-sources/Airtable/linux-arm64.md b/docs/data-sources/Airtable/linux-arm64.md index 2a218351..934e70f3 100644 --- a/docs/data-sources/Airtable/linux-arm64.md +++ b/docs/data-sources/Airtable/linux-arm64.md @@ -8,7 +8,7 @@ parent: Airtable Provides interface to work with Airtable API. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### airtable.bases() diff --git a/docs/data-sources/Airtable/linux-x64.md b/docs/data-sources/Airtable/linux-x64.md index 35345c4d..9df79aac 100644 --- a/docs/data-sources/Airtable/linux-x64.md +++ b/docs/data-sources/Airtable/linux-x64.md @@ -8,7 +8,7 @@ parent: Airtable Provides interface to work with Airtable API. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### airtable.bases() diff --git a/docs/data-sources/Airtable/macos-x64.md b/docs/data-sources/Airtable/macos-x64.md index 6fee1b8c..18ebd6e4 100644 --- a/docs/data-sources/Airtable/macos-x64.md +++ b/docs/data-sources/Airtable/macos-x64.md @@ -8,7 +8,7 @@ parent: Airtable Provides interface to work with Airtable API. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### airtable.bases() diff --git a/docs/data-sources/Airtable/windows-x64.md b/docs/data-sources/Airtable/windows-x64.md index b7ba1e14..24fafbdf 100644 --- a/docs/data-sources/Airtable/windows-x64.md +++ b/docs/data-sources/Airtable/windows-x64.md @@ -8,7 +8,7 @@ parent: Airtable Provides interface to work with Airtable API. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### airtable.bases() diff --git a/docs/data-sources/Archives/alpine-x64.md b/docs/data-sources/Archives/alpine-x64.md index 4e69e222..8179ba88 100644 --- a/docs/data-sources/Archives/alpine-x64.md +++ b/docs/data-sources/Archives/alpine-x64.md @@ -8,7 +8,7 @@ parent: Archives Provides schema to work with archives files ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### archives.file(string path) diff --git a/docs/data-sources/Archives/linux-arm64.md b/docs/data-sources/Archives/linux-arm64.md index 7ede151b..a5078117 100644 --- a/docs/data-sources/Archives/linux-arm64.md +++ b/docs/data-sources/Archives/linux-arm64.md @@ -8,7 +8,7 @@ parent: Archives Provides schema to work with archives files ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### archives.file(string path) diff --git a/docs/data-sources/Archives/linux-x64.md b/docs/data-sources/Archives/linux-x64.md index 7e70a68b..87eaa756 100644 --- a/docs/data-sources/Archives/linux-x64.md +++ b/docs/data-sources/Archives/linux-x64.md @@ -8,7 +8,7 @@ parent: Archives Provides schema to work with archives files ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### archives.file(string path) diff --git a/docs/data-sources/Archives/macos-x64.md b/docs/data-sources/Archives/macos-x64.md index 97144731..4e341b52 100644 --- a/docs/data-sources/Archives/macos-x64.md +++ b/docs/data-sources/Archives/macos-x64.md @@ -8,7 +8,7 @@ parent: Archives Provides schema to work with archives files ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### archives.file(string path) diff --git a/docs/data-sources/Archives/windows-x64.md b/docs/data-sources/Archives/windows-x64.md index 19523f19..dfddc695 100644 --- a/docs/data-sources/Archives/windows-x64.md +++ b/docs/data-sources/Archives/windows-x64.md @@ -8,7 +8,7 @@ parent: Archives Provides schema to work with archives files ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### archives.file(string path) diff --git a/docs/data-sources/CANBus/alpine-x64.md b/docs/data-sources/CANBus/alpine-x64.md index e9012d09..02db7fbf 100644 --- a/docs/data-sources/CANBus/alpine-x64.md +++ b/docs/data-sources/CANBus/alpine-x64.md @@ -8,7 +8,7 @@ parent: CANBus Provides schema to work with CAN bus data. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### can.separatedvalues(string csvData, string dbcData, string idOfType = "dec" | "hex" | "bin") diff --git a/docs/data-sources/CANBus/linux-arm64.md b/docs/data-sources/CANBus/linux-arm64.md index 0f3a67fa..9f75f936 100644 --- a/docs/data-sources/CANBus/linux-arm64.md +++ b/docs/data-sources/CANBus/linux-arm64.md @@ -8,7 +8,7 @@ parent: CANBus Provides schema to work with CAN bus data. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### can.separatedvalues(string csvData, string dbcData, string idOfType = "dec" | "hex" | "bin") diff --git a/docs/data-sources/CANBus/linux-x64.md b/docs/data-sources/CANBus/linux-x64.md index c378d3bb..1509b284 100644 --- a/docs/data-sources/CANBus/linux-x64.md +++ b/docs/data-sources/CANBus/linux-x64.md @@ -8,7 +8,7 @@ parent: CANBus Provides schema to work with CAN bus data. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### can.separatedvalues(string csvData, string dbcData, string idOfType = "dec" | "hex" | "bin") diff --git a/docs/data-sources/CANBus/macos-x64.md b/docs/data-sources/CANBus/macos-x64.md index 81ff087e..d88c960f 100644 --- a/docs/data-sources/CANBus/macos-x64.md +++ b/docs/data-sources/CANBus/macos-x64.md @@ -8,7 +8,7 @@ parent: CANBus Provides schema to work with CAN bus data. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### can.separatedvalues(string csvData, string dbcData, string idOfType = "dec" | "hex" | "bin") diff --git a/docs/data-sources/CANBus/windows-x64.md b/docs/data-sources/CANBus/windows-x64.md index 6867cab7..1b03214e 100644 --- a/docs/data-sources/CANBus/windows-x64.md +++ b/docs/data-sources/CANBus/windows-x64.md @@ -8,7 +8,7 @@ parent: CANBus Provides schema to work with CAN bus data. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### can.separatedvalues(string csvData, string dbcData, string idOfType = "dec" | "hex" | "bin") diff --git a/docs/data-sources/Docker/alpine-x64.md b/docs/data-sources/Docker/alpine-x64.md index ee716639..0d0beda8 100644 --- a/docs/data-sources/Docker/alpine-x64.md +++ b/docs/data-sources/Docker/alpine-x64.md @@ -8,7 +8,7 @@ parent: Docker Provides schema to work with docker containers, images, networks and volumes. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### docker.containers() diff --git a/docs/data-sources/Docker/linux-arm64.md b/docs/data-sources/Docker/linux-arm64.md index c871acae..0ed8114d 100644 --- a/docs/data-sources/Docker/linux-arm64.md +++ b/docs/data-sources/Docker/linux-arm64.md @@ -8,7 +8,7 @@ parent: Docker Provides schema to work with docker containers, images, networks and volumes. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### docker.containers() diff --git a/docs/data-sources/Docker/linux-x64.md b/docs/data-sources/Docker/linux-x64.md index d28b9f04..8573d09f 100644 --- a/docs/data-sources/Docker/linux-x64.md +++ b/docs/data-sources/Docker/linux-x64.md @@ -8,7 +8,7 @@ parent: Docker Provides schema to work with docker containers, images, networks and volumes. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### docker.containers() diff --git a/docs/data-sources/Docker/macos-x64.md b/docs/data-sources/Docker/macos-x64.md index e2954aa1..4363b3bb 100644 --- a/docs/data-sources/Docker/macos-x64.md +++ b/docs/data-sources/Docker/macos-x64.md @@ -8,7 +8,7 @@ parent: Docker Provides schema to work with docker containers, images, networks and volumes. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### docker.containers() diff --git a/docs/data-sources/Docker/windows-x64.md b/docs/data-sources/Docker/windows-x64.md index fb1b6b8b..1ca030c1 100644 --- a/docs/data-sources/Docker/windows-x64.md +++ b/docs/data-sources/Docker/windows-x64.md @@ -8,7 +8,7 @@ parent: Docker Provides schema to work with docker containers, images, networks and volumes. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### docker.containers() diff --git a/docs/data-sources/FlatFile/alpine-x64.md b/docs/data-sources/FlatFile/alpine-x64.md index 49578438..460587c3 100644 --- a/docs/data-sources/FlatFile/alpine-x64.md +++ b/docs/data-sources/FlatFile/alpine-x64.md @@ -8,7 +8,7 @@ parent: FlatFile Provides schema to work with flat files ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### flat.file(string path) diff --git a/docs/data-sources/FlatFile/linux-arm64.md b/docs/data-sources/FlatFile/linux-arm64.md index 56dc7b82..a757ceb6 100644 --- a/docs/data-sources/FlatFile/linux-arm64.md +++ b/docs/data-sources/FlatFile/linux-arm64.md @@ -8,7 +8,7 @@ parent: FlatFile Provides schema to work with flat files ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### flat.file(string path) diff --git a/docs/data-sources/FlatFile/linux-x64.md b/docs/data-sources/FlatFile/linux-x64.md index 476613d7..10d52e5c 100644 --- a/docs/data-sources/FlatFile/linux-x64.md +++ b/docs/data-sources/FlatFile/linux-x64.md @@ -8,7 +8,7 @@ parent: FlatFile Provides schema to work with flat files ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### flat.file(string path) diff --git a/docs/data-sources/FlatFile/macos-x64.md b/docs/data-sources/FlatFile/macos-x64.md index 4792d080..d0033994 100644 --- a/docs/data-sources/FlatFile/macos-x64.md +++ b/docs/data-sources/FlatFile/macos-x64.md @@ -8,7 +8,7 @@ parent: FlatFile Provides schema to work with flat files ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### flat.file(string path) diff --git a/docs/data-sources/FlatFile/windows-x64.md b/docs/data-sources/FlatFile/windows-x64.md index 51296cb8..7f9c8ff9 100644 --- a/docs/data-sources/FlatFile/windows-x64.md +++ b/docs/data-sources/FlatFile/windows-x64.md @@ -8,7 +8,7 @@ parent: FlatFile Provides schema to work with flat files ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### flat.file(string path) diff --git a/docs/data-sources/Git/alpine-x64.md b/docs/data-sources/Git/alpine-x64.md index f156493a..2d42f1e4 100644 --- a/docs/data-sources/Git/alpine-x64.md +++ b/docs/data-sources/Git/alpine-x64.md @@ -8,7 +8,7 @@ parent: Git Provides schema to work with Git repositories. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### git.repository(string path) diff --git a/docs/data-sources/Git/linux-arm64.md b/docs/data-sources/Git/linux-arm64.md index 4fbcd999..78f82b3b 100644 --- a/docs/data-sources/Git/linux-arm64.md +++ b/docs/data-sources/Git/linux-arm64.md @@ -8,7 +8,7 @@ parent: Git Provides schema to work with Git repositories. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### git.repository(string path) diff --git a/docs/data-sources/Git/linux-x64.md b/docs/data-sources/Git/linux-x64.md index d1fce1a3..8acbd9c8 100644 --- a/docs/data-sources/Git/linux-x64.md +++ b/docs/data-sources/Git/linux-x64.md @@ -8,7 +8,7 @@ parent: Git Provides schema to work with Git repositories. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### git.repository(string path) diff --git a/docs/data-sources/Git/macos-x64.md b/docs/data-sources/Git/macos-x64.md index 5b675e45..006f3e96 100644 --- a/docs/data-sources/Git/macos-x64.md +++ b/docs/data-sources/Git/macos-x64.md @@ -8,7 +8,7 @@ parent: Git Provides schema to work with Git repositories. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### git.repository(string path) diff --git a/docs/data-sources/Git/windows-x64.md b/docs/data-sources/Git/windows-x64.md index ec84629c..e289759a 100644 --- a/docs/data-sources/Git/windows-x64.md +++ b/docs/data-sources/Git/windows-x64.md @@ -8,7 +8,7 @@ parent: Git Provides schema to work with Git repositories. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### git.repository(string path) diff --git a/docs/data-sources/Json/alpine-x64.md b/docs/data-sources/Json/alpine-x64.md index 742c538f..a826203d 100644 --- a/docs/data-sources/Json/alpine-x64.md +++ b/docs/data-sources/Json/alpine-x64.md @@ -8,7 +8,7 @@ parent: Json Provides schema to work with json files ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### json.file(string jsonFilePath, string jsonSchemaFilePath) diff --git a/docs/data-sources/Json/linux-arm64.md b/docs/data-sources/Json/linux-arm64.md index 68d4bf24..081947e0 100644 --- a/docs/data-sources/Json/linux-arm64.md +++ b/docs/data-sources/Json/linux-arm64.md @@ -8,7 +8,7 @@ parent: Json Provides schema to work with json files ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### json.file(string jsonFilePath, string jsonSchemaFilePath) diff --git a/docs/data-sources/Json/linux-x64.md b/docs/data-sources/Json/linux-x64.md index 502e5de4..db7f9e5e 100644 --- a/docs/data-sources/Json/linux-x64.md +++ b/docs/data-sources/Json/linux-x64.md @@ -8,7 +8,7 @@ parent: Json Provides schema to work with json files ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### json.file(string jsonFilePath, string jsonSchemaFilePath) diff --git a/docs/data-sources/Json/macos-x64.md b/docs/data-sources/Json/macos-x64.md index 0239ffb2..820870ce 100644 --- a/docs/data-sources/Json/macos-x64.md +++ b/docs/data-sources/Json/macos-x64.md @@ -8,7 +8,7 @@ parent: Json Provides schema to work with json files ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### json.file(string jsonFilePath, string jsonSchemaFilePath) diff --git a/docs/data-sources/Json/windows-x64.md b/docs/data-sources/Json/windows-x64.md index 21c0efd5..3551b7d5 100644 --- a/docs/data-sources/Json/windows-x64.md +++ b/docs/data-sources/Json/windows-x64.md @@ -8,7 +8,7 @@ parent: Json Provides schema to work with json files ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### json.file(string jsonFilePath, string jsonSchemaFilePath) diff --git a/docs/data-sources/Kubernetes/alpine-x64.md b/docs/data-sources/Kubernetes/alpine-x64.md index 79ebae32..c5066fbf 100644 --- a/docs/data-sources/Kubernetes/alpine-x64.md +++ b/docs/data-sources/Kubernetes/alpine-x64.md @@ -8,7 +8,7 @@ parent: Kubernetes Provides schema to work with Kubernetes. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### kubernetes.deployments() diff --git a/docs/data-sources/Kubernetes/linux-arm64.md b/docs/data-sources/Kubernetes/linux-arm64.md index 33826e24..8814095c 100644 --- a/docs/data-sources/Kubernetes/linux-arm64.md +++ b/docs/data-sources/Kubernetes/linux-arm64.md @@ -8,7 +8,7 @@ parent: Kubernetes Provides schema to work with Kubernetes. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### kubernetes.deployments() diff --git a/docs/data-sources/Kubernetes/linux-x64.md b/docs/data-sources/Kubernetes/linux-x64.md index e348e381..426244c2 100644 --- a/docs/data-sources/Kubernetes/linux-x64.md +++ b/docs/data-sources/Kubernetes/linux-x64.md @@ -8,7 +8,7 @@ parent: Kubernetes Provides schema to work with Kubernetes. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### kubernetes.deployments() diff --git a/docs/data-sources/Kubernetes/macos-x64.md b/docs/data-sources/Kubernetes/macos-x64.md index 64e00e58..2a2a497a 100644 --- a/docs/data-sources/Kubernetes/macos-x64.md +++ b/docs/data-sources/Kubernetes/macos-x64.md @@ -8,7 +8,7 @@ parent: Kubernetes Provides schema to work with Kubernetes. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### kubernetes.deployments() diff --git a/docs/data-sources/Kubernetes/windows-x64.md b/docs/data-sources/Kubernetes/windows-x64.md index 765453aa..0a4a5ef4 100644 --- a/docs/data-sources/Kubernetes/windows-x64.md +++ b/docs/data-sources/Kubernetes/windows-x64.md @@ -8,7 +8,7 @@ parent: Kubernetes Provides schema to work with Kubernetes. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### kubernetes.deployments() diff --git a/docs/data-sources/Ollama/alpine-x64.md b/docs/data-sources/Ollama/alpine-x64.md index 803e13ef..60e05a18 100644 --- a/docs/data-sources/Ollama/alpine-x64.md +++ b/docs/data-sources/Ollama/alpine-x64.md @@ -8,7 +8,7 @@ parent: Ollama Provides interface to work with Ollama API. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### ollama.llm(string model) diff --git a/docs/data-sources/Ollama/linux-arm64.md b/docs/data-sources/Ollama/linux-arm64.md index 88c58b74..30d42ef7 100644 --- a/docs/data-sources/Ollama/linux-arm64.md +++ b/docs/data-sources/Ollama/linux-arm64.md @@ -8,7 +8,7 @@ parent: Ollama Provides interface to work with Ollama API. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### ollama.llm(string model) diff --git a/docs/data-sources/Ollama/linux-x64.md b/docs/data-sources/Ollama/linux-x64.md index 582c80ef..bd613afb 100644 --- a/docs/data-sources/Ollama/linux-x64.md +++ b/docs/data-sources/Ollama/linux-x64.md @@ -8,7 +8,7 @@ parent: Ollama Provides interface to work with Ollama API. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### ollama.llm(string model) diff --git a/docs/data-sources/Ollama/macos-x64.md b/docs/data-sources/Ollama/macos-x64.md index a6f5cec7..ff8fdb37 100644 --- a/docs/data-sources/Ollama/macos-x64.md +++ b/docs/data-sources/Ollama/macos-x64.md @@ -8,7 +8,7 @@ parent: Ollama Provides interface to work with Ollama API. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### ollama.llm(string model) diff --git a/docs/data-sources/Ollama/windows-x64.md b/docs/data-sources/Ollama/windows-x64.md index 0cb43196..2714e921 100644 --- a/docs/data-sources/Ollama/windows-x64.md +++ b/docs/data-sources/Ollama/windows-x64.md @@ -8,7 +8,7 @@ parent: Ollama Provides interface to work with Ollama API. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### ollama.llm(string model) diff --git a/docs/data-sources/OpenAI/alpine-x64.md b/docs/data-sources/OpenAI/alpine-x64.md index dbbc2d13..d70ef8bb 100644 --- a/docs/data-sources/OpenAI/alpine-x64.md +++ b/docs/data-sources/OpenAI/alpine-x64.md @@ -8,7 +8,7 @@ parent: OpenAI Provides interface to work with OpenAI API. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### openai.gpt() diff --git a/docs/data-sources/OpenAI/linux-arm64.md b/docs/data-sources/OpenAI/linux-arm64.md index 6a9d62f8..c920d6b9 100644 --- a/docs/data-sources/OpenAI/linux-arm64.md +++ b/docs/data-sources/OpenAI/linux-arm64.md @@ -8,7 +8,7 @@ parent: OpenAI Provides interface to work with OpenAI API. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### openai.gpt() diff --git a/docs/data-sources/OpenAI/linux-x64.md b/docs/data-sources/OpenAI/linux-x64.md index 700c6e4c..8fc384b8 100644 --- a/docs/data-sources/OpenAI/linux-x64.md +++ b/docs/data-sources/OpenAI/linux-x64.md @@ -8,7 +8,7 @@ parent: OpenAI Provides interface to work with OpenAI API. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### openai.gpt() diff --git a/docs/data-sources/OpenAI/macos-x64.md b/docs/data-sources/OpenAI/macos-x64.md index bc6a3011..c1629267 100644 --- a/docs/data-sources/OpenAI/macos-x64.md +++ b/docs/data-sources/OpenAI/macos-x64.md @@ -8,7 +8,7 @@ parent: OpenAI Provides interface to work with OpenAI API. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### openai.gpt() diff --git a/docs/data-sources/OpenAI/windows-x64.md b/docs/data-sources/OpenAI/windows-x64.md index 9cfe51f7..3ced846c 100644 --- a/docs/data-sources/OpenAI/windows-x64.md +++ b/docs/data-sources/OpenAI/windows-x64.md @@ -8,7 +8,7 @@ parent: OpenAI Provides interface to work with OpenAI API. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### openai.gpt() diff --git a/docs/data-sources/Os/alpine-x64.md b/docs/data-sources/Os/alpine-x64.md index b4a5e240..6f3a6025 100644 --- a/docs/data-sources/Os/alpine-x64.md +++ b/docs/data-sources/Os/alpine-x64.md @@ -8,7 +8,7 @@ parent: Os Provides schema to work with operating system abstractions ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### os.dirscompare(string sourceDirectory, string destinationDirectory) diff --git a/docs/data-sources/Os/linux-arm64.md b/docs/data-sources/Os/linux-arm64.md index 6212d349..d9d6e146 100644 --- a/docs/data-sources/Os/linux-arm64.md +++ b/docs/data-sources/Os/linux-arm64.md @@ -8,7 +8,7 @@ parent: Os Provides schema to work with operating system abstractions ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### os.dirscompare(string sourceDirectory, string destinationDirectory) diff --git a/docs/data-sources/Os/linux-x64.md b/docs/data-sources/Os/linux-x64.md index a0bf2601..688998b9 100644 --- a/docs/data-sources/Os/linux-x64.md +++ b/docs/data-sources/Os/linux-x64.md @@ -8,7 +8,7 @@ parent: Os Provides schema to work with operating system abstractions ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### os.dirscompare(string sourceDirectory, string destinationDirectory) diff --git a/docs/data-sources/Os/macos-x64.md b/docs/data-sources/Os/macos-x64.md index 3eeb2d97..62a5742c 100644 --- a/docs/data-sources/Os/macos-x64.md +++ b/docs/data-sources/Os/macos-x64.md @@ -8,7 +8,7 @@ parent: Os Provides schema to work with operating system abstractions ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### os.dirscompare(string sourceDirectory, string destinationDirectory) diff --git a/docs/data-sources/Os/windows-x64.md b/docs/data-sources/Os/windows-x64.md index d8d7221d..58f17478 100644 --- a/docs/data-sources/Os/windows-x64.md +++ b/docs/data-sources/Os/windows-x64.md @@ -8,7 +8,7 @@ parent: Os Provides schema to work with operating system abstractions ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### os.dirscompare(string sourceDirectory, string destinationDirectory) diff --git a/docs/data-sources/Postgres/alpine-x64.md b/docs/data-sources/Postgres/alpine-x64.md index 831fbfc4..755cd64a 100644 --- a/docs/data-sources/Postgres/alpine-x64.md +++ b/docs/data-sources/Postgres/alpine-x64.md @@ -8,7 +8,7 @@ parent: Postgres Provides schema to work with postgres database ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### postgres.tableName('schemaName') diff --git a/docs/data-sources/Postgres/linux-arm64.md b/docs/data-sources/Postgres/linux-arm64.md index 0293b03e..75bed711 100644 --- a/docs/data-sources/Postgres/linux-arm64.md +++ b/docs/data-sources/Postgres/linux-arm64.md @@ -8,7 +8,7 @@ parent: Postgres Provides schema to work with postgres database ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### postgres.tableName('schemaName') diff --git a/docs/data-sources/Postgres/linux-x64.md b/docs/data-sources/Postgres/linux-x64.md index 03d23a22..fbe5d72f 100644 --- a/docs/data-sources/Postgres/linux-x64.md +++ b/docs/data-sources/Postgres/linux-x64.md @@ -8,7 +8,7 @@ parent: Postgres Provides schema to work with postgres database ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### postgres.tableName('schemaName') diff --git a/docs/data-sources/Postgres/macos-x64.md b/docs/data-sources/Postgres/macos-x64.md index df5c63d8..6bee4710 100644 --- a/docs/data-sources/Postgres/macos-x64.md +++ b/docs/data-sources/Postgres/macos-x64.md @@ -8,7 +8,7 @@ parent: Postgres Provides schema to work with postgres database ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### postgres.tableName('schemaName') diff --git a/docs/data-sources/Postgres/windows-x64.md b/docs/data-sources/Postgres/windows-x64.md index 0c6622dd..e827c466 100644 --- a/docs/data-sources/Postgres/windows-x64.md +++ b/docs/data-sources/Postgres/windows-x64.md @@ -8,7 +8,7 @@ parent: Postgres Provides schema to work with postgres database ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### postgres.tableName('schemaName') diff --git a/docs/data-sources/SeparatedValues/alpine-x64.md b/docs/data-sources/SeparatedValues/alpine-x64.md index 1bad13cc..7776d4a5 100644 --- a/docs/data-sources/SeparatedValues/alpine-x64.md +++ b/docs/data-sources/SeparatedValues/alpine-x64.md @@ -8,7 +8,7 @@ parent: SeparatedValues Provides schema to work with separated values like .csv, .tsv, semicolon. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### separatedvalues.comma(string path, bool hasHeader, int skipLines) diff --git a/docs/data-sources/SeparatedValues/linux-arm64.md b/docs/data-sources/SeparatedValues/linux-arm64.md index e1b4ebde..ae306c8d 100644 --- a/docs/data-sources/SeparatedValues/linux-arm64.md +++ b/docs/data-sources/SeparatedValues/linux-arm64.md @@ -8,7 +8,7 @@ parent: SeparatedValues Provides schema to work with separated values like .csv, .tsv, semicolon. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### separatedvalues.comma(string path, bool hasHeader, int skipLines) diff --git a/docs/data-sources/SeparatedValues/linux-x64.md b/docs/data-sources/SeparatedValues/linux-x64.md index ceb05af3..af2c0d64 100644 --- a/docs/data-sources/SeparatedValues/linux-x64.md +++ b/docs/data-sources/SeparatedValues/linux-x64.md @@ -8,7 +8,7 @@ parent: SeparatedValues Provides schema to work with separated values like .csv, .tsv, semicolon. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### separatedvalues.comma(string path, bool hasHeader, int skipLines) diff --git a/docs/data-sources/SeparatedValues/macos-x64.md b/docs/data-sources/SeparatedValues/macos-x64.md index e5882fc2..5a0697c6 100644 --- a/docs/data-sources/SeparatedValues/macos-x64.md +++ b/docs/data-sources/SeparatedValues/macos-x64.md @@ -8,7 +8,7 @@ parent: SeparatedValues Provides schema to work with separated values like .csv, .tsv, semicolon. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### separatedvalues.comma(string path, bool hasHeader, int skipLines) diff --git a/docs/data-sources/SeparatedValues/windows-x64.md b/docs/data-sources/SeparatedValues/windows-x64.md index b9db4649..fc76493a 100644 --- a/docs/data-sources/SeparatedValues/windows-x64.md +++ b/docs/data-sources/SeparatedValues/windows-x64.md @@ -8,7 +8,7 @@ parent: SeparatedValues Provides schema to work with separated values like .csv, .tsv, semicolon. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### separatedvalues.comma(string path, bool hasHeader, int skipLines) diff --git a/docs/data-sources/Sqlite/alpine-x64.md b/docs/data-sources/Sqlite/alpine-x64.md index 27dd227f..c3a2ab75 100644 --- a/docs/data-sources/Sqlite/alpine-x64.md +++ b/docs/data-sources/Sqlite/alpine-x64.md @@ -8,7 +8,7 @@ parent: Sqlite Provides ability to work with sqlite database ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### sqlite.tableName() diff --git a/docs/data-sources/Sqlite/linux-arm64.md b/docs/data-sources/Sqlite/linux-arm64.md index c77fb329..0cd8c46b 100644 --- a/docs/data-sources/Sqlite/linux-arm64.md +++ b/docs/data-sources/Sqlite/linux-arm64.md @@ -8,7 +8,7 @@ parent: Sqlite Provides ability to work with sqlite database ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### sqlite.tableName() diff --git a/docs/data-sources/Sqlite/linux-x64.md b/docs/data-sources/Sqlite/linux-x64.md index 61acb232..ad8c44fd 100644 --- a/docs/data-sources/Sqlite/linux-x64.md +++ b/docs/data-sources/Sqlite/linux-x64.md @@ -8,7 +8,7 @@ parent: Sqlite Provides ability to work with sqlite database ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### sqlite.tableName() diff --git a/docs/data-sources/Sqlite/macos-x64.md b/docs/data-sources/Sqlite/macos-x64.md index 36ebe67c..c14da25b 100644 --- a/docs/data-sources/Sqlite/macos-x64.md +++ b/docs/data-sources/Sqlite/macos-x64.md @@ -8,7 +8,7 @@ parent: Sqlite Provides ability to work with sqlite database ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### sqlite.tableName() diff --git a/docs/data-sources/Sqlite/windows-x64.md b/docs/data-sources/Sqlite/windows-x64.md index aa13c672..8d8900f6 100644 --- a/docs/data-sources/Sqlite/windows-x64.md +++ b/docs/data-sources/Sqlite/windows-x64.md @@ -8,7 +8,7 @@ parent: Sqlite Provides ability to work with sqlite database ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### sqlite.tableName() diff --git a/docs/data-sources/System/alpine-x64.md b/docs/data-sources/System/alpine-x64.md index fc2ed148..59f9895e 100644 --- a/docs/data-sources/System/alpine-x64.md +++ b/docs/data-sources/System/alpine-x64.md @@ -8,7 +8,7 @@ parent: System System schema helper methods ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### system.dual() diff --git a/docs/data-sources/System/linux-arm64.md b/docs/data-sources/System/linux-arm64.md index 6e58722d..f14d9f1f 100644 --- a/docs/data-sources/System/linux-arm64.md +++ b/docs/data-sources/System/linux-arm64.md @@ -8,7 +8,7 @@ parent: System System schema helper methods ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### system.dual() diff --git a/docs/data-sources/System/linux-x64.md b/docs/data-sources/System/linux-x64.md index 21a76632..a65c4846 100644 --- a/docs/data-sources/System/linux-x64.md +++ b/docs/data-sources/System/linux-x64.md @@ -8,7 +8,7 @@ parent: System System schema helper methods ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### system.dual() diff --git a/docs/data-sources/System/macos-x64.md b/docs/data-sources/System/macos-x64.md index 20906e1f..ed25ec1d 100644 --- a/docs/data-sources/System/macos-x64.md +++ b/docs/data-sources/System/macos-x64.md @@ -8,7 +8,7 @@ parent: System System schema helper methods ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### system.dual() diff --git a/docs/data-sources/System/windows-x64.md b/docs/data-sources/System/windows-x64.md index 18879d8c..c8ff689f 100644 --- a/docs/data-sources/System/windows-x64.md +++ b/docs/data-sources/System/windows-x64.md @@ -8,7 +8,7 @@ parent: System System schema helper methods ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### system.dual() diff --git a/docs/data-sources/Time/alpine-x64.md b/docs/data-sources/Time/alpine-x64.md index 554ca4d5..64c9197c 100644 --- a/docs/data-sources/Time/alpine-x64.md +++ b/docs/data-sources/Time/alpine-x64.md @@ -8,7 +8,7 @@ parent: Time Provides schema to work with time. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### time.interval(string startDateTime, string stopDateTime, string interval) diff --git a/docs/data-sources/Time/linux-arm64.md b/docs/data-sources/Time/linux-arm64.md index fad47ce8..45cac08e 100644 --- a/docs/data-sources/Time/linux-arm64.md +++ b/docs/data-sources/Time/linux-arm64.md @@ -8,7 +8,7 @@ parent: Time Provides schema to work with time. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### time.interval(string startDateTime, string stopDateTime, string interval) diff --git a/docs/data-sources/Time/linux-x64.md b/docs/data-sources/Time/linux-x64.md index e8a00eb9..47e23089 100644 --- a/docs/data-sources/Time/linux-x64.md +++ b/docs/data-sources/Time/linux-x64.md @@ -8,7 +8,7 @@ parent: Time Provides schema to work with time. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### time.interval(string startDateTime, string stopDateTime, string interval) diff --git a/docs/data-sources/Time/macos-x64.md b/docs/data-sources/Time/macos-x64.md index ac9d3eff..97e5d36e 100644 --- a/docs/data-sources/Time/macos-x64.md +++ b/docs/data-sources/Time/macos-x64.md @@ -8,7 +8,7 @@ parent: Time Provides schema to work with time. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### time.interval(string startDateTime, string stopDateTime, string interval) diff --git a/docs/data-sources/Time/windows-x64.md b/docs/data-sources/Time/windows-x64.md index 795653d2..68809d10 100644 --- a/docs/data-sources/Time/windows-x64.md +++ b/docs/data-sources/Time/windows-x64.md @@ -8,7 +8,7 @@ parent: Time Provides schema to work with time. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### time.interval(string startDateTime, string stopDateTime, string interval) diff --git a/docs/data-sources/roslyn/alpine-x64.md b/docs/data-sources/roslyn/alpine-x64.md index 98161985..e7b829a3 100644 --- a/docs/data-sources/roslyn/alpine-x64.md +++ b/docs/data-sources/roslyn/alpine-x64.md @@ -8,7 +8,7 @@ parent: Roslyn Provides schema to work with Roslyn data source. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### csharp.solution(string path) diff --git a/docs/data-sources/roslyn/linux-arm64.md b/docs/data-sources/roslyn/linux-arm64.md index ebb3336b..be3ca544 100644 --- a/docs/data-sources/roslyn/linux-arm64.md +++ b/docs/data-sources/roslyn/linux-arm64.md @@ -8,7 +8,7 @@ parent: Roslyn Provides schema to work with Roslyn data source. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### csharp.solution(string path) diff --git a/docs/data-sources/roslyn/linux-x64.md b/docs/data-sources/roslyn/linux-x64.md index 22b5781f..95da738d 100644 --- a/docs/data-sources/roslyn/linux-x64.md +++ b/docs/data-sources/roslyn/linux-x64.md @@ -8,7 +8,7 @@ parent: Roslyn Provides schema to work with Roslyn data source. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### csharp.solution(string path) diff --git a/docs/data-sources/roslyn/macos-x64.md b/docs/data-sources/roslyn/macos-x64.md index f75952f0..b024deda 100644 --- a/docs/data-sources/roslyn/macos-x64.md +++ b/docs/data-sources/roslyn/macos-x64.md @@ -8,7 +8,7 @@ parent: Roslyn Provides schema to work with Roslyn data source. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### csharp.solution(string path) diff --git a/docs/data-sources/roslyn/windows-x64.md b/docs/data-sources/roslyn/windows-x64.md index bc182f38..f61fdbb3 100644 --- a/docs/data-sources/roslyn/windows-x64.md +++ b/docs/data-sources/roslyn/windows-x64.md @@ -8,7 +8,7 @@ parent: Roslyn Provides schema to work with Roslyn data source. ## Tables -A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM #source.table()'). Below are the available tables exposed by this data source: +A table in Musoq represents a structured data source with rows and columns. Each table provides access to specific data types and can be queried using the FROM clause (e.g., 'FROM @source.table()'). Below are the available tables exposed by this data source: ### csharp.solution(string path) diff --git a/docs/practical-examples-and-applications/analysis-of-the-efcore-repository.md b/docs/practical-examples-and-applications/analysis-of-the-efcore-repository.md index 7b671b7c..454537d8 100644 --- a/docs/practical-examples-and-applications/analysis-of-the-efcore-repository.md +++ b/docs/practical-examples-and-applications/analysis-of-the-efcore-repository.md @@ -16,7 +16,7 @@ There are exactly `15992` commits, we can count this with a simple query: ```sql select Count(1) as CommitsCount -from #git.repository('D:\repos\efcore') r +from @git.repository('D:\repos\efcore') r cross apply r.Commits c group by 'fake' ``` @@ -36,7 +36,7 @@ select c.Author, c.AuthorEmail, c.CommittedWhen -from #git.repository('D:\repos\efcore') r +from @git.repository('D:\repos\efcore') r cross apply r.Commits c order by c.CommittedWhen desc take 10 @@ -68,7 +68,7 @@ select b.IsCurrentRepositoryHead, b.UpstreamBranchCanonicalName, b.RemoteName -from #git.repository('D:\repos\efcore') r +from @git.repository('D:\repos\efcore') r cross apply r.Branches b ``` @@ -83,7 +83,7 @@ select b.IsCurrentRepositoryHead, b.UpstreamBranchCanonicalName, b.RemoteName -from #git.repository('D:\repos\efcore') r +from @git.repository('D:\repos\efcore') r cross apply r.Branches b where b.FriendlyName like '%release%' ``` @@ -129,7 +129,7 @@ with AllAuthors as ( select Count(c.AuthorEmail) as AuthorsCommits - from #git.repository('D:\repos\efcore') r + from @git.repository('D:\repos\efcore') r cross apply r.Commits c group by c.AuthorEmail ) @@ -142,7 +142,7 @@ Here's the top 10 by number of commits: select c.AuthorEmail, Count(c.Sha) as CommitCount -from #git.repository('D:\repos\efcore') r +from @git.repository('D:\repos\efcore') r cross apply r.Commits c group by c.AuthorEmail having Count(c.Sha) > 10 @@ -173,7 +173,7 @@ with MentionedBugFix as ( ToString(c.CommittedWhen, 'yyyy-MM') as Month, c.Sha as CommitSha, c.MessageShort as CommitMessage - from #git.repository('D:\repos\efcore') s + from @git.repository('D:\repos\efcore') s cross apply s.Commits c where ToLowerInvariant(c.MessageShort) like '%fix%' or @@ -213,7 +213,7 @@ with ContributionLength as ( c.Count(1) as TotalCommits, c.MinDateTimeOffset(c.CommittedWhen) as FirstCommit, c.MaxDateTimeOffset(c.CommittedWhen) as LastCommit - from #git.repository('D:\repos\efcore') r + from @git.repository('D:\repos\efcore') r cross apply r.Commits c group by c.AuthorEmail having Count(c.AuthorEmail) > 1 @@ -248,7 +248,7 @@ WITH FileChanges AS ( SELECT d.Path, c.Count(c.Sha) as TimesModified - FROM #git.repository('D:\repos\efcore') r + FROM @git.repository('D:\repos\efcore') r CROSS APPLY r.Head.Commits c CROSS APPLY r.DifferenceBetween(r.CommitFrom(c.Sha), r.CommitFrom(c.Sha + '^')) d GROUP BY d.Path @@ -284,7 +284,7 @@ SELECT c.Author, c.CommittedWhen, Count(d.Path) as FilesChanged -FROM #git.repository('D:\repos\efcore') r +FROM @git.repository('D:\repos\efcore') r CROSS APPLY r.Take(r.Head.Commits, 10) c CROSS APPLY r.DifferenceBetween(r.CommitFrom(c.Sha), r.CommitFrom(c.Sha + '^')) d GROUP BY c.Sha, c.MessageShort, c.Author, c.CommittedWhen @@ -316,7 +316,7 @@ select b.IsCurrentRepositoryHead, b.RemoteName, Count(1) as NumberOfCommits -from #git.repository('D:\repos\efcore') r +from @git.repository('D:\repos\efcore') r cross apply r.Branches b cross apply r.GetBranchSpecificCommits(r.Self, b.Self) c group by b.FriendlyName, b.IsRemote, b.IsTracking, b.IsCurrentRepositoryHead, b.RemoteName @@ -339,7 +339,7 @@ with BranchInfo as ( c.Author, c.AuthorEmail, c.CommittedWhen - from #git.repository('D:\repos\efcore') r + from @git.repository('D:\repos\efcore') r cross apply r.SearchForBranches('origin/release/6.0') b cross apply b.GetBranchSpecificCommits(r.Self, b.Self) c ) @@ -352,7 +352,7 @@ Most are merge commits. Let's see what files were changed: with DifferenceInfo as ( select d.Path - from #git.repository('D:\repos\efcore') r + from @git.repository('D:\repos\efcore') r cross apply r.SearchForBranches('origin/release/6.0') b cross apply b.GetBranchSpecificCommits(r.Self, b.Self) c cross apply r.DifferenceBetween(r.CommitFrom(c.Sha), r.CommitFrom(c.Sha + '^')) d @@ -426,7 +426,7 @@ with CommitsFromTags as ( select t.MinCommit(t.Commit) as FirstCommit, t.MaxCommit(t.Commit) as LastCommit - from #git.repository('D:\repos\efcore') r + from @git.repository('D:\repos\efcore') r cross apply r.Tags t where t.FriendlyName = 'v5.0.0' or t.FriendlyName = 'v6.0.0' group by 'fake' @@ -435,7 +435,7 @@ select b.FirstCommit.CommittedWhen as FirstCommitDate, b.LastCommit.CommittedWhen as LastCommitDate, d.Path -from #git.repository('D:\repos\efcore') r2 +from @git.repository('D:\repos\efcore') r2 inner join CommitsFromTags b on 1 = 1 cross apply r2.DifferenceBetween(b.FirstCommit, b.LastCommit) d ``` @@ -464,7 +464,7 @@ with CommitsFromTags as ( select t.MinCommit(t.Commit) as FirstCommit, t.MaxCommit(t.Commit) as LastCommit - from #git.repository('D:\repos\efcore') r + from @git.repository('D:\repos\efcore') r cross apply r.Tags t where t.FriendlyName = 'v5.0.0' or t.FriendlyName = 'v6.0.0' group by 'fake' @@ -472,7 +472,7 @@ with CommitsFromTags as ( select d.Path, d.Count(1) as NumberOfChanges - from #git.repository('D:\repos\efcore') r2 + from @git.repository('D:\repos\efcore') r2 inner join CommitsFromTags b on 1 = 1 cross apply r2.Commits c1 cross apply r2.DifferenceBetween(r2.CommitFrom(c1.Sha), r2.CommitFrom(c1.Sha + '^')) d @@ -507,7 +507,7 @@ For visualizing the codebase evolution, we can count added and deleted lines for select p.LinesAdded, p.LinesDeleted -from #git.repository('D:\repos\efcore') r +from @git.repository('D:\repos\efcore') r cross apply r.Commits c cross apply r.PatchBetween(c.Self, r.CommitFrom(c.Self.Sha + '^')) p ``` \ No newline at end of file diff --git a/docs/practical-examples-and-applications/operating-system-as-a-data-source.md b/docs/practical-examples-and-applications/operating-system-as-a-data-source.md index 5b86fb16..40474daf 100644 --- a/docs/practical-examples-and-applications/operating-system-as-a-data-source.md +++ b/docs/practical-examples-and-applications/operating-system-as-a-data-source.md @@ -18,7 +18,7 @@ SELECT ProcessName, Directory, FileName -FROM #os.processes() WHERE ProcessName LIKE '%Musoq%' +FROM @os.processes() WHERE ProcessName LIKE '%Musoq%' ``` ## Finding `.cfg` and `.tmp` Files in Downloads @@ -26,7 +26,7 @@ FROM #os.processes() WHERE ProcessName LIKE '%Musoq%' This query retrieves the file size (`Length`) and the full path (`FullPath`) of all files located in the `Downloads` directory of the user `{USER}` that have either a `.cfg` or `.tmp` extension. It searches through all the subdirectories (`true` parameter indicates recursive search) within the specified path for files matching the criteria. ```sql -SELECT Length, FullPath FROM #os.files('C:\Users\{USER}\Downloads', true) WHERE FullPath LIKE '%.cfg' OR FullPath LIKE '%.tmp' +SELECT Length, FullPath FROM @os.files('C:\Users\{USER}\Downloads', true) WHERE FullPath LIKE '%.cfg' OR FullPath LIKE '%.tmp' ``` ## Listing Non-empty Files @@ -34,7 +34,7 @@ SELECT Length, FullPath FROM #os.files('C:\Users\{USER}\Downloads', true) WHERE This query lists the names (`Name`) of all non-empty files located in the `Downloads` directory of the user `{USER}`. It includes files from all subdirectories (the `true` parameter enables recursive search) within the specified path, filtering out any files with a length of `0` (empty files). ```sql -SELECT Name FROM #os.files('C:\Users\{USER}\Downloads', true) WHERE Length > 0 +SELECT Name FROM @os.files('C:\Users\{USER}\Downloads', true) WHERE Length > 0 ``` ## Counting File Types @@ -42,7 +42,7 @@ SELECT Name FROM #os.files('C:\Users\{USER}\Downloads', true) WHERE Length > 0 This query calculates the number of files for each file type (extension) located in the `Downloads` directory of the user `{USER}`. By grouping the results by the file extension (`Extension`), it provides a count of files for each unique extension. The search includes all subdirectories within the specified path due to the `true` parameter, enabling a comprehensive overview of file types present in the Downloads folder. ```sql -SELECT Extension, Count(Extension) FROM #os.files('C:\Users\{USER}\Downloads', true) GROUP BY Extension +SELECT Extension, Count(Extension) FROM @os.files('C:\Users\{USER}\Downloads', true) GROUP BY Extension ``` ## Paginating Files in Downloads @@ -50,7 +50,7 @@ SELECT Extension, Count(Extension) FROM #os.files('C:\Users\{USER}\Downloads', t This query displays the names (`Name`) of files located in the `Downloads` directory of user `{USER}`, implementing pagination by skipping the first 5 files and then taking the next 5 files. It searches through all subdirectories within the specified path (`true` parameter for recursive search), effectively listing files in a segmented manner, which is particularly useful for processing large sets of files in manageable chunks. ```sql -SELECT Name FROM #os.files('C:\Users\{USER}\Downloads', true) skip 5 take 5 +SELECT Name FROM @os.files('C:\Users\{USER}\Downloads', true) skip 5 take 5 ``` ## Finding CSV Files Containing 'Frames' Word in File Name @@ -58,7 +58,7 @@ SELECT Name FROM #os.files('C:\Users\{USER}\Downloads', true) skip 5 take 5 This query searches for `.csv` files that contain the word 'Frames' within their full path (`FullPath`) in the `Downloads` directory of the user `{USER}`. It leverages the `rlike` operator for regex pattern matching to filter files. The `true` parameter ensures that the search is conducted recursively through all subdirectories within the specified path, targeting only those `.csv` files whose names include 'Frames'. ```sql -SELECT Name FROM #os.files('C:\Users\{USER}\Downloads', true) WHERE FullPath rlike '.*Frames.*.csv' +SELECT Name FROM @os.files('C:\Users\{USER}\Downloads', true) WHERE FullPath rlike '.*Frames.*.csv' ``` ## Filtering `.tmp` and `.cfg` Files by Size @@ -67,12 +67,12 @@ This query selects the names (`Name`) of files within the `Downloads` directory ## Combining JPG Files from Two Folders -This query aggregates the full paths (`FullPath`) of `.jpg` files from two specific locations: `Folder1` and `Folder2` within the user `{USER}`'s directory. It uses the `UNION ALL` operation to combine the results from both folders into a single list, including duplicates if they exist. The `true` parameter for each `#os.files` function call ensures that the search includes all subdirectories within both specified paths, targeting `.jpg` files exclusively. +This query aggregates the full paths (`FullPath`) of `.jpg` files from two specific locations: `Folder1` and `Folder2` within the user `{USER}`'s directory. It uses the `UNION ALL` operation to combine the results from both folders into a single list, including duplicates if they exist. The `true` parameter for each `@os.files` function call ensures that the search includes all subdirectories within both specified paths, targeting `.jpg` files exclusively. ```sql -SELECT FullPath FROM #os.files('C:\Users\{USER}\Folder1', true) WHERE Name LIKE '%.jpg' +SELECT FullPath FROM @os.files('C:\Users\{USER}\Folder1', true) WHERE Name LIKE '%.jpg' UNION ALL (FullPath) -SELECT FullPath FROM #os.files('C:\Users\{USER}\Folder2', true) WHERE Name LIKE '%.jpg' +SELECT FullPath FROM @os.files('C:\Users\{USER}\Folder2', true) WHERE Name LIKE '%.jpg' ``` or you can use cross apply operator: @@ -81,7 +81,7 @@ or you can use cross apply operator: SELECT f.DirectoryName, f.FileName -FROM #os.directories('C:\Users\{USER}', false) d -CROSS APPLY #os.files(d.FullName, true) f +FROM @os.directories('C:\Users\{USER}', false) d +CROSS APPLY @os.files(d.FullName, true) f WHERE d.Name IN ('Folder1', 'Folder2') ``` \ No newline at end of file diff --git a/docs/practical-examples-and-applications/processing-.csv,-.tsv-files.md b/docs/practical-examples-and-applications/processing-.csv,-.tsv-files.md index 32676f0e..d9327065 100644 --- a/docs/practical-examples-and-applications/processing-.csv,-.tsv-files.md +++ b/docs/practical-examples-and-applications/processing-.csv,-.tsv-files.md @@ -120,7 +120,7 @@ First, we will enrich our calculations by determining the total price `UnitPrice select *, ToInt32(Quantity) * ToDecimal(UnitPrice) as TotalPrice -from #separatedvalues.csv('@qfs/category_product_data.csv', true, 0) +from @separatedvalues.csv('@qfs/category_product_data.csv', true, 0) ``` We begin by reading the file from the query space named `category_product_data.csv` which has a header `true` and we are supposed to start reading from row zero `0`. Because our data source reads all columns as string types, we have to convert them to numbers. With each row read, a transformation will be performed on the relevant columns followed by multiplication. @@ -143,7 +143,7 @@ If our file doesn’t have a header or the names are very irregular, we can simp select *, ToInt32(Column3) * ToDecimal(Column4) as Column5 -from #separatedvalues.csv('@qfs/category_product_data.csv', false, 1) +from @separatedvalues.csv('@qfs/category_product_data.csv', false, 1) ``` Table after our transformations: @@ -166,7 +166,7 @@ select Product, Sum(ToInt32(Quantity) * ToDecimal(UnitPrice), 1) as TotalPriceForCategory, Sum(ToInt32(Quantity) * ToDecimal(UnitPrice)) as TotalPriceForProduct -from #separatedvalues.csv('@qfs/category_product_data.csv', true, 0) +from @separatedvalues.csv('@qfs/category_product_data.csv', true, 0) group by Category, Product ``` @@ -210,7 +210,7 @@ select csv.Comment, gpt.Sentiment(csv.Comment) as Sentiment, csv.Date -from #separatedvalues.csv('@qfs/comments_sample.csv', true, 0) csv inner join #openai.gpt('gpt-4-1106-preview') gpt on 1 = 1 +from @separatedvalues.csv('@qfs/comments_sample.csv', true, 0) csv inner join @openai.gpt('gpt-4-1106-preview') gpt on 1 = 1 ``` -In this query, we use an `inner join` because we want to use a method that belongs to the calculated **gpt** table. This table always returns a single row; we are not specifically interested in the row value but want it to be available for each message. When initializing, we use the exact model name which is supposed to respond to our sentiment query. The data source `#openai.gpt` has more interesting methods with which I encourage you to become familiar in the source documentation. \ No newline at end of file +In this query, we use an `inner join` because we want to use a method that belongs to the calculated **gpt** table. This table always returns a single row; we are not specifically interested in the row value but want it to be available for each message. When initializing, we use the exact model name which is supposed to respond to our sentiment query. The data source `@openai.gpt` has more interesting methods with which I encourage you to become familiar in the source documentation. \ No newline at end of file diff --git a/docs/practical-examples-and-applications/querying-git-repositories.md b/docs/practical-examples-and-applications/querying-git-repositories.md index 7efa1502..709c05e5 100644 --- a/docs/practical-examples-and-applications/querying-git-repositories.md +++ b/docs/practical-examples-and-applications/querying-git-repositories.md @@ -41,7 +41,7 @@ with BranchCommits as ( select r.MinCommit(c.Self) as FirstCommit, r.MaxCommit(c.Self) as LastCommit - from #git.repository('/some/git/repo') r + from @git.repository('/some/git/repo') r cross apply r.SearchForBranches('feature/feature_1') b cross apply r.GetBranchSpecificCommits(r.Self, b.Self, false) c group by 'fake' @@ -56,7 +56,7 @@ select p.LinesAdded, p.LinesDeleted from BranchCommits b -inner join #git.repository('/some/git/repo') r on 1 = 1 +inner join @git.repository('/some/git/repo') r on 1 = 1 cross apply r.PatchBetween(r.CommitFrom(b.FirstCommit.Sha), r.CommitFrom(b.LastCommit.Sha)) p ``` @@ -82,7 +82,7 @@ with BranchCommits as ( select r.MinCommit(c.Self) as FirstCommit, r.MaxCommit(c.Self) as LastCommit - from #git.repository('/some/git/repo') r + from @git.repository('/some/git/repo') r cross apply r.SearchForBranches('feature/feature_1') b cross apply r.GetBranchSpecificCommits(r.Self, b.Self, false) c group by 'fake' @@ -92,7 +92,7 @@ select c.LinesAdded, c.LinesDeleted from BranchCommits b -inner join #git.repository('/some/git/repo') r on 1 = 1 +inner join @git.repository('/some/git/repo') r on 1 = 1 cross apply r.PatchBetween(r.CommitFrom(b.FirstCommit.Sha), r.CommitFrom(b.LastCommit.Sha)) p cross apply p.Changes c ``` diff --git a/docs/practical-examples-and-applications/querying-multiple-git-repositories-at-once.md b/docs/practical-examples-and-applications/querying-multiple-git-repositories-at-once.md index ed7457b4..eb429dd5 100644 --- a/docs/practical-examples-and-applications/querying-multiple-git-repositories-at-once.md +++ b/docs/practical-examples-and-applications/querying-multiple-git-repositories-at-once.md @@ -15,8 +15,8 @@ A quite useful feature of the tool is the ability to query multiple Git reposito with ProjectsToAnalyze as ( select dir2.FullName as FullName - from #os.directories('D:\repos', false) dir1 - cross apply #os.directories(dir1.FullName, false) dir2 + from @os.directories('D:\repos', false) dir1 + cross apply @os.directories(dir1.FullName, false) dir2 where dir2.Name = '.git' ) @@ -24,7 +24,7 @@ select c.Message, c.Author, c.CommittedWhen -from ProjectsToAnalyze p cross apply #git.repository(p.FullName) r +from ProjectsToAnalyze p cross apply @git.repository(p.FullName) r cross apply r.Commits c where c.AuthorEmail = 'my-email@email.ok' order by c.CommitedWhen desc @@ -59,8 +59,8 @@ with Repositories as ( select dir2.FullName as GitPath, dir2.Parent.Name as RepositoryName - from #os.directories('D:\repos', false) dir1 - cross apply #os.directories(dir1.FullName, false) dir2 + from @os.directories('D:\repos', false) dir1 + cross apply @os.directories(dir1.FullName, false) dir2 where dir2.Name = '.git' ) @@ -71,7 +71,7 @@ select repo.StringsJoin(',', repo.Distinct(repo.Split(repo.AggregateValues(c.AuthorEmail), ','))) as Authors, repo.MaxDateTimeOffset(c.CommittedWhen) as LastCommitDate from Repositories r -cross apply #git.repository(r.GitPath) repo +cross apply @git.repository(r.GitPath) repo cross apply repo.Commits c group by r.RepositoryName order by repo.Count(c.Sha) desc diff --git a/docs/practical-examples-and-applications/time-utilization.md b/docs/practical-examples-and-applications/time-utilization.md index 87859b41..bab77b53 100644 --- a/docs/practical-examples-and-applications/time-utilization.md +++ b/docs/practical-examples-and-applications/time-utilization.md @@ -13,7 +13,7 @@ Sometimes it's necessary to perform some action periodically. To specify when ou SELECT DateTime, DayOfWeek -FROM #time.interval('01/01/2024', '01/01/2025', 'days') +FROM @time.interval('01/01/2024', '01/01/2025', 'days') WHERE Day >= 1 AND Day <= 7 AND diff --git a/docs/practical-examples-and-applications/turning-csv-into-json.md b/docs/practical-examples-and-applications/turning-csv-into-json.md index b372f7c5..45662d90 100644 --- a/docs/practical-examples-and-applications/turning-csv-into-json.md +++ b/docs/practical-examples-and-applications/turning-csv-into-json.md @@ -14,7 +14,7 @@ This guide shows you how to convert CSV files to JSON using Musoq, with special To view your CSV data in table format, use this command: ```powershell -./Musoq.exe run query "select * from #separatedvalues.comma('cities.csv', true, 0)" +./Musoq.exe run query "select * from @separatedvalues.comma('cities.csv', true, 0)" ``` You'll see your data in a clear table format: @@ -36,7 +36,7 @@ You'll see your data in a clear table format: To convert the same data to flat JSON, add the --format json flag: ```powershell -./Musoq.exe run query "select * from #separatedvalues.comma('cities.csv', true, 0)" --format json +./Musoq.exe run query "select * from @separatedvalues.comma('cities.csv', true, 0)" --format json ``` This produces: @@ -50,7 +50,7 @@ This produces: The interpreted_json format allows you to treat column headers as a hierarchy of a JSON object and thus, interpret it to create complex objects. Here's how to use it: ```powershell -./Musoq.exe run query "select cityId as [city.id], cityName as [city.name], cityPopulation as [city.features.population], cityArea as [city.features.area], postOffices as [city.features.postOffices], schools as [city.features.schools], isCapitol as [city.features.isCapitol], isVoivodeshipCity as [city.features.isVoivodeship] from #separatedvalues.comma('cities.csv', true, 0)" --format interpreted_json +./Musoq.exe run query "select cityId as [city.id], cityName as [city.name], cityPopulation as [city.features.population], cityArea as [city.features.area], postOffices as [city.features.postOffices], schools as [city.features.schools], isCapitol as [city.features.isCapitol], isVoivodeshipCity as [city.features.isVoivodeship] from @separatedvalues.comma('cities.csv', true, 0)" --format interpreted_json ``` This creates a structured JSON output: diff --git a/docs/practical-examples-and-applications/turning-photos-to-hashtags-with-llms.md b/docs/practical-examples-and-applications/turning-photos-to-hashtags-with-llms.md index 80992660..a82412aa 100644 --- a/docs/practical-examples-and-applications/turning-photos-to-hashtags-with-llms.md +++ b/docs/practical-examples-and-applications/turning-photos-to-hashtags-with-llms.md @@ -25,8 +25,8 @@ Here's an example SQL query using the `llama3.2-vision:latest` model to generate select f.Name, l.AskImage('Describe this photo of my child in one sentence.', f.Base64File()) as description -from #os.files('/some/folder/with/photos', false) f -cross apply #ollama.llm('llama3.2-vision:latest') l +from @os.files('/some/folder/with/photos', false) f +cross apply @ollama.llm('llama3.2-vision:latest') l ``` ``` @@ -48,8 +48,8 @@ For comparison, the following query uses the `gpt-4o` model to generate image de select f.Name, l.AskImage('this is the photo of my little child I want you to describe. Be conscise, use only single statement.', f.Base64File()) as description -from #os.files('/some/folder/with/photos', false) f -cross apply #openai.gpt('gpt-4o') l +from @os.files('/some/folder/with/photos', false) f +cross apply @openai.gpt('gpt-4o') l ``` ``` @@ -70,14 +70,14 @@ with PhotosDescription as ( select f.Name as Name, l.AskImage('this is the photo of my little child I want you to describe. Be conscise, use only single statement.', f.Base64File()) as Description - from #os.files('/some/folder/with/photos', false) f - cross apply #ollama.llm('llama3.2-vision:11b-instruct-q4_K_M') l + from @os.files('/some/folder/with/photos', false) f + cross apply @ollama.llm('llama3.2-vision:11b-instruct-q4_K_M') l ) select p.Name, p.Description, l.LlmPerform('this is the description of the photo I want you generate hashtags for. It comes from my child photo album. Return only hashtags separated with comma (#something, #somethingElse). Comma is very important to separate hashtags. Dont forget about it. No description or explanation.', p.Description) as HashTags -from PhotosDescription p cross apply #openai.gpt('gpt-4o', 4096, 0.0) l +from PhotosDescription p cross apply @openai.gpt('gpt-4o', 4096, 0.0) l ``` ``` diff --git a/docs/sql-syntax-of-the-tool/common-table-expressions-(cte).md b/docs/sql-syntax-of-the-tool/common-table-expressions-(cte).md index 8c824ef6..163d103b 100644 --- a/docs/sql-syntax-of-the-tool/common-table-expressions-(cte).md +++ b/docs/sql-syntax-of-the-tool/common-table-expressions-(cte).md @@ -11,9 +11,9 @@ nav_order: 9 ```sql with FirstTable as ( - select 1 as x from #system.dual() + select 1 as x from @system.dual() ), SecondTable as ( - select 2 as y from #system.dual() + select 2 as y from @system.dual() ) select x, y from FirstTable f inner join SecondTable s on f.x <> s.y ``` \ No newline at end of file diff --git a/docs/sql-syntax-of-the-tool/from-clause.md b/docs/sql-syntax-of-the-tool/from-clause.md index c55105f7..74ec5343 100644 --- a/docs/sql-syntax-of-the-tool/from-clause.md +++ b/docs/sql-syntax-of-the-tool/from-clause.md @@ -7,11 +7,11 @@ nav_order: 3 # From Clause -You can witness three different types of `from` clauses. The first one is `from #schema.table(param1, ..., paramN)`, the second is `from SomeTableAlias`, and the third `from AnotherAlias(param1, ..., paramN)`. Basic usage often involves the first syntax, the second is utilized when referring to a source coming from **Common Table Expressions (CTEs)**, while the third is mainly used in situations where the data source's return types are unknown but known to the user writing the query. +You can witness three different types of `from` clauses. The first one is `from @schema.table(param1, ..., paramN)`, the second is `from SomeTableAlias`, and the third `from AnotherAlias(param1, ..., paramN)`. Basic usage often involves the first syntax, the second is utilized when referring to a source coming from **Common Table Expressions (CTEs)**, while the third is mainly used in situations where the data source's return types are unknown but known to the user writing the query. -## from #a.b(param1, ..., paramN) +## from @a.b(param1, ..., paramN) -In query writing, a commonly used command `from` is `from #a.b(param1, ...)`. This syntax specifies that we will be using an external data source. For instance, from `#separatedValues.csv(...)` indicates that we will utilize the source `separatedValues` and the table `csv` whose parameters will be passed `(...)`. This instructs the data source directly on how to retrieve the data and then load it into the evaluator. The data source is parameterized, which allows for configuring what data you want to receive and how you want to receive it. For example, when querying about an operating system disk, you likely wouldn't want to iterate over the entire disk but rather a set of folders that are important to you. Parameterization provides the flexibility to construct the portion of data you are inquiring about. By narrowing your searches, we speed up operation. **This clause must be aliased when using it in conjunction with the join syntax** +In query writing, a commonly used command `from` is `from @a.b(param1, ...)`. This syntax specifies that we will be using an external data source. For instance, from `@separatedValues.csv(...)` indicates that we will utilize the source `separatedValues` and the table `csv` whose parameters will be passed `(...)`. This instructs the data source directly on how to retrieve the data and then load it into the evaluator. The data source is parameterized, which allows for configuring what data you want to receive and how you want to receive it. For example, when querying about an operating system disk, you likely wouldn't want to iterate over the entire disk but rather a set of folders that are important to you. Parameterization provides the flexibility to construct the portion of data you are inquiring about. By narrowing your searches, we speed up operation. **This clause must be aliased when using it in conjunction with the join syntax** ## from SomeTableAlias @@ -37,7 +37,7 @@ table Invoice { ProductName 'string', ProductPrize 'decimal' }; -couple table #toolbox.invoices with Invoice as SourceOfInvoiceValues; +couple table @toolbox.invoices with Invoice as SourceOfInvoiceValues; ``` In this way, we provide the plugin and compiler with sufficient information about the required columns and types in the query. \ No newline at end of file diff --git a/docs/sql-syntax-of-the-tool/group-by-clause.md b/docs/sql-syntax-of-the-tool/group-by-clause.md index 4088a512..1154f2e5 100644 --- a/docs/sql-syntax-of-the-tool/group-by-clause.md +++ b/docs/sql-syntax-of-the-tool/group-by-clause.md @@ -13,11 +13,11 @@ The Group by operator allows you to specify columns or expressions that your row You can use methods like `Sum`, `SumIncome`, `SumOutcome`, `Count`, `AggregateValue`, and others to perform the aggregation of values in rows belonging to a particular group. Broadly speaking, the rules from SQL apply here, so after using `group by ColumnName`, the only thing you can return in select is `ColumnName` and aggregated values such as `Sum(SomeColumn)`. It should be noted that the `*` operator in aggregation operators is not supported. -`select ColumnName, Count(ColumnName) from #schema.method() group by ColumnName` +`select ColumnName, Count(ColumnName) from @schema.method() group by ColumnName` You can also group by the values altered by some method. The only rule here is to repeat that part in the select clause (if you need it) both as an indicator of the group and the value of the grouping. It should look like this: -`select SomeMethod(ColumnName), Sum(SomeMethod(ColumnName)) from #schema.method() group by SomeMethod(ColumnName)` +`select SomeMethod(ColumnName), Sum(SomeMethod(ColumnName)) from @schema.method() group by SomeMethod(ColumnName)` ## Parent Aggregation You can calculate aggregation for parent groups by placing the number of groups you want to skip as a parameter of the aggregate method. For example, if your query groups by the columns `Country` and `City` and you sum their population `Sum(Population)`, you could simultaneously sum the population for the entire country. In such a case, you should add `Sum(1, Population)` as well, which will compute the sum only for `Country` without considering different cities within the country. Aggregate methods can be combined with others in the **select** part. \ No newline at end of file diff --git a/docs/sql-syntax-of-the-tool/join-clause.md b/docs/sql-syntax-of-the-tool/join-clause.md index 05e2aa97..d458f0ab 100644 --- a/docs/sql-syntax-of-the-tool/join-clause.md +++ b/docs/sql-syntax-of-the-tool/join-clause.md @@ -10,19 +10,19 @@ nav_order: 7 Currently, the only supported operators are `inner join` and `[left | right] outer join`. The syntax for the `inner join` expression is as follows: ```sql -...from #schema.method(...) a inner join #schema.method() b on a.SomeColumn = b.SomeOtherColumn where ... +...from @schema.method(...) a inner join @schema.method() b on a.SomeColumn = b.SomeOtherColumn where ... ``` while the `left outer join` syntax is: ```sql -...from #schema.method(...) a left outer join #schema.method() b on a.SomeColumn = b.SomeOtherColumn where ... +...from @schema.method(...) a left outer join @schema.method() b on a.SomeColumn = b.SomeOtherColumn where ... ``` and `right outer join`: ```sql -...from #schema.method(...) a right outer join #schema.method() b on a.SomeColumn = b.SomeOtherColumn where ... +...from @schema.method(...) a right outer join @schema.method() b on a.SomeColumn = b.SomeOtherColumn where ... ``` When using a source that is parameterized (for example, `#schema.method()`), we must provide it with an alias. \ No newline at end of file diff --git a/docs/sql-syntax-of-the-tool/select-clause.md b/docs/sql-syntax-of-the-tool/select-clause.md index 5bebfd25..c329c62d 100644 --- a/docs/sql-syntax-of-the-tool/select-clause.md +++ b/docs/sql-syntax-of-the-tool/select-clause.md @@ -11,7 +11,7 @@ The `Select` command retrieves data from a specified source. As part of the sele ```sql with Dummy as ( - select 1 + 2 as 'EvaluatedExpression', SomeMethod(SomeColumn) as 'MyMethod', SomeColumn from #dummy.source() + select 1 + 2 as 'EvaluatedExpression', SomeMethod(SomeColumn) as 'MyMethod', SomeColumn from @dummy.source() ) select EvaluatedExpression, SomeColumn, MyMethod from Dummmy ``` @@ -19,9 +19,9 @@ select EvaluatedExpression, SomeColumn, MyMethod from Dummmy in this particular case, `SomeMethod(SomeColumn)` and `1 + 2` need to be aliased because they represent a complex expression within the CTE expression. Another example here involves set operators, which require that the columns match on both sides. ```sql -select ColumnName, 1 + 2 as 'EvaluatedExpression', SomeMethod(SomeColumn) as 'MyMethod' from #dummy.source() +select ColumnName, 1 + 2 as 'EvaluatedExpression', SomeMethod(SomeColumn) as 'MyMethod' from @dummy.source() union -select OtherMethod(ColumnName) as ColumnName, 3 + 4 as 'EvaluatedExpression', SomeMethod2(SomeColumn) as 'MyMethod' from #dummy.source() +select OtherMethod(ColumnName) as ColumnName, 3 + 4 as 'EvaluatedExpression', SomeMethod2(SomeColumn) as 'MyMethod' from @dummy.source() ``` As you can see, both operators require the same name. What is not visible here, but is also very important, is that expressions on both sides **must return the same types**. \ No newline at end of file diff --git a/docs/sql-syntax-of-the-tool/set-operators.md b/docs/sql-syntax-of-the-tool/set-operators.md index 3b539bd1..266a5c79 100644 --- a/docs/sql-syntax-of-the-tool/set-operators.md +++ b/docs/sql-syntax-of-the-tool/set-operators.md @@ -10,9 +10,9 @@ nav_order: 8 Set operators in `Musoq` differ slightly from the operators used in traditional SQL. They compare individual rows and calculate the result for the entire query. In `Musoq`, you must specify which columns will participate in the comparison, which looks like this: `query1 union all (Column1, Column2, ...) query2`. Columns must have the same names and order. If you want to use different columns for comparison, you need to give such a column an alias in order to match its name. Here's how it should look: ```sql -select Column from #schema.method() +select Column from @schema.method() union all (Column) -select Column2 as Column from #schema.method() +select Column2 as Column from @schema.method() ``` You cannot mix the return types of the columns, and the number of values returned for both columns must be the same. diff --git a/docs/technical-overview.md b/docs/technical-overview.md index e5d4adc5..8f9b2020 100644 --- a/docs/technical-overview.md +++ b/docs/technical-overview.md @@ -74,7 +74,7 @@ Let's trace a simple query through the system: ### Input Query ```sql SELECT Name, Size -FROM #os.files('/Documents') +FROM @os.files('/Documents') WHERE Extension = '.pdf' ORDER BY Size DESC ``` @@ -87,7 +87,7 @@ ORDER BY Size DESC ### 2. Schema Resolution ```csharp -// Resolve #os.files -> OSSchema.GetFilesRowSource +// Resolve @os.files -> OSSchema.GetFilesRowSource // Infer types: Name (string), Size (long), Extension (string) ``` @@ -140,7 +140,7 @@ public class MyDataRowSource : RowSource } // 3. Usage in Queries -// SELECT * FROM #mydata.source('parameter') +// SELECT * FROM @mydata.source('parameter') ``` ## Performance Characteristics @@ -179,18 +179,18 @@ public class MyDataRowSource : RowSource ### Embedded Usage ```csharp var engine = new MusoqEngine(); -var results = engine.Execute("SELECT COUNT(*) FROM #os.files('/logs')"); +var results = engine.Execute("SELECT COUNT(*) FROM @os.files('/logs')"); ``` ### CLI Usage ```bash -musoq "SELECT Name FROM #git.commits('/repo') WHERE AuthorEmail LIKE '%@company.com'" +musoq "SELECT Name FROM @git.commits('/repo') WHERE AuthorEmail LIKE '%@company.com'" ``` ### Custom Plugin Integration ```csharp engine.RegisterSchema(); -var results = engine.Execute("SELECT * FROM #mycustom.data()"); +var results = engine.Execute("SELECT * FROM @mycustom.data()"); ``` ## Next Steps