8,406 questions
0
votes
0
answers
167
views
How to efficiently get the last row of a rolling aggregation group without .last()?
I'm working with a large Polars LazyFrame and computing rolling aggregations grouped by customer (Cusid). I need to find the "front" of the rolling window (last Tts_date) for each group to ...
0
votes
1
answer
60
views
How can I aggregate all columns with a 'number' type in power query
I'm trying to use power query to aggregate some invoicing columns by project number in power query.
I'm currently using a group by function which looks at the project number and then aggregates each ...
1
vote
1
answer
79
views
Counting values using nested SQL query
I have the following tables with values:
CREATE TABLE Produkty
(
Id NUMBER(10) NOT NULL,
Nazwa VARCHAR2(50) NOT NULL,
Status VARCHAR2(50) NOT NULL,
CONSTRAINT CHK_Status CHECK (Status ...
0
votes
1
answer
47
views
Domain Driven Design Aggregate Pattern
In my bounded context we have User and webinar aggregate roots. The invariant is that a user can only be added to webinar once. To fulfill this, webinar aggregate has a list of participant Ids to ...
0
votes
0
answers
36
views
recursive sum of totals by org and descendants in redshift
I have a table like this:
total
alert
group_id
hlevel
full_path
parent_id
root_group_id
5100FFFF-60B6-D5CD-FCCD-A8A3E03F0000
1
BizA\DivA
5100FFFF-60B6-D5CD-BFBA-A8A3E03F0000
5100FFFF-60B6-D5CD-FCCD-...
0
votes
0
answers
67
views
How to aggregate by a set of columns and turn groups on columns with counts of the same dataframe in R? [duplicate]
I´ve got a large dataframe that I´ve got to aggregate and then show counts by geo, the lines should be unique by product, sex and education… already use dplyr to group by and then count but only get ...
0
votes
1
answer
70
views
Mondrian 10 ignores aggregate table
I have a fact table about sales figures (SALESSTATS table, in MYSCHEMA schema), and I created an aggregate table MYAGG (in MYSCHEMA as well), but when querying revenue per company, it ignores the ...
0
votes
1
answer
166
views
Android Health Connect giving very weird responses
I started down the rabbit hole of Android Health Connect, and everything was going great until it started giving me some weird results. I am currently using the latest release candidate version 1.1.0-...
0
votes
0
answers
78
views
ThrottlingInflightRoutePolicy is not working in camel throwing OutOfMemoryError when using aggregate EIP
ThrottlingInflightRoutePolicy routePolicy = new ThrottlingInflightRoutePolicy();
routePolicy.setMaxInflightExchanges(20);
routePolicy.setResumePercentOfMax(70);
from("jms:...
2
votes
3
answers
143
views
Double aggregation function
I have the result of a subquery:
SELECT
maker, p.type, COUNT(DISTINCT pc.model) pcs
FROM
Product p
INNER JOIN
Pc pc ON p.model = pc.model
GROUP BY
maker, p.type
UNION
SELECT
...
1
vote
2
answers
138
views
Would adding a CustomerId to the Order entity violate DDD or database design principles to improve lookup performance?
We are building a system using Domain-Driven Design (DDD) in C# (.NET), and we have a performance-related design concern.
Currently, in our domain model, a Customer creates OfferDetails, and each ...
0
votes
1
answer
101
views
Create a two-way table in R base that displays concatenated game results between players
Objective
To create a function in R {base} that produces a square matrix showing concatenated game results between players. The matrix should display the result of each pairwise match, concatenating ...
-1
votes
3
answers
66
views
Oracle SQL staged grouping [closed]
Basically i have a big joined table with bunch of key columns (some of witch are calculated) and a value column:
key1
key2
key3
key4
value1
ABC
F
cat
1
10
ABC
F
cat
2
20
ABC
F
cat
2
10
ABC
F
dog
1
20
...
0
votes
0
answers
98
views
Sort Index Aggregate by Seperate Column
I have a table of data that I'm sorting with an index aggregate. The data that I'm indexing has several numbers inside of it. Ex: W-X-Y-Z. If I use the small feature of aggregate, it naturally finds ...
0
votes
1
answer
118
views
How to avoid N+1 or memory inefficiency when applying DDD Aggregate pattern?
I’m applying the DDD Aggregate pattern in a Spring Boot application.
For example, Order is the aggregate root of OrderItem, and they are mapped like this:
@Entity
public class Order {
@Id
...
3
votes
1
answer
49
views
KGroupedStream reduce use key in Reducer logic
I am using Kafka Streams to group and reduce a kafka topic.
I want to generate an output for a key, if the key and the value are equal for all values against a given key; otherwise don't output ...
0
votes
1
answer
80
views
Does mongodb aggregate return documents that were inserted after the aggregate started?
A mongodb aggregate command returns a cursor that you can then iterate to get all documents corresponding to the aggregate command.
Does this cursor also return documents that were inserted after the ...
1
vote
1
answer
66
views
how to write the json with subdocument column names to json
I have code as below to write a json from the below dictionary
Looks like there is issue in my group by or aggregate.
It is not generating the JSON as expected as give below.
import json
data = { &...
0
votes
0
answers
48
views
Compacting to min/max row on TTL in Clickhouse
It's rather easy and well documented how to compact the data in clickhouse after TTL, for example from the docs...
CREATE TABLE events
(
`event` String,
`time` DateTime,
`value` UInt64
)
...
0
votes
2
answers
99
views
AggregateUpdateConcurrencyException when using DDD aggregate and pre-generated IDs
I have a Patient aggregate root entity with a list of Visit child entities under it. Per DDD principles, any operation on a Visit object is done through the aggregate root. Also, any persistence must ...
3
votes
2
answers
169
views
compute named quantiles in pandas using groupby aggregate
Among other descriptive statistics, I want to get some quantiles out of my pandas DataFrame. I can get the quantiles I want a couple of different ways, but I can't find the right way to do it with ...
0
votes
1
answer
67
views
Get columns associated with aggregate results involving multiple tables
Think web forum structure here. My current query gets the timestamps from the oldest and newest posts associated with each thread. What I can't seem to figure out is how to get the userid associated ...
2
votes
3
answers
109
views
Conditional aggregate and distinct
Using StringAgg with the distinct=True argument works under normal circumstances, e.g.:
entities = entities.annotate(roles=StringAgg(
"credits__role__name",
delimiter=", ",
...
0
votes
0
answers
42
views
Is there a way to match variables (e.g., grant number; number of hours) when aggregating and each person has multiple grant and hours?
enter image description hereI have an SPSS dataset in which persons have data in multiple rows. The rows represent a different agency and different grant hours. There are over 70 variables, which is ...
0
votes
2
answers
190
views
Spark aggregate on different group of Column
I have a table consists of 30 column in which first 5 columns made up to the primary key and rest are information i want to group on with primary keys.
Primary key = year,month,day,hr,ID
rest columns =...
0
votes
0
answers
73
views
Cython GroupBy Function much slower then similar Numba Function
I have a very basic group by function that I want to use in a Cython object but it's something like 400 times slower than a similar function in Python JITed by Numba
This is my Cython function
@cython....
1
vote
1
answer
75
views
How to query data if date is certain range before today's date?
I'm writing a MERN stack app to keep track of product's expiry dates in a store. The app will check to see if today's date is the same or after the product's "expiry date".
The query I wrote ...
-2
votes
2
answers
261
views
Using SQL , how do I select the max values when there is more than one with the same max value?
I am trying to select the maximum ImportDate for each person. For this person "Bob James" he should have the last 2 rows selected with ID 267311 and 267342. I need to see every column in the ...
0
votes
0
answers
44
views
Modeling many to many invariants in DDD
I'm currently learning DDD and am having trouble modeling invariants in a many to many relationship
Lets suppose I am attempting to model a school scheduling program, and I have the following ...
2
votes
2
answers
70
views
Why does summing data grouped by df.iloc[:, 0] also sum up the column names?
I have a DataFrame with a species column and four arbitrary data columns. I want to group it by species and sum up the four data columns for each one. I've tried to do this in two ways: once by ...
1
vote
1
answer
74
views
How to Apply JS Mongoose Aggregate Regex Match to String Array and Other Fields
I am trying to write an aggregation to regex match a search string across various fields in a list of items. Here is an example JSON array of those items:
{
"user": "String",
...
0
votes
0
answers
54
views
MongoDB aggregation - multiple levels of expanded product categories
I'm using the ecommerce platform swell, which allows for aggregation queries. I have to return product data with multiple levels of expanded categories.
the products have a category_index.id field ...
1
vote
1
answer
38
views
Logstash field is never shown after aggregation
I have logstash version 7.8.0
Can someone tell me why the aggregation below never shown THREAD_ID field into documents please ?
My field : thread_id is added in the end of aggregation ..
Sample.log:
...
0
votes
1
answer
71
views
SQL aggregate whether table contains a category or type of record
Can anyone think of a better way to structure a SQL query for this problem?
I want to group by account_id and determine whether a type of row exists in the table and just aggregate that to a simple ...
0
votes
0
answers
79
views
Clickhouse - optimize when filtering on aggregating columns in AggregatingMergeTree
Suppose I have a table of raw data that looks something like this:
CREATE TABLE raw_table(
uid UInt64,
timestamp DateTime64,
status String,
...
) ENGINE = MergeTree
ORDER BY (...
0
votes
1
answer
43
views
ElasticSearch - Get uniqe query results by id together with cardinality aggregation
Hello I would like to archive the following, we have a data pool there we store a lot of duplicated items (see a sample below) and i need to query all latest entry's by an distinct id, after wards i ...
-2
votes
1
answer
56
views
Left join but use group by field that on right table [duplicate]
I have two tables, first one has detailed order information.
Table A: Restaurants id, brand id, date, order id, order value (usd)
Table B: Restaurants id, restaurants name, brand name
I want to ...
0
votes
1
answer
36
views
How to create a variable from count of instances of an existing variable in SPSS
I want to create a variable that is the count of instances of a certain year in my dataset in SPSS. To be more specific, I am analyzing the number of suicides before and after 1996. I have a data set ...
0
votes
1
answer
50
views
the created_at search in prisma aggregateRow mongodb does not work
I use the date-fns library to work with dates. the code provided their methods.
prisma: 5.22.0
@prisma/client: 5.22.0
async getAllOnYear() {
const date = new Date()
const startYear = ...
0
votes
1
answer
96
views
while using aggregate plugin in logstash script i am getting undefined local variable or method 'map'
i am using aggregate plugin to keep count of how many events happened for a particular task id but when i try to use the map values inside the timeout_code i am getting "undefined local variable ...
0
votes
1
answer
159
views
Multiple STRING_AGG in one query
I have a dataset that looks like this:
Dummy table
The desired view I'd like is:
enter image description here
I have tried the STRING_AGG function, which works, but for only one column. See below for ...
1
vote
1
answer
105
views
Filtering a pivot to only include columns with data [Snowflake]
Somewhat of an unusual request. We have a software that asks survey questions. Any survey can include any number of questions (From 1 to 30 easily, but there is no limit).
The request from the user is ...
0
votes
1
answer
88
views
Aggregate into custom groups
I'm not sure if this can be done in one stored procedure. I got it working using nested views but I want it to be as concise as possible.
Every time I try to select from a subquery, I get errors that ...
1
vote
1
answer
107
views
How do I perform this aggregation over columns based on data from other columns in Polars?
I have data that looks like this loaded into Polars:
uid
groupid
thresholds
class
data1
data2
data3
data4
X1
X
0.0
0
1
1
1
X2
X
0.0
0
1
1
1
X3
X
0.0
0
1
1
1
Y1
Y
0.0
1
1
1
1
Y2
Y
0.0
1
1
1
1
Y3
Y
...
0
votes
2
answers
56
views
R - add column to dataset with number of times that a row value is repeated [duplicate]
i've searching for how to do this in R, but unfortunately didn't found an easy way to do it.
if i have a dataset called people like this
A
B
John
Student
John
Student
John
Student
Sarah
Student
Sarah
...
0
votes
1
answer
62
views
How to aggregate data using Date with JPA
I'm quite lost. I tried to aggregate data using this entity
@Entity
@Table(
name = "page_view",
indexes = [
Index(name = "idx_page_view_site_date", columnList = &...
0
votes
1
answer
32
views
Cross table sorting in mongodb
How do I sort a response from a table according to the other table's key?
For example:
I have a table named user data. The contents of the table is:
{ _id:objectId, name:string, age:number}
Now I have ...
1
vote
1
answer
103
views
When an aggregate inherits from an aggregate, is there risk of object slicing or memory leaks?
I am reading some material about C++17, I have a question about inheritance between aggregates.
If an aggregate inherits from an other aggregate, isn't it a problem ? Is there not any risk of slicing ...
0
votes
1
answer
65
views
Is it acceptable to pass a list of the same aggregate root type to a method in Domain-Driven Design (DDD)
We are learning and implementing Domain-Driven Design (DDD), and we have a sample entity below: PaymentInvoice.
My question is, is it acceptable to pass a list of PaymentInvoice entities to the ...
0
votes
1
answer
50
views
Create column of current balance in PySpark
I have the below dataframe created in PySpark code:
+---------------+-------------+---------------+------+
|TransactionDate|AccountNumber|TransactionType|Amount|
+---------------+-------------+--------...