[Groonga-commit] ranguba/rroonga at c9383b6 [master] Add Context#support_arrow?

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Jan 28 23:51:43 JST 2018


Kouhei Sutou	2018-01-28 23:51:43 +0900 (Sun, 28 Jan 2018)

  New Revision: c9383b60c8fe4692e496aa8973b2e98b74332fa2
  https://github.com/ranguba/rroonga/commit/c9383b60c8fe4692e496aa8973b2e98b74332fa2

  Message:
    Add Context#support_arrow?

  Modified files:
    ext/groonga/rb-grn-context.c
    test/test-table-arrow.rb

  Modified: ext/groonga/rb-grn-context.c (+28 -4)
===================================================================
--- ext/groonga/rb-grn-context.c    2018-01-28 23:47:36 +0900 (a0ea86b8)
+++ ext/groonga/rb-grn-context.c    2018-01-28 23:51:43 +0900 (75f13ae3)
@@ -1,6 +1,6 @@
 /* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
-  Copyright (C) 2010-2015  Kouhei Sutou <kou �� clear-code.com>
+  Copyright (C) 2010-2018  Kouhei Sutou <kou �� clear-code.com>
   Copyright (C) 2016  Masafumi Yokoyama <yokoyama �� clear-code.com>
 
   This library is free software; you can redistribute it and/or
@@ -700,10 +700,10 @@ rb_grn_context_support_lz4_p (VALUE self)
 }
 
 /*
- * If Groonga supports Zstandard compression, it returns `true`,
- * otherwise it returns `false`.
- *
  * @overload support_zstd?
+ *
+ *   @return [Boolean] `true` if Groonga supports Zstandard compression,
+ *     `false` otherwise.
  */
 static VALUE
 rb_grn_context_support_zstd_p (VALUE self)
@@ -722,6 +722,28 @@ rb_grn_context_support_zstd_p (VALUE self)
 }
 
 /*
+ * @overload support_arrow?
+ *
+ *   @return [Boolean] `true` if Groonga supports Apache Arrow,
+ *     `false` otherwise.
+ */
+static VALUE
+rb_grn_context_support_arrow_p (VALUE self)
+{
+    VALUE rb_support_p;
+    grn_ctx *context;
+    grn_obj support_p;
+
+    context = SELF(self);
+    GRN_BOOL_INIT(&support_p, 0);
+    grn_obj_get_info(context, NULL, GRN_INFO_SUPPORT_ARROW, &support_p);
+    rb_support_p = CBOOL2RVAL(GRN_BOOL_VALUE(&support_p));
+    GRN_OBJ_FIN(context, &support_p);
+
+    return rb_support_p;
+}
+
+/*
  * コンテキストが使うデータベースを返す。
  *
  * @overload database
@@ -1030,6 +1052,8 @@ rb_grn_init_context (VALUE mGrn)
                      rb_grn_context_support_lz4_p, 0);
     rb_define_method(cGrnContext, "support_zstd?",
                      rb_grn_context_support_zstd_p, 0);
+    rb_define_method(cGrnContext, "support_arrow?",
+                     rb_grn_context_support_arrow_p, 0);
 
     rb_define_method(cGrnContext, "database", rb_grn_context_get_database, 0);
 

  Modified: test/test-table-arrow.rb (+6 -2)
===================================================================
--- test/test-table-arrow.rb    2018-01-28 23:47:36 +0900 (eeddf689)
+++ test/test-table-arrow.rb    2018-01-28 23:51:43 +0900 (63745a8a)
@@ -1,4 +1,4 @@
-# Copyright (C) 2007  Kouhei Sutou <kou �� clear-code.com>
+# Copyright (C) 2017-2018  Kouhei Sutou <kou �� clear-code.com>
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -16,7 +16,11 @@
 class TableArrowTest < Test::Unit::TestCase
   include GroongaTestUtils
 
-  setup :setup_database
+  def setup
+    setup_database
+
+    omit("Apache Arrow support is required") unless context.support_arrow?
+  end
 
   def assert_dump_load(type, n_records)
     Groonga::Schema.define do |schema|
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180128/26320840/attachment-0001.htm 



More information about the Groonga-commit mailing list
Back to archive index