@@ -447,7 +447,7 @@ class ColumnExpressionSuite extends QueryTest {
447
447
}
448
448
449
449
test(" rand" ) {
450
- val randCol = testData.select(' key , rand(5L ).as(" rand" ))
450
+ val randCol = testData.select($ " key" , rand(5L ).as(" rand" ))
451
451
randCol.columns.length should be (2 )
452
452
val rows = randCol.collect()
453
453
rows.foreach { row =>
@@ -464,15 +464,15 @@ class ColumnExpressionSuite extends QueryTest {
464
464
465
465
// We first create a plan with two Projects.
466
466
// Project [rand + 1 AS rand1, rand - 1 AS rand2]
467
- // Project [key, Rand 5 AS rand]
467
+ // Project [key, ( Rand 5 + 1) AS rand]
468
468
// LogicalRDD [key, value]
469
469
// Because Rand function is not deterministic, the column rand is not deterministic.
470
470
// So, in the optimizer, we will not collapse Project [rand + 1 AS rand1, rand - 1 AS rand2]
471
471
// and Project [key, Rand 5 AS rand]. The final plan still has two Projects.
472
472
val dfWithTwoProjects =
473
473
testData
474
- .select(' key , rand(5L ).as(" rand" ))
475
- .select((' rand + 1 ).as(" rand1" ), (' rand - 1 ).as(" rand2" ))
474
+ .select($ " key" , ( rand(5L ) + 1 ).as(" rand" ))
475
+ .select(($ " rand" + 1 ).as(" rand1" ), ($ " rand" - 1 ).as(" rand2" ))
476
476
checkNumProjects(dfWithTwoProjects, 2 )
477
477
478
478
// Now, we add one more project rand1 - rand2 on top of the query plan.
@@ -481,13 +481,13 @@ class ColumnExpressionSuite extends QueryTest {
481
481
// So, the plan will be optimized from ...
482
482
// Project [(rand1 - rand2) AS (rand1 - rand2)]
483
483
// Project [rand + 1 AS rand1, rand - 1 AS rand2]
484
- // Project [key, Rand 5 AS rand]
484
+ // Project [key, ( Rand 5 + 1) AS rand]
485
485
// LogicalRDD [key, value]
486
486
// to ...
487
487
// Project [((rand + 1 AS rand1) - (rand - 1 AS rand2)) AS (rand1 - rand2)]
488
488
// Project [key, Rand 5 AS rand]
489
489
// LogicalRDD [key, value]
490
- val dfWithThreeProjects = dfWithTwoProjects.select(' rand1 - ' rand2 )
490
+ val dfWithThreeProjects = dfWithTwoProjects.select($ " rand1" - $ " rand2" )
491
491
checkNumProjects(dfWithThreeProjects, 2 )
492
492
dfWithThreeProjects.collect().foreach { row =>
493
493
assert(row.getDouble(0 ) === 2.0 +- 0.0001 )
0 commit comments