Github user hvanhovell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18483#discussion_r124988718
  
    --- Diff: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/codegen/GeneratedProjectionSuite.scala
 ---
    @@ -172,4 +172,40 @@ class GeneratedProjectionSuite extends SparkFunSuite {
         assert(unsafe1 === unsafe3)
         assert(unsafe1.getStruct(1, 7) === unsafe3.getStruct(1, 7))
       }
    +
    +  test("MutableProjection should not cache content from the input row") {
    +    val mutableProj = GenerateMutableProjection.generate(
    +      Seq(BoundReference(0, new StructType().add("i", StringType), true)))
    +    val row = new GenericInternalRow(1)
    +    mutableProj.target(row)
    +
    +    val unsafeProj = GenerateUnsafeProjection.generate(
    +      Seq(BoundReference(0, new StructType().add("i", StringType), true)))
    +    val unsafeRow = 
unsafeProj.apply(InternalRow(InternalRow(UTF8String.fromString("a"))))
    +
    +    mutableProj.apply(unsafeRow)
    +    assert(row.getStruct(0, 1).getString(0) == "a")
    +
    +    // Even if the input row of the mutable projection has been changed, 
the target mutable row
    +    // should keep same.
    +    unsafeProj.apply(InternalRow(InternalRow(UTF8String.fromString("b"))))
    +    assert(row.getStruct(0, 1).getString(0).toString == "a")
    +  }
    +
    +  test("SafeProjection should not cache content from the input row") {
    --- End diff --
    
    This has always worked right?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to