Open harpoonix opened 6 months ago
Hi Harsh,
Sorry for the late reply, I've been busy at work 😅
SELECT AVG(CAST(Year AS real) / Stadium_ID)
FROM concert_singer.concert;
will return the following raw QPL:
#1 = Scan Table [ concert ] Output [ concert.Year / concert.Stadium_ID ]
#2 = Aggregate [ #1 ] Output [ AVG(concert.Year / concert.Stadium_ID) ]
The thing is that we didn't intend to support this, so the post-processing done on this QPL will fail (it's all regular expression work there). The code that does the post-processing, i.e., working on QPL that comes out of Scala, is here.
SELECT Year
FROM concert_singer.concert
WHERE Year / Stadium_ID >= 100;
will return this raw QPL:
#1 = Scan Table [ concert ] Predicate [ concert.Year / concert.Stadium_ID >= 100 ] Output [ concert.Year , concert.Year , concert.Stadium_ID ]
It will be a matter of tinkering with the post-processor to handle these cases.
I don't know. It'll be a matter of trial and error with different queries. By the way, CAST
is somewhat supported; you don't see it in the QPL because, in Spider, it was meaningless. A CAST
is translated to a Convert
node in the XML execution plan from SQL Server, and we treat this node as a "pass-through" in the Scala code. I can see places where this might be handy (for example, the first query I gave above will divide two integers and return an integer unless cast), but it would also make a mess of most QPL, as implicit casts happen a lot, and they all create a Convert
node.
I don't personally work on QPL anymore, but I don't mind scheduling a Zoom meeting with you to show you around the code and which part of the pipeline does what. My email is bene@post.bgu.ac.il.
Hi Ben and Team, First, congratulations on the wonderful work. I was looking through your code and the QPL grammar specified, and could not find support for multiply (
*
) and divide (/
) operators in QPL. As of now, to the best of what I have seen, a question likeThe SQL for computing the inner query, for the average excellence rates of charter schools would be:
SCAN
operations only support one or morefieldName
s to be selected in the output, not operations on those fieldnames, for example division of two quantities,(No. of students who got above 1500 SAT score) / (Total Test Takers in that school)
in the above example.Predicate
, which only allows comparison operators for now. This limits the potential for use in queries where there is some predicate on say the product of two fields, eg.price_of_car
andorders_placed
to get some kind of total expenditure, or some condition on division or addition of two fields.CAST
(also used in our example above to convert into float for division) but are currently not supported by QPL?CAST
etc using this approach?Thank you so much. Your clarifications on these would be much appreciated.