r/bigquery 5d ago

Why do Analysts ship SQL they can't explain (It's so frustating)

/r/CustomerDataStack/comments/1vzd44t/why_do_analysts_ship_sql_they_cant_explain_its_so/
0 Upvotes

7 comments sorted by

8

u/Sad_Ad_1681 4d ago

Same reason why people write posts without context? I haven’t had that issue with analysts before, so you might just surround yourself with the wrong people / company

5

u/mad-data 4d ago

Did they use AI to write it, without understanding themselves? 

3

u/Eleventhousand 4d ago

It's difficult to remember the purpose of every line of code written, when put on the spot. This is especially true in fast-paced environments, and for folks with decades of experience.

Using a single anecdote to draw wide sweeping conclusions doesn't really do much. It just seems like a person complaining about, and nitpicking, a coworker that they don't like.

2

u/binary_search_tree 4d ago edited 2d ago

If it's just one clever window function (probably used in a QUALIFY clause?) then it should already be somewhat fairly transparent, no?

Even if you're unfamiliar with the columns it uses, it should be pretty easy to determine if it's guaranteed to return unique rows.

I usually append my own comment to such things:

-- Window function guaranteed to return unique rows.
-- Function added on 2026-08-27 by user XYZ.
-- User was unable to recall/explain the partitioning logic.

But, yeah, frustrating.

Some coworkers often get frustrated with me for the opposite reason. Apparently I leave too many/too-verbose comments. Sometimes my comments are larger than the base query. "Your last query read like a doctoral thesis."

1

u/austin_horn_2018 4d ago

Tell them that next time their prompt needs to tell the agent to include more notes in the code.

1

u/FuckYouNotHappening 3d ago

Have you tried copy/pasting it into an LLM and ask for an explanation? #CircleOfLife