-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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-32592][SQL] Make DataFrameReader.table take the specified options #29535
Changes from 1 commit
59971c4
04cf5a1
2d1e0f9
5567b7c
dcc88ca
f321560
12d90bd
b371912
a41c06a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,9 +23,9 @@ import org.apache.spark.sql.catalyst.errors.TreeNodeException | |
import org.apache.spark.sql.catalyst.expressions._ | ||
import org.apache.spark.sql.catalyst.expressions.codegen.{CodegenContext, ExprCode} | ||
import org.apache.spark.sql.catalyst.parser.ParserUtils | ||
import org.apache.spark.sql.catalyst.plans.logical.{Aggregate, LeafNode, LogicalPlan, UnaryNode} | ||
import org.apache.spark.sql.catalyst.plans.logical.{LeafNode, LogicalPlan, UnaryNode} | ||
import org.apache.spark.sql.catalyst.trees.TreeNode | ||
import org.apache.spark.sql.catalyst.util.quoteIdentifier | ||
import org.apache.spark.sql.catalyst.util.{quoteIdentifier, CaseInsensitiveMap} | ||
import org.apache.spark.sql.connector.catalog.{Identifier, TableCatalog} | ||
import org.apache.spark.sql.types.{DataType, Metadata, StructType} | ||
|
||
|
@@ -42,7 +42,9 @@ class UnresolvedException[TreeType <: TreeNode[_]](tree: TreeType, function: Str | |
* @param multipartIdentifier table name | ||
*/ | ||
case class UnresolvedRelation( | ||
multipartIdentifier: Seq[String]) extends LeafNode with NamedRelation { | ||
multipartIdentifier: Seq[String], | ||
options: CaseInsensitiveMap[String] = CaseInsensitiveMap[String](Map.empty)) | ||
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. can we use |
||
extends LeafNode with NamedRelation { | ||
import org.apache.spark.sql.connector.catalog.CatalogV2Implicits._ | ||
|
||
/** Returns a `.` separated name for this relation. */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ import org.apache.spark.annotation.Stable | |
import org.apache.spark.api.java.JavaRDD | ||
import org.apache.spark.internal.Logging | ||
import org.apache.spark.rdd.RDD | ||
import org.apache.spark.sql.catalyst.analysis.UnresolvedRelation | ||
import org.apache.spark.sql.catalyst.csv.{CSVHeaderChecker, CSVOptions, UnivocityParser} | ||
import org.apache.spark.sql.catalyst.expressions.ExprUtils | ||
import org.apache.spark.sql.catalyst.json.{CreateJacksonParser, JacksonParser, JSONOptions} | ||
|
@@ -822,9 +823,9 @@ class DataFrameReader private[sql](sparkSession: SparkSession) extends Logging { | |
*/ | ||
def table(tableName: String): DataFrame = { | ||
assertNoSpecifiedSchema("table") | ||
for ((k, v) <- this.extraOptions) | ||
sparkSession.conf.set(k, v) | ||
sparkSession.table(tableName) | ||
val multipartIdentifier = | ||
sparkSession.sessionState.sqlParser.parseMultipartIdentifier(tableName) | ||
Dataset.ofRows(sparkSession, UnresolvedRelation(multipartIdentifier, extraOptions)) | ||
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. we should create
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.
|
||
} | ||
|
||
/** | ||
|
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
options
to param doc?