File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
main/scala/org/apache/spark/sql
test/scala/org/apache/spark/sql/test Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ class DataFrameReader private[sql](sparkSession: SparkSession) extends Logging {
129129 * @since 1.4.0
130130 */
131131 def load (path : String ): DataFrame = {
132- load(Seq (path): _* ) // force invocation of `load(...varargs...)`
132+ option( " path " , path). load(Seq (path): _* ) // force invocation of `load(...varargs...)`
133133 }
134134
135135 /**
Original file line number Diff line number Diff line change @@ -170,6 +170,34 @@ class DataFrameReaderWriterSuite extends QueryTest with SharedSQLContext with Be
170170 assert(LastOptions .saveMode === SaveMode .ErrorIfExists )
171171 }
172172
173+ test(" test path option in load" ) {
174+ spark.read
175+ .format(" org.apache.spark.sql.test" )
176+ .option(" intOpt" , 56 )
177+ .load(" /test" )
178+
179+ assert(LastOptions .parameters(" intOpt" ) == " 56" )
180+ assert(LastOptions .parameters(" path" ) == " /test" )
181+
182+ LastOptions .clear()
183+ spark.read
184+ .format(" org.apache.spark.sql.test" )
185+ .option(" intOpt" , 55 )
186+ .load()
187+
188+ assert(LastOptions .parameters(" intOpt" ) == " 55" )
189+ assert(! LastOptions .parameters.contains(" path" ))
190+
191+ LastOptions .clear()
192+ spark.read
193+ .format(" org.apache.spark.sql.test" )
194+ .option(" intOpt" , 54 )
195+ .load(" /test" , " /test1" , " /test2" )
196+
197+ assert(LastOptions .parameters(" intOpt" ) == " 54" )
198+ assert(! LastOptions .parameters.contains(" path" ))
199+ }
200+
173201 test(" test different data types for options" ) {
174202 val df = spark.read
175203 .format(" org.apache.spark.sql.test" )
You can’t perform that action at this time.
0 commit comments