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

An hquery pipe to hquery is processed interactively and not via stdin #1

Closed
mdgabriel opened this issue Mar 21, 2020 · 4 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@mdgabriel
Copy link
Owner

Consider

% for x in A B C D; do hquery "create $x <x:double>[i=0:0];"; done

that creates the arrays A, B, C and D. The following pipes to hquery works as expected

% echo "remove(A); remove(B); remove(C); remove(D);" | hquery

and

% hquery<<EOF
> remove(A);
> remove(B);
> remove(C);
> remove(D);
> EOF

and

% hquery -ocsv "project(list('arrays'),name);" | sed -r -n "/('A'|'B'|'C'|'D')./s/^.'([^'])'.$/remove(\1);/p" > remove.qy
% cat remove.qy | hquery

However, the follow pipe also works but outputs interactive output and prompts

% hquery -ocsv "project(list('arrays'),name);" | sed -r -n "/('A'|'B'|'C'|'D')./s/^.'([^'])'.$/remove(\1);/p" | hquery
SciDB version 19.11.0
{No} name,port,instance_id,online_since,instance_path
{0} 'localhost',1239,0,'2020-03-13 20:45:46','/home/scidb/scidbtrunk/stage/DB-mydb/0/0'
{1} 'localhost',1240,3,'2020-03-13 20:45:46','/home/scidb/scidbtrunk/stage/DB-mydb/0/1'
{2} 'dev2',1242,4294967297,'2020-03-13 20:45:46','/home/scidb/scidbtrunk/stage/DB-mydb/1/3'
{3} 'dev2',1241,4294967298,'2020-03-13 20:45:46','/home/scidb/scidbtrunk/stage/DB-mydb/1/2'
True/dcsv/0? True/dcsv/0? True/dcsv/0? True/dcsv/0? True/dcsv/0? %

@mdgabriel mdgabriel added the bug Something isn't working label Mar 21, 2020
@mdgabriel mdgabriel self-assigned this Mar 21, 2020
@mdgabriel
Copy link
Owner Author

Surprisingly, the follow works

% hquery -ocsv "project(list('arrays'),name);" | sed -r -n "/('A'|'B'|'C'|'D')./s/^.'([^'])'.$/remove(\1);/p" | (sleep 1; hquery)

@mdgabriel
Copy link
Owner Author

mdgabriel commented Mar 22, 2020

Upon review, hReady is only a suggestion and not a guarantee. One needs to introduce the option --wait-on-stdin (-W) to guarantee that hquery waits for stdin in a pipe.

@mdgabriel
Copy link
Owner Author

mdgabriel commented Mar 22, 2020

For the record, here is a cleaner example without sed
to remove arrays A, B, C and D

% hquery -otsv "project(apply,filter(list('arrays'),regex(name,'A|B|C|D')),
remove,'remove('+name+');'),remove);" | hquery -W

mdgabriel added a commit that referenced this issue Mar 22, 2020
Removed the now unnecessary base-compat constraint given
regex-1.0.*-r1.  Removed extra 'import Crypto.Hash' line in
UtilsUnsafe.hs.  Corrected some small documentation issues.  Updated
the scidb-hquery.cabal and stack.yaml files.  These changes did not
change the primitive API of hquery.  Tested lightly with SciDB 19.11
community edition.
@mdgabriel
Copy link
Owner Author

This issue is resolved with commit b568c3e.

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

1 participant