-
Notifications
You must be signed in to change notification settings - Fork 149
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
Add supports to Insert Into #9
Conversation
cc: @dongjoon-hyun May I add unit tests in another PR? |
I'll add the unit tests in this PR soon |
83c6cbd
to
e96d7ff
Compare
Hi @dongjoon-hyun , I have added the unit tests. cc: @jerryshao |
super.beforeAll() | ||
sparkSession = SparkSession.builder() | ||
.master("local") | ||
.config("spark.sql.catalogImplementation", "hive") |
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.
.config("spark.sql.catalogImplementation", "hive")
==> enableHiveSupport()
?
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.
Done.
override def beforeAll(): Unit = { | ||
super.beforeAll() | ||
sparkSession = SparkSession.builder() | ||
.master("local") |
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.
Maybe, local[1]
?
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.
Both local and local[1] will run Spark locally with one worker thread
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.
Oh, I see.
sparkSession.sql(s"CREATE TABLE $sourceHiveTblName (name string)") | ||
sparkSession.sql(s"INSERT INTO TABLE $sourceHiveTblName VALUES ('a'), ('b'), ('c')") | ||
|
||
sparkSession.sql(s"CREATE TABLE $sourceSparkTblName (name string) USING PARQUET") |
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.
Can we use USING ORC
instead of USING ORC
? :)
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.
Sure. Done.
Thank you for merging and adding UTs. |
Next time when you update some code in this PR, Travis CI will be triggered. |
Thanks, @dongjoon-hyun . I'll update this PR soon. |
case c: CreateDataSourceTableAsSelectCommand => | ||
logDebug(s"CREATE TABLE USING xx AS SELECT query: ${qd.qe}") | ||
CommandsHarvester.CreateDataSourceTableAsSelectHarvester.harvest(c, qd) | ||
|
||
case c: CreateViewCommand => |
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.
Do we have a test case for this? Otherwise, can we add this in another PR?
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.
Ohh, not yet. I'll add unit tests for CreateViewCommand
@weiqingy . Please update PR description because you added the test case and Travis CI verified that. Overall, LGTM. I think we can proceed to another PRs. cc @jerryshao |
Thanks @dongjoon-hyun . The unit test for CreateViewHarvester was added. |
Changes:
Merge code supporting "Insert Into" and "Create View xx As Select * From xx" into master branch.
Testing:
New unit tests were added.
I manually tested this PR in HDP cluster:
Case1:
sql("create table table_parquet_200 (a int) using parquet")
sql("insert into table table_parquet_200 values (200)")
sql("create table table_parquet_300 (a int) using parquet")
sql("INSERT INTO table_parquet_300 SELECT * FROM table_parquet_200")
Case2:
sql("CREATE TABLE t00000(a int)")
sql("INSERT INTO t00000 VALUES (1)")
sql("CREATE TABLE t10000(a int)")
sql("INSERT INTO t10000 SELECT * FROM t00000")
Case 3:
sql("CREATE TABLE sourceTable(a int)")
sql("INSERT INTO sourceTable VALUES (1)")
sql("CREATE view s_view1 as select * from sourceTable")