-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from hhatto/imporve-result-with-apache-arrow
improve select result with apache arrow output type
- Loading branch information
Showing
2 changed files
with
41 additions
and
4 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
examples/groonga_microblog_tutorial/3_search_error_with_pyarrow.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# coding: utf-8 | ||
from poyonga import Groonga | ||
|
||
|
||
def _call_with_apachearrow(g, cmd, **kwargs): | ||
print("[http with apache arrow response]") | ||
ret = g.call(cmd, **kwargs) | ||
print("status:", ret.status) | ||
if cmd == "select": | ||
print(type(ret.items)) | ||
if ret.items: | ||
print("item:", len(ret.items)) | ||
for item in ret.items: | ||
print(item) | ||
else: | ||
print(ret.body) | ||
print("=*=" * 30) | ||
else: | ||
print(ret.body) | ||
|
||
|
||
g = Groonga() | ||
|
||
_call_with_apachearrow( | ||
g, | ||
"select", | ||
table="Comment", # NOTE: invalid table name | ||
filter="last_modified<=1268802000", | ||
output_columns="posted_by.name,comment,last_modified", | ||
output_type="apache-arrow", | ||
drilldown="hash_tags,posted_by", | ||
drilldown_output_column="_id", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters