Closed FaresKi closed 1 year ago
@mattwar are you able to assist here?
Thanks
For #2. It is not possible to know the columns returned by a function without first analyzing the body of the function itself since the functions are not defined declaring a result schema and it may depend on the arguments given to the function when called.
Lucky for you, the parser has already done this analysis, so when you find a function that was called you just need to examine that expression node's ResultType property.
The best thing you can do for #1, is to build a map of all the functions being called and the columns they return. Then when you find those columns being referred to you can attribute them back to the function they came from.
Hi! There are 2 questions I'm having and was hoping you could help solve. 1) Quick question about the Parser. I'm trying to extract columns that are strictly used in
where
statements. For example, I got a query like the following:Here's the parsing logic I tried to implement:
In other words, I initially fetch the function name (or table name), parse the rest of the query, and when I first encounter a
where
FilterOperator
, I enable the linking of column names to functions. Small problem, there are plenty of edge cases I don't know how to cover. Especially functions and columns that are mentioned inside other functions (toscalar
, for example). How would you implement it on your side?2) Is there a similar - or easily implementable - method that provides a way to verify if a column is amongst the
Function
'sOutputColumns
? Something equivalent toTableSymbol.GetColumn
's method?Thanks in advance for your answers! Fares
P.S: I don't know if it's worth it, but here's the definition of the
DataModel
class: