This is an automated email from the ASF dual-hosted git repository.

ffacs pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git


The following commit(s) were added to refs/heads/main by this push:
     new 98aebbeb0 MINOR: better column name error description
98aebbeb0 is described below

commit 98aebbeb0da0390e2e599995fa908e3d580ac471
Author: xiedeyantu <[email protected]>
AuthorDate: Mon Jun 10 18:07:45 2024 +0800

    MINOR: better column name error description
    
    ### 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]>
---
 c++/src/TypeImpl.cc  | 3 ++-
 c++/test/TestType.cc | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/c++/src/TypeImpl.cc b/c++/src/TypeImpl.cc
index c7b073c71..cbc7b8279 100644
--- a/c++/src/TypeImpl.cc
+++ b/c++/src/TypeImpl.cc
@@ -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));
diff --git a/c++/test/TestType.cc b/c++/test/TestType.cc
index c9ac2f285..cec0d8d2c 100644
--- a/c++/test/TestType.cc
+++ b/c++/test/TestType.cc
@@ -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.");
   }
 

Reply via email to