Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .copilot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -338,7 +338,7 @@ dotnet test --filter "TestCategory=Integration"
// Using test infrastructure pattern
var schemaProvider = new BasicSchemaProvider<MyEntity>(dataSources);
var compiledQuery = InstanceCreator.CompileForExecution(
"SELECT Name, Value FROM #schema.table('param')",
"SELECT Name, Value FROM @schema.table('param')",
Guid.NewGuid().ToString(),
schemaProvider,
loggerResolver);
Expand All @@ -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";

Expand Down Expand Up @@ -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<BasicEntity>(query);
Expand Down Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions .copilot/api-usage-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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");
```
Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -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";

Expand Down
8 changes: 4 additions & 4 deletions .copilot/development-debugging-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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(),
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .copilot/plugin-development-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,15 @@ 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();
```

### 2. **CLI Integration**
```bash
# Command-line usage
musoq "SELECT COUNT(*) FROM #git.commits('/repo')"
musoq "SELECT COUNT(*) FROM @git.commits('/repo')"
```

### 3. **Plugin Development**
Expand Down
8 changes: 4 additions & 4 deletions Musoq.Benchmarks/Components/ExecutionBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,25 @@ 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<string, IEnumerable<CountryEntity>>
{
{"#A", data}
{"@A", data}
};

return CreateForCountryWithOptions(script, sources, compilationOptions);
}

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<string, IEnumerable<ProfileEntity>>
{
{"#A", data}
{"@A", data}
};

return CreateForProfilesWithOptions(script, sources, compilationOptions);
Expand Down
4 changes: 2 additions & 2 deletions Musoq.Converter.Tests/BuildTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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());

Expand Down
2 changes: 1 addition & 1 deletion Musoq.Evaluator.Tests/AliasGeneratorQueryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<BasicEntity>(query);
var secondBuild = CreateBuildItems<BasicEntity>(query);
Expand Down
46 changes: 23 additions & 23 deletions Musoq.Evaluator.Tests/AliasTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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<UnknownColumnOrAliasException>(() => CreateAndRunVirtualMachine(query, [
new()
Expand All @@ -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()
Expand All @@ -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";

Expand Down Expand Up @@ -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";

Expand All @@ -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
)
Expand Down Expand Up @@ -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
)
Expand All @@ -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, [
Expand All @@ -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<AliasAlreadyUsedException>(() => CreateAndRunVirtualMachine(query, [
new(),
Expand All @@ -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<AliasAlreadyUsedException>(() => CreateAndRunVirtualMachine(query, [
new(),
Expand All @@ -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<AliasAlreadyUsedException>(() => CreateAndRunVirtualMachine(query, [
Expand All @@ -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<AliasAlreadyUsedException>(() => CreateAndRunVirtualMachine(query, [
new(),
Expand All @@ -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<AliasAlreadyUsedException>(() => CreateAndRunVirtualMachine(query, [
new(),
Expand Down
Loading
Loading