4.1.1.13.OrderBy_manual.md 2.99 KB
Newer Older
HooYoungAhn's avatar
HooYoungAhn committed
---
html:
  toc: true
  offline: true
export_on_save:
  html: true
---
# OrderBy Operator
---
## Operator 설명
- 선택한 column에 대해서 모든 데이터를 오름차순/내림차순으로 정렬한다.
## Operator 파라미터 설명
- selectedColumnId: 정렬을 수행할 column (required)
- method: 정렬 방법(오름차순, 내림차순). Enum(ASC,DESC) (required)
## Operator 모듈 테스트 결과

### 입력 데이터
<table style=text-align="center">
  <tr>
    <td>2015</td><td>9</td><td>1</td><td>0</td><td>0</td><td>1000000100</td><td>1</td><td>29</td>
  <tr>
  <tr>
  <td>2015</td><td>9</td><td>1</td><td>0</td><td>0</td><td>1000000200</td><td>2</td><td>36</td>
  </tr>
  <tr>
  <td>2015</td><td>9</td><td>1</td><td>0</td><td>0</td><td>1000000300</td><td>3</td><td>55</td>
  <tr>
  <td>2015</td><td>9</td><td>1</td><td>0</td><td>0</td><td>1000000400</td><td>4</td><td>50</td>
  </tr>
  <tr>
  <td>2015</td><td>9</td><td>1</td><td>0</td><td>0</td><td>1000000500</td><td>5</td><td>109</td>
  </tr>
  <tr>
  <td>2015</td><td>9</td><td>1</td><td>0</td><td>0</td><td>1000000600</td><td>6</td><td>73</td>
  </tr>
  <tr>
  <td>2015</td><td>9</td><td>1</td><td>0</td><td>0</td><td>1000000700</td><td>7</td><td>29</td>
  </tr>
  <tr>
  <td>2015</td><td>9</td><td>1</td><td>0</td><td>0</td><td>1000000800</td><td>8</td><td>26</td>
  </tr>
  <tr>
  <td>2015</td><td>9</td><td>1</td><td>0</td><td>0</td><td>1000000900</td><td>9</td><td>17</td>
  </tr>
  <tr>
  <td>2015</td><td>9</td><td>1</td><td>0</td><td>0</td><td>1000001000</td><td>10</td><td>21</td>
  </tr>

</table>      




### 결과 데이터

<table style=text-align="center">
  <tr>
    <td>2015</td><td>9</td><td>1</td><td>0</td><td>0</td><td>1000000500</td><td>5</td><td>109</td>
  </tr>
  <tr>
    <td>2015</td><td>9</td><td>1</td><td>0</td><td>0</td><td>1000000600</td><td>6</td><td>73</td>
  </tr>
  <tr>
    <td>2015</td><td>9</td><td>1</td><td>0</td><td>0</td><td>1000000300</td><td>3</td><td>55</td>
  <tr>
  <tr>
    <td>2015</td><td>9</td><td>1</td><td>0</td><td>0</td><td>1000000400</td><td>4</td><td>50</td>
  </tr>
  <tr>
    <td>2015</td><td>9</td><td>1</td><td>0</td><td>0</td><td>1000000200</td><td>2</td><td>36</td>
  </tr>
  <tr>
    <td>2015</td><td>9</td><td>1</td><td>0</td><td>0</td><td>1000000100</td><td>1</td><td>29</td>
  <tr>
  <tr>
    <td>2015</td><td>9</td><td>1</td><td>0</td><td>0</td><td>1000000800</td><td>8</td><td>26</td>
  </tr>
  <tr>
    <td>2015</td><td>9</td><td>1</td><td>0</td><td>0</td><td>1000001000</td><td>10</td><td>21</td>
  </tr>
  <tr>
    <td>2015</td><td>9</td><td>1</td><td>0</td><td>0</td><td>1000000900</td><td>9</td><td>17</td>
  </tr>
</table>

- parameter를 다음과 같이 설정하였다.

```scala
val orderByColInfo = OrderByColumnInfo.newBuilder()
  .setSelectedColumnId(7)
  .setMethod(OrderByColumnInfo.Method.DESC)
  .build()
```
- 정렬을 할 column을 7번째(마지막) column으로 설정하였다. 결과 DataFrame을 보면 7번째 column에 대해서 내림차순으로 정렬된 것을 확인할 수 있다.