Skip to content

ORC-2069: Fix convert tool failed to read csv - #2504

Closed
cxzl25 wants to merge 1 commit into
apache:mainfrom
cxzl25:ORC-2069
Closed

cxzl25 wants to merge 1 commit into
apache:mainfrom
cxzl25:ORC-2069

Conversation

@cxzl25

@cxzl25 cxzl25 commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR aims to fix convert tool failed to read csv.

Why are the changes needed?

orc-tools-2.2.2-uber.jar is not packaged commons-lang3, which causes its convert command to fail to read csv.

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/orc/shade/commons/lang3/ObjectUtils
	at com.opencsv.CSVParser.<init>(CSVParser.java:110)
	at com.opencsv.CSVParserBuilder.build(CSVParserBuilder.java:139)
	at org.apache.orc.tools.convert.CsvReader.<init>(CsvReader.java:89)
	at org.apache.orc.tools.convert.ConvertTool$FileInformation.getRecordReader(ConvertTool.java:162)
	at org.apache.orc.tools.convert.ConvertTool.run(ConvertTool.java:221)
	at org.apache.orc.tools.convert.ConvertTool.main(ConvertTool.java:174)
	at org.apache.orc.tools.Driver.main(Driver.java:118)
Caused by: java.lang.ClassNotFoundException: org.apache.orc.shade.commons.lang3.ObjectUtils
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:580)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:490)
	... 7 more

How was this patch tested?

local test

Was this patch authored or co-authored using generative AI tooling?

No

@dongjoon-hyun dongjoon-hyun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @cxzl25 .

It seems that I missed opencsv transitive dependency in the following PR.

Comment thread java/tools/pom.xml
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<!-- convert tool CSVParser uses org.apache.commons.lang3 -->
<scope>runtime</scope>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question: Is runtime enough to build the uber jar to have this, @cxzl25 ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is declared as compile scope, the check of maven-dependency-plugin will report an error, so only runtime scope can be used.

[INFO] --- dependency:3.9.0:analyze-only (default) @ orc-tools ---
[ERROR] Unused declared dependencies found:
[ERROR]    org.apache.commons:commons-lang3:jar:3.20.0:compile

@dongjoon-hyun dongjoon-hyun added this to the 2.2.3 milestone Jan 30, 2026
@dongjoon-hyun

Copy link
Copy Markdown
Member

Merged to main/2.2.

dongjoon-hyun pushed a commit that referenced this pull request Jan 30, 2026
### What changes were proposed in this pull request?
This PR aims to fix convert tool failed to read csv.

### Why are the changes needed?

`orc-tools-2.2.2-uber.jar` is not packaged `commons-lang3`, which causes its convert command to fail to read csv.

```java
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/orc/shade/commons/lang3/ObjectUtils
	at com.opencsv.CSVParser.<init>(CSVParser.java:110)
	at com.opencsv.CSVParserBuilder.build(CSVParserBuilder.java:139)
	at org.apache.orc.tools.convert.CsvReader.<init>(CsvReader.java:89)
	at org.apache.orc.tools.convert.ConvertTool$FileInformation.getRecordReader(ConvertTool.java:162)
	at org.apache.orc.tools.convert.ConvertTool.run(ConvertTool.java:221)
	at org.apache.orc.tools.convert.ConvertTool.main(ConvertTool.java:174)
	at org.apache.orc.tools.Driver.main(Driver.java:118)
Caused by: java.lang.ClassNotFoundException: org.apache.orc.shade.commons.lang3.ObjectUtils
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:580)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:490)
	... 7 more
```

### How was this patch tested?
local test

### Was this patch authored or co-authored using generative AI tooling?
No

Closes #2504 from cxzl25/ORC-2069.

Authored-by: sychen <sychen@ctrip.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 7ecda8d)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants