Skip to content

Commit 2bd9cbf

Browse files
committed
Fix nits
1 parent e8c63ad commit 2bd9cbf

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ class DataFrameReader private[sql](sparkSession: SparkSession) extends Logging {
285285
* and timestamp type. By default, it is `null` which means trying to read times and date by
286286
* `java.sql.Timestamp.valueOf()` and `java.sql.Date.valueOf()` or ISO 8601 format.</li>
287287
* </ul>
288-
288+
*
289289
* @since 2.0.0
290290
*/
291291
@scala.annotation.varargs

sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVSuite.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -814,31 +814,31 @@ class CSVSuite extends QueryTest with SharedSQLContext with SQLTestUtils {
814814
test("Write timestamps correctly with dateFormat option") {
815815
withTempDir { dir =>
816816
// With dateFormat option.
817-
val datesWithFormatPath = s"${dir.getCanonicalPath}/datesWithFormat.csv"
818-
val datesWithFormat = spark.read
817+
val timestampsWithFormatPath = s"${dir.getCanonicalPath}/timestampsWithFormat.csv"
818+
val timestampsWithFormat = spark.read
819819
.format("csv")
820820
.option("header", "true")
821821
.option("inferSchema", "true")
822822
.option("dateFormat", "dd/MM/yyyy HH:mm")
823823
.load(testFile(datesFile))
824-
datesWithFormat.write
824+
timestampsWithFormat.write
825825
.format("csv")
826826
.option("header", "true")
827827
.option("dateFormat", "yyyy/MM/dd HH:mm")
828-
.save(datesWithFormatPath)
828+
.save(timestampsWithFormatPath)
829829

830-
// This will load back the dates as string.
831-
val stringDatesWithFormat = spark.read
830+
// This will load back the timestamps as string.
831+
val stringTimestampsWithFormat = spark.read
832832
.format("csv")
833833
.option("header", "true")
834834
.option("inferSchema", "false")
835-
.load(datesWithFormatPath)
836-
val expectedStringDatesWithFormat = Seq(
835+
.load(timestampsWithFormatPath)
836+
val expectedStringTimestampsWithFormat = Seq(
837837
Row("2015/08/26 18:00"),
838838
Row("2014/10/27 18:30"),
839839
Row("2016/01/28 20:00"))
840840

841-
checkAnswer(stringDatesWithFormat, expectedStringDatesWithFormat)
841+
checkAnswer(stringTimestampsWithFormat, expectedStringTimestampsWithFormat)
842842
}
843843
}
844844
}

sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json/JsonSuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,7 @@ class JsonSuite extends QueryTest with SharedSQLContext with TestJsonData {
16731673
val datesWithFormat = spark.read
16741674
.schema(customSchema)
16751675
.option("dateFormat", "dd/MM/yyyy HH:mm")
1676-
.json(datesRecord)
1676+
.json(datesRecords)
16771677

16781678
datesWithFormat.write
16791679
.format("json")
@@ -1702,7 +1702,7 @@ class JsonSuite extends QueryTest with SharedSQLContext with TestJsonData {
17021702
val timestampsWithFormat = spark.read
17031703
.schema(customSchema)
17041704
.option("dateFormat", "dd/MM/yyyy HH:mm")
1705-
.json(datesRecord)
1705+
.json(datesRecords)
17061706
timestampsWithFormat.write
17071707
.format("json")
17081708
.option("dateFormat", "yyyy/MM/dd HH:mm")

sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json/TestJsonData.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ private[json] trait TestJsonData {
222222
spark.sparkContext.parallelize(
223223
s"""{"a": 1${"0" * 38}, "b": 92233720368547758070}""" :: Nil)
224224

225-
def datesRecord: RDD[String] =
225+
def datesRecords: RDD[String] =
226226
spark.sparkContext.parallelize(
227227
"""{"date": "26/08/2015 18:00"}""" ::
228228
"""{"date": "27/10/2014 18:30"}""" ::

0 commit comments

Comments
 (0)