Skip to content

Commit

Permalink
MINOR: better column name error description
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?
This PR aims to better column name error description.

### Why are the changes needed?
If column name is count(*), it can only throw 'No field name set', it not friendly to us.

### How was this patch tested?
Testing with Doris

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

Closes #1954 from xiedeyantu/patch-1.

Authored-by: xiedeyantu <[email protected]>
Signed-off-by: ffacs <[email protected]>
  • Loading branch information
xiedeyantu authored and ffacs committed Jun 10, 2024
1 parent 833817b commit 98aebbe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion c++/src/TypeImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,8 @@ namespace orc {
std::pair<std::string, size_t> nameRes = parseName(input, pos, end);
pos = nameRes.second;
if (input[pos] != ':') {
throw std::logic_error("Invalid struct type. No field name set.");
throw std::logic_error("Invalid struct type. Field name can not contain '" +
std::string(1, input[pos]) + "'.");
}
std::pair<std::unique_ptr<Type>, size_t> typeRes = TypeImpl::parseType(input, ++pos, end);
result->addStructField(nameRes.first, std::move(typeRes.first));
Expand Down
2 changes: 1 addition & 1 deletion c++/test/TestType.cc
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ namespace orc {
expectLogicErrorDuringParse("int<>", "Invalid < after int type.");
expectLogicErrorDuringParse("array(int)", "Missing < after array.");
expectLogicErrorDuringParse("struct<struct<bigint>>",
"Invalid struct type. No field name set.");
"Invalid struct type. Field name can not contain '<'.");
expectLogicErrorDuringParse("struct<a:bigint;b:string>", "Missing comma after field.");
}

Expand Down

0 comments on commit 98aebbe

Please sign in to comment.