You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/07/13 17:25:27 UTC

[GitHub] [arrow] wesm commented on a change in pull request #7684: ARROW-9374: [C++][Python] Expose MakeArrayFromScalar

wesm commented on a change in pull request #7684:
URL: https://github.com/apache/arrow/pull/7684#discussion_r453807979



##########
File path: cpp/src/arrow/array/array_test.cc
##########
@@ -384,6 +398,40 @@ TEST_F(TestArray, TestMakeArrayFromScalar) {
   }
 }
 
+TEST_F(TestArray, TestMakeArrayFromDictionaryScalar) {
+  auto dictionary = ArrayFromJSON(utf8(), R"(["foo", "bar", "baz"])");
+  auto type = std::make_shared<DictionaryType>(int8(), utf8());

Review comment:
       `::arrow::dictionary` works too

##########
File path: cpp/src/arrow/array/array_test.cc
##########
@@ -384,6 +398,40 @@ TEST_F(TestArray, TestMakeArrayFromScalar) {
   }
 }
 
+TEST_F(TestArray, TestMakeArrayFromDictionaryScalar) {
+  auto dictionary = ArrayFromJSON(utf8(), R"(["foo", "bar", "baz"])");
+  auto type = std::make_shared<DictionaryType>(int8(), utf8());
+  ASSERT_OK_AND_ASSIGN(auto value, MakeScalar(int8(), 1));
+  auto scalar = DictionaryScalar({value, dictionary}, type);

Review comment:
       Note you can also do `DictionaryScalar scalar({..., `




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org