8 ms·
I interviewed with AWS for an analyst/business intelligence engineer role. When asked to write a query to get the total GDP by month per country, I wrote a que
by oarabbus_ 7y ago
I interviewed with AWS for an analyst/business intelligence engineer role.
When asked to write a query to get the total GDP by month per country, I wrote a query along the lines of:
select date_trunc('month',datecolumn) as month, country, sum(GDP) over (partition by date_trunc('month', datecolumn), country)
FROM the_table
order by 1
The interviewer asked me if I was missing something. I said no. "Don't you need an additional clause if you're doing a sum?"
"No," I responded, "in AWS Redshift (and postgres and mysql 8.0+ and...) if you do a Sum Window Function a group by is not necessary"
The interviewer made a noise and demeanor changed as if I knew not what I was talking about. While I can't be 100% sure, I'm almost positive I was failed for "missing" the group by.
I went home later that day and wrote exactly the same query, which ran successfully. The AWS BI Intelligence Engineering manager didn't even know how to use a sum window function. I was a bit frustrated at being failed because the interviewer didn't know of a (well-known, well-used) feature, but perhaps I dodged a bullet.
- burtonator 7y agoThese things can always be childish when working with a bad interviewer. I once had an engineer keep interrupting me while I was explaining how sockets work because I wasn't covering small minutia details. Interviewing is an insane process. This is why building networks is more valuable so you're basically being interviewed by people you've already worked with.
- hinkley 7y agoI get too distracted wondering if these people are always like this or just in interviews. The silver lining is that I don't get jobs where the interviewers make me uncomfortable, so I don't have to deal with them more than once.
- bsg75 7y ago> I once had an engineer keep interrupting me while I was explaining how sockets work because I wasn't covering small minutia details. I'm going to be in trouble when it comes time to interview again someday. I am not nearly as accepting of muscle flexing (anti-social behavior) as I was 10 years ago.
- lacampbell 7y agoYou and me both. I had to walk out of an interview because the interviewer had become borderline rude and I could not think of anything at all professional to respond with. Here's to future self-employment!
- oarabbus_ 7y agoHow'd you walk out? "Sorry, but I'd like to respect both of our time and end my candidacy here"?
- lacampbell 7y agoI literally shot up out of my seat, offered my hand and said 'thanks for your time!' and got the hell out of there. Not the smoothest, but it was just time for me to leave.
- posixplz 7y agoMakes me appreciate working for a large cloud with a core value “don’t be a jerk.”
- baseballMan 7y agoIs this Microsoft? If so, good to know they've adopted this policy!
- jfz 7y agoSounds like Pivotal, which literally has "Be Kind" as one of the three core values.
- posixplz 7y agoOracle Cloud Infrastructure, actually. Oracle gets a lot of flak on HN, and some of it is justified. But the reality is that the team working on OCI is top-notch. And the product itself is quite compelling. Oracle as an enterprise/legal behemoth is very different from the cloud transformation business unit.
- deleted 7y ago[deleted]
- imtringued 7y agoSockets are easy. First there was the big bang...
- cliffy 7y agoI'm guessing you didn't get to do this interactively? If I interviewed someone and they seemed knew something I didn't and could prove it by actually running the query/code I would be impressed. At the very least the interviewer should have checked your claim after the interview if they were skeptical. I think it's a real mistake when you don't let candidates write actual code and run it during interviews.
- phpnode 7y agoIn my FB interview I was told I wasn't allowed to run the code, which seemed completely ridiculous to me. It was even more frustrating when my interviewer told me I'd missed an edge case when I was certain I'd covered it - I'm still not sure who was right.
- vonmoltke 7y agoAt least you got to type your code. I had to write mine out on a whiteboard (actually, a patch of wall with whiteboard paint).
- bootlooped 7y agoI went to an interview where there were no spare computers, so I was asked to write out a blackjack game in Java with pencil and paper. That was a lot worse than any of the whiteboard ones I've had.
- wolco 7y agoReminds me of programming tests at my college.
- 420codebro 7y agoFuck all these losers. I'm not kidding. They can get fucking aids and die at this point holy shit.
- oarabbus_ 7y ago
- socialist_coder 7y agoTo be fair, in my opinion, you chose the wrong tool for the task. Why would you use a sum window function instead of a much simpler aggregate sum function (that does require a group by)? Without the group by, you will be returning every row from the table, which isn't what the task calls for. You'd then have to do an additional row_number() or distinct or something to just get the unique rows per month per country.
- oarabbus_ 7y agoI simplified the ask to be honest. It was not a simple `select date, country, sum(gdp) from table group by 1,2`. There were additional components to the question. And as you mentioned, you can also distinct on the window function. This is not an inefficient operation in Redshift. Also I fundamentally disagree with your premise. One result set is equivalent to another, and as long as you aren't using unnecessary nested loop joins or such, there are a dozen ways to solve a query. In another interview at a similarly-competitive company to AWS , I was asked to do some work on orders and orderdetail tables to find all customers where the aggregate total of their orders from 2005 were greater than that of their orders from 2007. I did it using a couple of `sum(case when extract(year from datecol) = 200x then order_amount end)` statements. The interviewer told me the question was intended to test whether the applicant was able to do a self-join but they were impressed with my alternative solution. That is the proper way to test SQL, not to say someone "did the query the wrong way"
- jaf656s 7y ago>One result set is equivalent to another, and as long as you aren't using unnecessary nested loop joins or such, there are a dozen ways to solve a query. If they consume similar resources I'd almost always opt for the simplest one to understand. In cases where the simpler one is less efficient, I might still use it if the task didn't require absolute optimization.
- SilasX 7y agoSure, and that would be a fair criticism, to say, "is there a version of this that's more intuitive and easier to read with the same load on the server?" But the interviewer (assuming the OP faithfully represented the exchange and the domain) is insisting that the query does not do what was asked -- when it does -- and is saying so based on the interviewer's own incomplete understanding. That's not a good reason to reject a candidate, even if there might be other good reasons in this case.
- jandrewrogers 7y agoIn my experience, it is not unusual at that company for an interviewer to have poor knowledge of the technical subject matter they are asking you about, and to be unaware of this fact. Amazon has some extremely bright engineers but, unlike some of the other tech companies, there quite apparently doesn't seem to be a quality floor either and you can be unlucky in an interview.
- rb808 7y agoRather than be annoyed, you'd probably get bonus marks if you could show him the group-by query (sounds like you could have done that easily), then explain why your way is better. The interviewer would have been impressed at your maturity and skill.
- oarabbus_ 7y agoThe actual interview was more akin to the interviewer telling an interviewee that "python doesn't support multithreading"; something patently false. No, this kind of erroneous statement should not be glossed over. For your information, this was the later stage of questions. The very first question did involve a simple summation group by, so I'd already demonstrated my understanding there. I showed no frustration or annoyance during the interview in case you are attempting to imply that was the case.
- m463 7y ago"python doesn't support multithreading" wait, what about the GIL?!? did they fix that?
- OldManAndTheCpp 7y agoI think the parent is saying you /can/ use threads, but they will all contend on the GIL.
- lalaland1125 7y agoPython does support multithreading. The only thing the GIL does is prevent you from simultaneously running python code in more than one thread. You can still use threads to do io in parallel or to help interleave CPU tasks.
- kmarc 7y agoThis happens everywhere; The superstar software developer (no) who knows everything (no) gets to interview you, and sometimes they are simply not right. Your story reminds me my ~7th (?) interview with Google where for LRU caching I mentioned Java's LinkedHashMap; which resulted in he explaining me "what a ridiculous, memory-wasting data structure would that be!" - and going on for a good 5 more minutes bashing my lack of knowledge and me trying coming up with ad-hoc data structures. Needless to say, I continuously refused all their recruiters since then. (For the interested: https://docs.oracle.com/javase/7/docs/api/java/util/LinkedHashMap.html https://docs.oracle.com/javase/7/docs/api/java/util/LinkedHa..., "This kind of map is well-suited to building LRU caches." - part of Java for more than a decade.)
- SilasX 7y agoMy story: an interviewer stubbornly insisted that my code had to be O(n^2) because it had an inner loop, even though the inner loop was only iterating over the substructure of each element, rather than every pair of elements, and then demonstrated that he had no idea how to resolve a disagreement of that kind, and then immediately vetoed me from the rest of the day's interviews. https://www.reddit.com/r/cscareerquestions/comments/1ilh7o/what_to_do_technical_interview_where_interviewer/ https://www.reddit.com/r/cscareerquestions/comments/1ilh7o/w...
- sokoloff 7y agoIf you manually unrolled the inner loop during the argument, would that have worked? (I’m not saying you should have had to, but sometimes you need to pick up a clue by four and whack someone with it.)
- SilasX 7y agoSee the follow up comments about the experience in the Reddit thread. Everything bounced off this guy. He even thought he had “got me” by asking “what happens when the words are really long?” And I was like, “if the average word is long, that just means there are fewer of them for a given n and it cancels out.” I then clarified definitions about what “n” refers to and showed how it’s the same thing as “average word length L times number of words w”. I even asked him what he would need to see to believe it was O(n) and he had no answer. Nothing worked!
- ben509 7y agoThis is the reason whiteboarding gets a lot of hate. It's really a great way to get insight into how people approach problems and how fluent they are in a subject. And if they get something wrong, but they thought it through, that's a problem that will fix itself pretty readily. The person who doesn't think stuff through likely won't start. But the naive approach to whiteboarding is to do it as a test, can the person perform task X on the fly. The trouble is it's invariably an ad hoc test that generates ludicrously biased data. The really bad interviewers want to stroke their ego by stumping you with all the cool minutiae they know.
- oarabbus_ 7y agoA week after, I passed a whiteboarding with one interviewer, the first of 4, at another large company (not FANG tier) writing pandas and SQL. The interviewer cared about design and the steps to perform a data loading task then querying it, and offered the choice of writing code or pseudocode (I did pseudo for python and wrote out the SQL explicitly). That’s the proper way to whiteboard.
- stunt 7y agoI remember suggesting one of my colleagues to take an interview instead of me and my manager disagreed and said I never saw him admitting to make a mistake. Ideally you only hire people with good soft skills, but if you couldn’t, at least you should make sure they don’t do the interviews.
- ragerino 7y agoI hired last time someone because he showed us something we did not know yet.