Skip to content

Commit 96c594a

Browse files
committed
Use Java call style and use JavaCode instead of Any.
1 parent 4b49e8a commit 96c594a

File tree

1 file changed

+10
-10
lines changed
  • sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen

1 file changed

+10
-10
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/javaCode.scala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,26 +178,26 @@ object Block {
178178
}
179179

180180
// Folds eagerly the literal args into the code parts.
181-
private def foldLiteralArgs(parts: Seq[String], args: Seq[Any]): (Seq[String], Seq[Any]) = {
181+
private def foldLiteralArgs(parts: Seq[String], args: Seq[Any]): (Seq[String], Seq[JavaCode]) = {
182182
val codeParts = ArrayBuffer.empty[String]
183-
val blockInputs = ArrayBuffer.empty[Any]
183+
val blockInputs = ArrayBuffer.empty[JavaCode]
184184

185185
val strings = parts.iterator
186186
val inputs = args.iterator
187187
val buf = new StringBuilder(Block.CODE_BLOCK_BUFFER_LENGTH)
188188

189-
buf append strings.next
189+
buf.append(strings.next)
190190
while (strings.hasNext) {
191191
val input = inputs.next
192192
input match {
193193
case _: ExprValue | _: Block =>
194194
codeParts += buf.toString
195195
buf.clear
196-
blockInputs += input
196+
blockInputs += input.asInstanceOf[JavaCode]
197197
case _ =>
198-
buf append input
198+
buf.append(input)
199199
}
200-
buf append strings.next
200+
buf.append(strings.next)
201201
}
202202
if (buf.nonEmpty) {
203203
codeParts += buf.toString
@@ -211,7 +211,7 @@ object Block {
211211
* A block of java code. Including a sequence of code parts and some inputs to this block.
212212
* The actual java code is generated by embedding the inputs into the code parts.
213213
*/
214-
case class CodeBlock(codeParts: Seq[String], blockInputs: Seq[Any]) extends Block {
214+
case class CodeBlock(codeParts: Seq[String], blockInputs: Seq[JavaCode]) extends Block {
215215
override lazy val exprValues: Set[ExprValue] = {
216216
blockInputs.flatMap {
217217
case b: Block => b.exprValues
@@ -223,10 +223,10 @@ case class CodeBlock(codeParts: Seq[String], blockInputs: Seq[Any]) extends Bloc
223223
val strings = codeParts.iterator
224224
val inputs = blockInputs.iterator
225225
val buf = new StringBuilder(Block.CODE_BLOCK_BUFFER_LENGTH)
226-
buf append StringContext.treatEscapes(strings.next)
226+
buf.append(StringContext.treatEscapes(strings.next))
227227
while (strings.hasNext) {
228-
buf append inputs.next
229-
buf append StringContext.treatEscapes(strings.next)
228+
buf.append(inputs.next)
229+
buf.append(StringContext.treatEscapes(strings.next))
230230
}
231231
buf.toString
232232
}

0 commit comments

Comments
 (0)