Skip to content

Commit 118b4dd

Browse files
[SC-5704][REDSHIFT] Rename ExpressionToSQL test suite file and converter class. (apache#226)
## What changes were proposed in this pull request? We merged in and closed PR apache#221 too soon, missing this commit that addressed the last review comments there. ## How was this patch tested? Ran the existing unit tests.
1 parent 1abda7f commit 118b4dd

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

external/redshift/src/main/scala/com/databricks/spark/redshift/pushdown/ExpressionToSQL.scala

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@ import org.apache.spark.sql.catalyst.expressions._
1515
import org.apache.spark.sql.catalyst.expressions.aggregate._
1616
import org.apache.spark.sql.types._
1717

18-
19-
private[pushdown] class ExpressionToSqlConverter(fields: Seq[Attribute]) {
18+
/**
19+
* Converter class to be used for turning a Catalyst `Expression` into a piece of SQL text
20+
* that Redshift can digest.
21+
*
22+
* @param fields a set of "context" attributes to be used when resolving `AttributeReference`s
23+
*/
24+
private[pushdown] class ExpressionToSQL(fields: Seq[Attribute]) {
2025
type ExpressionToSqlPF = PartialFunction[Expression, String]
2126

2227
private val literalExprs: ExpressionToSqlPF = {
@@ -202,11 +207,11 @@ private[pushdown] class ExpressionToSqlConverter(fields: Seq[Attribute]) {
202207

203208
private[pushdown] object ExpressionToSQL {
204209
/**
205-
* Helper function that instantiates an `ExpressionToSqlConverter` object
210+
* Helper function that instantiates an `ExpressionToSQL` converter object
206211
* and calls its `convertExpression()` method with the provided arguments.
207212
*/
208213
def convert(expr: Expression, fields: Seq[Attribute]): String = {
209-
val converter = new ExpressionToSqlConverter(fields)
214+
val converter = new ExpressionToSQL(fields)
210215
converter.convertExpression(expr)
211216
}
212217
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import org.apache.spark.sql.catalyst.expressions._
1919
import org.apache.spark.sql.types._
2020

2121

22-
class ExpressionToSqlSuite extends SparkFunSuite {
22+
class ExpressionToSQLSuite extends SparkFunSuite {
2323
def testExpr(expr: Expression, fields: Seq[Attribute], expected: String): Unit =
2424
assertResult(expected)(ExpressionToSQL.convert(expr, fields))
2525

0 commit comments

Comments
 (0)