Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ private void checkResult(List<String> resultString, List<PipeData> list) {
int cnt = 0;
for (String string : resultString) {
for (PipeData pipeData : resultMap.get(string)) {
Assert.assertEquals(pipeData.getType(), list.get(cnt++).getType());
Assert.assertEquals(pipeData.getPipeDataType(), list.get(cnt++).getPipeDataType());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public DeletionPipeData(String sgName, Deletion deletion, long serialNumber) {
}

@Override
public PipeDataType getType() {
public PipeDataType getPipeDataType() {
return PipeDataType.DELETION;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ public void setSerialNumber(long serialNumber) {
this.serialNumber = serialNumber;
}

public abstract PipeDataType getType();
public abstract PipeDataType getPipeDataType();

public long serialize(DataOutputStream stream) throws IOException {
long serializeSize = 0;
stream.writeByte((byte) getType().ordinal());
stream.writeByte(getPipeDataType().getType());
serializeSize += Byte.BYTES;
stream.writeLong(serialNumber);
serializeSize += Long.BYTES;
Expand All @@ -74,7 +74,7 @@ public void deserialize(DataInputStream stream) throws IOException, IllegalPathE
public static PipeData createPipeData(DataInputStream stream)
throws IOException, IllegalPathException {
PipeData pipeData;
PipeDataType type = PipeDataType.values()[stream.readByte()];
PipeDataType type = PipeDataType.getPipeDataType(stream.readByte());
switch (type) {
case TSFILE:
pipeData = new TsFilePipeData();
Expand All @@ -98,7 +98,28 @@ public static PipeData createPipeData(byte[] bytes) throws IllegalPathException,
public abstract ILoader createLoader();

public enum PipeDataType {
TSFILE,
DELETION,
TSFILE((byte) 0),
DELETION((byte) 1);

private final byte type;

PipeDataType(byte type) {
this.type = type;
}

public byte getType() {
return type;
}

public static PipeDataType getPipeDataType(byte type) {
switch (type) {
case 0:
return PipeDataType.TSFILE;
case 1:
return PipeDataType.DELETION;
default:
throw new IllegalArgumentException("Invalid input: " + type);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public String getStorageGroupName() {
}

@Override
public PipeDataType getType() {
public PipeDataType getPipeDataType() {
return PipeDataType.TSFILE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ private void deletePipeData(long serialNumber) {
if (commitData == null) {
return;
}
if (PipeData.PipeDataType.TSFILE.equals(commitData.getType())) {
if (PipeData.PipeDataType.TSFILE.equals(commitData.getPipeDataType())) {
List<File> tsFiles = ((TsFilePipeData) commitData).getTsFiles(false);
for (File file : tsFiles) {
Files.deleteIfExists(file.toPath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public TSStatus transportPipeData(ByteBuffer buff) throws TException {
logger.info(
"Start load pipeData with serialize number {} and type {},value={}",
pipeData.getSerialNumber(),
pipeData.getType(),
pipeData.getPipeDataType(),
pipeData);
try {
pipeData.createLoader().load();
Expand Down