Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitab7e0a9

Browse files
committed
Fix creation of ordered projections
1 parentf123758 commitab7e0a9

File tree

4 files changed

+35
-3
lines changed

4 files changed

+35
-3
lines changed

‎sql/test.sql‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,30 @@ select vit_refresh();
3131
select*from vit;
3232
selectcount(*)from vitwhere t='min'::text;
3333
selectcount(*)from vitwhere i>='1 minute'::interval;
34+
35+
createtablestock(symbolchar(5), daydate, lowreal, highreal, openreal, closereal);
36+
insert into stockvalues
37+
('AAA','01-11-2018',10.0,11.0,10.1,10.8),
38+
('AAA','02-11-2018',11.0,12.0,11.2,11.5),
39+
('AAA','03-11-2018',10.4,10.6,10.5,10.4),
40+
('AAA','04-11-2018',11.1,11.5,11.2,11.4),
41+
('AAA','05-11-2018',11.0,11.3,11.4,11.1);
42+
select create_projection('vstock','stock',array['day','low','high','open','close'],array['symbol'],'day');
43+
44+
select vstock_refresh();
45+
selectavg((open+close)/2),max(high-low)from stockgroup by day;
46+
setvops.auto_substitute_projections=on;
47+
explain (costs off)selectavg((open+close)/2),max(high-low)from stockgroup by day;
48+
selectavg((open+close)/2),max(high-low)from stockgroup by day;
49+
50+
insert into stockvalues
51+
('AAA','06-11-2018',10.1,10.8,10.3,10.2),
52+
('AAA','07-11-2018',11.1,11.8,10.2,11.4),
53+
('AAA','08-11-2018',11.2,11.6,11.4,11.3),
54+
('AAA','09-11-2018',10.6,11.1,11.3,10.8),
55+
('AAA','10-11-2018',10.7,11.3,10.8,11.1);
56+
select vstock_refresh();
57+
58+
selectavg((open+close)/2),max(high-low)from stockgroup by day;
59+
setvops.auto_substitute_projections=off;
60+
selectavg((open+close)/2),max(high-low)from stockgroup by day;

‎vops--1.0.sql‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3197,7 +3197,7 @@ declare
31973197
sep :=',';
31983198
if att_name=order_by
31993199
then
3200-
key_type= typname;
3200+
key_type:= att_typname;
32013201
end if;
32023202
end loop;
32033203

@@ -3222,7 +3222,7 @@ declare
32223222
execute create_index;
32233223
if key_type='timestamp'or key_type='date'
32243224
then
3225-
min_value :='''-infinity''';
3225+
min_value :='''''-infinity''''::'||key_type;
32263226
else
32273227
min_value :='-1';-- assume that key have only non-negative values
32283228
end if;

‎vops.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1932,7 +1932,7 @@ Datum vops_populate(PG_FUNCTION_ARGS)
19321932
Oidtype_id=DatumGetObjectId(SPI_getbinval(spi_tuple,spi_tupdesc,2,&is_null));
19331933
types[i].tid=vops_get_type(type_id);
19341934
get_typlenbyvalalign(type_id,&types[i].len,&types[i].byval,&types[i].align);
1935-
if (types[i].len<0) {/* varying length type: extract size from atttypmod */
1935+
if (types[i].tid!=VOPS_LAST&&types[i].len<0) {/* varying length type: extract size from atttypmod */
19361936
types[i].len=DatumGetInt32(SPI_getbinval(spi_tuple,spi_tupdesc,3,&is_null))-VARHDRSZ;
19371937
if (types[i].len<0) {
19381938
elog(ERROR,"Size of column %s is unknown",name);

‎vops.html‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,11 @@ <h2><a name="projections">Table projections</a></h2>
819819
<li>Query performs aggregation of vector (tile) columns.</li>
820820
<li>All other expressions in target list,<code>ORDER BY</code> /<code>GROUP BY</code> clauses refers only to scalar attributes of projection.</li>
821821
</ul>
822+
<p>
823+
Projection can be removed using<code>drop_projection(projection_name text)</code> function.
824+
It not only drops the correspondent table, but also remove information about it from<code>vops_partitions</code> table
825+
and drops generated refresh function.
826+
</p>
822827

823828

824829
<h2><aname="example">Example</a></h2>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp