You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "hawk9821 (via GitHub)" <gi...@apache.org> on 2026/02/02 06:37:18 UTC
[PR] [Bug][api] Support nested arrayType for SeaTunnelDataTypeConvertorUtil [seatunnel]
hawk9821 opened a new pull request, #10436:
URL: https://github.com/apache/seatunnel/pull/10436
<!--
Thank you for contributing to SeaTunnel! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
## Contribution Checklist
- Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/seatunnel/issues).
- Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
- Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
-->
### Purpose of this pull request
Support nested arrayType for `SeaTunnelDataTypeConvertorUtil` and supplement unit tests to fix insufficient original type coverage.
<!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
### Does this PR introduce _any_ user-facing change?
no
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released SeaTunnel versions or within the unreleased branches such as dev.
If no, write 'No'.
If you are adding/modifying connector documents, please follow our new specifications: https://github.com/apache/seatunnel/issues/4544.
-->
### How was this patch tested?
SeaTunnelDataTypeConvertorUtilTest#testAllSupportedTypes
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
If you are adding E2E test cases, maybe refer to https://github.com/apache/seatunnel/blob/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-mysql-e2e/src/test/resources/mysqlcdc_to_mysql.conf, here is a good example.
-->
### Check list
* [ ] If any new Jar binary package adding in your PR, please add License Notice according
[New License Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/contribution/new-license.md)
* [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/seatunnel/tree/dev/docs
* [ ] If necessary, please update `incompatible-changes.md` to describe the incompatibility caused by this PR.
* [ ] If you are contributing the connector code, please check that the following files are updated:
1. Update [plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties) and add new connector information in it
2. Update the pom file of [seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
3. Add ci label in [label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
4. Add e2e testcase in [seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
5. Update connector [plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Bug][api] Support nested arrayType for SeaTunnelDataTypeConvertorUtil [seatunnel]
Posted by "dybyte (via GitHub)" <gi...@apache.org>.
dybyte commented on PR #10436:
URL: https://github.com/apache/seatunnel/pull/10436#issuecomment-3833464617
This seems duplicate with #10396 .
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Bug][api] Support nested arrayType for SeaTunnelDataTypeConvertorUtil [seatunnel]
Posted by "DanielCarter-stack (via GitHub)" <gi...@apache.org>.
DanielCarter-stack commented on PR #10436:
URL: https://github.com/apache/seatunnel/pull/10436#issuecomment-3834454057
<!-- code-pr-reviewer -->
<!-- cpr:pr_reply_v2_parts {"group": "apache/seatunnel#10436", "part": 1, "total": 1} -->
### Issue 1: Insufficient Test Coverage (MINOR)
**Location**: `seatunnel-api/src/test/java/org/apache/seatunnel/api/table/catalog/SeaTunnelDataTypeConvertorUtilTest.java:313-324`
**Related Context**:
- Test class: `SeaTunnelDataTypeConvertorUtilTest`
- Method under test: `SeaTunnelDataTypeConvertorUtil.parseArrayType()` (private method)
- Caller: `SeaTunnelDataTypeConvertorUtil.deserializeSeaTunnelDataType()`
**Problem Description**:
The newly added test case `testAllSupportedTypes` only tests `array<array<int>>` (two-dimensional array), but does not verify:
1. Three-layer or deeper nesting: `array<array<array<int>>>`
2. Combinations of Array with other complex types: `array<map<string, int>>`, `array<row<...>>`
Although the recursive logic theoretically supports arbitrary depth, boundary testing is missing.
**Potential Risks**:
- Risk 1: If someone modifies `ArrayType.of()` or `getGenericType()` in the future, deep nesting may be broken
- Risk 2: The type system's consistency assumptions are not explicitly verified in tests
**Impact Scope**:
- Direct impact: `testAllSupportedTypes` test method
- Indirect impact: All Connectors that depend on nested type resolution (if users use three or more layers of nesting)
- Affected area: Core API layer (low-frequency scenario)
**Severity**: MINOR
**Improvement Suggestion**:
```java
// Add at the end of the testAllSupportedTypes() method
// Test deep nested arrays (3+ levels)
ArrayType<?, ?> arrayOfArrayOfArrayType =
(ArrayType<?, ?>)
SeaTunnelDataTypeConvertorUtil.deserializeSeaTunnelDataType(
"c_array_array_array", "array<array<array<int>>>");
Assertions.assertEquals(ArrayType.INT_ARRAY_TYPE,
((ArrayType<?, ?>) arrayOfArrayOfArrayType.getElementType()).getElementType());
// Test array with other complex types
SeaTunnelRowType rowInArray =
(SeaTunnelRowType)
SeaTunnelDataTypeConvertorUtil.deserializeSeaTunnelDataType(
"c_array_row", "array<{c1 = string, c2 = int}>");
Assertions.assertEquals(2, rowInArray.getFieldTypes().length);
```
**Rationale**:
1. Completeness: Verify recursive depth boundaries
2. Consistency: Ensure Array's nesting behavior is consistent with Map and Row
3. Regression protection: Prevent future changes from breaking deep nesting
### Issue 2: Documentation Does Not Explicitly State Support for Nested Arrays (MINOR)
**Location**: `docs/en/introduction/concepts/schema-feature.md:98`
**Related Context**:
- Documentation section: What type supported at now
- PR goal: Fix nested array support
- User group: All users using Schema configuration
**Problem Description**:
schema-feature.md line 98 states that array element types include "int string boolean ... double", but does not explicitly state that arrays themselves can be contained. Although line 109 states that map's value can be "any type", which technically includes arrays, users may be misled by the explicit list of array element types.
**Potential Risks**:
- Risk 1: Users may think arrays can only contain basic types and dare not use nested arrays
- Risk 2: Inconsistency between documentation and code implementation reduces credibility
**Impact Scope**:
- Direct impact: schema-feature.md documentation
- Indirect impact: All users who need to use nested arrays
- Affected area: User documentation (medium impact)
**Severity**: MINOR
**Improvement Suggestion**:
```markdown
| array | `ValueType[]` | A array is a data type that represents a collection of elements.
The element type can be any basic type (int, string, boolean, tinyint, smallint, bigint, float, double) or another array for nested structures. |
```
And add in the example section:
```hocon
# Example of nested array
c_matrix = "array<array<int>>" # 2D array of integers
```
**Rationale**:
1. Accuracy: Documentation should reflect the actual capabilities of the code
2. Usability: Explicitly inform users that nested arrays can be used to improve feature visibility
3. Consistency: Maintain consistency with the map type description (map states value can be "any type")
### Issue 3: Missing Tests for `array<row<...>>` (MINOR)
**Location**: `seatunnel-api/src/test/java/org/apache/seatunnel/api/table/catalog/SeaTunnelDataTypeConvertorUtilTest.java`
**Related Context**:
- Row type itself supports nesting (testConvertRowTypeNest has verified this)
- Array type now supports nesting (newly added in this PR)
- But the combination of Array nesting Row has not been tested
**Problem Description**:
Test cases cover nested Array and nested Map, but do not verify the scenario of Array containing Row. Given that Row is a commonly used complex type in SeaTunnel (corresponding to structs), this is a reasonable use case.
**Potential Risks**:
- Risk 1: The HOCON parser may have boundary issues when processing `array<{a = int}>`
- Risk 2: `ArrayType.of()` may have type inference issues when the element type is `SeaTunnelRowType`
**Impact Scope**:
- Direct impact: Test coverage
- Indirect impact: If users use `array<row<...>>`, they may encounter untested bugs
- Affected area: Core API layer (medium-frequency scenario)
**Severity**: MINOR
**Improvement Suggestion**:
```java
// Add in the testAllSupportedTypes() method
// Test array with row type
SeaTunnelRowType rowTypeInArray =
(SeaTunnelRowType)
SeaTunnelDataTypeConvertorUtil.deserializeSeaTunnelDataType(
"c_array_row", "array<{name = string, age = int}>");
Assertions.assertEquals(2, rowTypeInArray.getFieldTypes().length);
Assertions.assertEquals("name", rowTypeInArray.getFieldName(0));
Assertions.assertEquals(BasicType.STRING_TYPE, rowTypeInArray.getFieldType(0));
```
**Rationale**:
1. Practicality: Array<Row> is a common complex data structure (such as array objects)
2. Completeness: Verify combinations of Array with all complex types
3. Risk control: HOCON parsing may have boundary issues in this scenario
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Bug][api] Support nested arrayType for SeaTunnelDataTypeConvertorUtil [seatunnel]
Posted by "hawk9821 (via GitHub)" <gi...@apache.org>.
hawk9821 closed pull request #10436: [Bug][api] Support nested arrayType for SeaTunnelDataTypeConvertorUtil
URL: https://github.com/apache/seatunnel/pull/10436
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Bug][api] Support nested arrayType for SeaTunnelDataTypeConvertorUtil [seatunnel]
Posted by "hawk9821 (via GitHub)" <gi...@apache.org>.
hawk9821 commented on PR #10436:
URL: https://github.com/apache/seatunnel/pull/10436#issuecomment-3840057272
> This seems duplicate with #10396 .
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org