| 1 |
/* |
| 2 |
* Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, |
| 3 |
* and the EPL 1.0 (https://h2database.com/html/license.html). |
| 4 |
* Initial Developer: H2 Group |
| 5 |
*/ |
| 6 |
package org.h2.expression.analysis; |
| 7 |
|
| 8 |
import java.util.HashMap; |
| 9 |
|
| 10 |
import org.h2.value.Value; |
| 11 |
|
| 12 |
/** |
| 13 |
* Partition data of a window aggregate. |
| 14 |
*/ |
| 15 |
public final class PartitionData { |
| 16 |
|
| 17 |
/** |
| 18 |
* Aggregate data. |
| 19 |
*/ |
| 20 |
private Object data; |
| 21 |
|
| 22 |
/** |
| 23 |
* Evaluated result. |
| 24 |
*/ |
| 25 |
private Value result; |
| 26 |
|
| 27 |
/** |
| 28 |
* Evaluated ordered result. |
| 29 |
*/ |
| 30 |
private HashMap<Integer, Value> orderedResult; |
| 31 |
|
| 32 |
/** |
| 33 |
* Creates new instance of partition data. |
| 34 |
* |
| 35 |
* @param data |
| 36 |
* aggregate data |
| 37 |
*/ |
| 38 |
PartitionData(Object data) { |
| 39 |
this.data = data; |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* Returns the aggregate data. |
| 44 |
* |
| 45 |
* @return the aggregate data |
| 46 |
*/ |
| 47 |
Object getData() { |
| 48 |
return data; |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* Returns the result. |
| 53 |
* |
| 54 |
* @return the result |
| 55 |
*/ |
| 56 |
Value getResult() { |
| 57 |
return result; |
| 58 |
} |
| 59 |
|
| 60 |
/** |
| 61 |
* Sets the result. |
| 62 |
* |
| 63 |
* @param result |
| 64 |
* the result to set |
| 65 |
*/ |
| 66 |
void setResult(Value result) { |
| 67 |
this.result = result; |
| 68 |
data = null; |
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* Returns the ordered result. |
| 73 |
* |
| 74 |
* @return the ordered result |
| 75 |
*/ |
| 76 |
HashMap<Integer, Value> getOrderedResult() { |
| 77 |
return orderedResult; |
| 78 |
} |
| 79 |
|
| 80 |
/** |
| 81 |
* Sets the ordered result. |
| 82 |
* |
| 83 |
* @param orderedResult |
| 84 |
* the ordered result to set |
| 85 |
*/ |
| 86 |
void setOrderedResult(HashMap<Integer, Value> orderedResult) { |
| 87 |
this.orderedResult = orderedResult; |
| 88 |
data = null; |
| 89 |
} |
| 90 |
|
| 91 |
} |