-
Notifications
You must be signed in to change notification settings - Fork 442
Fix schema/type inference issue #261
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
Conversation
This reverts commit 9be0313.
@HyukjinKwon @falaki Do you want me to raise new PR with a single commit? That will make sure we have a clean commit history? |
Current coverage is
|
@tanwanirahul This is why I said here #244 (comment), the author might have to be you. |
@@ -42,7 +42,11 @@ private[csv] object InferSchema { | |||
mergeRowTypes) | |||
|
|||
val structFields = header.zip(rootTypes).map { case (thisHeader, rootType) => | |||
StructField(thisHeader, rootType, nullable = true) | |||
val dType = rootType match { |
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.
BTW, does this not produce Nulltype
after merging Nulltype
s?
It looks the test Merging Nulltypes should yeild Nulltype
is not covering this.
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.
@HyukjinKwon Please elaborate. Referring to doc comments in InferSchema.scala
/**
- Similar to the JSON schema inference.
- [[org.apache.spark.sql.execution.datasources.json.InferSchema]]
-
1. Infer type of each row
-
2. Merge row types to find common type
-
*/
3. Replace any null types with string type
All null types should be replaced with String types at the end. This is what is happening right now?
If I understand you correctly, you feel there is a need for some more tests to be added. Could you please mention what that test is suppose to test?
As far as testing merging two nulltypes returning null type, is already covered.
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.
Ah, sorry. Please ignore my comment.
@tanwanirahul Well, but If you need to change some codes here, then I think you better create another PR maybe. (And please close the previous PR) |
I will create a JIRA on Spark and submit a patch once this is merged. |
Thanks. This looks good and passes all tests. Merging it now. |
#244
This is re-opened due to the build failure in travis.