18
18
import com .facebook .presto .spi .schedule .NodeSelectionStrategy ;
19
19
import com .google .common .collect .ImmutableList ;
20
20
import com .google .common .collect .ImmutableMap ;
21
- import org .apache .hadoop .fs .Path ;
22
21
import org .openjdk .jol .info .ClassLayout ;
23
22
24
23
import javax .annotation .concurrent .NotThreadSafe ;
32
31
import static com .google .common .base .Preconditions .checkArgument ;
33
32
import static com .google .common .base .Preconditions .checkState ;
34
33
import static io .airlift .slice .SizeOf .sizeOf ;
34
+ import static io .airlift .slice .SizeOf .sizeOfCharArray ;
35
35
import static io .airlift .slice .SizeOf .sizeOfObjectArray ;
36
- import static java .nio .charset .StandardCharsets .UTF_8 ;
37
36
import static java .util .Objects .requireNonNull ;
38
37
39
38
@ NotThreadSafe
@@ -45,7 +44,8 @@ public class InternalHiveSplit
45
44
private static final int HOST_ADDRESS_INSTANCE_SIZE = ClassLayout .parseClass (HostAddress .class ).instanceSize () +
46
45
ClassLayout .parseClass (String .class ).instanceSize ();
47
46
48
- private final byte [] relativeUri ;
47
+ private final String path ;
48
+ private final boolean isRelative ;
49
49
private final long end ;
50
50
private final long fileSize ;
51
51
private final long fileModifiedTime ;
@@ -72,7 +72,8 @@ public class InternalHiveSplit
72
72
private int currentBlockIndex ;
73
73
74
74
public InternalHiveSplit (
75
- String relativeUri ,
75
+ String path ,
76
+ boolean isRelative ,
76
77
long start ,
77
78
long end ,
78
79
long fileSize ,
@@ -92,15 +93,16 @@ public InternalHiveSplit(
92
93
checkArgument (end >= 0 , "end must be non-negative" );
93
94
checkArgument (fileSize >= 0 , "fileSize must be non-negative" );
94
95
checkArgument (fileModifiedTime >= 0 , "fileModifiedTime must be non-negative" );
95
- requireNonNull (relativeUri , "relativeUri is null" );
96
+ requireNonNull (path , "path is null" );
96
97
requireNonNull (readBucketNumber , "readBucketNumber is null" );
97
98
requireNonNull (tableBucketNumber , "tableBucketNumber is null" );
98
99
requireNonNull (nodeSelectionStrategy , "nodeSelectionStrategy is null" );
99
100
requireNonNull (partitionInfo , "partitionInfo is null" );
100
101
requireNonNull (extraFileInfo , "extraFileInfo is null" );
101
102
requireNonNull (encryptionInformation , "encryptionInformation is null" );
102
103
103
- this .relativeUri = relativeUri .getBytes (UTF_8 );
104
+ this .path = path ;
105
+ this .isRelative = isRelative ;
104
106
this .start = start ;
105
107
this .end = end ;
106
108
this .fileSize = fileSize ;
@@ -113,7 +115,7 @@ public InternalHiveSplit(
113
115
this .partitionInfo = partitionInfo ;
114
116
this .extraFileInfo = extraFileInfo ;
115
117
this .customSplitInfo = ImmutableMap
116
- .copyOf (requireNonNull (customSplitInfo , "customSplitInfo is null" ));
118
+ .copyOf (requireNonNull (customSplitInfo , "customSplitInfo is null" ));
117
119
118
120
ImmutableList .Builder <List <HostAddress >> addressesBuilder = ImmutableList .builder ();
119
121
blockEndOffsets = new long [blocks .size ()];
@@ -131,8 +133,7 @@ public InternalHiveSplit(
131
133
132
134
public String getPath ()
133
135
{
134
- String relativePathString = new String (relativeUri , UTF_8 );
135
- return new Path (partitionInfo .getPath ().resolve (relativePathString )).toString ();
136
+ return isRelative ? partitionInfo .getPath () + path : path ;
136
137
}
137
138
138
139
public long getStart ()
@@ -254,7 +255,7 @@ public void reset()
254
255
public int getEstimatedSizeInBytes ()
255
256
{
256
257
int result = INSTANCE_SIZE ;
257
- result += sizeOf ( relativeUri );
258
+ result += sizeOfCharArray ( path . length () );
258
259
result += sizeOf (blockEndOffsets );
259
260
if (!blockAddresses .isEmpty ()) {
260
261
result += sizeOfObjectArray (blockAddresses .size ());
@@ -275,7 +276,7 @@ public int getEstimatedSizeInBytes()
275
276
public String toString ()
276
277
{
277
278
return toStringHelper (this )
278
- .add ("relativeUri " , new String ( relativeUri , UTF_8 ) )
279
+ .add ("path " , path )
279
280
.add ("start" , start )
280
281
.add ("end" , end )
281
282
.add ("fileSize" , fileSize )
0 commit comments