-
Notifications
You must be signed in to change notification settings - Fork 1
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
Pivotal # 182332696: TSV File List Serialization #571
Pivotal # 182332696: TSV File List Serialization #571
Conversation
jhoanmanuelms
commented
May 31, 2022
- Include first list in the TSV file list serialization
- Add file list assertions to the itests
- Include first list in the TSV file list serialization - Add file list assertions to the itests
@@ -15,7 +15,7 @@ import java.io.OutputStream | |||
internal class FileListTsvStreamDeserializer { | |||
fun serializeFileList(files: Sequence<BioFile>, fileList: OutputStream) { | |||
val writer = fileList.bufferedWriter() | |||
writeHeaderNames(files.first(), writer) | |||
processFirstFile(files.first(), writer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something does not look correct, if you notice we are writing two times now the attributes values of the first file. Once in line 35 and another in line 19. That probablythe reason unit test are failing.
This does not look correct. Do I am missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the problem was coming from the .first()
method taking out the first element from the sequence. Then, when it starts iterating, it'll miss it since it's already processed
- Remove extra line - Adjust the sequence creation in the unit tests
|
||
var idx = -1 | ||
val files = object : Sequence<BioFile> { | ||
override fun iterator(): Iterator<BioFile> = object : Iterator<BioFile> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this way of creating a sequence looks overcomplex to me, why we have change previos approach (create a list and use asSequence)? . You may check https://kotlinlang.org/docs/sequences.html#construct there they mention 4 recomended ways to construct a sequence.
- From elements
- From iterable (previos appraoch)
- From a function
- From chunks
All this IMO looks way simpler that new approach.
- Fix ktlint errors - Simplify sequence creation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM