Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21619#discussion_r197795127
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/javaCode.scala
 ---
    @@ -148,14 +149,17 @@ trait Block extends JavaCode {
       }
     
       // Concatenates this block with other block.
    -  def + (other: Block): Block
    +  def + (other: Block): Block = other match {
    --- End diff --
    
    A general question about `+`.
    
    Previously we generate a giant string for an expression tree, which is hard 
to tune. To keep more information in the generated code, we introduce this 
`JavaCode`/`CodeBlock` framework to keep a tree of strings instead of a giant 
string.
    
    For an expression `a op b`, we should generate a tree of strings for `a` 
and `b`, then `op` creates a new tree node and keeps `a` and `b` as children. 
That means, if we refer to a `CodeBlock` inside a `code"..."`, the `CodeBlock` 
should become a child of the new `CodeBlock`. However, `+` usually happens 
within the same operator, I'm not sure if we should create a new level of tree 
node here.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to