Sigma OA Interview Question: Implement a Simplified SigmaTable

18 Views
No Comments

Implement a simplified version of Sigma’s core product.

We provide a few starter classes, Column, DataWarehouseTable, and DataWarehouse, and your task is to implement SigmaTable.

Background:

Sigma is a user interface that sits on top of various cloud data warehouses. We provide a unified way to interact with your data, despite differences in warehouse implementations.

Data warehouses contain tables, usually similar to SQL tables. Sigma has tables as well, in which you can create columns that are functions of other columns (for example, [My Sum Col] = [Data 1] + [Data 2]). We also have the ability to add summaries to our tables, which are aggregations (like a Min or Max) of all values in a column.

However, instead of storing or altering customer data, we store the operations that need to be performed on the base table to get the desired result. When the customer accesses a table in Sigma, we compile the operations to SQL, which we execute in the customer’s data warehouse against the latest version of their data.

The customer’s data may be private or sensitive, so storing their data on Sigma’s servers would be a security violation.

Implementation Details:

  • For the security reasons described above, do not store any warehouse data other than the get_data_warehouse method in the SigmaTable class. Do not store data computed from warehouse data in the SigmaTable either.
  • Do not store additional data in the data warehouse.
  • Trying to use a missing column should raise a ValueError.
  • Missing data should be treated as 0.
  • You can store whatever metadata you want in the SigmaTable.
  • In cases of ambiguity, make reasonable choices.

Testing Details:

  • We provide a small amount of test code that covers the basic functionality of the SigmaTable, as well as some debugging output. These tests are not comprehensive, so you should test your implementation yourself as well.
  • To run the provided test suite, set PRINT_ONLY variable in the "Test code" section to False and click the "Test my code" button.
  • To print the example table (created in make_test_table), set the PRINT_ONLY variable in the "Test code" section to True and click "Test my code".

Example Screenshots:

My Cool Data

Col A | Col B | A + B
1 | 4 | 5
2 | 5 | 7
3 | 6 | 9

Summary:
3 rows - 5 columns
Max of Col A: 3
Min of A + B: 5

This problem asks you to implement a simplified SigmaTable that stores column operations rather than warehouse data itself. The key idea is to keep only metadata about how derived columns and summaries are defined, so results always reflect the latest base-table values. Missing values should behave as 0, while references to nonexistent columns must raise ValueError. A clean solution typically tracks dependencies and computes column data lazily from the underlying warehouse when requested.

END
 0