← Airwallex Interview Insights

Airwallex·Data Scientist·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
May 2026Remote

Summary

SQL-heavy technical screen for a DS role at Airwallex. Three questions, all content moderation flavored, progressively harder. The last one tripped me up more than I expected for what looked like a straightforward aggregation problem.

Questions Asked (3)

Q1

Given a table of per-user, per-post, per-day view counts, write SQL to count how many distinct posts received at least 10 total views in the last 7 days.

Product Analytics & MetricsData Modeling
Author's notes

Pretty clean warmup.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the table schema and the definition of 'last 7 days' (e.g., relative to current date or max date in data). Then, aggregate total views per post over the last 7 days, filter for posts with at least 10 views, and count the distinct posts.

Pro tip: Mention that you would confirm whether the view counts are already aggregated per user-post-day or if they need to be summed; also discuss handling of time zones and date boundaries to ensure accurate 7-day window.

1. Clarify requirements and schema

Ask about the table structure, column names, and how 'last 7 days' is defined (e.g., relative to current date or max date in the table). Confirm that view counts are additive and that a post is identified by a unique post_id.

2. Filter to last 7 days

Use a WHERE clause to restrict rows to the last 7 days based on the date column, ensuring the window is correctly calculated (e.g., date >= CURRENT_DATE - INTERVAL '7 days' or using a subquery for max date).

3. Aggregate views per post

Group by post_id and sum the view counts to get total views per post over the 7-day period.

4. Filter posts with >=10 views

Apply a HAVING clause to keep only posts where the total views are at least 10.

5. Count distinct posts

Wrap the filtered result in a subquery or use COUNT(DISTINCT post_id) to get the final count of distinct posts.

Key Points to Mention

  • Use of GROUP BY and SUM to aggregate views per post.
  • HAVING clause to filter aggregated results (>=10 views).
  • COUNT(DISTINCT post_id) to count unique posts.
  • Date filtering with proper interval logic (e.g., CURRENT_DATE - INTERVAL '7 days').
  • Consideration of time zones and date boundaries.
  • Assumption that each row represents a user-post-day combination with a view count column.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Using a policy scores table that holds per-post violation probabilities, compute the share of total views in the last 30 days that came from posts classified as Nudity violations (probability above 0.5).

Product Analytics & MetricsData Modeling
Author's notes

The ratio calculation itself is fine.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the table schemas and join keys between the policy scores table and the views table. Then, filter views to the last 30 days, join with policy scores, and classify posts as Nudity violations if the probability exceeds 0.5. Finally, compute the sum of views for those posts and divide by the total views in the same period to get the share.

Pro tip: Always confirm the time zone and whether 'last 30 days' is inclusive of today; also check for duplicate policy scores per post and decide on an aggregation method (e.g., max or latest).

1. Understand the data model

Identify the relevant tables: one with per-post violation probabilities (policy scores) and one with post views. Determine the join key (e.g., post_id) and ensure you know the time column for views.

2. Filter views to last 30 days

Apply a date filter to the views table to include only views from the last 30 days relative to the current date. Be mindful of time zones and whether to include the current day.

3. Join and classify posts

Join the filtered views with the policy scores table on post_id. Classify each post as a Nudity violation if its nudity probability > 0.5. Handle any duplicate scores per post (e.g., by taking the latest or max).

4. Compute the share

Calculate the sum of views for posts classified as Nudity violations and divide it by the total sum of views in the last 30 days. Multiply by 100 to express as a percentage.

Key Points to Mention

  • Clarify the definition of 'Nudity violations' and the threshold (probability > 0.5).
  • Ensure the join between views and policy scores is correct and handles missing scores.
  • Consider time zone and date boundaries for 'last 30 days'.
  • Handle duplicate policy scores per post (e.g., by taking the most recent or maximum probability).
  • Validate the result by checking total views and the sum of views for Nudity violations.
  • Discuss potential data quality issues, such as posts with no policy score or views with no matching post.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

For each calendar month and each violation type, among posts flagged with probability above 0.5 that also had at least one view that month, report the distinct post count per violation type and its percentage share of all flagged post/violation pairs in that month.

Product Analytics & MetricsData ModelingRoot Cause Analysis
Author's notes

This one got me.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Break the problem into three logical layers: filtering, aggregation, and percentage calculation. First, identify posts flagged with probability > 0.5 and ensure they had at least one view in the given month. Then, for each month and violation type, count distinct posts and compute the percentage share of all flagged post/violation pairs in that month.

Pro tip: Clarify the grain of the data and the definition of 'flagged post/violation pairs' upfront—this avoids double-counting and ensures the percentage denominator is correct. Also, consider edge cases like months with no flagged posts.

1. Filter flagged posts with views

Select posts with flag probability > 0.5 and join with view data to keep only those with at least one view in the target month.

2. Aggregate distinct post counts

Group by month and violation type, then count distinct post IDs to get the numerator for each group.

3. Compute monthly totals

For each month, calculate the total number of distinct flagged post/violation pairs (or total distinct posts if each post has one violation type) to serve as the denominator.

4. Calculate percentage share

Divide each group's distinct post count by the monthly total and multiply by 100 to get the percentage share.

5. Validate and present results

Check for anomalies, ensure percentages sum to 100% per month, and format the output clearly.

Key Points to Mention

  • Definition of 'flagged post/violation pair' and whether a post can have multiple violation types.
  • Handling of posts with multiple views in a month (distinct count avoids duplication).
  • Treatment of months with zero flagged posts (avoid division by zero).
  • Importance of using the correct denominator: all flagged post/violation pairs in that month, not all posts.
  • Potential data quality issues: missing view data, flag probability thresholds, and time zone considerations for monthly boundaries.
  • Use of window functions or subqueries to compute monthly totals efficiently.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.