You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "joonseolee (via GitHub)" <gi...@apache.org> on 2025/09/26 07:30:04 UTC
[PR] [Feature][File] Add word parser for RAG support [seatunnel]
joonseolee opened a new pull request, #9898:
URL: https://github.com/apache/seatunnel/pull/9898
### Purpose of this pull request
- Add and refine Word (.docx) reading via `WordReadStrategy`.
- Output schema (10 fields): `element_id`, `element_type`, `text_content`, `font_style`, `underline_style`, `font_size`, `font_family`, `text_color`, `alignment`, `hyperlink_url`.
- Process document elements in natural order (paragraphs and tables). Footnote text is included within the referencing paragraph’s `text_content`.
- Due to Apache POI limitations, the minimal extractable unit is a paragraph. Run-level styles are aggregated at the paragraph level:
- `font_style`: NORMAL/BOLD/ITALIC/BOLD_ITALIC
- `underline_style`: null or concrete style (e.g., SINGLE)
- `font_size`, `font_family`: first encountered values or null
- `text_color`: defaults to "000000" when absent
- `hyperlink_url`: all links in a paragraph concatenated with commas
### Does this PR introduce any user-facing change?
Yes. The Word reader’s output schema is simplified to 10 fields above. Some formatting attributes now return `null` when not explicitly present; `text_color` defaults to `"000000"`. Elements are emitted in document order, and hyperlinks are aggregated per paragraph.
### How was this patch tested?
- Added `WordReadStrategyTest` to validate all 10 fields against a sample `.docx`.
- Verified:
- Paragraph rows contain text and aggregated formatting/links.
- Table rows produce a single text blob per table; formatting-related fields are `null`.
### Check list
* [x] 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 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)
### Related Issue
#9715
--
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] [Feature][File] Add word parser for RAG support [seatunnel]
Posted by "danielnadean (via GitHub)" <gi...@apache.org>.
danielnadean commented on PR #9898:
URL: https://github.com/apache/seatunnel/pull/9898#issuecomment-5317321264
Checked why the Aug 10 CI run on this head went red: the only failing job was `unit-test (8, windows-latest)`, and inside it the only error is `WorkerTagTest` timing out after 311s in `before()` with `IllegalStateException: Node failed to start!` — a Hazelcast cluster-start timeout on a slow Windows JDK8 runner, in an engine test this PR doesn't touch. The same 311-second signature is hitting other unrelated PRs this week, each time in a different roving engine test. Notably, this PR's own new tests (`WordReadStrategyTest` and the `AllFileSpecificationCheckTest` change) passed on Windows in that same job.
Since Actions can't be re-run on this fork by non-owners, I've pushed a fresh `upstream/dev` sync instead (54 commits, clean auto-merge, PR diff unchanged) — keeps the branch current and retriggers CI.
--
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] [Feature][File] Add word parser for RAG support [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #9898:
URL: https://github.com/apache/seatunnel/pull/9898#issuecomment-4278483426
Hi @joonseolee, thank you for continuing the RAG/document parsing work. Adding a Word parser to the File connector is a useful feature direction, especially for users who want to ingest `.docx` documents into vector/search pipelines.
I reviewed the latest head locally from branch `seatunnel-review-9898`.
- Head commit: `ce2a470bdbe8a86686f10c5a1ede418d819ef66e`
- Merge base used for local review: `6416a17a0e3f9e8c13a211a188245ad7b1fc31f6`
- `git diff --stat upstream/dev...HEAD`: 4 files changed, 408 insertions, 1 deletion
- `git diff --check upstream/dev...HEAD`: clean
- GitHub reports the branch as mergeable but blocked by the failed `Build` check
- I tried to fetch the failed Build log, but GitHub returned `HTTP 410`, so the log is no longer available
- I did not run Maven tests locally; this review is based on local code, full diff, and call-chain analysis.
## What this PR fixes
User pain point: users want File Source to read Word `.docx` documents and emit paragraph/table/link/style content as structured rows for RAG and downstream text processing.
Fix approach: the PR adds `FileFormat.WORD("docx")`, a POI-based `WordReadStrategy`, and a local `test.docx` unit test.
In one sentence: the idea is good, but the format is not wired into the normal File Source initialization path yet, so `file_format_type = word` is currently not usable in a real job.
## Runtime Flow Reviewed
```text
User config
-> file_format_type = word
-> BaseFileSourceConfig(ReadonlyConfig) [BaseFileSourceConfig.java:60-66]
-> readonlyConfig.get(FILE_FORMAT_TYPE) = FileFormat.WORD
-> ReadStrategyFactory.of(...).name() [ReadStrategyFactory.java:34-39]
-> FileFormat.WORD.getReadStrategy()
-> new WordReadStrategy()
-> parseFilePaths(readonlyConfig) [BaseFileSourceConfig.java:69-78]
-> readStrategy.getFileNamesByPath(rootPath)
-> WordReadStrategy.getFileNamesByPath() [WordReadStrategy.java:264-266]
-> Arrays.asList(path)
Schema initialization
-> BaseFileSourceConfig.parseCatalogTable() [BaseFileSourceConfig.java:81-113]
-> switch(fileFormat)
-> WORD is not in CSV/TEXT/JSON/EXCEL/XML/ORC/PARQUET/BINARY
-> default throws FORMAT_NOT_SUPPORT
Therefore the normal job fails before reaching:
-> WordReadStrategy.read() [WordReadStrategy.java:53-67]
-> FileInputStream(path)
-> new XWPFDocument(fis)
-> processDocumentInOrder()
```
## Blocking Issues
### Issue 1: `WORD` is not handled by `BaseFileSourceConfig.parseCatalogTable()`, so real jobs fail during source initialization
- Location: `seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/config/BaseFileSourceConfig.java:93`
- Severity: High
The PR adds `FileFormat.WORD`, and `ReadStrategyFactory` can instantiate `WordReadStrategy`. However, the main File Source config path still has this switch:
```java
switch (fileFormat) {
case CSV:
case TEXT:
case JSON:
case EXCEL:
case XML:
...
case ORC:
case PARQUET:
case BINARY:
...
default:
throw new FileConnectorException(
FileConnectorErrorCode.FORMAT_NOT_SUPPORT,
"SeaTunnel does not supported this file format: [" + fileFormat + "]");
}
```
`WORD` falls into `default`, so a user setting `file_format_type = word` will fail during source initialization before any `.docx` file is read.
Suggested fix: add `WORD` to the appropriate schema initialization branch and add a test at the `BaseFileSourceConfig` level that constructs a real config with `file_format_type = word` and verifies that it does not throw `FORMAT_NOT_SUPPORT`.
### Issue 2: `WordReadStrategy` bypasses the File connector filesystem abstraction and only supports local files
- Location: `seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/WordReadStrategy.java:55`
- Severity: High
The current read path uses:
```java
try (FileInputStream fis = new FileInputStream(path);
XWPFDocument document = new XWPFDocument(fis)) {
...
}
```
That means the new reader only works for files on the worker's local filesystem. The File connector normally supports Local/HDFS/S3/OSS/FTP/SFTP-style paths through the existing filesystem abstraction, and several existing readers use `hadoopFileSystemProxy.getInputStream(path)` plus the shared archive/compression handling.
This matters for real users: `path = "s3a://bucket/docs/a.docx"` or `hdfs://.../a.docx` will not be read by `FileInputStream`. Also, `getFileNamesByPath()` just returns `Arrays.asList(path)`, so directory listing, file filtering, partition discovery, and archive handling are not integrated.
Suggested fix: reuse the existing `AbstractReadStrategy` filesystem path: open the document from `hadoopFileSystemProxy.getInputStream(path)`, and follow the existing file reader patterns for listing, filters, partitions, and compressed archives where applicable.
## Non-blocking But Important
### Issue 3: Word schema declares `element_id` inconsistently
- Location: `seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/WordReadStrategy.java:269`
- Severity: Medium
`getSeaTunnelRowTypeInfo()` declares `element_id` as `INT_TYPE`, and the emitted rows put an integer into field 0. But `getActualSeaTunnelRowTypeInfo()` declares `element_id` as `STRING_TYPE`.
Once `WORD` is wired into `BaseFileSourceConfig`, this can make the runtime schema disagree with the actual row data.
Suggested fix: keep both schema methods consistent, preferably by sharing one row type definition. `element_id` should be `INT_TYPE` if the emitted value remains an integer.
### Issue 4: User-facing docs are missing for the new `word` file format
- Location: `docs/en/connector-v2/source/SftpFile.md:170`
- Severity: Medium
This PR adds a new user-visible `file_format_type`, but the File Source docs in `docs/en` and `docs/zh` are not updated. Users need to know the supported value, supported suffixes (`docx` vs `doc`), output schema, limitations, and an example config.
Suggested fix: update the relevant File Source docs in both English and Chinese, including LocalFile/S3File/SftpFile/OSS/HDFS-style docs as appropriate.
## CI
The current `Build` check is failed. I could not inspect the details because GitHub returned `HTTP 410` when requesting the old logs, but a green rerun is still required after the code fixes.
## Merge Conclusion
### Conclusion: Not recommended to merge
Blocking items:
- Issue 1: `file_format_type = word` is not wired into the normal File Source initialization path.
- Issue 2: the reader only uses local `FileInputStream`, so it does not support the File connector's real filesystem paths.
Recommended fixes:
- Wire `WORD` into `BaseFileSourceConfig.parseCatalogTable()`.
- Reuse the File connector filesystem abstraction instead of `FileInputStream`.
- Make the Word output schema consistent.
- Add docs and a config-level regression test.
- Rerun CI once the branch is updated.
Overall, this is a useful feature idea, but it needs to be connected to the actual SeaTunnel File Source lifecycle before it can be merged.
--
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] [Feature][File] Add word parser for RAG support [seatunnel]
Posted by "joonseolee (via GitHub)" <gi...@apache.org>.
joonseolee commented on code in PR #9898:
URL: https://github.com/apache/seatunnel/pull/9898#discussion_r2425014400
##########
seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/WordReadStrategy.java:
##########
@@ -0,0 +1,296 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.file.source.reader;
+
+import org.apache.seatunnel.api.source.Collector;
+import org.apache.seatunnel.api.table.catalog.CatalogTable;
+import org.apache.seatunnel.api.table.type.BasicType;
+import org.apache.seatunnel.api.table.type.SeaTunnelDataType;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
+import org.apache.seatunnel.connectors.seatunnel.file.exception.FileConnectorErrorCode;
+import org.apache.seatunnel.connectors.seatunnel.file.exception.FileConnectorException;
+
+import org.apache.poi.xwpf.usermodel.IBodyElement;
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
+import org.apache.poi.xwpf.usermodel.XWPFHyperlink;
+import org.apache.poi.xwpf.usermodel.XWPFHyperlinkRun;
+import org.apache.poi.xwpf.usermodel.XWPFParagraph;
+import org.apache.poi.xwpf.usermodel.XWPFRun;
+import org.apache.poi.xwpf.usermodel.XWPFTable;
+import org.apache.poi.xwpf.usermodel.XWPFTableCell;
+import org.apache.poi.xwpf.usermodel.XWPFTableRow;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+@Slf4j
+public class WordReadStrategy extends AbstractReadStrategy {
+
+ private static final String DEFAULT_TEXT_COLOR = "000000";
+
+ @Override
+ public void read(String path, String tableId, Collector<SeaTunnelRow> output)
+ throws IOException, FileConnectorException {
+ try (FileInputStream fis = new FileInputStream(path);
+ XWPFDocument document = new XWPFDocument(fis)) {
+
+ int elementId = 1;
+
+ processDocumentInOrder(document, output, tableId, elementId);
+ } catch (Exception e) {
+ throw new FileConnectorException(
+ FileConnectorErrorCode.FILE_READ_FAILED,
+ "Failed to read Word document: " + path,
+ e);
+ }
+ }
+
+ private void processDocumentInOrder(
+ XWPFDocument document, Collector<SeaTunnelRow> output, String tableId, int elementId) {
+
+ for (IBodyElement element : document.getBodyElements()) {
+ if (element instanceof XWPFParagraph) {
+ XWPFParagraph paragraph = (XWPFParagraph) element;
+ if (paragraph.getText() != null && !paragraph.getText().trim().isEmpty()) {
+ SeaTunnelRow row = createParagraphRow(paragraph, elementId++, tableId);
+ output.collect(row);
+ }
+ } else if (element instanceof XWPFTable) {
+ XWPFTable table = (XWPFTable) element;
+ String tableData = extractTableData(table);
+ if (!tableData.trim().isEmpty()) {
+ SeaTunnelRow row = createTableRow(tableData, elementId++, tableId);
+ output.collect(row);
+ }
+ }
+ }
+ }
+
+ @Override
+ public SeaTunnelRowType getSeaTunnelRowTypeInfo(String path) throws FileConnectorException {
+ return new SeaTunnelRowType(
+ new String[] {
Review Comment:
@Hisoka-X
I wanted to add those values as well, but I couldn't due to technical issues like the ones below.
- heading_level: Not reliably derivable. Style names/IDs vary by template, language, and custom styles; there is no stable, standard mapping. Outline level may be absent, so consistent extraction isn’t guaranteed.
- text: Same as text_content
- page_number: Not available. Pagination is a rendering/layout result (paper size, margins, fonts, images, printer settings); Apache POI does not perform layout computation.
- position_index: A hierarchical index (Markdown-style) isn’t feasible without a reliable document tree and heading detection; Word’s body is effectively flat and heading detection is inconsistent. A simple global ordinal is possible.
- parent_id: Not available. WordprocessingML does not provide an explicit AST with parent-child relationships for paragraphs.
- child_ids: Not available for the same reason as parent_id; there’s no stable logical child list per element in Word.
--
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] [Feature][File] Add word parser for RAG support [seatunnel]
Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #9898:
URL: https://github.com/apache/seatunnel/pull/9898#discussion_r2382593855
##########
seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/config/FileFormat.java:
##########
@@ -181,7 +182,17 @@ public ReadStrategy getReadStrategy() {
return new MarkdownReadStrategy();
}
},
- ;
+ WORD("docx") {
Review Comment:
how about `.doc`?
##########
seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/WordReadStrategy.java:
##########
@@ -0,0 +1,296 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.file.source.reader;
+
+import org.apache.seatunnel.api.source.Collector;
+import org.apache.seatunnel.api.table.catalog.CatalogTable;
+import org.apache.seatunnel.api.table.type.BasicType;
+import org.apache.seatunnel.api.table.type.SeaTunnelDataType;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
+import org.apache.seatunnel.connectors.seatunnel.file.exception.FileConnectorErrorCode;
+import org.apache.seatunnel.connectors.seatunnel.file.exception.FileConnectorException;
+
+import org.apache.poi.xwpf.usermodel.IBodyElement;
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
+import org.apache.poi.xwpf.usermodel.XWPFHyperlink;
+import org.apache.poi.xwpf.usermodel.XWPFHyperlinkRun;
+import org.apache.poi.xwpf.usermodel.XWPFParagraph;
+import org.apache.poi.xwpf.usermodel.XWPFRun;
+import org.apache.poi.xwpf.usermodel.XWPFTable;
+import org.apache.poi.xwpf.usermodel.XWPFTableCell;
+import org.apache.poi.xwpf.usermodel.XWPFTableRow;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+@Slf4j
+public class WordReadStrategy extends AbstractReadStrategy {
+
+ private static final String DEFAULT_TEXT_COLOR = "000000";
+
+ @Override
+ public void read(String path, String tableId, Collector<SeaTunnelRow> output)
+ throws IOException, FileConnectorException {
+ try (FileInputStream fis = new FileInputStream(path);
+ XWPFDocument document = new XWPFDocument(fis)) {
+
+ int elementId = 1;
+
+ processDocumentInOrder(document, output, tableId, elementId);
+ } catch (Exception e) {
+ throw new FileConnectorException(
+ FileConnectorErrorCode.FILE_READ_FAILED,
+ "Failed to read Word document: " + path,
+ e);
+ }
+ }
+
+ private void processDocumentInOrder(
+ XWPFDocument document, Collector<SeaTunnelRow> output, String tableId, int elementId) {
+
+ for (IBodyElement element : document.getBodyElements()) {
+ if (element instanceof XWPFParagraph) {
+ XWPFParagraph paragraph = (XWPFParagraph) element;
+ if (paragraph.getText() != null && !paragraph.getText().trim().isEmpty()) {
+ SeaTunnelRow row = createParagraphRow(paragraph, elementId++, tableId);
+ output.collect(row);
+ }
+ } else if (element instanceof XWPFTable) {
+ XWPFTable table = (XWPFTable) element;
+ String tableData = extractTableData(table);
+ if (!tableData.trim().isEmpty()) {
+ SeaTunnelRow row = createTableRow(tableData, elementId++, tableId);
+ output.collect(row);
+ }
+ }
+ }
+ }
+
+ @Override
+ public SeaTunnelRowType getSeaTunnelRowTypeInfo(String path) throws FileConnectorException {
+ return new SeaTunnelRowType(
+ new String[] {
Review Comment:
we need those too.
"heading_level",
"text",
"page_number",
"position_index",
"parent_id",
"child_ids"
Just like markdown. We should keep most fields are same.
--
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] [Feature][File] Add word parser for RAG support [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #9898:
URL: https://github.com/apache/seatunnel/pull/9898#issuecomment-5379744923
Following up on the one open item from my last review (the CI result), since I said I'd approve once it came back green.
Status check on the same head (`269f37e06e0c`, no new commits since):
- The `Build` run I flagged as still `in_progress` (fork run `32093735779`, and the equivalent Apache-side check `95581717681`) has since completed — but as `cancelled`, not `success` (completed at `2026-08-18T05:12:48Z`, about 1h36m after my review). So the CI result never actually resolved green; it was cancelled instead. I'm not treating a cancelled run as equivalent to a passing one, so the approval I offered is still pending on a real green run.
- Separately, the branch has since drifted from `dev`: `git compare dev...269f37e06e0c` now reports `diverged` (8 ahead / 33 behind), and GitHub shows `mergeStateStatus: DIRTY` / `mergeable: CONFLICTING`. I hadn't flagged this before since it wasn't the case at review time — worth syncing with `dev` while re-triggering the build anyway.
Code-side, nothing has changed since my last review and I have no new concerns there. Once the Build check comes back with an actual green result on a synced head, I'm still happy to approve.
--
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] [Feature][File] Add word parser for RAG support [seatunnel]
Posted by "joonseolee (via GitHub)" <gi...@apache.org>.
joonseolee commented on code in PR #9898:
URL: https://github.com/apache/seatunnel/pull/9898#discussion_r2424963218
##########
seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/config/FileFormat.java:
##########
@@ -181,7 +182,17 @@ public ReadStrategy getReadStrategy() {
return new MarkdownReadStrategy();
}
},
- ;
+ WORD("docx") {
Review Comment:
I forgot it so I will add `doc` too :)
--
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] [Feature][File] Add word parser for RAG support [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on PR #9898:
URL: https://github.com/apache/seatunnel/pull/9898#issuecomment-5322956941
Both findings from the 2026-08-10 review are addressed on the new head:
- **Issue 5 (blocker)**: `FileFormat.WORD` added to `BaseFileSource#buildCatalogTableForEmptyPath`'s self-describing list, so Cos/Obs/OssJindo Word sources started against an empty path now get the real 10-column schema instead of the simple-text fallback — with a comment pinning this list to its `BaseFileSourceConfig` sibling so the next self-describing format doesn't repeat the pattern a third time. Good catch on this one; it's exactly the kind of parallel-implementation gap that's invisible until the first gate is fixed.
- **Issue 6**: all ten `WordReadStrategy` parsing/mapping helpers now carry method-level Javadoc documenting the non-obvious rules (paragraph-level run aggregation, comma-joined hyperlink URLs, the filtered `NONE` underline, the `000000` color default, the lossy `" | "`/newline table projection).
On the CI note in section 3: the `unit-test (8, windows-latest)` failure on the previous head wasn't `WordReadStrategyTest` — I pulled the log, and the only error was `WorkerTagTest` timing out at 311s in `before()` (`Node failed to start!`), the roving Hazelcast/slow-Windows-runner flake hitting several unrelated PRs since the new windows-2025 runner image rolled out. `WordReadStrategyTest` passed on Windows in that same job.
Also merged current dev — clean, no conflicts.
--
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] [Feature][File] Add word parser for RAG support [seatunnel]
Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #9898:
URL: https://github.com/apache/seatunnel/pull/9898#discussion_r2442904969
##########
seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/WordReadStrategy.java:
##########
@@ -0,0 +1,296 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.file.source.reader;
+
+import org.apache.seatunnel.api.source.Collector;
+import org.apache.seatunnel.api.table.catalog.CatalogTable;
+import org.apache.seatunnel.api.table.type.BasicType;
+import org.apache.seatunnel.api.table.type.SeaTunnelDataType;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
+import org.apache.seatunnel.connectors.seatunnel.file.exception.FileConnectorErrorCode;
+import org.apache.seatunnel.connectors.seatunnel.file.exception.FileConnectorException;
+
+import org.apache.poi.xwpf.usermodel.IBodyElement;
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
+import org.apache.poi.xwpf.usermodel.XWPFHyperlink;
+import org.apache.poi.xwpf.usermodel.XWPFHyperlinkRun;
+import org.apache.poi.xwpf.usermodel.XWPFParagraph;
+import org.apache.poi.xwpf.usermodel.XWPFRun;
+import org.apache.poi.xwpf.usermodel.XWPFTable;
+import org.apache.poi.xwpf.usermodel.XWPFTableCell;
+import org.apache.poi.xwpf.usermodel.XWPFTableRow;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+@Slf4j
+public class WordReadStrategy extends AbstractReadStrategy {
+
+ private static final String DEFAULT_TEXT_COLOR = "000000";
+
+ @Override
+ public void read(String path, String tableId, Collector<SeaTunnelRow> output)
+ throws IOException, FileConnectorException {
+ try (FileInputStream fis = new FileInputStream(path);
+ XWPFDocument document = new XWPFDocument(fis)) {
+
+ int elementId = 1;
+
+ processDocumentInOrder(document, output, tableId, elementId);
+ } catch (Exception e) {
+ throw new FileConnectorException(
+ FileConnectorErrorCode.FILE_READ_FAILED,
+ "Failed to read Word document: " + path,
+ e);
+ }
+ }
+
+ private void processDocumentInOrder(
+ XWPFDocument document, Collector<SeaTunnelRow> output, String tableId, int elementId) {
+
+ for (IBodyElement element : document.getBodyElements()) {
+ if (element instanceof XWPFParagraph) {
+ XWPFParagraph paragraph = (XWPFParagraph) element;
+ if (paragraph.getText() != null && !paragraph.getText().trim().isEmpty()) {
+ SeaTunnelRow row = createParagraphRow(paragraph, elementId++, tableId);
+ output.collect(row);
+ }
+ } else if (element instanceof XWPFTable) {
+ XWPFTable table = (XWPFTable) element;
+ String tableData = extractTableData(table);
+ if (!tableData.trim().isEmpty()) {
+ SeaTunnelRow row = createTableRow(tableData, elementId++, tableId);
+ output.collect(row);
+ }
+ }
+ }
+ }
+
+ @Override
+ public SeaTunnelRowType getSeaTunnelRowTypeInfo(String path) throws FileConnectorException {
+ return new SeaTunnelRowType(
+ new String[] {
Review Comment:
> text: Same as text_content
we should keep the same value with same fields name. text_content->text.
--
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] [Feature][File] Add word parser for RAG support [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on PR #9898:
URL: https://github.com/apache/seatunnel/pull/9898#issuecomment-3609877035
@joonseolee hi,
CI failed, please help solve it
--
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] [Feature][File] Add word parser for RAG support [seatunnel]
Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on PR #9898:
URL: https://github.com/apache/seatunnel/pull/9898#issuecomment-3338942869
cc @liugddx could you help to review it?
--
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] [Feature][File] Add word parser for RAG support [seatunnel]
Posted by "liugddx (via GitHub)" <gi...@apache.org>.
liugddx commented on PR #9898:
URL: https://github.com/apache/seatunnel/pull/9898#issuecomment-3345072829
Please fix the test case issue.
--
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] [Feature][File] Add word parser for RAG support [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on PR #9898:
URL: https://github.com/apache/seatunnel/pull/9898#issuecomment-5236834512
@/private/tmp/claude-501/-Volumes-disk6-tmp-seatunnel-third-abandoned-pr-recovery-a79615/ffa922be-4ccb-40a7-b9a9-7c70535d1690/scratchpad/pr9898_comment.md
--
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