-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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
[SPARK-24583][SQL] Wrong schema type in InsertIntoDataSourceCommand #21585
Conversation
Test build #92046 has finished for PR 21585 at commit
|
retest this please |
Test build #92047 has finished for PR 21585 at commit
|
@gatorsmile @cloud-fan Could you please review this PR? |
import org.apache.spark.util.Utils | ||
|
||
class SimpleInsertSource extends SchemaRelationProvider { | ||
override def createRelation( | ||
sqlContext: SQLContext, |
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.
4 spaces indentation
// Apply the schema of the existing table to the new data. | ||
val df = sparkSession.internalCreateDataFrame(data.queryExecution.toRdd, logicalRelation.schema) | ||
relation.insert(df, overwrite) | ||
// Data should have been casted to the schema of the insert relation. |
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.
it's better to mention which rule did it
compressed = false, | ||
properties = Map.empty), | ||
schema = schema, | ||
provider = Some("org.apache.spark.sql.sources.SimpleInsertSource")) |
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.
use classOf[SimpleInsertSource].getName
instead of hardcoding
thanks, LGTM |
Done with the changes. Thanks a lot, @cloud-fan ! |
Test build #92093 has finished for PR 21585 at commit
|
retest this please |
Test build #92092 has finished for PR 21585 at commit
|
Test build #92091 has finished for PR 21585 at commit
|
Test build #92095 has finished for PR 21585 at commit
|
Thanks! Merged to master/2.3 |
## What changes were proposed in this pull request? Change insert input schema type: "insertRelationType" -> "insertRelationType.asNullable", in order to avoid nullable being overridden. ## How was this patch tested? Added one test in InsertSuite. Author: Maryann Xue <maryannxue@apache.org> Closes #21585 from maryannxue/spark-24583. (cherry picked from commit bc0498d) Signed-off-by: Xiao Li <gatorsmile@gmail.com>
What changes were proposed in this pull request?
Change insert input schema type: "insertRelationType" -> "insertRelationType.asNullable", in order to avoid nullable being overridden.
How was this patch tested?
Added one test in InsertSuite.