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

Empty result of query #974

Closed
EgorBu opened this issue Oct 14, 2019 · 4 comments
Closed

Empty result of query #974

EgorBu opened this issue Oct 14, 2019 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@EgorBu
Copy link

EgorBu commented Oct 14, 2019

Hello,

I'm getting empty results for UAST unexpectedly.

How gitbase was launched:

>>> BBLFSH_ENDPOINT=0.0.0.0:9432 GITBASE_INDEX_DIR=~/workspace/egorbu/tensorflow_analysis_source_ce/dump/tensorflow_analysis/gitbase_index ./gitbase server -v -d tensorflow_repos

Version:

>>> gitbase version
gitbase (v0.23.1) - build 07-05-2019_14_11_18

Query:

SELECT
    files.repository_id,
    files.file_path,
    UAST(files.blob_content, LANGUAGE(files.file_path, files.blob_content), '//FunctionGroup') as functions
FROM files
NATURAL JOIN commit_files
NATURAL JOIN commits
NATURAL JOIN refs
WHERE
    refs.ref_name= 'HEAD' and functions IS NOT NULL
    AND LANGUAGE(files.file_path,files.blob_content) = 'Java'
LIMIT 10;

But it returns empty results.
Logs from gitbase:

INFO[1820] audit trail                                   action=query address="127.0.0.1:39288" connection_id=7 duration=32.011312302s pid=7 query="SELECT\n    files.repository_id,\n    files.file_path,\n    UAST(files.blob_content, LANGUAGE(files.file_path, files.blob_content), '//FunctionGroup') as functions\nFROM files\nNATURAL JOIN commit_files\nNATURAL JOIN commits\nNATURAL JOIN refs\nWHERE\n    refs.ref_name= 'HEAD' and functions IS NOT NULL\n    AND LANGUAGE(files.file_path,files.blob_content) = 'Java'\nLIMIT 10;" success=true system=audit user=root
INFO[1820] ConnectionClosed: client 7  
@erizocosmico erizocosmico self-assigned this Oct 14, 2019
@erizocosmico erizocosmico added the bug Something isn't working label Oct 14, 2019
@erizocosmico
Copy link
Contributor

Before diving deeper into this, can you try with the latest rc of 0.24.0 and see if this solves your issue?

@EgorBu
Copy link
Author

EgorBu commented Oct 14, 2019

I will be able to check probably in couple of hours

@m09
Copy link

m09 commented Oct 14, 2019

It works for me if I prefix FunctionGroup by uast: like so:

SELECT
    files.repository_id,
    files.file_path,
    UAST(files.blob_content, LANGUAGE(files.file_path, files.blob_content), '//uast:FunctionGroup') as functions
FROM files
NATURAL JOIN commit_files
NATURAL JOIN commits
NATURAL JOIN refs
WHERE
    refs.ref_name= 'HEAD'
    AND functions IS NOT NULL
    AND LANGUAGE(files.file_path,files.blob_content) = 'Java'
LIMIT 10;

@EgorBu
Copy link
Author

EgorBu commented Oct 14, 2019

Thanks @erizocosmico @m09 @ajnavarro !
Solution is
/FunctionGroup -> //uast:FunctionGroup

@EgorBu EgorBu closed this as completed Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants