Comments (6)
Yes I agree the documentation is really good!
I'm not sure about this particular case, if this is the desired behavior. I'll keep it open for @vogievetsky to comment on.
from plywood.
@lastlegion Could you post your query (make it more generic if you need to)?
You should be running collect
on a DATASET
type object. It will hit https://github.com/implydata/plywood/blob/master/src/expressions/baseExpression.ts#L1431 to use a CollectExpression
I may be able to help out more if I understand your exact query.
from plywood.
I've been trying different variants of the following query:
var ex4 = ply().apply("d", $("dataset").filter($("field2").in(0,1)))
.apply("dd2", $("d").collect("$field2"))
or
var ex4 = ply().apply("d", $("dataset").filter($("field2").in(0,1)))
.apply("dd", $("d").select("field1", "field2"))
.apply("dd2", $("dd").collect("$field2"))
and I get the following error:
(node:55886) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: unsupported aggregate action $__SEGMENT__:DATASET.collect($HR:NUMBER) (as __VALUE__)
I tried replacing collect
with other aggregation functions like count
etc. and was able to get the right results. Thanks @robertervin for your help!
from plywood.
@lastlegion You're completely correct on this. I also ran into this issue when I tried running it.
What you want to do instead is first split by field2
. This will issue a groupBy
query to Druid, which is much more efficient than pulling all field2
values into memory in javascript then making them distinct.
So your first query would turn into
var ex4 = ply()
.apply("d", $("dataset")
.filter($("field2").in(0,1))
)
.apply("dd2", $("d")
.split({id: "$field2"})
.collect("$id")
)
Perhaps @vogievetsky may be able to shed some light on why Plywood doesn't perform this by default, or if my logic on the reasoning is correct.
from plywood.
Thanks for your help! Yes I'm able to the desired output by applying .split()
before .collect()
. Yes if this is a bug then I'm willing to put in a pull request or help with documenting it.
from plywood.
@lastlegion You're welcome! I'm not actually a member of Imply, so I can't accept any PRs or anything. I do think the documentation is fairly good, but could could definitely be improved.
You can try submitting a PR for it in https://github.com/implydata/plywood/blob/master/docs/expressions.md and calling out @vogievetsky (who I believe is the sole owner of this codebase).
Would appreciate if you could close this issue as well since it's fixed.
from plywood.
Related Issues (20)
- Allow extensibility for Druid extensions
- Question about supporting escape in string parsing rule
- How to let plywood use listFiltering? HOT 1
- Configure Plywood to not throw exception on unknown dimension
- Incomplete results for deeply nested queries
- Bucketing Time splits requires floorable Duration
- Adding Column Comparison filter
- Lookups
- Expression.some does not work
- Support of doubleFirst and doubleLast aggregation for druid HOT 1
- union dataset support
- Plywood and Druid zero-fill on timeseries queries HOT 1
- feature request: ability to split by TIME_FORMAT druid sql equivalent.
- How can I modify the start day of the week after selecting time shift
- Date equality works on Druid but not locally
- MatchExpression does not support ignoring case
- [Deprecation] SharedArrayBuffer will require cross-origin isolation as of M91, around May 2021.
- How to customize an expression in plywood?
- Getting incorrect count distinct value in Plywood
- concurrent limit requester getting stuck
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plywood.