You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by do...@apache.org on 2023/06/23 08:09:03 UTC

[orc] branch main updated: ORC-1453: Fix 'implicit-fallthrough' warnings (#1549)

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

dongjoon 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 790b9291f ORC-1453: Fix 'implicit-fallthrough' warnings (#1549)
790b9291f is described below

commit 790b9291f1e5daeb3b052cb0dd6917b54fd048cc
Author: Dongjoon Hyun <do...@apache.org>
AuthorDate: Fri Jun 23 01:08:58 2023 -0700

    ORC-1453: Fix 'implicit-fallthrough' warnings (#1549)
    
    ### What changes were proposed in this pull request?
    
    This PR aims to fix `implicit-fallthrough` warning.
    
    ### Why are the changes needed?
    
    To pass `Docker` tests on `clang`
    
    ### How was this patch tested?
    
    Pass the CIs and manual docker testing.
---
 c++/src/ColumnReader.cc |  8 ++++----
 c++/src/ColumnWriter.cc |  8 ++++----
 c++/src/TypeImpl.cc     | 23 +++++++++++------------
 3 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/c++/src/ColumnReader.cc b/c++/src/ColumnReader.cc
index 3552acf39..7fdcd530f 100644
--- a/c++/src/ColumnReader.cc
+++ b/c++/src/ColumnReader.cc
@@ -1722,16 +1722,16 @@ namespace orc {
     }
 
     switch (static_cast<int64_t>(type.getKind())) {
-      case SHORT: {
+      case SHORT:
         if (useTightNumericVector) {
           return std::make_unique<IntegerColumnReader<ShortVectorBatch>>(type, stripe);
         }
-      }
-      case INT: {
+        return std::make_unique<IntegerColumnReader<LongVectorBatch>>(type, stripe);
+      case INT:
         if (useTightNumericVector) {
           return std::make_unique<IntegerColumnReader<IntVectorBatch>>(type, stripe);
         }
-      }
+        return std::make_unique<IntegerColumnReader<LongVectorBatch>>(type, stripe);
       case LONG:
       case DATE:
         return std::make_unique<IntegerColumnReader<LongVectorBatch>>(type, stripe);
diff --git a/c++/src/ColumnWriter.cc b/c++/src/ColumnWriter.cc
index 0c72e1ccf..a7412c0e4 100644
--- a/c++/src/ColumnWriter.cc
+++ b/c++/src/ColumnWriter.cc
@@ -2824,10 +2824,12 @@ namespace orc {
         if (options.getUseTightNumericVector()) {
           return std::make_unique<IntegerColumnWriter<ShortVectorBatch>>(type, factory, options);
         }
+        return std::make_unique<IntegerColumnWriter<LongVectorBatch>>(type, factory, options);
       case INT:
         if (options.getUseTightNumericVector()) {
           return std::make_unique<IntegerColumnWriter<IntVectorBatch>>(type, factory, options);
         }
+        return std::make_unique<IntegerColumnWriter<LongVectorBatch>>(type, factory, options);
       case LONG:
         return std::make_unique<IntegerColumnWriter<LongVectorBatch>>(type, factory, options);
       case BYTE:
@@ -2835,13 +2837,11 @@ namespace orc {
           return std::make_unique<ByteColumnWriter<ByteVectorBatch>>(type, factory, options);
         }
         return std::make_unique<ByteColumnWriter<LongVectorBatch>>(type, factory, options);
-      case BOOLEAN: {
+      case BOOLEAN:
         if (options.getUseTightNumericVector()) {
           return std::make_unique<BooleanColumnWriter<ByteVectorBatch>>(type, factory, options);
-        } else {
-          return std::make_unique<BooleanColumnWriter<LongVectorBatch>>(type, factory, options);
         }
-      }
+        return std::make_unique<BooleanColumnWriter<LongVectorBatch>>(type, factory, options);
       case DOUBLE:
         return std::make_unique<FloatingColumnWriter<double, DoubleVectorBatch>>(type, factory,
                                                                                  options, false);
diff --git a/c++/src/TypeImpl.cc b/c++/src/TypeImpl.cc
index 7e9af806f..0fd640b2d 100644
--- a/c++/src/TypeImpl.cc
+++ b/c++/src/TypeImpl.cc
@@ -286,38 +286,37 @@ namespace orc {
                                                               MemoryPool& memoryPool, bool encoded,
                                                               bool useTightNumericVector) const {
     switch (static_cast<int64_t>(kind)) {
-      case BOOLEAN: {
+      case BOOLEAN:
         if (useTightNumericVector) {
           return std::make_unique<ByteVectorBatch>(capacity, memoryPool);
         }
-      }
-      case BYTE: {
+        return std::make_unique<LongVectorBatch>(capacity, memoryPool);
+      case BYTE:
         if (useTightNumericVector) {
           return std::make_unique<ByteVectorBatch>(capacity, memoryPool);
         }
-      }
-      case SHORT: {
+        return std::make_unique<LongVectorBatch>(capacity, memoryPool);
+      case SHORT:
         if (useTightNumericVector) {
           return std::make_unique<ShortVectorBatch>(capacity, memoryPool);
         }
-      }
-      case INT: {
+        return std::make_unique<LongVectorBatch>(capacity, memoryPool);
+      case INT:
         if (useTightNumericVector) {
           return std::make_unique<IntVectorBatch>(capacity, memoryPool);
         }
-      }
+        return std::make_unique<LongVectorBatch>(capacity, memoryPool);
       case LONG:
-      case DATE: {
+      case DATE:
         return std::make_unique<LongVectorBatch>(capacity, memoryPool);
-      }
 
       case FLOAT:
         if (useTightNumericVector) {
           return std::make_unique<FloatVectorBatch>(capacity, memoryPool);
         }
-      case DOUBLE: {
         return std::make_unique<DoubleVectorBatch>(capacity, memoryPool);
-      }
+      case DOUBLE:
+        return std::make_unique<DoubleVectorBatch>(capacity, memoryPool);
 
       case STRING:
       case BINARY: