You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "aglinxinyuan (via GitHub)" <gi...@apache.org> on 2026/05/03 01:49:39 UTC

[PR] test(amber): add unit test coverage for DataFrame equality and inMemSize [texera]

aglinxinyuan opened a new pull request, #4784:
URL: https://github.com/apache/texera/pull/4784

   ### What changes were proposed in this PR?
   
   Add `DataPayloadSpec` covering the custom `equals` and `inMemSize` of `DataFrame`:
   
   - `inMemSize`: zero for an empty frame; sum of contained tuple sizes otherwise
   - `equals` reflexivity for empty frames
   - `equals` rejecting non-DataFrame values and `null`
   - `equals` rejecting different lengths
   - `equals` treating element-wise equal frames as equal
   - `equals` respecting element order
   - `equals` rejecting differing elements
   
   ### Any related issues, documentation, discussions?
   
   Closes #4783
   
   ### How was this PR tested?
   
   `sbt "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.common.ambermessage.DataPayloadSpec"` — 8/8 tests pass.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude Opus 4.7)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(amber): add unit test coverage for DataFrame equality and inMemSize [texera]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #4784:
URL: https://github.com/apache/texera/pull/4784#issuecomment-4365158383

   ## [Codecov](https://app.codecov.io/gh/apache/texera/pull/4784?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 42.13%. Comparing base ([`a5b8957`](https://app.codecov.io/gh/apache/texera/commit/a5b895715e589f7f74c1459cd314861288126532?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`b0c7106`](https://app.codecov.io/gh/apache/texera/commit/b0c7106c2f88b7d9bfd1ef65fde3a2b079e4e089?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 4 commits behind head on main.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff            @@
   ##               main    #4784   +/-   ##
   =========================================
     Coverage     42.13%   42.13%           
     Complexity     2001     2001           
   =========================================
     Files           957      957           
     Lines         34094    34094           
     Branches       3753     3753           
   =========================================
     Hits          14364    14364           
     Misses        18952    18952           
     Partials        778      778           
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/texera/pull/4784/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [python](https://app.codecov.io/gh/apache/texera/pull/4784/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `83.80% <ø> (ø)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/texera/pull/4784?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(amber): add unit test coverage for DataFrame equality and inMemSize [texera]

Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan commented on code in PR #4784:
URL: https://github.com/apache/texera/pull/4784#discussion_r3177498906


##########
amber/src/test/scala/org/apache/texera/amber/engine/common/ambermessage/DataPayloadSpec.scala:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.texera.amber.engine.common.ambermessage
+
+import org.apache.texera.amber.core.tuple.{Attribute, AttributeType, Schema, Tuple}
+import org.scalatest.flatspec.AnyFlatSpec
+
+class DataPayloadSpec extends AnyFlatSpec {
+
+  private val schema: Schema =
+    Schema().add(new Attribute("v", AttributeType.INTEGER))
+
+  private def tuple(v: Int): Tuple =
+    Tuple.builder(schema).add(new Attribute("v", AttributeType.INTEGER), Integer.valueOf(v)).build()

Review Comment:
   Done in 33b3f09db0. The `tuple` helper now uses `schema.getAttribute("v")` so the helper stays consistent with the schema under test.



##########
amber/src/test/scala/org/apache/texera/amber/engine/common/ambermessage/DataPayloadSpec.scala:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.texera.amber.engine.common.ambermessage
+
+import org.apache.texera.amber.core.tuple.{Attribute, AttributeType, Schema, Tuple}
+import org.scalatest.flatspec.AnyFlatSpec
+
+class DataPayloadSpec extends AnyFlatSpec {
+
+  private val schema: Schema =
+    Schema().add(new Attribute("v", AttributeType.INTEGER))
+
+  private def tuple(v: Int): Tuple =
+    Tuple.builder(schema).add(new Attribute("v", AttributeType.INTEGER), Integer.valueOf(v)).build()
+
+  "DataFrame.inMemSize" should "be zero for an empty frame" in {
+    assert(DataFrame(Array.empty).inMemSize == 0L)
+  }
+
+  it should "be the sum of inMemSize across the contained tuples" in {
+    val a = tuple(1)
+    val b = tuple(2)
+    val df = DataFrame(Array(a, b))
+    assert(df.inMemSize == a.inMemSize + b.inMemSize)
+  }
+
+  "DataFrame.equals" should "consider two empty frames equal" in {
+    assert(DataFrame(Array.empty) == DataFrame(Array.empty))
+  }

Review Comment:
   Done in 33b3f09db0. Split the empty-frame equality test into a true reflexivity case (`val df = ...; assert(df == df)`) and a separate case for two distinct empty-frame instances, so the test name matches the assertion.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(amber): add unit test coverage for DataFrame equality and inMemSize [texera]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #4784:
URL: https://github.com/apache/texera/pull/4784#discussion_r3177480860


##########
amber/src/test/scala/org/apache/texera/amber/engine/common/ambermessage/DataPayloadSpec.scala:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.texera.amber.engine.common.ambermessage
+
+import org.apache.texera.amber.core.tuple.{Attribute, AttributeType, Schema, Tuple}
+import org.scalatest.flatspec.AnyFlatSpec
+
+class DataPayloadSpec extends AnyFlatSpec {
+
+  private val schema: Schema =
+    Schema().add(new Attribute("v", AttributeType.INTEGER))
+
+  private def tuple(v: Int): Tuple =
+    Tuple.builder(schema).add(new Attribute("v", AttributeType.INTEGER), Integer.valueOf(v)).build()
+
+  "DataFrame.inMemSize" should "be zero for an empty frame" in {
+    assert(DataFrame(Array.empty).inMemSize == 0L)
+  }
+
+  it should "be the sum of inMemSize across the contained tuples" in {
+    val a = tuple(1)
+    val b = tuple(2)
+    val df = DataFrame(Array(a, b))
+    assert(df.inMemSize == a.inMemSize + b.inMemSize)
+  }
+
+  "DataFrame.equals" should "consider two empty frames equal" in {
+    assert(DataFrame(Array.empty) == DataFrame(Array.empty))
+  }

Review Comment:
   The PR description/issue mentions testing `equals` reflexivity for empty frames, but the current test checks equality between two separate empty frames. If the intent is reflexivity specifically, consider adding an explicit `val df = DataFrame(Array.empty); assert(df == df)` (or adjust the description/test wording to match what’s being asserted).



##########
amber/src/test/scala/org/apache/texera/amber/engine/common/ambermessage/DataPayloadSpec.scala:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.texera.amber.engine.common.ambermessage
+
+import org.apache.texera.amber.core.tuple.{Attribute, AttributeType, Schema, Tuple}
+import org.scalatest.flatspec.AnyFlatSpec
+
+class DataPayloadSpec extends AnyFlatSpec {
+
+  private val schema: Schema =
+    Schema().add(new Attribute("v", AttributeType.INTEGER))
+
+  private def tuple(v: Int): Tuple =
+    Tuple.builder(schema).add(new Attribute("v", AttributeType.INTEGER), Integer.valueOf(v)).build()

Review Comment:
   In the `tuple` helper, `Tuple.builder(schema).add(new Attribute("v", ...), ...)` creates a new `Attribute` instance instead of reusing the schema’s attribute. `Tuple.Builder.add(Attribute, field)` only type-checks against the provided `Attribute` (and `build()` doesn’t re-validate field types against the schema), so this helper could silently construct tuples whose field types don’t match `schema` if either side is changed later. Consider defining `val attr = schema.getAttribute("v")` (or keeping a single `Attribute` val used to build the schema) and using that in `add`, or use `addSequentially` for schema-ordered fields.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(amber): add unit test coverage for DataFrame equality and inMemSize [texera]

Posted by "Yicong-Huang (via GitHub)" <gi...@apache.org>.
Yicong-Huang merged PR #4784:
URL: https://github.com/apache/texera/pull/4784


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org