|
1 | 1 | /* |
2 | | - * Licensed to the Apache Software Foundation (ASF) under one |
3 | | - * or more contributor license agreements. See the NOTICE file |
4 | | - * distributed with this work for additional information |
5 | | - * regarding copyright ownership. The ASF licenses this file |
6 | | - * to you under the Apache License, Version 2.0 (the |
7 | | - * "License"); you may not use this file except in compliance |
8 | | - * with the License. You may obtain a copy of the License at |
| 2 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | + * you may not use this file except in compliance with the License. |
| 4 | + * You may obtain a copy of the License at |
9 | 5 | * |
10 | 6 | * http://www.apache.org/licenses/LICENSE-2.0 |
11 | 7 | * |
|
15 | 11 | * See the License for the specific language governing permissions and |
16 | 12 | * limitations under the License. |
17 | 13 | */ |
18 | | - |
19 | 14 | package org.apache.flink.connector.lance; |
20 | 15 |
|
21 | 16 | import org.apache.flink.core.io.InputSplit; |
|
30 | 25 | */ |
31 | 26 | public class LanceSplit implements InputSplit, Serializable { |
32 | 27 |
|
33 | | - private static final long serialVersionUID = 1L; |
34 | | - |
35 | | - /** |
36 | | - * Split number |
37 | | - */ |
38 | | - private final int splitNumber; |
39 | | - |
40 | | - /** |
41 | | - * Fragment ID |
42 | | - */ |
43 | | - private final int fragmentId; |
44 | | - |
45 | | - /** |
46 | | - * Dataset path |
47 | | - */ |
48 | | - private final String datasetPath; |
49 | | - |
50 | | - /** |
51 | | - * Row count in Fragment (estimated) |
52 | | - */ |
53 | | - private final long rowCount; |
54 | | - |
55 | | - /** |
56 | | - * Create LanceSplit |
57 | | - * |
58 | | - * @param splitNumber Split number |
59 | | - * @param fragmentId Fragment ID |
60 | | - * @param datasetPath Dataset path |
61 | | - * @param rowCount Row count |
62 | | - */ |
63 | | - public LanceSplit(int splitNumber, int fragmentId, String datasetPath, long rowCount) { |
64 | | - this.splitNumber = splitNumber; |
65 | | - this.fragmentId = fragmentId; |
66 | | - this.datasetPath = datasetPath; |
67 | | - this.rowCount = rowCount; |
68 | | - } |
69 | | - |
70 | | - @Override |
71 | | - public int getSplitNumber() { |
72 | | - return splitNumber; |
73 | | - } |
74 | | - |
75 | | - /** |
76 | | - * Get Fragment ID |
77 | | - */ |
78 | | - public int getFragmentId() { |
79 | | - return fragmentId; |
80 | | - } |
81 | | - |
82 | | - /** |
83 | | - * Get dataset path |
84 | | - */ |
85 | | - public String getDatasetPath() { |
86 | | - return datasetPath; |
87 | | - } |
88 | | - |
89 | | - /** |
90 | | - * Get row count |
91 | | - */ |
92 | | - public long getRowCount() { |
93 | | - return rowCount; |
94 | | - } |
95 | | - |
96 | | - @Override |
97 | | - public boolean equals(Object o) { |
98 | | - if (this == o) return true; |
99 | | - if (o == null || getClass() != o.getClass()) return false; |
100 | | - LanceSplit that = (LanceSplit) o; |
101 | | - return splitNumber == that.splitNumber && |
102 | | - fragmentId == that.fragmentId && |
103 | | - rowCount == that.rowCount && |
104 | | - Objects.equals(datasetPath, that.datasetPath); |
105 | | - } |
106 | | - |
107 | | - @Override |
108 | | - public int hashCode() { |
109 | | - return Objects.hash(splitNumber, fragmentId, datasetPath, rowCount); |
110 | | - } |
111 | | - |
112 | | - @Override |
113 | | - public String toString() { |
114 | | - return "LanceSplit{" + |
115 | | - "splitNumber=" + splitNumber + |
116 | | - ", fragmentId=" + fragmentId + |
117 | | - ", datasetPath='" + datasetPath + '\'' + |
118 | | - ", rowCount=" + rowCount + |
119 | | - '}'; |
120 | | - } |
| 28 | + private static final long serialVersionUID = 1L; |
| 29 | + |
| 30 | + /** Split number */ |
| 31 | + private final int splitNumber; |
| 32 | + |
| 33 | + /** Fragment ID */ |
| 34 | + private final int fragmentId; |
| 35 | + |
| 36 | + /** Dataset path */ |
| 37 | + private final String datasetPath; |
| 38 | + |
| 39 | + /** Row count in Fragment (estimated) */ |
| 40 | + private final long rowCount; |
| 41 | + |
| 42 | + /** |
| 43 | + * Create LanceSplit |
| 44 | + * |
| 45 | + * @param splitNumber Split number |
| 46 | + * @param fragmentId Fragment ID |
| 47 | + * @param datasetPath Dataset path |
| 48 | + * @param rowCount Row count |
| 49 | + */ |
| 50 | + public LanceSplit(int splitNumber, int fragmentId, String datasetPath, long rowCount) { |
| 51 | + this.splitNumber = splitNumber; |
| 52 | + this.fragmentId = fragmentId; |
| 53 | + this.datasetPath = datasetPath; |
| 54 | + this.rowCount = rowCount; |
| 55 | + } |
| 56 | + |
| 57 | + @Override |
| 58 | + public int getSplitNumber() { |
| 59 | + return splitNumber; |
| 60 | + } |
| 61 | + |
| 62 | + /** Get Fragment ID */ |
| 63 | + public int getFragmentId() { |
| 64 | + return fragmentId; |
| 65 | + } |
| 66 | + |
| 67 | + /** Get dataset path */ |
| 68 | + public String getDatasetPath() { |
| 69 | + return datasetPath; |
| 70 | + } |
| 71 | + |
| 72 | + /** Get row count */ |
| 73 | + public long getRowCount() { |
| 74 | + return rowCount; |
| 75 | + } |
| 76 | + |
| 77 | + @Override |
| 78 | + public boolean equals(Object o) { |
| 79 | + if (this == o) return true; |
| 80 | + if (o == null || getClass() != o.getClass()) return false; |
| 81 | + LanceSplit that = (LanceSplit) o; |
| 82 | + return splitNumber == that.splitNumber |
| 83 | + && fragmentId == that.fragmentId |
| 84 | + && rowCount == that.rowCount |
| 85 | + && Objects.equals(datasetPath, that.datasetPath); |
| 86 | + } |
| 87 | + |
| 88 | + @Override |
| 89 | + public int hashCode() { |
| 90 | + return Objects.hash(splitNumber, fragmentId, datasetPath, rowCount); |
| 91 | + } |
| 92 | + |
| 93 | + @Override |
| 94 | + public String toString() { |
| 95 | + return "LanceSplit{" |
| 96 | + + "splitNumber=" |
| 97 | + + splitNumber |
| 98 | + + ", fragmentId=" |
| 99 | + + fragmentId |
| 100 | + + ", datasetPath='" |
| 101 | + + datasetPath |
| 102 | + + '\'' |
| 103 | + + ", rowCount=" |
| 104 | + + rowCount |
| 105 | + + '}'; |
| 106 | + } |
121 | 107 | } |
0 commit comments