Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(JP) 文字列の比較結果が、SeqScanと一致しない #17

Closed
taiki-k opened this issue May 19, 2014 · 2 comments
Closed

(JP) 文字列の比較結果が、SeqScanと一致しない #17

taiki-k opened this issue May 19, 2014 · 2 comments
Labels
bug developer confirmed the steps to reproduce the problem, and does not work as expected

Comments

@taiki-k
Copy link
Contributor

taiki-k commented May 19, 2014

最新のコードにて、文字列の"<"や">"の比較を試していますが、
SeqScanの結果と一致しない場合が出現しました。

  • 実行したクエリー
SELECT * FROM member_pref_str WHERE pref_name < 'Ehime';
  • 対象のテーブル
pgstrom_test=# \d member_pref_str
 Table "public.member_pref_str"
  Column   |  Type   | Modifiers
-----------+---------+-----------
 pref      | integer |
 pref_name | text    |
  • 結果(SeqScan)
 pref | pref_name
------+-----------
    2 | Aomori
    3 | Akita
   12 | Chiba
   20 | Aichi
(4 rows)

*結果(GpuScan)

 pref | pref_name
------+-----------
    2 | Aomori
    3 | Akita
   12 | Chiba
   20 | Aichi
   37 | Ehime
(5 rows)
@kaigai
Copy link
Contributor

kaigai commented May 20, 2014

OpenCL側でテキストを比較する varlena_cmp において、
varlena型(可変長データ型; textなど)の長さを取得するために
VARSIZE_ANY() マクロを使用していた。

が、これは varlena型のヘッダ領域を含むサイズを返却する。
varlena型は4-byte又は1-byteのヘッダにデータ領域が続く
形式になっているため、VARSIZE_ANY_EXHDR() を使用
しなければデータ領域のみの長さを算出できない。

PostgreSQL本体より上記のマクロをポーティングし、
OpenCLのvarlena_cmp()を修正。

postgres=# select * from t6 where pref > 'Iwate';
id | pref
----+----------
5 | Miyagi
6 | Yamagata
(2 rows)

postgres=# set pg_strom.enabled = off;
SET
postgres=# select * from t6 where pref > 'Iwate';
id | pref
----+----------
5 | Miyagi
6 | Yamagata
(2 rows)

@taiki-k
Copy link
Contributor Author

taiki-k commented May 20, 2014

最新版で確認しました。
SeqScanの結果と一致するようになりました。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug developer confirmed the steps to reproduce the problem, and does not work as expected
Projects
None yet
Development

No branches or pull requests

2 participants