-
Notifications
You must be signed in to change notification settings - Fork 28.7k
[SPARK-4131] [SQL] Support INSERT OVERWRITE [LOCAL] DIRECTORY '/path/to/dir' [ROW FORMAT row_format] [STORED AS file_format] query. #13067
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ package org.apache.spark.sql.catalyst.plans.logical | |
import scala.collection.mutable.ArrayBuffer | ||
|
||
import org.apache.spark.sql.catalyst.analysis.MultiInstanceRelation | ||
import org.apache.spark.sql.catalyst.catalog.CatalogStorageFormat | ||
import org.apache.spark.sql.catalyst.expressions._ | ||
import org.apache.spark.sql.catalyst.expressions.aggregate.AggregateExpression | ||
import org.apache.spark.sql.catalyst.plans._ | ||
|
@@ -386,6 +387,16 @@ case class InsertIntoTable( | |
} | ||
} | ||
|
||
case class InsertIntoDir( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are moving quite a bit of parser code to Catalyst, it also adds alot of Hive parlance to Catalyst. Maybe we should just move this into SQL/core? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I could not figure out a way to push the code down without adding some extra if else statements which treats insert statements specially. If you insist I can add the code but I think its better the way it is right now. |
||
path: String, | ||
isLocal: Boolean, | ||
rowFormat: CatalogStorageFormat, | ||
child: LogicalPlan) | ||
extends LogicalPlan { | ||
override def children: Seq[LogicalPlan] = child :: Nil | ||
override def output: Seq[Attribute] = Seq.empty | ||
} | ||
|
||
/** | ||
* A container for holding named common table expressions (CTEs) and a query plan. | ||
* This operator will be removed during analysis and the relations will be substituted into child. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,10 @@ private[hive] trait HiveStrategies { | |
table: MetastoreRelation, partition, child, overwrite, ifNotExists) => | ||
execution.InsertIntoHiveTable( | ||
table, partition, planLater(child), overwrite, ifNotExists) :: Nil | ||
case logical.InsertIntoDir( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a Hive-only feature? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is HQL syntax but no reason for it to be HiveOnly feature. |
||
path, isLocal, rowFormat, child) => | ||
execution.InsertIntoDir( | ||
path, isLocal, rowFormat, planLater(child)) :: Nil | ||
case _ => Nil | ||
} | ||
} | ||
|
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.
Add this keyword to the
nonReserved
rule.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.
Added.