You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2018/10/29 22:33:37 UTC
[arrow] branch master updated: ARROW-3358: [Gandiva][C++] Deprecate
Gandiva Status.
This is an automated email from the ASF dual-hosted git repository.
wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new 1a6545a ARROW-3358: [Gandiva][C++] Deprecate Gandiva Status.
1a6545a is described below
commit 1a6545aa51f5f41f0233ee0a11ef87d21127c5ed
Author: Praveen <pr...@dremio.com>
AuthorDate: Mon Oct 29 18:33:27 2018 -0400
ARROW-3358: [Gandiva][C++] Deprecate Gandiva Status.
Removing all references to gandiva status and using arrow
status instead.
Author: Praveen <pr...@dremio.com>
Closes #2861 from praveenbingo/ARROW-3358 and squashes the following commits:
43c13e645 <Praveen> ARROW-3358: Fixed lint and doc errors.
2192277e0 <Praveen> ARROW-3358: Fixed glib bindings and compiler warnings.
26189f880 <Praveen> ARROW-3358: Added missing arrow files.
fe64bb897 <Praveen> ARROW-3358: Deprecate Gandiva Status.
---
c_glib/arrow-glib/error.cpp | 8 +
c_glib/arrow-glib/error.h | 11 +-
c_glib/doc/gandiva-glib/gandiva-glib-docs.xml | 4 -
c_glib/gandiva-glib/Makefile.am | 54 +----
c_glib/gandiva-glib/error.cpp | 76 -------
c_glib/gandiva-glib/error.h | 50 -----
c_glib/gandiva-glib/error.hpp | 28 ---
c_glib/gandiva-glib/gandiva-enums.c.template | 56 ------
c_glib/gandiva-glib/gandiva-enums.h.template | 41 ----
c_glib/gandiva-glib/gandiva-glib.h | 2 -
c_glib/gandiva-glib/gandiva-glib.hpp | 1 -
c_glib/gandiva-glib/meson.build | 16 +-
c_glib/gandiva-glib/projector.cpp | 6 +-
cpp/src/arrow/status.cc | 9 +
cpp/src/arrow/status.h | 45 ++++-
cpp/src/gandiva/CMakeLists.txt | 2 -
cpp/src/gandiva/arrow.h | 4 +
cpp/src/gandiva/configuration.h | 2 +-
cpp/src/gandiva/date_utils.cc | 1 +
cpp/src/gandiva/date_utils.h | 2 +-
cpp/src/gandiva/engine.cc | 4 +-
cpp/src/gandiva/engine.h | 2 +-
cpp/src/gandiva/engine_llvm_test.cc | 13 +-
cpp/src/gandiva/expr_decomposer.cc | 14 +-
cpp/src/gandiva/expr_decomposer.h | 1 +
cpp/src/gandiva/expr_validator.cc | 10 +-
cpp/src/gandiva/expr_validator.h | 3 +-
cpp/src/gandiva/filter.cc | 21 +-
cpp/src/gandiva/filter.h | 3 +-
cpp/src/gandiva/function_holder_registry.h | 3 +-
cpp/src/gandiva/jni/jni_common.cc | 1 +
cpp/src/gandiva/like_holder.cc | 2 +-
cpp/src/gandiva/like_holder.h | 2 +-
cpp/src/gandiva/llvm_generator.cc | 15 +-
cpp/src/gandiva/llvm_generator_test.cc | 6 +-
cpp/src/gandiva/node.h | 3 +-
cpp/src/gandiva/node_visitor.h | 3 +-
cpp/src/gandiva/projector.cc | 33 ++--
cpp/src/gandiva/projector.h | 3 +-
cpp/src/gandiva/regex_util.h | 3 +-
cpp/src/gandiva/selection_vector.cc | 12 +-
cpp/src/gandiva/selection_vector.h | 3 +-
cpp/src/gandiva/selection_vector_impl.h | 2 +-
cpp/src/gandiva/status.h | 272 --------------------------
cpp/src/gandiva/status_test.cc | 71 -------
cpp/src/gandiva/tests/binary_test.cc | 3 +-
cpp/src/gandiva/tests/boolean_expr_test.cc | 15 +-
cpp/src/gandiva/tests/hash_test.cc | 5 +-
cpp/src/gandiva/tests/if_expr_test.cc | 3 +-
cpp/src/gandiva/tests/literal_test.cc | 3 +-
cpp/src/gandiva/tests/micro_benchmarks.cc | 2 +-
cpp/src/gandiva/tests/utf8_test.cc | 3 +-
cpp/src/gandiva/to_date_holder.cc | 2 +-
cpp/src/gandiva/to_date_holder.h | 3 +-
54 files changed, 195 insertions(+), 767 deletions(-)
diff --git a/c_glib/arrow-glib/error.cpp b/c_glib/arrow-glib/error.cpp
index 9ebbdc7..47c54e0 100644
--- a/c_glib/arrow-glib/error.cpp
+++ b/c_glib/arrow-glib/error.cpp
@@ -73,6 +73,14 @@ garrow_error_code(const arrow::Status &status)
return GARROW_ERROR_PLASMA_STORE_FULL;
case arrow::StatusCode::PlasmaObjectAlreadySealed:
return GARROW_ERROR_PLASMA_OBJECT_ALREADY_SEALED;
+ case arrow::StatusCode::CodeGenError:
+ return GARROW_ERROR_CODEGEN;
+ case arrow::StatusCode::ArrowError:
+ return GARROW_ERROR_ARROW;
+ case arrow::StatusCode::ExpressionValidationError:
+ return GARROW_ERROR_EXPRESSION_VALIDATION;
+ case arrow::StatusCode::ExecutionError:
+ return GARROW_ERROR_EXECUTION;
default:
return GARROW_ERROR_UNKNOWN;
}
diff --git a/c_glib/arrow-glib/error.h b/c_glib/arrow-glib/error.h
index 0a0b2b1..5d88ce3 100644
--- a/c_glib/arrow-glib/error.h
+++ b/c_glib/arrow-glib/error.h
@@ -38,8 +38,11 @@ G_BEGIN_DECLS
* @GARROW_ERROR_PLASMA_OBJECT_EXISTS: Object already exists on Plasma.
* @GARROW_ERROR_PLASMA_OBJECT_NONEXISTENT: Object doesn't exist on Plasma.
* @GARROW_ERROR_PLASMA_STORE_FULL: Store full error on Plasma.
- * @GARROW_ERROR_PLASMA_OBJECT_ALREADY_SEALED:
- * Object is already sealed on Plasma.
+ * @GARROW_ERROR_PLASMA_OBJECT_ALREADY_SEALED: Object already sealed on Plasma.
+ * @GARROW_ERROR_CODEGEN: Error generating code for expression evaluation in Gandiva.
+ * @GARROW_ERROR_ARROW: Error in Gandiva-Arrow integration.
+ * @GARROW_ERROR_EXPRESSION_VALIDATION: Validation errors in expression given for code generation.
+ * @GARROW_ERROR_EXECUTION: Execution error while evaluating the expression against a record batch.
*
* The error codes are used by all arrow-glib functions.
*
@@ -60,6 +63,10 @@ typedef enum {
GARROW_ERROR_PLASMA_OBJECT_NONEXISTENT,
GARROW_ERROR_PLASMA_STORE_FULL,
GARROW_ERROR_PLASMA_OBJECT_ALREADY_SEALED,
+ GARROW_ERROR_CODEGEN = 40,
+ GARROW_ERROR_ARROW,
+ GARROW_ERROR_EXPRESSION_VALIDATION,
+ GARROW_ERROR_EXECUTION,
} GArrowError;
#define GARROW_ERROR garrow_error_quark()
diff --git a/c_glib/doc/gandiva-glib/gandiva-glib-docs.xml b/c_glib/doc/gandiva-glib/gandiva-glib-docs.xml
index d51a645..2618750 100644
--- a/c_glib/doc/gandiva-glib/gandiva-glib-docs.xml
+++ b/c_glib/doc/gandiva-glib/gandiva-glib-docs.xml
@@ -46,10 +46,6 @@
<title>Projector</title>
<xi:include href="xml/projector.xml"/>
</chapter>
- <chapter id="error">
- <title>Error</title>
- <xi:include href="xml/error.xml"/>
- </chapter>
</part>
<chapter id="object-tree">
diff --git a/c_glib/gandiva-glib/Makefile.am b/c_glib/gandiva-glib/Makefile.am
index 5aa17a4..3a8b9d3 100644
--- a/c_glib/gandiva-glib/Makefile.am
+++ b/c_glib/gandiva-glib/Makefile.am
@@ -52,27 +52,16 @@ libgandiva_glib_la_LIBADD = \
../arrow-glib/libarrow-glib.la
libgandiva_glib_la_headers = \
- error.h \
expression.h \
gandiva-glib.h \
projector.h
-libgandiva_glib_la_generated_headers = \
- gandiva-enums.h
-
-libgandiva_glib_la_generated_sources = \
- gandiva-enums.c \
- $(libgandiva_glib_la_generated_headers)
-
libgandiva_glib_la_sources = \
- error.cpp \
expression.cpp \
projector.cpp \
- $(libgandiva_glib_la_headers) \
- $(libgandiva_glib_la_generated_sources)
+ $(libgandiva_glib_la_headers)
libgandiva_glib_la_cpp_headers = \
- error.hpp \
expression.hpp \
gandiva-glib.hpp \
projector.hpp
@@ -81,49 +70,10 @@ libgandiva_glib_la_SOURCES = \
$(libgandiva_glib_la_sources) \
$(libgandiva_glib_la_cpp_headers)
-BUILT_SOURCES = \
- $(libgandiva_glib_la_genearted_headers) \
- $(libgandiva_glib_la_genearted_sources) \
- stamp-gandiva-enums.c \
- stamp-gandiva-enums.h
-
-DISTCLEANFILES += \
- stamp-gandiva-enums.c \
- stamp-gandiva-enums.h
-
-EXTRA_DIST += \
- gandiva-enums.c.template \
- gandiva-enums.h.template
-
-gandiva-enums.h: stamp-gandiva-enums.h
- @true
-stamp-gandiva-enums.h: $(libgandiva_glib_la_headers) gandiva-enums.h.template
- $(AM_V_GEN) \
- (cd $(srcdir) && \
- $(GLIB_MKENUMS) \
- --identifier-prefix GGandiva \
- --symbol-prefix ggandiva \
- --template gandiva-enums.h.template \
- $(libgandiva_glib_la_headers)) > gandiva-enums.h
- touch $@
-
-gandiva-enums.c: stamp-gandiva-enums.c
- @true
-stamp-gandiva-enums.c: $(libgandiva_glib_la_headers) gandiva-enums.c.template
- $(AM_V_GEN) \
- (cd $(srcdir) && \
- $(GLIB_MKENUMS) \
- --identifier-prefix GGandiva \
- --symbol-prefix ggandiva \
- --template gandiva-enums.c.template \
- $(libgandiva_glib_la_headers)) > gandiva-enums.c
- touch $@
-
gandiva_glib_includedir = $(includedir)/gandiva-glib
gandiva_glib_include_HEADERS = \
$(libgandiva_glib_la_headers) \
- $(libgandiva_glib_la_cpp_headers) \
- $(libgandiva_glib_la_generated_headers)
+ $(libgandiva_glib_la_cpp_headers)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = \
diff --git a/c_glib/gandiva-glib/error.cpp b/c_glib/gandiva-glib/error.cpp
deleted file mode 100644
index 9fba7fd..0000000
--- a/c_glib/gandiva-glib/error.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <gandiva-glib/error.hpp>
-
-G_BEGIN_DECLS
-
-/**
- * SECTION: error
- * @title: GGandivaError
- * @short_description: Error code mapping between Gandiva and gandiva-glib
- *
- * #GGandivaError provides error codes corresponding to `gandiva::Status`
- * values.
- */
-
-G_DEFINE_QUARK(ggandiva-error-quark, ggandiva_error)
-
-static GGandivaError
-ggandiva_error_code(const gandiva::Status &status)
-{
- switch (status.code()) {
- case gandiva::StatusCode::OK:
- return GGANDIVA_ERROR_UNKNOWN;
- case gandiva::StatusCode::Invalid:
- return GGANDIVA_ERROR_INVALID;
- case gandiva::StatusCode::CodeGenError:
- return GGANDIVA_ERROR_CODE_GEN;
- case gandiva::StatusCode::ArrowError:
- return GGANDIVA_ERROR_ARROW;
- case gandiva::StatusCode::ExpressionValidationError:
- return GGANDIVA_ERROR_EXPRESSION_VALIDATION;
- default:
- return GGANDIVA_ERROR_UNKNOWN;
- }
-}
-
-G_END_DECLS
-
-gboolean
-ggandiva_error_check(GError **error,
- const gandiva::Status &status,
- const char *context)
-{
- if (status.ok()) {
- return TRUE;
- } else {
- g_set_error(error,
- GGANDIVA_ERROR,
- ggandiva_error_code(status),
- "%s: %s",
- context,
- status.ToString().c_str());
- return FALSE;
- }
-}
diff --git a/c_glib/gandiva-glib/error.h b/c_glib/gandiva-glib/error.h
deleted file mode 100644
index e79fde0..0000000
--- a/c_glib/gandiva-glib/error.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-/**
- * GGandivaError:
- * @GGANDIVA_ERROR_INVALID: Invalid value error.
- * @GGANDIVA_ERROR_CODE_GEN: Code generation error.
- * @GGANDIVA_ERROR_ARROW: Arrow error.
- * @GGANDIVA_ERROR_EXPRESSION_VALIDATION: Expression validation error.
- * @GGANDIVA_ERROR_UNKNOWN: Unknown error.
- *
- * The error codes are used by all gandiva-glib functions.
- *
- * They are corresponding to `gandiva::Status` values.
- */
-typedef enum {
- GGANDIVA_ERROR_INVALID = 1,
- GGANDIVA_ERROR_CODE_GEN,
- GGANDIVA_ERROR_ARROW,
- GGANDIVA_ERROR_EXPRESSION_VALIDATION,
- GGANDIVA_ERROR_UNKNOWN,
-} GGandivaError;
-
-#define GGANDIVA_ERROR ggandiva_error_quark()
-
-GQuark ggandiva_error_quark(void);
-
-G_END_DECLS
diff --git a/c_glib/gandiva-glib/error.hpp b/c_glib/gandiva-glib/error.hpp
deleted file mode 100644
index bd0f548..0000000
--- a/c_glib/gandiva-glib/error.hpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include <gandiva/status.h>
-
-#include <gandiva-glib/error.h>
-
-gboolean ggandiva_error_check(GError **error,
- const gandiva::Status &status,
- const char *context);
diff --git a/c_glib/gandiva-glib/gandiva-enums.c.template b/c_glib/gandiva-glib/gandiva-enums.c.template
deleted file mode 100644
index 80276f6..0000000
--- a/c_glib/gandiva-glib/gandiva-enums.c.template
+++ /dev/null
@@ -1,56 +0,0 @@
-/*** BEGIN file-header ***/
-/*
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <gandiva-glib/gandiva-glib.h>
-/*** END file-header ***/
-
-/*** BEGIN file-production ***/
-
-/* enumerations from "@filename@" */
-/*** END file-production ***/
-
-/*** BEGIN value-header ***/
-GType
-@enum_name@_get_type(void)
-{
- static GType etype = 0;
- if (G_UNLIKELY(etype == 0)) {
- static const G@Type@Value values[] = {
-/*** END value-header ***/
-
-/*** BEGIN value-production ***/
- {@VALUENAME@, "@VALUENAME@", "@valuenick@"},
-/*** END value-production ***/
-
-/*** BEGIN value-tail ***/
- {0, NULL, NULL}
- };
- etype = g_@type@_register_static(g_intern_static_string("@EnumName@"), values);
- }
- return etype;
-}
-/*** END value-tail ***/
-
-/*** BEGIN file-tail ***/
-/*** END file-tail ***/
diff --git a/c_glib/gandiva-glib/gandiva-enums.h.template b/c_glib/gandiva-glib/gandiva-enums.h.template
deleted file mode 100644
index 5150683..0000000
--- a/c_glib/gandiva-glib/gandiva-enums.h.template
+++ /dev/null
@@ -1,41 +0,0 @@
-/*** BEGIN file-header ***/
-/*
- * 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.
- */
-
-#pragma once
-
-#include <gandiva-glib/error.h>
-
-G_BEGIN_DECLS
-/*** END file-header ***/
-
-/*** BEGIN file-production ***/
-
-/* enumerations from "@filename@" */
-/*** END file-production ***/
-
-/*** BEGIN value-header ***/
-GType @enum_name@_get_type(void) G_GNUC_CONST;
-#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
-/*** END value-header ***/
-
-/*** BEGIN file-tail ***/
-
-G_END_DECLS
-/*** END file-tail ***/
diff --git a/c_glib/gandiva-glib/gandiva-glib.h b/c_glib/gandiva-glib/gandiva-glib.h
index 9741354..62fd2b5 100644
--- a/c_glib/gandiva-glib/gandiva-glib.h
+++ b/c_glib/gandiva-glib/gandiva-glib.h
@@ -19,7 +19,5 @@
#pragma once
-#include <gandiva-glib/error.h>
#include <gandiva-glib/expression.h>
-#include <gandiva-glib/gandiva-enums.h>
#include <gandiva-glib/projector.h>
diff --git a/c_glib/gandiva-glib/gandiva-glib.hpp b/c_glib/gandiva-glib/gandiva-glib.hpp
index 3771caf..08563ca 100644
--- a/c_glib/gandiva-glib/gandiva-glib.hpp
+++ b/c_glib/gandiva-glib/gandiva-glib.hpp
@@ -21,6 +21,5 @@
#include <gandiva-glib/gandiva-glib.h>
-#include <gandiva-glib/error.hpp>
#include <gandiva-glib/expression.hpp>
#include <gandiva-glib/projector.hpp>
diff --git a/c_glib/gandiva-glib/meson.build b/c_glib/gandiva-glib/meson.build
index f4fdf8e..32bd307 100644
--- a/c_glib/gandiva-glib/meson.build
+++ b/c_glib/gandiva-glib/meson.build
@@ -20,36 +20,22 @@
project_name = 'gandiva-glib'
sources = files(
- 'error.cpp',
'expression.cpp',
'projector.cpp',
)
c_headers = files(
- 'error.h',
'expression.h',
'gandiva-glib.h',
'projector.h',
)
cpp_headers = files(
- 'error.hpp',
'expression.hpp',
'gandiva-glib.hpp',
'projector.hpp',
)
-enums = gnome.mkenums('enums',
- sources: c_headers,
- identifier_prefix: 'GGandiva',
- symbol_prefix: 'ggandiva',
- c_template: 'gandiva-enums.c.template',
- h_template: 'gandiva-enums.h.template',
- install_dir: join_paths(include_dir, project_name),
- install_header: true)
-enums_source = enums[0]
-enums_header = enums[1]
-
headers = c_headers + cpp_headers
install_headers(headers, subdir: project_name)
@@ -78,7 +64,7 @@ pkgconfig.generate(filebase: project_name,
gnome.generate_gir(libgandiva_glib,
dependencies: declare_dependency(sources: arrow_glib_gir),
- sources: sources + c_headers + enums,
+ sources: sources + c_headers,
namespace: 'Gandiva',
nsversion: api_version,
identifier_prefix: 'GGandiva',
diff --git a/c_glib/gandiva-glib/projector.cpp b/c_glib/gandiva-glib/projector.cpp
index bdac5f3..983ecda 100644
--- a/c_glib/gandiva-glib/projector.cpp
+++ b/c_glib/gandiva-glib/projector.cpp
@@ -25,7 +25,7 @@
#include <arrow-glib/record-batch.hpp>
#include <arrow-glib/schema.hpp>
-#include <gandiva-glib/error.hpp>
+#include <arrow-glib/error.hpp>
#include <gandiva-glib/expression.hpp>
#include <gandiva-glib/projector.hpp>
@@ -140,7 +140,7 @@ ggandiva_projector_new(GArrowSchema *schema,
gandiva_projector->Make(arrow_schema,
gandiva_expressions,
&gandiva_projector);
- if (ggandiva_error_check(error, status, "[gandiva][projector][new]")) {
+ if (garrow_error_check(error, status, "[gandiva][projector][new]")) {
return ggandiva_projector_new_raw(&gandiva_projector);
} else {
return NULL;
@@ -171,7 +171,7 @@ ggandiva_projector_evaluate(GGandivaProjector *projector,
gandiva_projector->Evaluate(*arrow_record_batch,
memory_pool,
&arrow_arrays);
- if (ggandiva_error_check(error, status, "[gandiva][projector][evaluate]")) {
+ if (garrow_error_check(error, status, "[gandiva][projector][evaluate]")) {
GList *arrays = NULL;
for (auto arrow_array : arrow_arrays) {
auto array = garrow_array_new_raw(&arrow_array);
diff --git a/cpp/src/arrow/status.cc b/cpp/src/arrow/status.cc
index 918dbc7..8be8b36 100644
--- a/cpp/src/arrow/status.cc
+++ b/cpp/src/arrow/status.cc
@@ -84,6 +84,15 @@ std::string Status::CodeAsString() const {
case StatusCode::PlasmaObjectAlreadySealed:
type = "Plasma object is already sealed";
break;
+ case StatusCode::CodeGenError:
+ type = "CodeGenError in Gandiva";
+ break;
+ case StatusCode::ExpressionValidationError:
+ type = "ExpressionValidationError";
+ break;
+ case StatusCode::ExecutionError:
+ type = "ExecutionError in Gandiva";
+ break;
default:
type = "Unknown";
break;
diff --git a/cpp/src/arrow/status.h b/cpp/src/arrow/status.h
index a8b8536..e7ab68c 100644
--- a/cpp/src/arrow/status.h
+++ b/cpp/src/arrow/status.h
@@ -60,6 +60,17 @@
} \
} while (false)
+#define ARROW_RETURN_FAILURE_IF_FALSE(condition, status) \
+ do { \
+ if (!(condition)) { \
+ Status _status = (status); \
+ std::stringstream ss; \
+ ss << __FILE__ << ":" << __LINE__ << " code: " << _status.CodeAsString() << " \n " \
+ << _status.message(); \
+ return Status(_status.code(), ss.str()); \
+ } \
+ } while (0)
+
// This is an internal-use macro and should not be used in public headers.
#ifndef RETURN_NOT_OK
#define RETURN_NOT_OK(s) ARROW_RETURN_NOT_OK(s)
@@ -84,7 +95,12 @@ enum class StatusCode : char {
PlasmaObjectNonexistent = 21,
PlasmaStoreFull = 22,
PlasmaObjectAlreadySealed = 23,
- StillExecuting = 24
+ StillExecuting = 24,
+ // Gandiva range of errors
+ CodeGenError = 40,
+ ArrowError = 41,
+ ExpressionValidationError = 42,
+ ExecutionError = 43
};
#if defined(__clang__)
@@ -183,6 +199,23 @@ class ARROW_EXPORT Status {
static Status StillExecuting() { return Status(StatusCode::StillExecuting, ""); }
+ // Return error status of an appropriate type.
+ static Status CodeGenError(const std::string& msg) {
+ return Status(StatusCode::CodeGenError, msg);
+ }
+
+ static Status ArrowError(const std::string& msg) {
+ return Status(StatusCode::ArrowError, msg);
+ }
+
+ static Status ExpressionValidationError(const std::string& msg) {
+ return Status(StatusCode::ExpressionValidationError, msg);
+ }
+
+ static Status ExecutionError(const std::string& msg) {
+ return Status(StatusCode::ExecutionError, msg);
+ }
+
// Returns true iff the status indicates success.
bool ok() const { return (state_ == NULL); }
@@ -215,6 +248,16 @@ class ARROW_EXPORT Status {
bool IsStillExecuting() const { return code() == StatusCode::StillExecuting; }
+ bool IsCodeGenError() const { return code() == StatusCode::CodeGenError; }
+
+ bool IsArrowError() const { return code() == StatusCode::ArrowError; }
+
+ bool IsExpressionValidationError() const {
+ return code() == StatusCode::ExpressionValidationError;
+ }
+
+ bool IsExecutionError() const { return code() == StatusCode::ExecutionError; }
+
// Return a string representation of this status suitable for printing.
// Returns the string "OK" for success.
std::string ToString() const;
diff --git a/cpp/src/gandiva/CMakeLists.txt b/cpp/src/gandiva/CMakeLists.txt
index a377e40..299611c 100644
--- a/cpp/src/gandiva/CMakeLists.txt
+++ b/cpp/src/gandiva/CMakeLists.txt
@@ -113,7 +113,6 @@ install(FILES
logging.h
projector.h
selection_vector.h
- status.h
tree_expr_builder.h
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/gandiva")
@@ -141,7 +140,6 @@ add_gandiva_unit_test(llvm_generator_test.cc llvm_generator.cc regex_util.cc eng
add_gandiva_unit_test(annotator_test.cc annotator.cc function_signature.cc)
add_gandiva_unit_test(tree_expr_test.cc tree_expr_builder.cc expr_decomposer.cc annotator.cc function_registry.cc function_signature.cc like_holder.cc regex_util.cc to_date_holder.cc date_utils.cc)
add_gandiva_unit_test(expr_decomposer_test.cc expr_decomposer.cc tree_expr_builder.cc annotator.cc function_registry.cc function_signature.cc like_holder.cc regex_util.cc to_date_holder.cc date_utils.cc)
-add_gandiva_unit_test(status_test.cc)
add_gandiva_unit_test(expression_registry_test.cc llvm_types.cc expression_registry.cc function_signature.cc function_registry.cc)
add_gandiva_unit_test(selection_vector_test.cc selection_vector.cc)
add_gandiva_unit_test(lru_cache_test.cc)
diff --git a/cpp/src/gandiva/arrow.h b/cpp/src/gandiva/arrow.h
index f6d0855..ea28352 100644
--- a/cpp/src/gandiva/arrow.h
+++ b/cpp/src/gandiva/arrow.h
@@ -25,6 +25,7 @@
#include <arrow/builder.h>
#include <arrow/pretty_print.h>
#include <arrow/record_batch.h>
+#include <arrow/status.h>
#include <arrow/type.h>
namespace gandiva {
@@ -44,6 +45,9 @@ using SchemaPtr = std::shared_ptr<arrow::Schema>;
using ArrayDataPtr = std::shared_ptr<arrow::ArrayData>;
using ArrayDataVector = std::vector<ArrayDataPtr>;
+using Status = arrow::Status;
+using StatusCode = arrow::StatusCode;
+
} // namespace gandiva
#endif // GANDIVA_EXPR_ARROW_H
diff --git a/cpp/src/gandiva/configuration.h b/cpp/src/gandiva/configuration.h
index 9014660..04e2eed 100644
--- a/cpp/src/gandiva/configuration.h
+++ b/cpp/src/gandiva/configuration.h
@@ -21,7 +21,7 @@
#include <memory>
#include <string>
-#include "gandiva/status.h"
+#include "arrow/status.h"
namespace gandiva {
diff --git a/cpp/src/gandiva/date_utils.cc b/cpp/src/gandiva/date_utils.cc
index eacb541..2686b19 100644
--- a/cpp/src/gandiva/date_utils.cc
+++ b/cpp/src/gandiva/date_utils.cc
@@ -17,6 +17,7 @@
#include <algorithm>
#include <memory>
+#include <sstream>
#include <vector>
#include "gandiva/date_utils.h"
diff --git a/cpp/src/gandiva/date_utils.h b/cpp/src/gandiva/date_utils.h
index 0f17bdf..64a150b 100644
--- a/cpp/src/gandiva/date_utils.h
+++ b/cpp/src/gandiva/date_utils.h
@@ -23,7 +23,7 @@
#include <unordered_map>
#include <vector>
-#include "gandiva/status.h"
+#include "gandiva/arrow.h"
namespace gandiva {
diff --git a/cpp/src/gandiva/engine.cc b/cpp/src/gandiva/engine.cc
index 78cc84a..59884c5 100644
--- a/cpp/src/gandiva/engine.cc
+++ b/cpp/src/gandiva/engine.cc
@@ -92,7 +92,7 @@ Status Engine::Make(std::shared_ptr<Configuration> config,
engine_obj->AddGlobalMappings();
auto status = engine_obj->LoadPreCompiledIRFiles(config->byte_code_file_path());
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
*engine = std::move(engine_obj);
return Status::OK();
@@ -162,7 +162,7 @@ Status Engine::RemoveUnusedFunctions() {
// Optimise and compile the module.
Status Engine::FinalizeModule(bool optimise_ir, bool dump_ir) {
auto status = RemoveUnusedFunctions();
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
if (dump_ir) {
DumpIR("Before optimise");
diff --git a/cpp/src/gandiva/engine.h b/cpp/src/gandiva/engine.h
index 485447b..f377ebc 100644
--- a/cpp/src/gandiva/engine.h
+++ b/cpp/src/gandiva/engine.h
@@ -28,12 +28,12 @@
#include <llvm/IR/LLVMContext.h>
#include <llvm/IR/Module.h>
+#include "arrow/status.h"
#include "arrow/util/macros.h"
#include "gandiva/configuration.h"
#include "gandiva/llvm_types.h"
#include "gandiva/logging.h"
-#include "gandiva/status.h"
namespace gandiva {
diff --git a/cpp/src/gandiva/engine_llvm_test.cc b/cpp/src/gandiva/engine_llvm_test.cc
index 424b258..fe4f82e 100644
--- a/cpp/src/gandiva/engine_llvm_test.cc
+++ b/cpp/src/gandiva/engine_llvm_test.cc
@@ -100,11 +100,12 @@ llvm::Function* TestEngine::BuildVecAdd(Engine* engine, LLVMTypes* types) {
TEST_F(TestEngine, TestAddUnoptimised) {
std::unique_ptr<Engine> engine;
- Engine::Make(ConfigurationBuilder::DefaultConfiguration(), &engine);
+ Status status = Engine::Make(ConfigurationBuilder::DefaultConfiguration(), &engine);
+ EXPECT_TRUE(status.ok()) << status.message();
LLVMTypes types(*engine->context());
llvm::Function* ir_func = BuildVecAdd(engine.get(), &types);
- engine->FinalizeModule(false, false);
-
+ status = engine->FinalizeModule(false, false);
+ EXPECT_TRUE(status.ok()) << status.message();
add_vector_func_t add_func =
reinterpret_cast<add_vector_func_t>(engine->CompiledFunction(ir_func));
@@ -114,10 +115,12 @@ TEST_F(TestEngine, TestAddUnoptimised) {
TEST_F(TestEngine, TestAddOptimised) {
std::unique_ptr<Engine> engine;
- Engine::Make(ConfigurationBuilder::DefaultConfiguration(), &engine);
+ Status status = Engine::Make(ConfigurationBuilder::DefaultConfiguration(), &engine);
+ EXPECT_TRUE(status.ok()) << status.message();
LLVMTypes types(*engine->context());
llvm::Function* ir_func = BuildVecAdd(engine.get(), &types);
- engine->FinalizeModule(true, false);
+ status = engine->FinalizeModule(true, false);
+ EXPECT_TRUE(status.ok()) << status.message();
add_vector_func_t add_func =
reinterpret_cast<add_vector_func_t>(engine->CompiledFunction(ir_func));
diff --git a/cpp/src/gandiva/expr_decomposer.cc b/cpp/src/gandiva/expr_decomposer.cc
index a46c16e..bd6b467 100644
--- a/cpp/src/gandiva/expr_decomposer.cc
+++ b/cpp/src/gandiva/expr_decomposer.cc
@@ -72,7 +72,7 @@ Status ExprDecomposer::Visit(const FunctionNode& in_node) {
std::vector<ValueValidityPairPtr> args;
for (auto& child : node.children()) {
auto status = child->Accept(*this);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
args.push_back(result());
}
@@ -81,7 +81,7 @@ Status ExprDecomposer::Visit(const FunctionNode& in_node) {
std::shared_ptr<FunctionHolder> holder;
if (native_function->NeedsFunctionHolder()) {
auto status = FunctionHolderRegistry::Make(desc->name(), node, &holder);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
}
if (native_function->result_nullable_type() == RESULT_NULL_IF_NULL) {
@@ -121,20 +121,20 @@ Status ExprDecomposer::Visit(const FunctionNode& in_node) {
Status ExprDecomposer::Visit(const IfNode& node) {
PushConditionEntry(node);
auto status = node.condition()->Accept(*this);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
auto condition_vv = result();
PopConditionEntry(node);
// Add a local bitmap to track the output validity.
int local_bitmap_idx = PushThenEntry(node);
status = node.then_node()->Accept(*this);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
auto then_vv = result();
PopThenEntry(node);
PushElseEntry(node, local_bitmap_idx);
status = node.else_node()->Accept(*this);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
auto else_vv = result();
bool is_terminal_else = PopElseEntry(node);
@@ -153,7 +153,7 @@ Status ExprDecomposer::Visit(const BooleanNode& node) {
std::vector<ValueValidityPairPtr> args;
for (auto& child : node.children()) {
auto status = child->Accept(*this);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
args.push_back(result());
}
@@ -180,7 +180,7 @@ Status ExprDecomposer::Visit(const BooleanNode& node) {
/* decompose the children. */ \
std::vector<ValueValidityPairPtr> args; \
auto status = node.eval_expr()->Accept(*this); \
- GANDIVA_RETURN_NOT_OK(status); \
+ ARROW_RETURN_NOT_OK(status); \
args.push_back(result()); \
/* In always outputs valid results, so no validity dex */ \
auto value_dex = std::make_shared<InExprDex<ctype>>(args, node.values()); \
diff --git a/cpp/src/gandiva/expr_decomposer.h b/cpp/src/gandiva/expr_decomposer.h
index 4b9ad5b..28fa616 100644
--- a/cpp/src/gandiva/expr_decomposer.h
+++ b/cpp/src/gandiva/expr_decomposer.h
@@ -24,6 +24,7 @@
#include <utility>
#include <gtest/gtest_prod.h>
+#include "gandiva/arrow.h"
#include "gandiva/expression.h"
#include "gandiva/node.h"
#include "gandiva/node_visitor.h"
diff --git a/cpp/src/gandiva/expr_validator.cc b/cpp/src/gandiva/expr_validator.cc
index 11cc48c..3f5d637 100644
--- a/cpp/src/gandiva/expr_validator.cc
+++ b/cpp/src/gandiva/expr_validator.cc
@@ -85,18 +85,18 @@ Status ExprValidator::Visit(const FunctionNode& node) {
for (auto& child : node.children()) {
Status status = child->Accept(*this);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
}
return Status::OK();
}
Status ExprValidator::Visit(const IfNode& node) {
Status status = node.condition()->Accept(*this);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
status = node.then_node()->Accept(*this);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
status = node.else_node()->Accept(*this);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
auto if_node_ret_type = node.return_type();
auto then_node_ret_type = node.then_node()->return_type();
@@ -149,7 +149,7 @@ Status ExprValidator::Visit(const BooleanNode& node) {
}
status = child->Accept(*this);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
}
return Status::OK();
}
diff --git a/cpp/src/gandiva/expr_validator.h b/cpp/src/gandiva/expr_validator.h
index ab03b0d..5bb54db 100644
--- a/cpp/src/gandiva/expr_validator.h
+++ b/cpp/src/gandiva/expr_validator.h
@@ -21,14 +21,15 @@
#include <string>
#include <unordered_map>
+#include "arrow/status.h"
#include "boost/functional/hash.hpp"
+
#include "gandiva/arrow.h"
#include "gandiva/expression.h"
#include "gandiva/function_registry.h"
#include "gandiva/llvm_types.h"
#include "gandiva/node.h"
#include "gandiva/node_visitor.h"
-#include "gandiva/status.h"
namespace gandiva {
diff --git a/cpp/src/gandiva/filter.cc b/cpp/src/gandiva/filter.cc
index f2f99d9..16bfdec 100644
--- a/cpp/src/gandiva/filter.cc
+++ b/cpp/src/gandiva/filter.cc
@@ -28,7 +28,6 @@
#include "gandiva/filter_cache_key.h"
#include "gandiva/llvm_generator.h"
#include "gandiva/selection_vector_impl.h"
-#include "gandiva/status.h"
namespace gandiva {
@@ -41,12 +40,12 @@ Filter::Filter(std::unique_ptr<LLVMGenerator> llvm_generator, SchemaPtr schema,
Status Filter::Make(SchemaPtr schema, ConditionPtr condition,
std::shared_ptr<Configuration> configuration,
std::shared_ptr<Filter>* filter) {
- GANDIVA_RETURN_FAILURE_IF_FALSE(schema != nullptr,
- Status::Invalid("schema cannot be null"));
- GANDIVA_RETURN_FAILURE_IF_FALSE(condition != nullptr,
- Status::Invalid("condition cannot be null"));
- GANDIVA_RETURN_FAILURE_IF_FALSE(configuration != nullptr,
- Status::Invalid("configuration cannot be null"));
+ ARROW_RETURN_FAILURE_IF_FALSE(schema != nullptr,
+ Status::Invalid("schema cannot be null"));
+ ARROW_RETURN_FAILURE_IF_FALSE(condition != nullptr,
+ Status::Invalid("condition cannot be null"));
+ ARROW_RETURN_FAILURE_IF_FALSE(configuration != nullptr,
+ Status::Invalid("configuration cannot be null"));
static Cache<FilterCacheKey, std::shared_ptr<Filter>> cache;
FilterCacheKey cache_key(schema, configuration, *(condition.get()));
std::shared_ptr<Filter> cachedFilter = cache.GetModule(cache_key);
@@ -57,16 +56,16 @@ Status Filter::Make(SchemaPtr schema, ConditionPtr condition,
// Build LLVM generator, and generate code for the specified expression
std::unique_ptr<LLVMGenerator> llvm_gen;
Status status = LLVMGenerator::Make(configuration, &llvm_gen);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
// Run the validation on the expression.
// Return if the expression is invalid since we will not be able to process further.
ExprValidator expr_validator(llvm_gen->types(), schema);
status = expr_validator.Validate(condition);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
status = llvm_gen->Build({condition});
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
// Instantiate the filter with the completely built llvm generator
*filter = std::make_shared<Filter>(std::move(llvm_gen), schema, configuration);
@@ -105,7 +104,7 @@ Status Filter::Evaluate(const arrow::RecordBatch& batch,
// Execute the expression(s).
auto status = llvm_generator_->Execute(batch, {array_data});
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
// Compute the intersection of the value and validity.
auto result = bitmaps.GetLocalBitMap(2);
diff --git a/cpp/src/gandiva/filter.h b/cpp/src/gandiva/filter.h
index 5d266f4..6ff7010 100644
--- a/cpp/src/gandiva/filter.h
+++ b/cpp/src/gandiva/filter.h
@@ -23,11 +23,12 @@
#include <utility>
#include <vector>
+#include "arrow/status.h"
+
#include "gandiva/arrow.h"
#include "gandiva/condition.h"
#include "gandiva/configuration.h"
#include "gandiva/selection_vector.h"
-#include "gandiva/status.h"
namespace gandiva {
diff --git a/cpp/src/gandiva/function_holder_registry.h b/cpp/src/gandiva/function_holder_registry.h
index 34545da..7e2772e 100644
--- a/cpp/src/gandiva/function_holder_registry.h
+++ b/cpp/src/gandiva/function_holder_registry.h
@@ -23,10 +23,11 @@
#include <string>
#include <unordered_map>
+#include "arrow/status.h"
+
#include "gandiva/function_holder.h"
#include "gandiva/like_holder.h"
#include "gandiva/node.h"
-#include "gandiva/status.h"
#include "gandiva/to_date_holder.h"
namespace gandiva {
diff --git a/cpp/src/gandiva/jni/jni_common.cc b/cpp/src/gandiva/jni/jni_common.cc
index f2cafc8..efc3c6e 100644
--- a/cpp/src/gandiva/jni/jni_common.cc
+++ b/cpp/src/gandiva/jni/jni_common.cc
@@ -20,6 +20,7 @@
#include <map>
#include <memory>
#include <mutex>
+#include <sstream>
#include <string>
#include <utility>
#include <vector>
diff --git a/cpp/src/gandiva/like_holder.cc b/cpp/src/gandiva/like_holder.cc
index 9509b59..d659b22 100644
--- a/cpp/src/gandiva/like_holder.cc
+++ b/cpp/src/gandiva/like_holder.cc
@@ -77,7 +77,7 @@ Status LikeHolder::Make(const std::string& sql_pattern,
std::shared_ptr<LikeHolder>* holder) {
std::string pcre_pattern;
auto status = RegexUtil::SqlLikePatternToPcre(sql_pattern, pcre_pattern);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
auto lholder = std::shared_ptr<LikeHolder>(new LikeHolder(pcre_pattern));
if (!lholder->regex_.ok()) {
diff --git a/cpp/src/gandiva/like_holder.h b/cpp/src/gandiva/like_holder.h
index 4d5a32c..23ed367 100644
--- a/cpp/src/gandiva/like_holder.h
+++ b/cpp/src/gandiva/like_holder.h
@@ -22,9 +22,9 @@
#include <string>
#include <re2/re2.h>
+#include "arrow/status.h"
#include "gandiva/function_holder.h"
#include "gandiva/node.h"
-#include "gandiva/status.h"
namespace gandiva {
diff --git a/cpp/src/gandiva/llvm_generator.cc b/cpp/src/gandiva/llvm_generator.cc
index 46f42e1..17d7f47 100644
--- a/cpp/src/gandiva/llvm_generator.cc
+++ b/cpp/src/gandiva/llvm_generator.cc
@@ -19,6 +19,7 @@
#include <fstream>
#include <iostream>
+#include <sstream>
#include <string>
#include <utility>
#include <vector>
@@ -44,7 +45,7 @@ Status LLVMGenerator::Make(std::shared_ptr<Configuration> config,
std::unique_ptr<LLVMGenerator>* llvm_generator) {
std::unique_ptr<LLVMGenerator> llvmgen_obj(new LLVMGenerator());
Status status = Engine::Make(config, &(llvmgen_obj->engine_));
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
*llvm_generator = std::move(llvmgen_obj);
return Status::OK();
@@ -57,12 +58,12 @@ Status LLVMGenerator::Add(const ExpressionPtr expr, const FieldDescriptorPtr out
ExprDecomposer decomposer(function_registry_, annotator_);
ValueValidityPairPtr value_validity;
auto status = decomposer.Decompose(*expr->root(), &value_validity);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
// Generate the IR function for the decomposed expression.
llvm::Function* ir_function = nullptr;
status = CodeGenExprValue(value_validity->value_expr(), output, idx, &ir_function);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
std::unique_ptr<CompiledExpr> compiled_expr(
new CompiledExpr(value_validity, output, ir_function));
@@ -77,12 +78,12 @@ Status LLVMGenerator::Build(const ExpressionVector& exprs) {
for (auto& expr : exprs) {
auto output = annotator_.AddOutputFieldDescriptor(expr->result());
status = Add(expr, output);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
}
// optimise, compile and finalize the module
status = engine_->FinalizeModule(optimise_ir_, dump_ir_);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
// setup the jit functions for each expression.
for (auto& compiled_expr : compiled_exprs_) {
@@ -232,8 +233,8 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, FieldDescriptorPtr out
engine_->AddFunctionToCompile(func_name);
*fn = llvm::Function::Create(prototype, llvm::GlobalValue::ExternalLinkage, func_name,
module());
- GANDIVA_RETURN_FAILURE_IF_FALSE((*fn != nullptr),
- Status::CodeGenError("Error creating function."));
+ ARROW_RETURN_FAILURE_IF_FALSE((*fn != nullptr),
+ Status::CodeGenError("Error creating function."));
// Name the arguments
llvm::Function::arg_iterator args = (*fn)->arg_begin();
llvm::Value* arg_addrs = &*args;
diff --git a/cpp/src/gandiva/llvm_generator_test.cc b/cpp/src/gandiva/llvm_generator_test.cc
index 998aacb..818c791 100644
--- a/cpp/src/gandiva/llvm_generator_test.cc
+++ b/cpp/src/gandiva/llvm_generator_test.cc
@@ -88,9 +88,11 @@ TEST_F(TestLLVMGenerator, TestAdd) {
llvm::Function* ir_func = nullptr;
status = generator->CodeGenExprValue(func_dex, desc_sum, 0, &ir_func);
- ASSERT_TRUE(status.ok());
+ EXPECT_TRUE(status.ok()) << status.message();
+
+ status = generator->engine_->FinalizeModule(true, false);
+ EXPECT_TRUE(status.ok()) << status.message();
- generator->engine_->FinalizeModule(true, false);
EvalFunc eval_func = (EvalFunc)generator->engine_->CompiledFunction(ir_func);
int num_records = 4;
diff --git a/cpp/src/gandiva/node.h b/cpp/src/gandiva/node.h
index c0bb81e..8768fab 100644
--- a/cpp/src/gandiva/node.h
+++ b/cpp/src/gandiva/node.h
@@ -22,12 +22,13 @@
#include <unordered_set>
#include <vector>
+#include "arrow/status.h"
+
#include "gandiva/arrow.h"
#include "gandiva/func_descriptor.h"
#include "gandiva/gandiva_aliases.h"
#include "gandiva/literal_holder.h"
#include "gandiva/node_visitor.h"
-#include "gandiva/status.h"
namespace gandiva {
diff --git a/cpp/src/gandiva/node_visitor.h b/cpp/src/gandiva/node_visitor.h
index b8f95bc..ba3645a 100644
--- a/cpp/src/gandiva/node_visitor.h
+++ b/cpp/src/gandiva/node_visitor.h
@@ -20,8 +20,9 @@
#include <string>
+#include "arrow/status.h"
+
#include "gandiva/logging.h"
-#include "gandiva/status.h"
namespace gandiva {
diff --git a/cpp/src/gandiva/projector.cc b/cpp/src/gandiva/projector.cc
index 04bb5e3..51a370e 100644
--- a/cpp/src/gandiva/projector.cc
+++ b/cpp/src/gandiva/projector.cc
@@ -25,7 +25,6 @@
#include "gandiva/expr_validator.h"
#include "gandiva/llvm_generator.h"
#include "gandiva/projector_cache_key.h"
-#include "gandiva/status.h"
namespace gandiva {
@@ -46,12 +45,12 @@ Status Projector::Make(SchemaPtr schema, const ExpressionVector& exprs,
Status Projector::Make(SchemaPtr schema, const ExpressionVector& exprs,
std::shared_ptr<Configuration> configuration,
std::shared_ptr<Projector>* projector) {
- GANDIVA_RETURN_FAILURE_IF_FALSE(schema != nullptr,
- Status::Invalid("schema cannot be null"));
- GANDIVA_RETURN_FAILURE_IF_FALSE(!exprs.empty(),
- Status::Invalid("expressions need to be non-empty"));
- GANDIVA_RETURN_FAILURE_IF_FALSE(configuration != nullptr,
- Status::Invalid("configuration cannot be null"));
+ ARROW_RETURN_FAILURE_IF_FALSE(schema != nullptr,
+ Status::Invalid("schema cannot be null"));
+ ARROW_RETURN_FAILURE_IF_FALSE(!exprs.empty(),
+ Status::Invalid("expressions need to be non-empty"));
+ ARROW_RETURN_FAILURE_IF_FALSE(configuration != nullptr,
+ Status::Invalid("configuration cannot be null"));
// see if equivalent projector was already built
static Cache<ProjectorCacheKey, std::shared_ptr<Projector>> cache;
@@ -65,7 +64,7 @@ Status Projector::Make(SchemaPtr schema, const ExpressionVector& exprs,
// Build LLVM generator, and generate code for the specified expressions
std::unique_ptr<LLVMGenerator> llvm_gen;
Status status = LLVMGenerator::Make(configuration, &llvm_gen);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
// Run the validation on the expressions.
// Return if any of the expression is invalid since
@@ -73,11 +72,11 @@ Status Projector::Make(SchemaPtr schema, const ExpressionVector& exprs,
ExprValidator expr_validator(llvm_gen->types(), schema);
for (auto& expr : exprs) {
status = expr_validator.Validate(expr);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
}
status = llvm_gen->Build(exprs);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
// save the output field types. Used for validation at Evaluate() time.
std::vector<FieldPtr> output_fields;
@@ -96,7 +95,7 @@ Status Projector::Make(SchemaPtr schema, const ExpressionVector& exprs,
Status Projector::Evaluate(const arrow::RecordBatch& batch,
const ArrayDataVector& output_data_vecs) {
Status status = ValidateEvaluateArgsCommon(batch);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
if (output_data_vecs.size() != output_fields_.size()) {
std::stringstream ss;
@@ -115,7 +114,7 @@ Status Projector::Evaluate(const arrow::RecordBatch& batch,
Status status = ValidateArrayDataCapacity(*array_data, *(output_fields_[idx]),
static_cast<int>(batch.num_rows()));
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
++idx;
}
return llvm_generator_->Execute(batch, output_data_vecs);
@@ -124,7 +123,7 @@ Status Projector::Evaluate(const arrow::RecordBatch& batch,
Status Projector::Evaluate(const arrow::RecordBatch& batch, arrow::MemoryPool* pool,
arrow::ArrayVector* output) {
Status status = ValidateEvaluateArgsCommon(batch);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
if (output == nullptr) {
return Status::Invalid("output must be non-null.");
@@ -141,14 +140,14 @@ Status Projector::Evaluate(const arrow::RecordBatch& batch, arrow::MemoryPool* p
status = AllocArrayData(field->type(), static_cast<int>(batch.num_rows()), pool,
&output_data);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
output_data_vecs.push_back(output_data);
}
// Execute the expression(s).
status = llvm_generator_->Execute(batch, output_data_vecs);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
// Create and return array arrays.
output->clear();
@@ -169,13 +168,13 @@ Status Projector::AllocArrayData(const DataTypePtr& type, int num_records,
std::shared_ptr<arrow::Buffer> null_bitmap;
int64_t size = arrow::BitUtil::BytesForBits(num_records);
astatus = arrow::AllocateBuffer(pool, size, &null_bitmap);
- GANDIVA_RETURN_ARROW_NOT_OK(astatus);
+ ARROW_RETURN_NOT_OK(astatus);
std::shared_ptr<arrow::Buffer> data;
const auto& fw_type = dynamic_cast<const arrow::FixedWidthType&>(*type);
int64_t data_len = arrow::BitUtil::BytesForBits(num_records * fw_type.bit_width());
astatus = arrow::AllocateBuffer(pool, data_len, &data);
- GANDIVA_RETURN_ARROW_NOT_OK(astatus);
+ ARROW_RETURN_NOT_OK(astatus);
*array_data = arrow::ArrayData::Make(type, num_records, {null_bitmap, data});
return Status::OK();
diff --git a/cpp/src/gandiva/projector.h b/cpp/src/gandiva/projector.h
index efb6f4e..7ab45ff 100644
--- a/cpp/src/gandiva/projector.h
+++ b/cpp/src/gandiva/projector.h
@@ -23,10 +23,11 @@
#include <utility>
#include <vector>
+#include "arrow/status.h"
+
#include "gandiva/arrow.h"
#include "gandiva/configuration.h"
#include "gandiva/expression.h"
-#include "gandiva/status.h"
namespace gandiva {
diff --git a/cpp/src/gandiva/regex_util.h b/cpp/src/gandiva/regex_util.h
index 99bb40a..6a22af2 100644
--- a/cpp/src/gandiva/regex_util.h
+++ b/cpp/src/gandiva/regex_util.h
@@ -19,9 +19,10 @@
#define GANDIVA_REGEX_UTIL_H
#include <set>
+#include <sstream>
#include <string>
-#include "gandiva/status.h"
+#include "gandiva/arrow.h"
namespace gandiva {
diff --git a/cpp/src/gandiva/selection_vector.cc b/cpp/src/gandiva/selection_vector.cc
index a36cba9..0fd64a4 100644
--- a/cpp/src/gandiva/selection_vector.cc
+++ b/cpp/src/gandiva/selection_vector.cc
@@ -18,11 +18,11 @@
#include "gandiva/selection_vector.h"
#include <memory>
+#include <sstream>
#include <utility>
#include <vector>
#include "gandiva/selection_vector_impl.h"
-#include "gandiva/status.h"
namespace gandiva {
@@ -76,7 +76,7 @@ Status SelectionVector::PopulateFromBitMap(const uint8_t* bitmap, int bitmap_siz
Status SelectionVector::MakeInt16(int max_slots, std::shared_ptr<arrow::Buffer> buffer,
std::shared_ptr<SelectionVector>* selection_vector) {
auto status = SelectionVectorInt16::ValidateBuffer(max_slots, buffer);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
*selection_vector = std::make_shared<SelectionVectorInt16>(max_slots, buffer);
return Status::OK();
@@ -86,7 +86,7 @@ Status SelectionVector::MakeInt16(int max_slots, arrow::MemoryPool* pool,
std::shared_ptr<SelectionVector>* selection_vector) {
std::shared_ptr<arrow::Buffer> buffer;
auto status = SelectionVectorInt16::AllocateBuffer(max_slots, pool, &buffer);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
*selection_vector = std::make_shared<SelectionVectorInt16>(max_slots, buffer);
return Status::OK();
@@ -95,7 +95,7 @@ Status SelectionVector::MakeInt16(int max_slots, arrow::MemoryPool* pool,
Status SelectionVector::MakeInt32(int max_slots, std::shared_ptr<arrow::Buffer> buffer,
std::shared_ptr<SelectionVector>* selection_vector) {
auto status = SelectionVectorInt32::ValidateBuffer(max_slots, buffer);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
*selection_vector = std::make_shared<SelectionVectorInt32>(max_slots, buffer);
return Status::OK();
@@ -105,7 +105,7 @@ Status SelectionVector::MakeInt32(int max_slots, arrow::MemoryPool* pool,
std::shared_ptr<SelectionVector>* selection_vector) {
std::shared_ptr<arrow::Buffer> buffer;
auto status = SelectionVectorInt32::AllocateBuffer(max_slots, pool, &buffer);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
*selection_vector = std::make_shared<SelectionVectorInt32>(max_slots, buffer);
return Status::OK();
@@ -116,7 +116,7 @@ Status SelectionVectorImpl<C_TYPE, A_TYPE>::AllocateBuffer(
int max_slots, arrow::MemoryPool* pool, std::shared_ptr<arrow::Buffer>* buffer) {
auto buffer_len = max_slots * sizeof(C_TYPE);
auto astatus = arrow::AllocateBuffer(pool, buffer_len, buffer);
- GANDIVA_RETURN_ARROW_NOT_OK(astatus);
+ ARROW_RETURN_NOT_OK(astatus);
return Status::OK();
}
diff --git a/cpp/src/gandiva/selection_vector.h b/cpp/src/gandiva/selection_vector.h
index b6a7ad8..4dd9fe7 100644
--- a/cpp/src/gandiva/selection_vector.h
+++ b/cpp/src/gandiva/selection_vector.h
@@ -20,9 +20,10 @@
#include <memory>
+#include "arrow/status.h"
+
#include "gandiva/arrow.h"
#include "gandiva/logging.h"
-#include "gandiva/status.h"
namespace gandiva {
diff --git a/cpp/src/gandiva/selection_vector_impl.h b/cpp/src/gandiva/selection_vector_impl.h
index 80d3521..a628bf0 100644
--- a/cpp/src/gandiva/selection_vector_impl.h
+++ b/cpp/src/gandiva/selection_vector_impl.h
@@ -21,12 +21,12 @@
#include <limits>
#include <memory>
+#include "arrow/status.h"
#include "arrow/util/macros.h"
#include "gandiva/arrow.h"
#include "gandiva/logging.h"
#include "gandiva/selection_vector.h"
-#include "gandiva/status.h"
namespace gandiva {
diff --git a/cpp/src/gandiva/status.h b/cpp/src/gandiva/status.h
deleted file mode 100644
index 68e1230..0000000
--- a/cpp/src/gandiva/status.h
+++ /dev/null
@@ -1,272 +0,0 @@
-// 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.
-
-#ifndef GANDIVA_STATUS_H
-#define GANDIVA_STATUS_H
-
-#include <assert.h>
-#include <sstream>
-#include <string>
-#include <utility>
-
-#include "arrow/util/macros.h"
-
-#define GANDIVA_RETURN_NOT_OK(status) \
- do { \
- Status _status = (status); \
- if (!_status.ok()) { \
- std::stringstream ss; \
- ss << __FILE__ << ":" << __LINE__ << " code: " << _status.CodeAsString() << " \n " \
- << _status.message(); \
- return Status(_status.code(), ss.str()); \
- } \
- } while (0)
-
-#define GANDIVA_RETURN_FAILURE_IF_FALSE(condition, status) \
- do { \
- if (!(condition)) { \
- Status _status = (status); \
- std::stringstream ss; \
- ss << __FILE__ << ":" << __LINE__ << " code: " << _status.CodeAsString() << " \n " \
- << _status.message(); \
- return Status(_status.code(), ss.str()); \
- } \
- } while (0)
-
-// Check arrow status & convert to gandiva status on error.
-#define GANDIVA_RETURN_ARROW_NOT_OK(astatus) \
- do { \
- if (!(astatus).ok()) { \
- return Status(StatusCode::ArrowError, (astatus).message()); \
- } \
- } while (0)
-
-namespace gandiva {
-
-enum class StatusCode : char {
- OK = 0,
- Invalid = 1,
- CodeGenError = 2,
- ArrowError = 3,
- ExpressionValidationError = 4,
- ExecutionError = 5,
-};
-
-class Status {
- public:
- // Create a success status.
- Status() : state_(NULL) {}
- ~Status() { delete state_; }
-
- Status(StatusCode code, const std::string& msg);
-
- // Copy the specified status.
- Status(const Status& s);
- Status& operator=(const Status& s);
-
- // Move the specified status.
- Status(Status&& s);
- Status& operator=(Status&& s);
-
- // AND the statuses.
- Status operator&(const Status& s) const;
- Status operator&(Status&& s) const;
- Status& operator&=(const Status& s);
- Status& operator&=(Status&& s);
-
- // Return a success status.
- static Status OK() { return Status(); }
-
- // Return error status of an appropriate type.
- static Status CodeGenError(const std::string& msg) {
- return Status(StatusCode::CodeGenError, msg);
- }
-
- static Status Invalid(const std::string& msg) {
- return Status(StatusCode::Invalid, msg);
- }
-
- static Status ArrowError(const std::string& msg) {
- return Status(StatusCode::ArrowError, msg);
- }
-
- static Status ExpressionValidationError(const std::string& msg) {
- return Status(StatusCode::ExpressionValidationError, msg);
- }
-
- static Status ExecutionError(const std::string& msg) {
- return Status(StatusCode::ExecutionError, msg);
- }
-
- // Returns true if the status indicates success.
- bool ok() const { return (state_ == NULL); }
-
- bool IsCodeGenError() const { return code() == StatusCode::CodeGenError; }
-
- bool IsInvalid() const { return code() == StatusCode::Invalid; }
-
- bool IsArrowError() const { return code() == StatusCode::ArrowError; }
-
- bool IsExpressionValidationError() const {
- return code() == StatusCode::ExpressionValidationError;
- }
-
- bool IsExecutionError() const { return code() == StatusCode::ExecutionError; }
-
- // Return a string representation of this status suitable for printing.
- // Returns the string "OK" for success.
- std::string ToString() const;
-
- // Return a string representation of the status code, without the message
- // text or posix code information.
- std::string CodeAsString() const;
-
- StatusCode code() const { return ok() ? StatusCode::OK : state_->code; }
-
- std::string message() const { return ok() ? "" : state_->msg; }
-
- private:
- struct State {
- StatusCode code;
- std::string msg;
- };
- // OK status has a `NULL` state_. Otherwise, `state_` points to
- // a `State` structure containing the error code and message(s)
- State* state_;
-
- void CopyFrom(const Status& s);
- void MoveFrom(Status& s);
-};
-
-static inline std::ostream& operator<<(std::ostream& os, const Status& x) {
- os << x.ToString();
- return os;
-}
-
-inline Status::Status(const Status& s)
- : state_((s.state_ == NULL) ? NULL : new State(*s.state_)) {}
-
-inline Status& Status::operator=(const Status& s) {
- // The following condition catches both aliasing (when this == &s),
- // and the common case where both s and *this are ok.
- if (state_ != s.state_) {
- CopyFrom(s);
- }
- return *this;
-}
-
-inline Status::Status(Status&& s) : state_(s.state_) { s.state_ = NULL; }
-
-inline Status& Status::operator=(Status&& s) {
- MoveFrom(s);
- return *this;
-}
-
-inline Status Status::operator&(const Status& s) const {
- if (ok()) {
- return s;
- } else {
- return *this;
- }
-}
-
-inline Status Status::operator&(Status&& s) const {
- if (ok()) {
- return std::move(s);
- } else {
- return *this;
- }
-}
-
-inline Status& Status::operator&=(const Status& s) {
- if (ok() && !s.ok()) {
- CopyFrom(s);
- }
- return *this;
-}
-
-inline Status& Status::operator&=(Status&& s) {
- if (ok() && !s.ok()) {
- MoveFrom(s);
- }
- return *this;
-}
-
-inline Status::Status(StatusCode code, const std::string& msg) {
- assert(code != StatusCode::OK);
- state_ = new State;
- state_->code = code;
- state_->msg = msg;
-}
-
-inline void Status::CopyFrom(const Status& s) {
- delete state_;
- if (s.state_ == NULLPTR) {
- state_ = NULLPTR;
- } else {
- state_ = new State(*s.state_);
- }
-}
-
-inline std::string Status::CodeAsString() const {
- if (state_ == NULLPTR) {
- return "OK";
- }
-
- const char* type;
- switch (code()) {
- case StatusCode::OK:
- type = "OK";
- break;
- case StatusCode::CodeGenError:
- type = "CodeGenError";
- break;
- case StatusCode::Invalid:
- type = "Invalid";
- break;
- case StatusCode::ExpressionValidationError:
- type = "ExpressionValidationError";
- break;
- case StatusCode::ExecutionError:
- type = "ExecutionError";
- break;
- default:
- type = "Unknown";
- break;
- }
- return std::string(type);
-}
-
-inline void Status::MoveFrom(Status& s) {
- delete state_;
- state_ = s.state_;
- s.state_ = NULL;
-}
-
-inline std::string Status::ToString() const {
- std::string result(CodeAsString());
- if (state_ == NULL) {
- return result;
- }
- result += ": ";
- result += state_->msg;
- return result;
-}
-
-} // namespace gandiva
-
-#endif // GANDIVA_STATUS_H
diff --git a/cpp/src/gandiva/status_test.cc b/cpp/src/gandiva/status_test.cc
deleted file mode 100644
index d88be35..0000000
--- a/cpp/src/gandiva/status_test.cc
+++ /dev/null
@@ -1,71 +0,0 @@
-// 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.
-
-#include "gandiva/status.h"
-
-#include <sstream>
-
-#include <gtest/gtest.h>
-
-namespace gandiva {
-
-TEST(StatusTest, TestCodeAndMessage) {
- Status ok = Status::OK();
- ASSERT_EQ(StatusCode::OK, ok.code());
- Status code_gen_error = Status::CodeGenError("input invalid.");
- ASSERT_EQ(StatusCode::CodeGenError, code_gen_error.code());
- ASSERT_EQ("input invalid.", code_gen_error.message());
-}
-
-TEST(StatusTest, TestToString) {
- Status code_gen_error = Status::CodeGenError("input invalid.");
- ASSERT_EQ("CodeGenError: input invalid.", code_gen_error.ToString());
-
- std::stringstream ss;
- ss << code_gen_error;
- ASSERT_EQ(code_gen_error.ToString(), ss.str());
-}
-
-TEST(StatusTest, AndStatus) {
- Status a = Status::OK();
- Status b = Status::OK();
- Status c = Status::CodeGenError("invalid value");
-
- Status res;
- res = a & b;
- ASSERT_TRUE(res.ok());
- res = a & c;
- ASSERT_TRUE(res.IsCodeGenError());
-
- res = Status::OK();
- res &= c;
- ASSERT_TRUE(res.IsCodeGenError());
-
- // With rvalues
- res = Status::OK() & Status::CodeGenError("foo");
- ASSERT_TRUE(res.IsCodeGenError());
- res = Status::CodeGenError("foo") & Status::OK();
- ASSERT_TRUE(res.IsCodeGenError());
-
- res = Status::OK();
- res &= Status::OK();
- ASSERT_TRUE(res.ok());
- res &= Status::CodeGenError("foo");
- ASSERT_TRUE(res.IsCodeGenError());
-}
-
-} // namespace gandiva
diff --git a/cpp/src/gandiva/tests/binary_test.cc b/cpp/src/gandiva/tests/binary_test.cc
index 74f9839..d5d99db 100644
--- a/cpp/src/gandiva/tests/binary_test.cc
+++ b/cpp/src/gandiva/tests/binary_test.cc
@@ -17,8 +17,9 @@
#include <gtest/gtest.h>
#include "arrow/memory_pool.h"
+#include "arrow/status.h"
+
#include "gandiva/projector.h"
-#include "gandiva/status.h"
#include "gandiva/tests/test_util.h"
#include "gandiva/tree_expr_builder.h"
diff --git a/cpp/src/gandiva/tests/boolean_expr_test.cc b/cpp/src/gandiva/tests/boolean_expr_test.cc
index 45e2120..3351ab3 100644
--- a/cpp/src/gandiva/tests/boolean_expr_test.cc
+++ b/cpp/src/gandiva/tests/boolean_expr_test.cc
@@ -17,8 +17,9 @@
#include <gtest/gtest.h>
#include "arrow/memory_pool.h"
+#include "arrow/status.h"
+
#include "gandiva/projector.h"
-#include "gandiva/status.h"
#include "gandiva/tests/test_util.h"
#include "gandiva/tree_expr_builder.h"
@@ -81,7 +82,7 @@ TEST_F(TestBooleanExpr, SimpleAnd) {
exp = MakeArrowArrayBool({false, false, false, false}, {true, false, false, false});
in_batch = arrow::RecordBatch::Make(schema, num_records, {arraya, arrayb});
outputs.clear();
- projector->Evaluate(*in_batch, pool_, &outputs);
+ status = projector->Evaluate(*in_batch, pool_, &outputs);
EXPECT_TRUE(status.ok());
EXPECT_ARROW_ARRAY_EQUALS(exp, outputs.at(0));
@@ -92,7 +93,7 @@ TEST_F(TestBooleanExpr, SimpleAnd) {
exp = MakeArrowArrayBool({false, false, true, false}, {true, false, true, false});
in_batch = arrow::RecordBatch::Make(schema, num_records, {arraya, arrayb});
outputs.clear();
- projector->Evaluate(*in_batch, pool_, &outputs);
+ status = projector->Evaluate(*in_batch, pool_, &outputs);
EXPECT_TRUE(status.ok());
EXPECT_ARROW_ARRAY_EQUALS(exp, outputs.at(0));
@@ -103,7 +104,7 @@ TEST_F(TestBooleanExpr, SimpleAnd) {
exp = MakeArrowArrayBool({false, false, false, false}, {true, false, false, false});
in_batch = arrow::RecordBatch::Make(schema, num_records, {arraya, arrayb});
outputs.clear();
- projector->Evaluate(*in_batch, pool_, &outputs);
+ status = projector->Evaluate(*in_batch, pool_, &outputs);
EXPECT_TRUE(status.ok());
EXPECT_ARROW_ARRAY_EQUALS(exp, outputs.at(0));
}
@@ -154,7 +155,7 @@ TEST_F(TestBooleanExpr, SimpleOr) {
exp = MakeArrowArrayBool({false, false, true, false}, {false, false, true, false});
in_batch = arrow::RecordBatch::Make(schema, num_records, {arraya, arrayb});
outputs.clear();
- projector->Evaluate(*in_batch, pool_, &outputs);
+ status = projector->Evaluate(*in_batch, pool_, &outputs);
EXPECT_TRUE(status.ok());
EXPECT_ARROW_ARRAY_EQUALS(exp, outputs.at(0));
@@ -165,7 +166,7 @@ TEST_F(TestBooleanExpr, SimpleOr) {
exp = MakeArrowArrayBool({false, false, true, false}, {true, false, true, false});
in_batch = arrow::RecordBatch::Make(schema, num_records, {arraya, arrayb});
outputs.clear();
- projector->Evaluate(*in_batch, pool_, &outputs);
+ status = projector->Evaluate(*in_batch, pool_, &outputs);
EXPECT_TRUE(status.ok());
EXPECT_ARROW_ARRAY_EQUALS(exp, outputs.at(0));
@@ -176,7 +177,7 @@ TEST_F(TestBooleanExpr, SimpleOr) {
exp = MakeArrowArrayBool({false, false, true, false}, {false, false, true, false});
in_batch = arrow::RecordBatch::Make(schema, num_records, {arraya, arrayb});
outputs.clear();
- projector->Evaluate(*in_batch, pool_, &outputs);
+ status = projector->Evaluate(*in_batch, pool_, &outputs);
EXPECT_TRUE(status.ok());
EXPECT_ARROW_ARRAY_EQUALS(exp, outputs.at(0));
}
diff --git a/cpp/src/gandiva/tests/hash_test.cc b/cpp/src/gandiva/tests/hash_test.cc
index fbe5a4a..96f9228 100644
--- a/cpp/src/gandiva/tests/hash_test.cc
+++ b/cpp/src/gandiva/tests/hash_test.cc
@@ -15,10 +15,13 @@
// specific language governing permissions and limitations
// under the License.
+#include <sstream>
+
#include <gtest/gtest.h>
#include "arrow/memory_pool.h"
+#include "arrow/status.h"
+
#include "gandiva/projector.h"
-#include "gandiva/status.h"
#include "gandiva/tests/test_util.h"
#include "gandiva/tree_expr_builder.h"
diff --git a/cpp/src/gandiva/tests/if_expr_test.cc b/cpp/src/gandiva/tests/if_expr_test.cc
index 811137f..93b3567 100644
--- a/cpp/src/gandiva/tests/if_expr_test.cc
+++ b/cpp/src/gandiva/tests/if_expr_test.cc
@@ -17,8 +17,9 @@
#include <gtest/gtest.h>
#include "arrow/memory_pool.h"
+#include "arrow/status.h"
+
#include "gandiva/projector.h"
-#include "gandiva/status.h"
#include "gandiva/tests/test_util.h"
#include "gandiva/tree_expr_builder.h"
diff --git a/cpp/src/gandiva/tests/literal_test.cc b/cpp/src/gandiva/tests/literal_test.cc
index e6f81e975..ced6645 100644
--- a/cpp/src/gandiva/tests/literal_test.cc
+++ b/cpp/src/gandiva/tests/literal_test.cc
@@ -17,8 +17,9 @@
#include <gtest/gtest.h>
#include "arrow/memory_pool.h"
+#include "arrow/status.h"
+
#include "gandiva/projector.h"
-#include "gandiva/status.h"
#include "gandiva/tests/test_util.h"
#include "gandiva/tree_expr_builder.h"
diff --git a/cpp/src/gandiva/tests/micro_benchmarks.cc b/cpp/src/gandiva/tests/micro_benchmarks.cc
index 936378a..89eeed0 100644
--- a/cpp/src/gandiva/tests/micro_benchmarks.cc
+++ b/cpp/src/gandiva/tests/micro_benchmarks.cc
@@ -18,8 +18,8 @@
#include <gtest/gtest.h>
#include "arrow/memory_pool.h"
+#include "arrow/status.h"
#include "gandiva/projector.h"
-#include "gandiva/status.h"
#include "gandiva/tests/test_util.h"
#include "gandiva/tests/timed_evaluate.h"
#include "gandiva/tree_expr_builder.h"
diff --git a/cpp/src/gandiva/tests/utf8_test.cc b/cpp/src/gandiva/tests/utf8_test.cc
index 63d49dd..a0684fe 100644
--- a/cpp/src/gandiva/tests/utf8_test.cc
+++ b/cpp/src/gandiva/tests/utf8_test.cc
@@ -17,8 +17,9 @@
#include <gtest/gtest.h>
#include "arrow/memory_pool.h"
+#include "arrow/status.h"
+
#include "gandiva/projector.h"
-#include "gandiva/status.h"
#include "gandiva/tests/test_util.h"
#include "gandiva/tree_expr_builder.h"
diff --git a/cpp/src/gandiva/to_date_holder.cc b/cpp/src/gandiva/to_date_holder.cc
index 4f08b10..054e25f 100644
--- a/cpp/src/gandiva/to_date_holder.cc
+++ b/cpp/src/gandiva/to_date_holder.cc
@@ -64,7 +64,7 @@ Status ToDateHolder::Make(const std::string& sql_pattern, int32_t suppress_error
std::shared_ptr<ToDateHolder>* holder) {
std::shared_ptr<std::string> transformed_pattern;
Status status = DateUtils::ToInternalFormat(sql_pattern, &transformed_pattern);
- GANDIVA_RETURN_NOT_OK(status);
+ ARROW_RETURN_NOT_OK(status);
auto lholder = std::shared_ptr<ToDateHolder>(
new ToDateHolder(*(transformed_pattern.get()), suppress_errors));
*holder = lholder;
diff --git a/cpp/src/gandiva/to_date_holder.h b/cpp/src/gandiva/to_date_holder.h
index 8feff3d..91133cc 100644
--- a/cpp/src/gandiva/to_date_holder.h
+++ b/cpp/src/gandiva/to_date_holder.h
@@ -22,10 +22,11 @@
#include <string>
#include <unordered_map>
+#include "arrow/status.h"
+
#include "gandiva/execution_context.h"
#include "gandiva/function_holder.h"
#include "gandiva/node.h"
-#include "gandiva/status.h"
namespace gandiva {