Musoq
Musoq copied to clipboard
Source for [InjectSource] cannot be properly recognized for plugins that have overloaded methods.
let's assume such a query:
select Decompress(AggregateFiles(GetFileInfo()), './Results/DecompressTest') from #disk.zip('./Files.zip')
GetFileInfo() definition can have two overloads, first one FileInfo GetFileInfo([InjectSource] FileInfo) and FileInfo GetFileInfo([InjectSource] ZipArchiveEntry). Based on that, when the compiler sees such a query, it gets the first GetFileInfo() from the methods manager which is wrong. It's because the compiler doesn't have enough information about what kind of source disk.zip(...) returns.
Currently, the compiler should just throws compilation error instead of trying to use wrong method and throw InvalidCastException on runtime.
To Address full resolving of this issue, my proposition is to extend SchemaBase interface to provide such a information during the compilation phase. It looks to be complex to resolve it properly and I feel it addresses the current limitation of evaluator. It will require deeper investigation especially when taken into account queries that use joins, unions and stuff like that.