You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2019/06/11 23:56:07 UTC

[arrow] branch master updated: ARROW-5486: [GLib] Add binding of gandiva::FunctionRegistry and related things

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

kou 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 9c753c4  ARROW-5486: [GLib] Add binding of gandiva::FunctionRegistry and related things
9c753c4 is described below

commit 9c753c4e88cbc4f2881d0c10213e947c3b9adf0c
Author: Kenta Murata <mr...@mrkn.jp>
AuthorDate: Wed Jun 12 08:55:52 2019 +0900

    ARROW-5486: [GLib] Add binding of gandiva::FunctionRegistry and related things
    
    I'd like to add a support of gandiva::FunctionRegistry and the related things in gandiva-glib.
    
    TODO:
    - [x] implements binding
    - [x] make a JIRA ticket
    - [x] write tests
    
    Author: Kenta Murata <mr...@mrkn.jp>
    Author: Kouhei Sutou <ko...@clear-code.com>
    
    Closes #4424 from mrkn/gandiva_glib_function_registry and squashes the following commits:
    
    59fbd5518 <Kouhei Sutou> Clean equal tests
    1f0303269 <Kouhei Sutou> Simplify
    2d857f320 <Kouhei Sutou> Use sub_test_case
    550b1aa4e <Kouhei Sutou> Remove needless const
    f9cd73c4a <Kouhei Sutou> Use range for
    1f8eb8283 <Kouhei Sutou> Remove needless const
    864fb66cd <Kouhei Sutou> Style for
    f14614902 <Kouhei Sutou> Add missing a new line
    b8e59602a <Kouhei Sutou> Use ggandiva_native_function_get_raw()
    ddc922edc <Kouhei Sutou> Clean tests
    59840bf94 <Kouhei Sutou> gandiva::FunctionRegistry::LookupSignature() may return null
    85d1cce40 <Kouhei Sutou> Add ggandiva_native_function_equal()
    dc8bfdce1 <Kouhei Sutou> Remove _signature
    3736a8634 <Kouhei Sutou> Add missing native-function
    ce11144a6 <Kouhei Sutou> Add missing config.h include
    3aa2ae4df <Kenta Murata> Use assert block for predicate methods
    d6964267c <Kenta Murata> Use ggandiva_function_registry_lookup_signature in tests
    b6b0cdbbf <Kenta Murata> Simplify assertion
    392c25ccd <Kenta Murata> Fix variable name
    26d17d179 <Kenta Murata> Add ggandiva_function_registry_lookup_signature
    a96e8228a <Kenta Murata> Add test of Gandiva::FunctionSignature#==
    a5a085b71 <Kenta Murata> Add ggandiva_function_signature_new
    2deda77e1 <Kenta Murata> Remove redundant include
    2f8eff3dd <Kenta Murata> Remove needless const modifier
    a577c4464 <Kenta Murata> Fix function name
    eb6c84831 <Kenta Murata> Fix variable name
    8bf04957b <Kenta Murata> Fix prototype declaration of ggandiva_function_registry_new
    f8d68ff21 <Kenta Murata> Fix variable name
    2e1df3889 <Kenta Murata> Fix indentation
    d1ab47e45 <Kenta Murata> Remove needless semicolon
    96bc87a28 <Kenta Murata> Include config.h in gandiva-glib/function-registry.cpp
    aed01b270 <Kenta Murata> Fix include file
    b93626c21 <Kenta Murata> Align trailing back slashes
    1829f0bf2 <Kenta Murata> Fix document of ggandiva_native_function_to_string
    7e9370553 <Kenta Murata> Fix parameter names
    114d59dfb <Kenta Murata> Fix document of ggandiva_function_signature_get_base_name
    14d0c2208 <Kenta Murata> Fix variable name
    6d711bbf2 <Kenta Murata> Fix document of ggandiva_function_signature_to_string
    5fc6677f6 <Kenta Murata> Fix parameter names
    5688fcbfd <Kenta Murata> Fix parameter name
    50d07477a <Kenta Murata> Fix arguments of glib-mkenums in gandiva-glib/Makefile.am
    19cc82819 <Kenta Murata> Add ggandiva_function_signature_get_param_types
    7bbdf0edc <Kenta Murata> Add ggandiva_function_signature_get_base_name
    f29596840 <Kenta Murata> Add ggandiva_function_signature_get_ret_type
    194cf1662 <Kenta Murata> Add (transfer full) tag for ggandiva_function_signature_to_string
    1be2a2d3c <Kenta Murata> Add tests for GGandivaFunctionSignature
    0a2cff454 <Kenta Murata> Rewrite a test of ggandiva_native_function_to_string
    c5323b1de <Kenta Murata> Fix ggandiva_native_function_get_signature
    b213e896d <Kenta Murata> Add @include section in documentation comments
    38a0c8e02 <Kenta Murata> Add tests for GGandivaNativeFunction
    20acafd91 <Kenta Murata> Add tests for GGandivaFunctionRegistry
    0b4a3cf46 <Kenta Murata> Fix coding style
    79a9b5308 <Kenta Murata> Support enum generation
    f9aac99fa <Kenta Murata> Include new headers in <gandiva-glib.h>
    f1c3ad343 <Kenta Murata> Rename functions
    1c8b111a5 <Kenta Murata> Provide conversion functions for gandiva::ResultNullableType
    f0a83a35e <Kenta Murata> Rename functions
    046d564b7 <Kenta Murata> Remove needless functions
    bc9f26f87 <Kenta Murata> Fix coding style
    1e1de34eb <Kenta Murata> Stop keeping the instance of FunctionRegistry
    dd38c518c <Kenta Murata> Follow prepend then reverse idiom
    e01684662 <Kenta Murata> Stop caching a list of NativeFunction objects in a FunctionRegistry
    0897e36d2 <Kenta Murata> Fix documentation comments
    2ac4f11c1 <Kenta Murata> Align trailing backslack
    c3692d8fa <Kenta Murata> Add binding of gandiva::FunctionRegistry and related things
---
 c_glib/doc/gandiva-glib/gandiva-glib-docs.xml      |  20 ++
 c_glib/gandiva-glib/Makefile.am                    |  58 ++++-
 .../{gandiva-glib.h => enums.c.template}           |  40 ++-
 .../{gandiva-glib.h => enums.h.template}           |  23 +-
 c_glib/gandiva-glib/function-registry.cpp          | 120 +++++++++
 .../{gandiva-glib.h => function-registry.h}        |  26 +-
 c_glib/gandiva-glib/function-signature.cpp         | 247 +++++++++++++++++++
 c_glib/gandiva-glib/function-signature.h           |  48 ++++
 .../{gandiva-glib.h => function-signature.hpp}     |   9 +-
 c_glib/gandiva-glib/gandiva-glib.h                 |   3 +
 c_glib/gandiva-glib/meson.build                    |  21 +-
 c_glib/gandiva-glib/native-function.cpp            | 273 +++++++++++++++++++++
 c_glib/gandiva-glib/native-function.h              |  64 +++++
 .../{gandiva-glib.h => native-function.hpp}        |  18 +-
 c_glib/test/gandiva/test-function-registry.rb      |  45 ++++
 c_glib/test/gandiva/test-function-signature.rb     | 101 ++++++++
 c_glib/test/gandiva/test-native-function.rb        | 129 ++++++++++
 c_glib/test/helper/data-type.rb                    |  59 +++++
 c_glib/test/run-test.rb                            |   1 +
 19 files changed, 1286 insertions(+), 19 deletions(-)

diff --git a/c_glib/doc/gandiva-glib/gandiva-glib-docs.xml b/c_glib/doc/gandiva-glib/gandiva-glib-docs.xml
index 2335e11..81bbb08 100644
--- a/c_glib/doc/gandiva-glib/gandiva-glib-docs.xml
+++ b/c_glib/doc/gandiva-glib/gandiva-glib-docs.xml
@@ -56,6 +56,22 @@
     </chapter>
   </part>
 
+  <part id="function">
+    <title>Function</title>
+    <chapter id="function-registry">
+      <title>Registry</title>
+      <xi:include href="xml/function-registry.xml"/>
+    </chapter>
+    <chapter id="function-signature">
+      <title>Signature</title>
+      <xi:include href="xml/function-signature.xml"/>
+    </chapter>
+    <chapter id="native-function">
+      <title>Native function</title>
+      <xi:include href="xml/native-function.xml"/>
+    </chapter>
+  </part>
+
   <chapter id="object-tree">
     <title>Object Hierarchy</title>
     <xi:include href="xml/tree_index.sgml"/>
@@ -68,6 +84,10 @@
     <title>Index of deprecated API</title>
     <xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
   </index>
+  <index id="api-index-0-14-0" role="0.14.0">
+    <title>Index of new symbols in 0.14.0</title>
+    <xi:include href="xml/api-index-0.14.0.xml"><xi:fallback /></xi:include>
+  </index>
   <index id="api-index-0-12-0" role="0.12.0">
     <title>Index of new symbols in 0.12.0</title>
     <xi:include href="xml/api-index-0.12.0.xml"><xi:fallback /></xi:include>
diff --git a/c_glib/gandiva-glib/Makefile.am b/c_glib/gandiva-glib/Makefile.am
index 5869dc7..f2d0a7a 100644
--- a/c_glib/gandiva-glib/Makefile.am
+++ b/c_glib/gandiva-glib/Makefile.am
@@ -53,19 +53,35 @@ libgandiva_glib_la_LIBADD =			\
 
 libgandiva_glib_la_headers =			\
 	expression.h				\
+	function-registry.h			\
+	function-signature.h			\
 	gandiva-glib.h				\
+	native-function.h			\
 	node.h					\
 	projector.h
 
+libgandiva_glib_la_generated_headers =		\
+	enums.h
+
+libgandiva_glib_la_generated_sources =		\
+	enums.c					\
+	$(libgandiva_glib_la_generated_headers)
+
 libgandiva_glib_la_sources =			\
 	expression.cpp				\
+	function-registry.cpp			\
+	function-signature.cpp			\
 	node.cpp				\
+	native-function.cpp			\
 	projector.cpp				\
-	$(libgandiva_glib_la_headers)
+	$(libgandiva_glib_la_headers)		\
+	$(libgandiva_glib_la_generated_sources)
 
 libgandiva_glib_la_cpp_headers =		\
 	expression.hpp				\
+	function-signature.hpp			\
 	gandiva-glib.hpp			\
+	native-function.hpp			\
 	node.hpp				\
 	projector.hpp
 
@@ -73,10 +89,48 @@ libgandiva_glib_la_SOURCES =			\
 	$(libgandiva_glib_la_sources)		\
 	$(libgandiva_glib_la_cpp_headers)
 
+BUILT_SOURCES =					\
+	$(libgandiva_glib_la_generated_sources)	\
+	stamp-enums.c				\
+	stamp-enums.h
+
+DISTCLEANFILES +=				\
+	stamp-enums.c				\
+	stamp-enums.h
+
+EXTRA_DIST +=					\
+	enums.c.template			\
+	enums.h.template
+
+enums.h: stamp-enums.h
+	@true
+stamp-enums.h: $(libgandiva_glib_la_headers) enums.h.template
+	$(AM_V_GEN)					\
+	  (cd $(srcdir) &&				\
+	   $(GLIB_MKENUMS)				\
+	     --identifier-prefix GGandiva		\
+	     --symbol-prefix ggandiva			\
+	     --template enums.h.template		\
+	     $(libgandiva_glib_la_headers)) > enums.h
+	touch $@
+
+enums.c: stamp-enums.c
+	@true
+stamp-enums.c: $(libarrow_glib_la_headers) enums.c.template
+	$(AM_V_GEN)					\
+	  (cd $(srcdir) &&				\
+	   $(GLIB_MKENUMS)				\
+	     --identifier-prefix GGandiva		\
+	     --symbol-prefix ggandiva			\
+	     --template enums.c.template		\
+	     $(libgandiva_glib_la_headers)) > 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_cpp_headers)	\
+	$(libgandiva_glib_la_generated_headers)
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA =				\
diff --git a/c_glib/gandiva-glib/gandiva-glib.h b/c_glib/gandiva-glib/enums.c.template
similarity index 50%
copy from c_glib/gandiva-glib/gandiva-glib.h
copy to c_glib/gandiva-glib/enums.c.template
index 10a91f53..80276f6 100644
--- a/c_glib/gandiva-glib/gandiva-glib.h
+++ b/c_glib/gandiva-glib/enums.c.template
@@ -1,3 +1,4 @@
+/*** BEGIN file-header ***/
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +18,39 @@
  * under the License.
  */
 
-#pragma once
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
 
-#include <gandiva-glib/expression.h>
-#include <gandiva-glib/node.h>
-#include <gandiva-glib/projector.h>
+#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-glib.h b/c_glib/gandiva-glib/enums.h.template
similarity index 66%
copy from c_glib/gandiva-glib/gandiva-glib.h
copy to c_glib/gandiva-glib/enums.h.template
index 10a91f53..8d7b463 100644
--- a/c_glib/gandiva-glib/gandiva-glib.h
+++ b/c_glib/gandiva-glib/enums.h.template
@@ -1,3 +1,4 @@
+/*** BEGIN file-header ***/
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -19,6 +20,22 @@
 
 #pragma once
 
-#include <gandiva-glib/expression.h>
-#include <gandiva-glib/node.h>
-#include <gandiva-glib/projector.h>
+#include <glib.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/function-registry.cpp b/c_glib/gandiva-glib/function-registry.cpp
new file mode 100644
index 0000000..10099be
--- /dev/null
+++ b/c_glib/gandiva-glib/function-registry.cpp
@@ -0,0 +1,120 @@
+/*
+ * 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/function_registry.h>
+#include <gandiva-glib/function-registry.h>
+
+#include <gandiva-glib/function-signature.hpp>
+#include <gandiva-glib/native-function.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: function-registry
+ * @short_description: FunctionRegistry class
+ * @title: FunctionRegistry class
+ * @include: gandiva-glib/gandiva-glib.h
+ *
+ * Since: 0.14.0
+ */
+
+G_DEFINE_TYPE(GGandivaFunctionRegistry,
+              ggandiva_function_registry,
+              G_TYPE_OBJECT)
+
+static void
+ggandiva_function_registry_init(GGandivaFunctionRegistry *object)
+{
+}
+
+static void
+ggandiva_function_registry_class_init(GGandivaFunctionRegistryClass *klass)
+{
+}
+
+/**
+ * ggandiva_function_registry_new:
+ *
+ * Returns: A newly created #GGandivaFunctionRegistry.
+ *
+ * Since: 0.14.0
+ */
+GGandivaFunctionRegistry *
+ggandiva_function_registry_new(void)
+{
+  return GGANDIVA_FUNCTION_REGISTRY(g_object_new(GGANDIVA_TYPE_FUNCTION_REGISTRY, NULL));
+}
+
+/**
+ * ggandiva_function_registry_lookup:
+ * @function_registry: A #GGandivaFunctionRegistry.
+ * @function_signature: A #GGandivaFunctionSignature to be looked up.
+ *
+ * Returns: (transfer full) (nullable):
+ *   The native functions associated to the given #GGandivaFunctionSignature.
+ *
+ * Since: 0.14.0
+ */
+GGandivaNativeFunction *
+ggandiva_function_registry_lookup(GGandivaFunctionRegistry *function_registry,
+                                  GGandivaFunctionSignature *function_signature)
+{
+  gandiva::FunctionRegistry gandiva_function_registry;
+  auto gandiva_function_signature =
+    ggandiva_function_signature_get_raw(function_signature);
+  auto gandiva_native_function =
+    gandiva_function_registry.LookupSignature(*gandiva_function_signature);
+  if (gandiva_native_function) {
+    return ggandiva_native_function_new_raw(gandiva_native_function);
+  } else {
+    return NULL;
+  }
+}
+
+/**
+ * ggandiva_function_registry_get_native_functions:
+ * @function_registry: A #GGandivaFunctionRegistry.
+ *
+ * Returns: (transfer full) (element-type GGandivaNativeFunction):
+ *   The native functions in the function registry.
+ *
+ * Since: 0.14.0
+ */
+GList *
+ggandiva_function_registry_get_native_functions(GGandivaFunctionRegistry *function_registry)
+{
+  gandiva::FunctionRegistry gandiva_function_registry;
+
+  GList *native_functions = nullptr;
+  for (auto gandiva_native_function = gandiva_function_registry.begin();
+       gandiva_native_function != gandiva_function_registry.end();
+       ++gandiva_native_function) {
+    auto native_function = ggandiva_native_function_new_raw(gandiva_native_function);
+    native_functions = g_list_prepend(native_functions, native_function);
+  }
+  native_functions = g_list_reverse(native_functions);
+
+  return native_functions;
+}
+
+G_END_DECLS
diff --git a/c_glib/gandiva-glib/gandiva-glib.h b/c_glib/gandiva-glib/function-registry.h
similarity index 50%
copy from c_glib/gandiva-glib/gandiva-glib.h
copy to c_glib/gandiva-glib/function-registry.h
index 10a91f53..1a0d767 100644
--- a/c_glib/gandiva-glib/gandiva-glib.h
+++ b/c_glib/gandiva-glib/function-registry.h
@@ -19,6 +19,26 @@
 
 #pragma once
 
-#include <gandiva-glib/expression.h>
-#include <gandiva-glib/node.h>
-#include <gandiva-glib/projector.h>
+#include <gandiva-glib/native-function.h>
+
+G_BEGIN_DECLS
+
+#define GGANDIVA_TYPE_FUNCTION_REGISTRY (ggandiva_function_registry_get_type())
+G_DECLARE_DERIVABLE_TYPE(GGandivaFunctionRegistry,
+                         ggandiva_function_registry,
+                         GGANDIVA,
+                         FUNCTION_REGISTRY,
+                         GObject)
+
+struct _GGandivaFunctionRegistryClass
+{
+  GObjectClass parent_class;
+};
+
+GGandivaFunctionRegistry *ggandiva_function_registry_new(void);
+GGandivaNativeFunction *
+ggandiva_function_registry_lookup(GGandivaFunctionRegistry *function_registry,
+                                  GGandivaFunctionSignature *function_signature);
+GList *ggandiva_function_registry_get_native_functions(GGandivaFunctionRegistry *function_registry);
+
+G_END_DECLS
diff --git a/c_glib/gandiva-glib/function-signature.cpp b/c_glib/gandiva-glib/function-signature.cpp
new file mode 100644
index 0000000..1079f3b
--- /dev/null
+++ b/c_glib/gandiva-glib/function-signature.cpp
@@ -0,0 +1,247 @@
+/*
+ * 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 <arrow-glib/basic-data-type.hpp>
+
+#include <gandiva-glib/function-signature.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: function-signature
+ * @short_description: FunctionSignature class
+ * @title: FunctionSignature class
+ * @include: gandiva-glib/gandiva-glib.h
+ *
+ * Since: 0.14.0
+ */
+
+typedef struct GGandivaFunctionSignaturePrivate_ {
+  gandiva::FunctionSignature function_signature;
+} GGandivaFunctionSignaturePrivate;
+
+enum {
+  PROP_FUNCTION_SIGNATURE = 1
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GGandivaFunctionSignature,
+                           ggandiva_function_signature,
+                           G_TYPE_OBJECT)
+
+#define GGANDIVA_FUNCTION_SIGNATURE_GET_PRIVATE(obj)      \
+    static_cast<GGandivaFunctionSignaturePrivate *>(      \
+        ggandiva_function_signature_get_instance_private( \
+          GGANDIVA_FUNCTION_SIGNATURE(obj)))
+
+static void
+ggandiva_function_signature_set_property(GObject *object,
+                                         guint prop_id,
+                                         const GValue *value,
+                                         GParamSpec *pspec)
+{
+  auto priv = GGANDIVA_FUNCTION_SIGNATURE_GET_PRIVATE(object);
+  switch (prop_id) {
+  case PROP_FUNCTION_SIGNATURE:
+    priv->function_signature =
+      *static_cast<const gandiva::FunctionSignature *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+ggandiva_function_signature_init(GGandivaFunctionSignature *object)
+{
+}
+
+static void
+ggandiva_function_signature_class_init(GGandivaFunctionSignatureClass *klass)
+{
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = ggandiva_function_signature_set_property;
+
+  GParamSpec *spec;
+  spec = g_param_spec_pointer("function-signature",
+                              "FunctionSignature",
+                              "The raw gandiva::FunctionSignature *",
+                              static_cast<GParamFlags>(G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property(gobject_class, PROP_FUNCTION_SIGNATURE, spec);
+}
+
+/**
+ * ggandiva_function_signature_new:
+ * @base_name: A base name of a function.
+ * @parameter_types: (element-type GArrowDataType)
+ *   A list of parameter data types.
+ * @return_type: A return data type.
+ *
+ * Returns:
+ *   A #GGandivaFunctionSignature.
+ *
+ * Since: 0.14.0
+ */
+GGandivaFunctionSignature *
+ggandiva_function_signature_new(const gchar *base_name,
+                                GList *parameter_types,
+                                GArrowDataType *return_type)
+{
+  gandiva::DataTypeVector arrow_parameter_types;
+  for (auto node = parameter_types; node; node = g_list_next(node)) {
+    auto data_type = GARROW_DATA_TYPE(node->data);
+    auto arrow_data_type = garrow_data_type_get_raw(data_type);
+    arrow_parameter_types.push_back(arrow_data_type);
+  }
+
+  auto arrow_return_type = garrow_data_type_get_raw(return_type);
+
+  gandiva::FunctionSignature gandiva_function_signature(base_name,
+                                                        arrow_parameter_types,
+                                                        arrow_return_type);
+  return ggandiva_function_signature_new_raw(&gandiva_function_signature);
+}
+
+/**
+ * ggandiva_function_signature_equal:
+ * @function_signature: A #GGandivaFunctionSignature.
+ * @other_function_signature: A #GGandivaFunctionSignature to be compared.
+ *
+ * Returns: %TRUE if both of them have the same data, %FALSE otherwise.
+ *
+ * Since: 0.14.0
+ */
+gboolean
+ggandiva_function_signature_equal(GGandivaFunctionSignature *function_signature,
+                                  GGandivaFunctionSignature *other_function_signature)
+{
+  auto gandiva_function_signature =
+    ggandiva_function_signature_get_raw(function_signature);
+  auto gandiva_other_function_signature =
+    ggandiva_function_signature_get_raw(other_function_signature);
+
+  return (*gandiva_function_signature) == (*gandiva_other_function_signature);
+}
+
+/**
+ * ggandiva_function_signature_to_string:
+ * @function_signature: A #GGandivaFunctionSignature
+ *
+ * Returns: (transfer full): The string representation of the function signature.
+ *
+ *   It should be freed with g_free() when no longer needed.
+ *
+ * Since: 0.14.0
+ */
+gchar *
+ggandiva_function_signature_to_string(GGandivaFunctionSignature *function_signature)
+{
+  auto gandiva_function_signature =
+    ggandiva_function_signature_get_raw(function_signature);
+  return g_strdup(gandiva_function_signature->ToString().c_str());
+}
+
+/**
+ * ggandiva_function_signature_get_return_type:
+ * @function_signature: A #GGandivaFunctionSignature
+ *
+ * Returns: (transfer full):
+ *   A #GArrowDataType of the return value of the function signature.
+ *
+ * Since: 0.14.0
+ */
+GArrowDataType *
+ggandiva_function_signature_get_return_type(GGandivaFunctionSignature *function_signature)
+{
+  auto gandiva_function_signature =
+    ggandiva_function_signature_get_raw(function_signature);
+  auto arrow_data_type = gandiva_function_signature->ret_type();
+  auto data_type = garrow_data_type_new_raw(&arrow_data_type);
+  return data_type;
+}
+
+/**
+ * ggandiva_function_signature_get_base_name:
+ * @function_signature: A #GGandivaFunctionSignature
+ *
+ * Returns: (transfer full): A base name of the function signature.
+ *
+ *   It should be freed with g_free() when no longer needed.
+ *
+ * Since: 0.14.0
+ */
+gchar *
+ggandiva_function_signature_get_base_name(GGandivaFunctionSignature *function_signature)
+{
+  auto gandiva_function_signature =
+    ggandiva_function_signature_get_raw(function_signature);
+  return g_strdup(gandiva_function_signature->base_name().c_str());
+}
+
+/**
+ * ggandiva_function_signature_get_param_types:
+ * @function_signature: A #GGandivaFunctionSignature
+ *
+ * Returns: (transfer full) (element-type GArrowDataType):
+ *   A list of parameter data types of the function signature.
+ *
+ * Since: 0.14.0
+ */
+GList *
+ggandiva_function_signature_get_param_types(GGandivaFunctionSignature *function_signature)
+{
+  auto gandiva_function_signature =
+    ggandiva_function_signature_get_raw(function_signature);
+
+  GList *param_type_list = nullptr;
+  auto arrow_param_types = gandiva_function_signature->param_types();
+  for (auto &arrow_param_type : arrow_param_types) {
+    auto data_type = garrow_data_type_new_raw(&arrow_param_type);
+    param_type_list = g_list_prepend(param_type_list, data_type);
+  }
+  param_type_list = g_list_reverse(param_type_list);
+
+  return param_type_list;
+}
+
+G_END_DECLS
+
+GGandivaFunctionSignature *
+ggandiva_function_signature_new_raw(const gandiva::FunctionSignature *gandiva_function_signature)
+{
+  auto function_signature =
+    GGANDIVA_FUNCTION_SIGNATURE(g_object_new(GGANDIVA_TYPE_FUNCTION_SIGNATURE,
+                                             "function-signature",
+                                             gandiva_function_signature,
+                                             NULL));
+  return function_signature;
+}
+
+const gandiva::FunctionSignature *
+ggandiva_function_signature_get_raw(GGandivaFunctionSignature *function_signature)
+{
+  auto priv = GGANDIVA_FUNCTION_SIGNATURE_GET_PRIVATE(function_signature);
+  return &priv->function_signature;
+}
diff --git a/c_glib/gandiva-glib/function-signature.h b/c_glib/gandiva-glib/function-signature.h
new file mode 100644
index 0000000..b1099ff
--- /dev/null
+++ b/c_glib/gandiva-glib/function-signature.h
@@ -0,0 +1,48 @@
+/*
+ * 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 <arrow-glib/arrow-glib.h>
+
+G_BEGIN_DECLS
+
+#define GGANDIVA_TYPE_FUNCTION_SIGNATURE (ggandiva_function_signature_get_type())
+G_DECLARE_DERIVABLE_TYPE(GGandivaFunctionSignature,
+                         ggandiva_function_signature,
+                         GGANDIVA,
+                         FUNCTION_SIGNATURE,
+                         GObject)
+
+struct _GGandivaFunctionSignatureClass
+{
+  GObjectClass parent_class;
+};
+
+GGandivaFunctionSignature *ggandiva_function_signature_new(const gchar *base_name,
+                                                           GList *parameter_types,
+                                                           GArrowDataType *return_type);
+gboolean ggandiva_function_signature_equal(GGandivaFunctionSignature *function_signature,
+                                           GGandivaFunctionSignature *other_function_signature);
+gchar *ggandiva_function_signature_to_string(GGandivaFunctionSignature *function_signature);
+GArrowDataType *ggandiva_function_signature_get_return_type(GGandivaFunctionSignature *function_signature);
+gchar *ggandiva_function_signature_get_base_name(GGandivaFunctionSignature *function_signature);
+GList *ggandiva_function_signature_get_param_types(GGandivaFunctionSignature *function_signature);
+
+G_END_DECLS
diff --git a/c_glib/gandiva-glib/gandiva-glib.h b/c_glib/gandiva-glib/function-signature.hpp
similarity index 71%
copy from c_glib/gandiva-glib/gandiva-glib.h
copy to c_glib/gandiva-glib/function-signature.hpp
index 10a91f53..24f71e6 100644
--- a/c_glib/gandiva-glib/gandiva-glib.h
+++ b/c_glib/gandiva-glib/function-signature.hpp
@@ -19,6 +19,9 @@
 
 #pragma once
 
-#include <gandiva-glib/expression.h>
-#include <gandiva-glib/node.h>
-#include <gandiva-glib/projector.h>
+#include <gandiva/function_signature.h>
+
+#include <gandiva-glib/function-signature.h>
+
+GGandivaFunctionSignature *ggandiva_function_signature_new_raw(const gandiva::FunctionSignature *gandiva_function_signature);
+const gandiva::FunctionSignature *ggandiva_function_signature_get_raw(GGandivaFunctionSignature *signature);
diff --git a/c_glib/gandiva-glib/gandiva-glib.h b/c_glib/gandiva-glib/gandiva-glib.h
index 10a91f53..ddebfe5 100644
--- a/c_glib/gandiva-glib/gandiva-glib.h
+++ b/c_glib/gandiva-glib/gandiva-glib.h
@@ -20,5 +20,8 @@
 #pragma once
 
 #include <gandiva-glib/expression.h>
+#include <gandiva-glib/function-registry.h>
+#include <gandiva-glib/function-signature.h>
+#include <gandiva-glib/native-function.h>
 #include <gandiva-glib/node.h>
 #include <gandiva-glib/projector.h>
diff --git a/c_glib/gandiva-glib/meson.build b/c_glib/gandiva-glib/meson.build
index 11ef8d6..b233d7c 100644
--- a/c_glib/gandiva-glib/meson.build
+++ b/c_glib/gandiva-glib/meson.build
@@ -21,24 +21,43 @@ project_name = 'gandiva-glib'
 
 sources = files(
   'expression.cpp',
+  'function-registry.cpp',
+  'function-signature.cpp',
   'node.cpp',
+  'native-function.cpp',
   'projector.cpp',
 )
 
 c_headers = files(
   'expression.h',
+  'function-registry.h',
+  'function-signature.h',
   'gandiva-glib.h',
   'node.h',
+  'native-function.h',
   'projector.h',
 )
 
 cpp_headers = files(
   'expression.hpp',
+  'function-signature.hpp',
   'gandiva-glib.hpp',
   'node.hpp',
+  'native-function.hpp',
   'projector.hpp',
 )
 
+enums = gnome.mkenums('enums',
+                      sources: c_headers,
+                      identifier_prefix: 'GGandiva',
+                      symbol_prefix: 'ggandiva',
+                      c_template: 'enums.c.template',
+                      h_template: 'enums.h.template',
+                      install_dir: join_paths(include_dir, meson.project_name()),
+                      install_header: true)
+enums_source = enums[0]
+enums_header = enums[1]
+
 headers = c_headers + cpp_headers
 install_headers(headers, subdir: project_name)
 
@@ -67,7 +86,7 @@ pkgconfig.generate(libgandiva_glib,
 
 gnome.generate_gir(libgandiva_glib,
                    dependencies: declare_dependency(sources: arrow_glib_gir),
-                   sources: sources + c_headers,
+                   sources: sources + c_headers + enums,
                    namespace: 'Gandiva',
                    nsversion: api_version,
                    identifier_prefix: 'GGandiva',
diff --git a/c_glib/gandiva-glib/native-function.cpp b/c_glib/gandiva-glib/native-function.cpp
new file mode 100644
index 0000000..d069147
--- /dev/null
+++ b/c_glib/gandiva-glib/native-function.cpp
@@ -0,0 +1,273 @@
+/*
+ * 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/native-function.hpp>
+
+#include <gandiva-glib/function-signature.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: native-function
+ * @short_description: NativeFunction class
+ * @title: NativeFunction class
+ * @include: gandiva-glib/gandiva-glib.h
+ *
+ * Since: 0.14.0
+ */
+
+typedef struct GGandivaNativeFunctionPrivate_ {
+  const gandiva::NativeFunction *native_function;
+} GGandivaNativeFunctionPrivate;
+
+enum {
+  PROP_NATIVE_FUNCTION = 1
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GGandivaNativeFunction,
+                           ggandiva_native_function,
+                           G_TYPE_OBJECT)
+
+#define GGANDIVA_NATIVE_FUNCTION_GET_PRIVATE(obj)      \
+    static_cast<GGandivaNativeFunctionPrivate *>(      \
+        ggandiva_native_function_get_instance_private( \
+          GGANDIVA_NATIVE_FUNCTION(obj)))
+
+static void
+ggandiva_native_function_set_property(GObject *object,
+                                      guint prop_id,
+                                      const GValue *value,
+                                      GParamSpec *pspec)
+{
+  auto priv = GGANDIVA_NATIVE_FUNCTION_GET_PRIVATE(object);
+  switch (prop_id) {
+  case PROP_NATIVE_FUNCTION:
+    priv->native_function =
+      static_cast<const gandiva::NativeFunction *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+ggandiva_native_function_init(GGandivaNativeFunction *object)
+{
+}
+
+static void
+ggandiva_native_function_class_init(GGandivaNativeFunctionClass *klass)
+{
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = ggandiva_native_function_set_property;
+
+  GParamSpec *spec;
+  spec = g_param_spec_pointer("native-function",
+                              "NativeFunction",
+                              "The raw gandiva::NativeFunction *",
+                              static_cast<GParamFlags>(G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property(gobject_class, PROP_NATIVE_FUNCTION, spec);
+}
+
+/**
+ * ggandiva_native_function_get_signature:
+ * @native_function: A #GGandivaNativeFunction.
+ *
+ * Returns: (transfer full): A #GGandivaFunctionSignature that represents
+ *   the signature of the native function.
+ *
+ * Since: 0.14.0
+ */
+GGandivaFunctionSignature *
+ggandiva_native_function_get_signature(GGandivaNativeFunction *native_function)
+{
+  auto gandiva_native_function =
+    ggandiva_native_function_get_raw(native_function);
+  auto &gandiva_function_signature = gandiva_native_function->signature();
+  return ggandiva_function_signature_new_raw(&gandiva_function_signature);
+}
+
+/**
+ * ggandiva_native_function_equal:
+ * @native_function: A #GGandivaNativeFunction.
+ * @other_native_function: A #GGandivaNativeFunction to be compared.
+ *
+ * Returns: %TRUE if both of them have the same data, %FALSE otherwise.
+ *
+ * Since: 0.14.0
+ */
+gboolean
+ggandiva_native_function_equal(GGandivaNativeFunction *native_function,
+                               GGandivaNativeFunction *other_native_function)
+{
+  auto gandiva_native_function =
+    ggandiva_native_function_get_raw(native_function);
+  auto gandiva_other_native_function =
+    ggandiva_native_function_get_raw(other_native_function);
+  return gandiva_native_function == gandiva_other_native_function;
+}
+
+/**
+ * ggandiva_native_function_to_string:
+ * @native_function: A #GGandivaNativeFunction.
+ *
+ * Returns: (transfer full):
+ *   The string representation of the signature of the native function.
+ *   It should be freed with g_free() when no longer needed.
+ *
+ * Since: 0.14.0
+ */
+gchar *
+ggandiva_native_function_to_string(GGandivaNativeFunction *native_function)
+{
+  auto gandiva_native_function =
+    ggandiva_native_function_get_raw(native_function);
+  auto gandiva_function_signature = gandiva_native_function->signature();
+  return g_strdup(gandiva_function_signature.ToString().c_str());
+}
+
+/**
+ * ggandiva_native_function_get_result_nullable_type:
+ * @native_function: A #GGandivaNativeFunction.
+ *
+ * Returns:
+ *   A value of #GGandivaResultNullableType.
+ *
+ * Since: 0.14.0
+ */
+GGandivaResultNullableType
+ggandiva_native_function_get_result_nullable_type(GGandivaNativeFunction *native_function)
+{
+  auto gandiva_native_function =
+    ggandiva_native_function_get_raw(native_function);
+  const auto gandiva_result_nullable_type =
+    gandiva_native_function->result_nullable_type();
+  return ggandiva_result_nullable_type_from_raw(gandiva_result_nullable_type);
+}
+
+/**
+ * ggandiva_native_function_need_context:
+ * @native_function: A #GGandivaNativeFunction.
+ *
+ * Returns:
+ *   %TRUE if the native function needs a context for evaluation,
+ *   %FALSE otherwise.
+ *
+ * Since: 0.14.0
+ */
+gboolean
+ggandiva_native_function_need_context(GGandivaNativeFunction *native_function)
+{
+  auto gandiva_native_function =
+    ggandiva_native_function_get_raw(native_function);
+  return gandiva_native_function->NeedsContext();
+}
+
+/**
+ * ggandiva_native_function_need_function_holder:
+ * @native_function: A #GGandivaNativeFunction.
+ *
+ * Returns:
+ *   %TRUE if the native function needs a function holder for evaluation,
+ *   %FALSE otherwise.
+ *
+ * Since: 0.14.0
+ */
+gboolean
+ggandiva_native_function_need_function_holder(GGandivaNativeFunction *native_function)
+{
+  auto gandiva_native_function =
+    ggandiva_native_function_get_raw(native_function);
+  return gandiva_native_function->NeedsFunctionHolder();
+}
+
+/**
+ * ggandiva_native_function_can_return_errors:
+ * @native_function: A #GGandivaNativeFunction.
+ *
+ * Returns:
+ *   %TRUE if the native function has the possibility of returning errors,
+ *   %FALSE otherwise.
+ *
+ * Since: 0.14.0
+ */
+gboolean
+ggandiva_native_function_can_return_errors(GGandivaNativeFunction *native_function)
+{
+  auto gandiva_native_function =
+    ggandiva_native_function_get_raw(native_function);
+  return gandiva_native_function->CanReturnErrors();
+}
+
+G_END_DECLS
+
+GGandivaResultNullableType
+ggandiva_result_nullable_type_from_raw(gandiva::ResultNullableType gandiva_type)
+{
+  switch (gandiva_type) {
+  case gandiva::kResultNullIfNull:
+    return GGANDIVA_RESULT_NULL_IF_NULL;
+  case gandiva::kResultNullNever:
+    return GGANDIVA_RESULT_NULL_NEVER;
+  case gandiva::kResultNullInternal:
+    return GGANDIVA_RESULT_NULL_INTERNAL;
+  default:
+    return GGANDIVA_RESULT_NULL_IF_NULL;
+  }
+}
+
+gandiva::ResultNullableType
+ggandiva_result_nullable_type_to_raw(GGandivaResultNullableType type)
+{
+  switch (type) {
+  case GGANDIVA_RESULT_NULL_IF_NULL:
+    return gandiva::kResultNullIfNull;
+  case GGANDIVA_RESULT_NULL_NEVER:
+    return gandiva::kResultNullNever;
+  case GGANDIVA_RESULT_NULL_INTERNAL:
+    return gandiva::kResultNullInternal;
+  default:
+    return gandiva::kResultNullIfNull;
+  }
+}
+
+GGandivaNativeFunction *
+ggandiva_native_function_new_raw(const gandiva::NativeFunction *gandiva_native_function)
+{
+  auto native_function =
+    GGANDIVA_NATIVE_FUNCTION(g_object_new(GGANDIVA_TYPE_NATIVE_FUNCTION,
+                                          "native-function",
+                                          gandiva_native_function,
+                                          NULL));
+  return native_function;
+}
+
+const gandiva::NativeFunction *
+ggandiva_native_function_get_raw(GGandivaNativeFunction *native_function)
+{
+  auto priv = GGANDIVA_NATIVE_FUNCTION_GET_PRIVATE(native_function);
+  return priv->native_function;
+}
diff --git a/c_glib/gandiva-glib/native-function.h b/c_glib/gandiva-glib/native-function.h
new file mode 100644
index 0000000..a7ffb60
--- /dev/null
+++ b/c_glib/gandiva-glib/native-function.h
@@ -0,0 +1,64 @@
+/*
+ * 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/function-signature.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GGandivaResultNullableType:
+ * @GGANDIVA_RESULT_NULL_IF_NULL: This means the result validity is an intersection of
+ *   the validity of the children.
+ * @GGANDIVA_RESULT_NULL_NEVER: This means that the result is always valid.
+ * @GGANDIVA_RESULT_NULL_INTERNAL: This means that the result validity depends on some
+ *   internal logic.
+ *
+ * They are corresponding to `gandiva::ResultNullableType` values.
+ */
+typedef enum {
+  GGANDIVA_RESULT_NULL_IF_NULL,
+  GGANDIVA_RESULT_NULL_NEVER,
+  GGANDIVA_RESULT_NULL_INTERNAL
+} GGandivaResultNullableType;
+
+#define GGANDIVA_TYPE_NATIVE_FUNCTION (ggandiva_native_function_get_type())
+G_DECLARE_DERIVABLE_TYPE(GGandivaNativeFunction,
+                         ggandiva_native_function,
+                         GGANDIVA,
+                         NATIVE_FUNCTION,
+                         GObject)
+
+struct _GGandivaNativeFunctionClass
+{
+  GObjectClass parent_class;
+};
+
+GGandivaFunctionSignature *ggandiva_native_function_get_signature(GGandivaNativeFunction *native_function);
+gboolean
+ggandiva_native_function_equal(GGandivaNativeFunction *native_function,
+                               GGandivaNativeFunction *other_native_function);
+gchar *ggandiva_native_function_to_string(GGandivaNativeFunction *native_function);
+GGandivaResultNullableType ggandiva_native_function_get_result_nullable_type(GGandivaNativeFunction *native_function);
+gboolean ggandiva_native_function_need_context(GGandivaNativeFunction *native_function);
+gboolean ggandiva_native_function_need_function_holder(GGandivaNativeFunction *native_function);
+gboolean ggandiva_native_function_can_return_errors(GGandivaNativeFunction *native_function);
+
+G_END_DECLS
diff --git a/c_glib/gandiva-glib/gandiva-glib.h b/c_glib/gandiva-glib/native-function.hpp
similarity index 60%
copy from c_glib/gandiva-glib/gandiva-glib.h
copy to c_glib/gandiva-glib/native-function.hpp
index 10a91f53..76119ca 100644
--- a/c_glib/gandiva-glib/gandiva-glib.h
+++ b/c_glib/gandiva-glib/native-function.hpp
@@ -19,6 +19,18 @@
 
 #pragma once
 
-#include <gandiva-glib/expression.h>
-#include <gandiva-glib/node.h>
-#include <gandiva-glib/projector.h>
+#include <gandiva/native_function.h>
+
+#include <gandiva-glib/native-function.h>
+
+G_BEGIN_DECLS
+
+GGandivaResultNullableType
+ggandiva_result_nullable_type_from_raw(gandiva::ResultNullableType gandiva_type);
+gandiva::ResultNullableType
+ggandiva_result_nullable_type_to_raw(GGandivaResultNullableType type);
+
+GGandivaNativeFunction *ggandiva_native_function_new_raw(const gandiva::NativeFunction *gandiva_native_function);
+const gandiva::NativeFunction *ggandiva_native_function_get_raw(GGandivaNativeFunction *native_function);
+
+G_END_DECLS
diff --git a/c_glib/test/gandiva/test-function-registry.rb b/c_glib/test/gandiva/test-function-registry.rb
new file mode 100644
index 0000000..85b0307
--- /dev/null
+++ b/c_glib/test/gandiva/test-function-registry.rb
@@ -0,0 +1,45 @@
+# 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.
+
+class TestGandivaFunctionRegistry < Test::Unit::TestCase
+  include Helper::DataType
+
+  def setup
+    omit("Gandiva is required") unless defined?(::Gandiva)
+    @registry = Gandiva::FunctionRegistry.new
+  end
+
+  sub_test_case("lookup") do
+    def test_found
+      native_function = @registry.native_functions[0]
+      assert_equal(native_function,
+                   @registry.lookup(native_function.signature))
+    end
+
+    def test_not_found
+      signature = Gandiva::FunctionSignature.new("nonexistent",
+                                                 [],
+                                                 boolean_data_type)
+      assert_nil(@registry.lookup(signature))
+    end
+  end
+
+  def test_native_functions
+    assert_equal([Gandiva::NativeFunction],
+                 @registry.native_functions.collect(&:class).uniq)
+  end
+end
diff --git a/c_glib/test/gandiva/test-function-signature.rb b/c_glib/test/gandiva/test-function-signature.rb
new file mode 100644
index 0000000..ada3bbc
--- /dev/null
+++ b/c_glib/test/gandiva/test-function-signature.rb
@@ -0,0 +1,101 @@
+# 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.
+
+class TestGandivaFunctionSignature < Test::Unit::TestCase
+  include Helper::DataType
+
+  def setup
+    omit("Gandiva is required") unless defined?(::Gandiva)
+    parameter_types = [string_data_type, string_data_type, int32_data_type]
+    @to_date = Gandiva::FunctionSignature.new("to_date",
+                                              parameter_types,
+                                              date64_data_type)
+  end
+
+  def test_new
+    signature = Gandiva::FunctionSignature.new("add",
+                                               [
+                                                 int32_data_type,
+                                                 int32_data_type,
+                                               ],
+                                               int32_data_type)
+    assert_equal("int32 add(int32, int32)",
+                 signature.to_s)
+  end
+
+  sub_test_case("equal") do
+    def test_true
+      add_int32_1 = Gandiva::FunctionSignature.new("add",
+                                                   [
+                                                     int32_data_type,
+                                                     int32_data_type,
+                                                   ],
+                                                   int32_data_type)
+      add_int32_2 = Gandiva::FunctionSignature.new("add",
+                                                   [
+                                                     int32_data_type,
+                                                     int32_data_type,
+                                                   ],
+                                                   int32_data_type)
+      assert do
+        add_int32_1 == add_int32_2
+      end
+    end
+
+    def test_false
+      add_int32 = Gandiva::FunctionSignature.new("add",
+                                                 [
+                                                   int32_data_type,
+                                                   int32_data_type,
+                                                 ],
+                                                 int32_data_type)
+      add_int16 = Gandiva::FunctionSignature.new("add",
+                                                 [
+                                                   int16_data_type,
+                                                   int16_data_type,
+                                                 ],
+                                                 int16_data_type)
+      assert do
+        add_int32 != add_int16
+      end
+    end
+  end
+
+  def test_to_string
+    assert_equal("date64[ms] to_date(string, string, int32)",
+                 @to_date.to_s)
+  end
+
+  def test_get_return_type
+    assert_equal(date64_data_type,
+                 @to_date.return_type)
+  end
+
+  def test_get_base_name
+    assert_equal("to_date",
+                 @to_date.base_name)
+  end
+
+  def test_get_param_types
+    assert_equal([
+                   string_data_type,
+                   string_data_type,
+                   int32_data_type,
+                 ],
+                 @to_date.param_types)
+  end
+end
diff --git a/c_glib/test/gandiva/test-native-function.rb b/c_glib/test/gandiva/test-native-function.rb
new file mode 100644
index 0000000..f2546da
--- /dev/null
+++ b/c_glib/test/gandiva/test-native-function.rb
@@ -0,0 +1,129 @@
+# 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.
+
+class TestGandivaNativeFunction < Test::Unit::TestCase
+  include Helper::DataType
+
+  def setup
+    omit("Gandiva is required") unless defined?(::Gandiva)
+    @registry = Gandiva::FunctionRegistry.new
+    @not = lookup("not", [boolean_data_type], boolean_data_type)
+    @isnull = lookup("isnull", [int8_data_type], boolean_data_type)
+  end
+
+  def lookup(name, param_types, return_type)
+    signature = Gandiva::FunctionSignature.new(name,
+                                               param_types,
+                                               return_type)
+    @registry.lookup(signature)
+  end
+
+  def test_get_signature
+    assert_kind_of(Gandiva::FunctionSignature,
+                   @not.signature)
+  end
+
+  sub_test_case("equal") do
+    def test_true
+      assert do
+        @not == @registry.lookup(@not.signature)
+      end
+    end
+
+    def test_false
+      assert do
+        @not != @isnull
+      end
+    end
+  end
+
+  def test_to_string
+    assert_equal(@not.signature.to_s,
+                 @not.to_s)
+  end
+
+  sub_test_case("get_result_nullbale_type") do
+    def test_if_null
+      assert_equal(Gandiva::ResultNullableType::IF_NULL,
+                   @not.result_nullable_type)
+    end
+
+    def test_never
+      assert_equal(Gandiva::ResultNullableType::NEVER,
+                   @isnull.result_nullable_type)
+    end
+
+    def test_internal
+      to_date = lookup("to_date",
+                       [string_data_type, string_data_type, int32_data_type],
+                       date64_data_type)
+      assert_equal(Gandiva::ResultNullableType::INTERNAL,
+                   to_date.result_nullable_type)
+    end
+  end
+
+  sub_test_case("need_context") do
+    def test_need
+      assert do
+        not @not.need_context
+      end
+    end
+
+    def test_not_need
+      upper = lookup("upper",
+                     [string_data_type],
+                     string_data_type)
+      assert do
+        upper.need_context
+      end
+    end
+  end
+
+  sub_test_case("need_function_holder") do
+    def test_need
+      like = lookup("like",
+                    [string_data_type, string_data_type],
+                    boolean_data_type)
+      assert do
+        like.need_function_holder
+      end
+    end
+
+    def test_not_need
+      assert do
+        not @not.need_function_holder
+      end
+    end
+  end
+
+  sub_test_case("can_return_errors") do
+    def test_can
+      divide = lookup("divide",
+                      [int8_data_type, int8_data_type],
+                      int8_data_type)
+      assert do
+        divide.can_return_errors?
+      end
+    end
+
+    def test_not_can
+      assert do
+        not @not.can_return_errors?
+      end
+    end
+  end
+end
diff --git a/c_glib/test/helper/data-type.rb b/c_glib/test/helper/data-type.rb
new file mode 100644
index 0000000..5716f7e
--- /dev/null
+++ b/c_glib/test/helper/data-type.rb
@@ -0,0 +1,59 @@
+# 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
+# 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.
+
+module Helper
+  module DataType
+    def boolean_data_type
+      Arrow::BooleanDataType.new
+    end
+
+    def int8_data_type
+      Arrow::Int8DataType.new
+    end
+
+    def int16_data_type
+      Arrow::Int16DataType.new
+    end
+
+    def int32_data_type
+      Arrow::Int32DataType.new
+    end
+
+    def string_data_type
+      Arrow::StringDataType.new
+    end
+
+    def date64_data_type
+      Arrow::Date64DataType.new
+    end
+  end
+end
diff --git a/c_glib/test/run-test.rb b/c_glib/test/run-test.rb
index 16104a6..e6c7d3e 100755
--- a/c_glib/test/run-test.rb
+++ b/c_glib/test/run-test.rb
@@ -66,6 +66,7 @@ require "rbconfig"
 require "tempfile"
 require "zlib"
 require_relative "helper/buildable"
+require_relative "helper/data-type"
 require_relative "helper/fixture"
 require_relative "helper/omittable"
 require_relative "helper/plasma-store"