Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor TsFile #736

Closed
wants to merge 19 commits into from
Closed

Refactor TsFile #736

wants to merge 19 commits into from

Conversation

HTHou
Copy link
Contributor

@HTHou HTHou commented Jan 14, 2020

@LeiRui
Copy link
Contributor

LeiRui commented Jan 14, 2020

The travis tests fail

@HTHou
Copy link
Contributor Author

HTHou commented Jan 14, 2020

The travis tests fail

Yes, there are still lots of works to complete. So it's only a draft.

return new SnappyCompressor();
default:
throw new CompressionTypeNotSupportedException(name.toString());
case UNCOMPRESSED:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the indention.

*/
TSDataType getDataType(String measurement) throws NoMeasurementException;
TSDataType getDataType(Path path) throws NoMeasurementException, IOException;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment should be updated too.

@HTHou HTHou marked this pull request as ready for review February 10, 2020 08:03
@HTHou
Copy link
Contributor Author

HTHou commented Feb 11, 2020

The new structure of TsFileMetadata is shown below.
Screen Shot 2020-02-11 at 9 31 17 AM

More detailed doc to be added soon.

@liutaohua
Copy link
Contributor

I think TsOffsetArray is a bad design, because it is hard to understanding it, and each DeviceIndexArray takes 8 byte to store the index.
If you put the contents of TsOffsetArray directly into the DeviceIndexArray, it would only take 4 byte to record the number, and it would be easier to understand

Copy link
Member

@qiaojialin qiaojialin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please format the code first

private int numOfChunkMetaDatas;

private String measurementId;
private List<ChunkMetaData> chunkMetaDataList = new ArrayList<>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to store this in TimeseriesMetaData. I expect TimeseriesMetadata be used in this way:

List TsFileSequenceReader.getAllChunkMetadata(TimeseriesMetaDataIndex metadataIndex)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, fixed.


import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;

public class TimeseriesMetaData {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public class TimeseriesMetaData {
public class TimeseriesMetadataIndex {

Actually this is an index to ChunkMetadatas of one series. Similar to the TsDeviceMetadataIndex


private long startOffsetOfChunkMetaDataList;
private int chunkMetaDataListDataSize;
private int numOfChunkMetaDatas;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this field?

We could read ChunkMetadata from a ByteBuffer like this:

List metadatas = new ArrayList();
for (bytebuffer.remaining > 0) {
metadatas.add(bytebuffer.readChunkMetadata());
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Thank you.

return 5;
default:
return -1;
case BOOLEAN:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not change this, our google-style contains the blanks.

return PLA;
default:
return UNCOMPRESSED;
case 0:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change back

return IRREGULAR_FREQ;
default:
return IRREGULAR_FREQ;
case 0:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change back

return new FloatStatistics();
default:
throw new UnknownColumnTypeException(type.toString());
case INT32:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change back

logger.error(
"Failed to get HDFSInput in Hadoop file system. Please check your dependency of Hadoop module.",
e);
logger.error("Failed to get HDFSInput in Hadoop file system. Please check your dependency of Hadoop module.", e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to use idea to format the codes......... Maybe this line exceeds the max length.

@HTHou
Copy link
Contributor Author

HTHou commented Feb 12, 2020

The updated structure is here.

Screen Shot 2020-02-12 at 4 25 20 PM

@HTHou
Copy link
Contributor Author

HTHou commented Feb 24, 2020

I changed some UnitTests in IoTDB server, because I added a new kind of MNode DeviceMNode in MTree. As a result, the deviceId cannot be storage group name any more. The storage group must be on the higher level of device.

@HTHou HTHou closed this Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants