13
13
*/
14
14
package io .trino .plugin .hudi ;
15
15
16
- import com .fasterxml .jackson .annotation .JsonCreator ;
17
- import com .fasterxml .jackson .annotation .JsonProperty ;
18
16
import com .google .common .collect .ImmutableList ;
19
17
import com .google .common .collect .ImmutableMap ;
20
18
import io .trino .plugin .hive .HiveColumnHandle ;
35
33
import static java .lang .Math .toIntExact ;
36
34
import static java .util .Objects .requireNonNull ;
37
35
38
- public class HudiSplit
36
+ public record HudiSplit (
37
+ Optional <HudiBaseFile > baseFile ,
38
+ List <HudiLogFile > logFiles ,
39
+ String commitTime ,
40
+ TupleDomain <HiveColumnHandle > predicate ,
41
+ List <HivePartitionKey > partitionKeys ,
42
+ SplitWeight splitWeight )
39
43
implements ConnectorSplit
40
44
{
41
45
private static final int INSTANCE_SIZE = toIntExact (instanceSize (HudiSplit .class ));
42
46
43
- private final Optional <HudiBaseFile > baseFile ;
44
- private final List <HudiLogFile > logFiles ;
45
- private final String commitTime ;
46
- private final TupleDomain <HiveColumnHandle > predicate ;
47
- private final List <HivePartitionKey > partitionKeys ;
48
- private final SplitWeight splitWeight ;
49
-
50
- @ JsonCreator
51
- public HudiSplit (
52
- @ JsonProperty ("baseFile" ) HudiBaseFile baseFile ,
53
- @ JsonProperty ("logFiles" ) List <HudiLogFile > logFiles ,
54
- @ JsonProperty ("commitTime" ) String commitTime ,
55
- @ JsonProperty ("predicate" ) TupleDomain <HiveColumnHandle > predicate ,
56
- @ JsonProperty ("partitionKeys" ) List <HivePartitionKey > partitionKeys ,
57
- @ JsonProperty ("splitWeight" ) SplitWeight splitWeight )
47
+ public HudiSplit
58
48
{
59
- this . baseFile = Optional . ofNullable ( baseFile );
60
- this . logFiles = requireNonNull (logFiles , "logFiles is null" );
61
- this . commitTime = requireNonNull (commitTime , "commitTime is null" );
62
- this . predicate = requireNonNull (predicate , "predicate is null" );
63
- this . partitionKeys = ImmutableList .copyOf (requireNonNull ( partitionKeys , "partitionKeys is null" ) );
64
- this . splitWeight = requireNonNull (splitWeight , "splitWeight is null" );
49
+ requireNonNull ( baseFile , " baseFile is null" );
50
+ requireNonNull (logFiles , "logFiles is null" );
51
+ requireNonNull (commitTime , "commitTime is null" );
52
+ requireNonNull (predicate , "predicate is null" );
53
+ partitionKeys = ImmutableList .copyOf (partitionKeys );
54
+ requireNonNull (splitWeight , "splitWeight is null" );
65
55
}
66
56
67
57
@ Override
@@ -74,43 +64,6 @@ public Map<String, String> getSplitInfo()
74
64
.buildOrThrow ();
75
65
}
76
66
77
- @ JsonProperty
78
- public Optional <HudiBaseFile > getBaseFile ()
79
- {
80
- return baseFile ;
81
- }
82
-
83
- @ JsonProperty
84
- public List <HudiLogFile > getLogFiles ()
85
- {
86
- return logFiles ;
87
- }
88
-
89
- @ JsonProperty
90
- public String getCommitTime ()
91
- {
92
- return commitTime ;
93
- }
94
-
95
- @ JsonProperty
96
- @ Override
97
- public SplitWeight getSplitWeight ()
98
- {
99
- return splitWeight ;
100
- }
101
-
102
- @ JsonProperty
103
- public TupleDomain <HiveColumnHandle > getPredicate ()
104
- {
105
- return predicate ;
106
- }
107
-
108
- @ JsonProperty
109
- public List <HivePartitionKey > getPartitionKeys ()
110
- {
111
- return partitionKeys ;
112
- }
113
-
114
67
@ Override
115
68
public long getRetainedSizeInBytes ()
116
69
{
0 commit comments