Mayil-AI-Sandbox / kuzudb_jan15

MIT License
0 stars 0 forks source link

Kuzu Shell Pasting sometimes cuts the query short (hashtag2764) #36

Open vikramsubramanian opened 4 months ago

vikramsubramanian commented 4 months ago

I am pasting the following query into the kuzu shell:

MATCH (p:Person {id: 0}), (friend:Person {firstName: "A"})
       WHERE NOT p.id=friend.id
       WITH p, friend
       MATCH path = (p)-[:KNOWS* SHORTEST 1..3]-(friend)
       WITH min(length(path)) AS distance, friend
ORDER BY
    distance ASC,
    friend.lastName ASC,
    to_int64(friend.id) ASC
LIMIT 20

MATCH (friend)-[:IS_LOCATED_IN]->(friendCity:City)
OPTIONAL MATCH (friend)-[studyAt:STUDY_AT]->(uni:University)-[:IS_LOCATED_IN]->(uniCity:City)
WITH friend, collect(
    CASE uni.name
        WHEN null THEN null
        ELSE [uni.name, studyAt.classYear, uniCity.name]
    END ) AS unis, friendCity, distance

OPTIONAL MATCH (friend)-[workAt:WORK_AT]->(company:Company)-[:IS_LOCATED_IN]->(companyCountry:Country)
WITH friend, collect(
    CASE company.name
        WHEN null THEN null
        ELSE [company.name, workAt.workFrom, companyCountry.name]
    END ) AS companies, unis, friendCity, distance

RETURN
    friend.id AS friendId,
    friend.lastName AS friendLastName,
    distance AS distanceFromPerson,
    friend.birthday AS friendBirthday,
    friend.creationDate AS friendCreationDate,
    friend.gender AS friendGender,
    friend.browserUsed AS friendBrowserUsed,
    friend.locationIP AS friendLocationIp,
    friend.email AS friendEmails,
    friend.speaks AS friendLanguages,
    friendCity.name AS friendCityName,
    unis AS friendUniversities,
    companies AS friendCompanies
ORDER BY
    distanceFromPerson ASC,
    friendLastName ASC,
    to_int64(friendId) ASC
LIMIT 20

This may not be a valid query (I'm using the shell to test if certain things are valid or not), but often times the shell cuts the end of some of the lines short. For example, the last line may be LIMI instead of LIMIT 20. This behaviour occurs very randomly.

Update: it seems like this issue occurs rather frequently in the vscode terminal. )

mayil-ai[bot] commented 4 months ago

Summary: Kuzu Shell pasting cuts the query short randomly, especially in the VSCode terminal.

Possible Solution

Based on the provided information, the issue seems to be related to pasting multi-line queries into the Kùzu shell, particularly when using the VSCode terminal. The end of some lines is being cut short, which suggests a problem with the handling of clipboard data or the input buffer in the shell interface.

To address this issue, consider the following steps:

None of the provided code snippets seem directly related to the kuzu shell or its input handling mechanism. Therefore, the solution would involve writing or modifying the shell's code to handle pasted queries more robustly, which is not present in the snippets.

Code snippets to check