Home › Interview Questions › Explain the following concepts: (1) computing a to…

Explain the following concepts: (1) computing a total for each customer across 1,000 rows, (2) connecting AI applications with external tools and data through a protocol, and (3) why Spark reads input but delays applying filters until an action.

🟡 Medium Conceptual Junior level
1Times asked
Nov 2026Last seen
Nov 2026First seen

💡 Model Answer

  1. Computing a total per customer across 1,000 rows can be done with a window function or aggregation. Using a window: SELECT customer_id, SUM(amount) OVER (PARTITION BY customer_id) AS total FROM sales; This returns a row per original record with the total for that customer. Alternatively, GROUP BY customer_id and SUM(amount) gives one row per customer.
  1. Connecting AI applications with external tools and data often uses a protocol such as OpenAI’s API, REST, or a custom message bus. The protocol defines request/response formats, authentication, and data serialization, allowing the AI model to call external services (e.g., databases, APIs) securely and reliably.
  1. Spark’s lazy evaluation means transformations like filter() are recorded but not executed until an action triggers the job. This allows Spark to build an optimized DAG, combine stages, and apply optimizations like predicate pushdown, resulting in efficient execution.

This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.

🎤 Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers on a discreet on-screen overlay.

Get Assisting AI — Starts at ₹500