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

[BUG] JSQLParser 4.9: pgvector cosine similarity <=> Failing #2005

Open
lqh19870820 opened this issue May 15, 2024 · 0 comments
Open

[BUG] JSQLParser 4.9: pgvector cosine similarity <=> Failing #2005

lqh19870820 opened this issue May 15, 2024 · 0 comments

Comments

@lqh19870820
Copy link

lqh19870820 commented May 15, 2024

Failing SQL Feature:

  • Crash in Postgres Vector when evaluating cosine similarity like (embedding <=> '[3,1,2]') due to enclosing parentheses. <=> can't be parsed

SQL Example:

  • Using
    Statement statement = CCJSqlParserUtil.parse(vectorSql)

however, the following crashes:

String vectorSql= "SELECT (embedding <=> '[3,1,2]') AS cosine_similarity FROM items;";

with error message:

Exception in thread "main" net.sf.jsqlparser.JSQLParserException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "<=" <OP_MINORTHANEQUALS>
at line 1, column 19.

Was expecting one of:

")"
"."
"::"
"["
"^"

at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatement(CCJSqlParserUtil.java:350)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:123)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:89)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:62)
at cn.xlink.codeless.data.worker.restful.test.SqlTest.parseInsert(SqlTest.java:293)
at cn.xlink.codeless.data.worker.restful.test.SqlTest.main(SqlTest.java:71)

Caused by: java.util.concurrent.ExecutionException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "<=" <OP_MINORTHANEQUALS>
at line 1, column 19.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant