The GitHub Actions job "Required Checks" on 
texera.git/gh-readonly-queue/main/pr-8481-6c774a560887fd64fbb468f474411c147401f969
 has failed.
Run started by GitHub user aglinxinyuan (triggered by aglinxinyuan).

Head commit for run:
b75a01bc9c5355349091465d2e025b658b6a4e5e / Kary Zheng 
<[email protected]>
feat(operator): cut a numeric column into bins (#8481)

### What changes were proposed in this PR?

An operator that cuts a numeric column into bins and adds the bin a row
fell in as a column of its own.

Two cuts, because they answer different questions. Equal width divides
the span into bins of one size; equal frequency cuts at the quantiles,
so the bins hold about as many rows as each other. The second is why the
operator reads the whole table before it emits: a quantile is not known
until the last row has arrived.

The bin reads as its own range, `(2.5, 5.0]`, which is a label to group
by rather than a number to do arithmetic on.

### Any related issues, documentation, discussions?

Not part of #8325: that set makes the operators Texera already had
exportable. This adds a new one, which implements the trait from the
start rather than gaining it. The trait is in #8327, which has merged.

Closes #8479, the task this change is the whole of.

The same gap as #8478, on the other kind of column. Grouping by a
continuous number puts almost every row in a group of its own, so counts
per age bracket or per price band could not be asked for; a user wanting
them had to write a Python UDF.

### How was this PR tested?

Ten unit tests in the operator's own spec, over the schema it declares
and the Python it emits on both paths. The parity harness runs it on
four configurations, one per cut plus a hostile column name and an empty
cell, comparing the engine's answer against the exported script's.

The operator in the editor, cutting `score` into four equal-width bins:


![config](https://github.com/user-attachments/assets/209ee4bd-8896-4619-9368-99bb5ead3723)

Each row's bin beside the value it came from, named by the range it fell
in rather than by a number:


![result](https://github.com/user-attachments/assets/1602b2f3-bcbb-4297-8414-0bc25d56a880)

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 5)

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>

Report URL: https://github.com/apache/texera/actions/runs/44240048376

With regards,
GitHub Actions via GitBox

Reply via email to