-
Notifications
You must be signed in to change notification settings - Fork 69
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
Sort df.compileTimeSchema() columns according to df.schema() so they're easier to compare #990
base: master
Are you sure you want to change the base?
Conversation
…re easier to compare
3689c11
to
adca94b
Compare
return compileSchema.sorted(order, path = root) | ||
} | ||
|
||
internal fun DataFrameSchema.putColumnsOrder(order: MutableMap<ColumnPath, Int>, path: ColumnPath) { |
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.
kinda strange to see DataFrameSchema
be the receiver. I'd expect the mutable map to be the receiver, since that's what you're modifying. That could also enable the notation:
val order = buildMap<ColumnPath, Int> {
putColumnsInOrderOf(runtimeSchema, path)
}
} | ||
} | ||
|
||
internal fun DataFrameSchema.sorted(order: Map<ColumnPath, Int>, path: ColumnPath): DataFrameSchema { |
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.
here it's okay to have it as a receiver :) I'd only name it "sortedBy(order)" to be more expressive.
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.
just some small syntactical tips, otherwise lgtm :)
This is quality of life improvement. I print both schemas when i test implementation of join operation. I used to get compileTimeSchema in somewhat random order, it makes diff useless. Now when columns are present in both schemas, they will go in a definite order