aggregation

How Camel 2.11 batch aggregation works with separate route?

馋奶兔 提交于 2019-12-01 06:27:36
First there is a similar unanswered question Joining routes into single aggregator We have some consumer routes (ftp, file, smb) reading files from remote systems. Simplified for test with direct route, but similar behavior with batch consumers: from("direct:"+routeId).id(routeId) .setProperty(AGGREGATION_PROPERTY, constant(routeId)) .log(String.format("Sending (${body}) to %s", "direct:start1")) .to("direct:aggregate"); After transformation all results from one poll are aggregated by batch in a separate route: from("direct:aggregate") .aggregate(property(AGGREGATION_PROPERTY), new

django aggregation to lower resolution using grouping by a date range

你。 提交于 2019-12-01 05:52:12
horrible title, but let me explain: i've got this django model containing a timestamp (date) and the attribute to log - f.e. the number of users consuming some ressource - (value). class Viewers(models.Model): date = models.DateTimeField() value = models.IntegerField() for each 10seconds the table contains the number of users. something like this: | date | value | |------|-------| | t1 | 15 | | t2 | 18 | | t3 | 27 | | t4 | 25 | | .. | .. | | t30 | 38 | | t31 | 36 | | .. | .. | now i want to generate different statistics from this data, each with another resolution. f.e. for a chart of the last

Django Postgresql ArrayField aggregation

﹥>﹥吖頭↗ 提交于 2019-12-01 03:27:29
In my Django application, using Postgresql, I have a model with an ArrayField of CharFields. I would like to know if there's a DB way to aggregate and get a list of all the strings in the table. For example: ['dog', 'cat'] ['dog'] ['cat'] would yield ['dog', 'cat'] I know how to do that in Python but would like to find out a way to aggregate this on the DB level. Using Django 1.8.4 In PostgreSQL you can do the following: SELECT DISTINCT UNNEST(array_column) FROM the_table; So if your model looks something like class TheModel(models.Model): # ... array_field = ArrayField(models.CharField(max

Aggregation and Composition in Java Code

此生再无相见时 提交于 2019-12-01 00:43:24
As the Aggregation and Composition is related Association or we can say it gives the understanding of relationship between object or anything else. I posted this question because i asked one question in Interview that what is the Composition and Aggregation. So as per my understanding i given my idea which is as follow. http://www.coderanch.com/t/522414/java/java/Association-Aggregation-Composition Aggregation, Association and Composition Association vs. Aggregation vs. Composition in Java and also visited much more. and my basic explanation was related that Aggregation indicates loose

UML Aggregation with and without arrow head

故事扮演 提交于 2019-11-30 22:35:11
I always thought that the UML aggregate is defined as a black (filled) diamond at the beginning of a path and no arrow head that the end: |--------| |--------| | :MyA |<>------| :MyB | |--------| |--------| Today I came across a notation like <>-----> (with an explicit arrow head on the right end). So I looked it up in the UML 2.4 specification and actually found references for both versions. My favourite reference: "UML and Patterns" by Craig Larman only mentions the first version without the arrow. In the UML specification I found a notice about navigable ends , but I am not sure if this is

Can't aggregate arrays

别说谁变了你拦得住时间么 提交于 2019-11-30 21:11:53
I can create an array of arrays: select array[array[1, 2], array[3, 4]]; array --------------- {{1,2},{3,4}} But I can't aggregated arrays: select array_agg(array[c1, c2]) from ( values (1, 2), (3, 4) ) s(c1, c2); ERROR: could not find array type for data type integer[] What am I missing? I use: CREATE AGGREGATE array_agg_mult(anyarray) ( SFUNC = array_cat, STYPE = anyarray, INITCOND = '{}' ); and queries like: SELECT array_agg_mult( ARRAY[[x,x]] ) FROM generate_series(1,10) x; Note that you must aggregate 2-dimensional arrays, so you'll often want to wrap an input array in a single-element

Aggregation and Composition in Java Code

一曲冷凌霜 提交于 2019-11-30 19:47:38
问题 As the Aggregation and Composition is related Association or we can say it gives the understanding of relationship between object or anything else. I posted this question because i asked one question in Interview that what is the Composition and Aggregation. So as per my understanding i given my idea which is as follow. http://www.coderanch.com/t/522414/java/java/Association-Aggregation-Composition Aggregation, Association and Composition Association vs. Aggregation vs. Composition in Java

Fast melted data.table operations

我与影子孤独终老i 提交于 2019-11-30 19:36:51
I am looking for patterns for manipulating data.table objects whose structure resembles that of dataframes created with melt from the reshape2 package. I am dealing with data tables with millions of rows. Performance is critical. The generalized form of the question is whether there is a way to perform grouping based on a subset of values in a column and have the result of the grouping operation create one or more new columns. A specific form of the question could be how to use data.table to accomplish the equivalent of what dcast does in the following: input <- data.table( id=c(1, 1, 1, 2, 2,

SUM(subquery) in MYSQL

老子叫甜甜 提交于 2019-11-30 16:38:53
问题 Basically, I am trying the following: SELECT m.col1, SUM(SELECT col5 FROM table WHERE col2 = m.col1) FROM table AS m This doesn't seem to work. Is there any solution? 回答1: Why don't you do this: SELECT m.col1, (SELECT SUM(col5) FROM table WHERE col2 = m.col1) FROM table AS m 回答2: yes - use joins SELECT m.col1, SUM(j.col5) FROM table AS m JOIN table AS j ON j.col2 = m.col1 GROUP BY m.col1 回答3: Sum is used inside the second select, where we want to sum the column. The col2 may be ambiguous

Aggregation with Group By date in Spark SQL

こ雲淡風輕ζ 提交于 2019-11-30 15:55:05
问题 I have an RDD containing a timestamp named time of type long: root |-- id: string (nullable = true) |-- value1: string (nullable = true) |-- value2: string (nullable = true) |-- time: long (nullable = true) |-- type: string (nullable = true) I am trying to group by value1, value2 and time as YYYY-MM-DD. I tried to group by cast(time as Date) but then I got the following error: Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl