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

Commit796de9c

Browse files
committed
/contrib/cube improvements:
Update the calling convention for all external facing functions. Byexternal facing, I mean all functions that are directly referenced incube.sql. Prior to my update, all functions used the older V0 callingconvention. They now use V1.New Functions:cube(float[]), which makes a zero volume cube from a float arraycube(float[], float[]), which allows the user to create a cube fromtwo float arrays; one for the upper right and one for the lower leftcoordinate.cube_subset(cube, int4[]), to allow you to reorder or choose a subset ofdimensions from a cube, using index values specified in the array.Joshua Reich
1 parente628464 commit796de9c

File tree

7 files changed

+662
-196
lines changed

7 files changed

+662
-196
lines changed

‎contrib/cube/CHANGES

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
1+
********************************************************************************
2+
Changes that were made in July 2006 by Joshua Reich I.
3+
********************************************************************************
4+
5+
Code Cleanup:
6+
7+
Update the calling convention for all external facing functions. By external
8+
facing, I mean all functions that are directly referenced in cube.sql. Prior
9+
to my update, all functions used the older V0 calling convention. They now
10+
use V1.
11+
12+
New Functions:
13+
14+
cube(float[]), which makes a zero volume cube from a float array
15+
16+
cube(float[], float[]), which allows the user to create a cube from
17+
two float arrays; one for the upper right and one for the lower left
18+
coordinate.
19+
20+
cube_subset(cube, int4[]), to allow you to reorder or choose a subset of
21+
dimensions from a cube, using index values specified in the array.
22+
23+
********************************************************************************
124
Changes that were made in August/September 2002 by Bruno Wolff III.
25+
********************************************************************************
226

327
Note that this was based on a 7.3 development version and changes may not
428
directly work with earlier versions.

‎contrib/cube/README.cube

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,16 @@ cube(float8, float8) returns cube
244244
This makes a one dimensional cube.
245245
cube(1,2) == '(1),(2)'
246246

247+
cube(float8[]) returns cube
248+
This makes a zero-volume cube using the coordinates defined by the
249+
array.
250+
cube(ARRAY[1,2]) == '(1,2)'
251+
252+
cube(float8[], float8[]) returns cube
253+
This makes a cube, with upper right and lower left coordinates as
254+
defined by the 2 float arrays. Arrays must be of the same length.
255+
cube('{1,2}'::float[], '{3,4}'::float[]) == '(1,2),(3,4)'
256+
247257
cube(cube, float8) returns cube
248258
This builds a new cube by adding a dimension on to an existing cube with
249259
the same values for both parts of the new coordinate. This is useful for
@@ -267,6 +277,13 @@ cube_ur_coord(cube, int) returns double
267277
cube_ur_coord returns the nth coordinate value for the upper right corner
268278
of a cube. This is useful for doing coordinate transformations.
269279

280+
cube_subset(cube, int[]) returns cube
281+
Builds a new cube from an existing cube, using a list of dimension indexes
282+
from an array. Can be used to find both the ll and ur coordinate of single
283+
dimenion, e.g.: cube_subset(cube('(1,3,5),(6,7,8)'), ARRAY[2]) = '(3),(7)'
284+
Or can be used to drop dimensions, or reorder them as desired, e.g.:
285+
cube_subset(cube('(1,3,5),(6,7,8)'), ARRAY[3,2,1,1]) = '(5, 3, 1, 1),(8, 7, 6, 6)'
286+
270287
cube_is_point(cube) returns bool
271288
cube_is_point returns true if a cube is also a point. This is true when the
272289
two defining corners are the same.
@@ -327,3 +344,10 @@ in August/September of 2002.
327344

328345
These include changing the precision from single precision to double
329346
precision and adding some new functions.
347+
348+
------------------------------------------------------------------------
349+
350+
Additional updates were made by Joshua Reich <josh@root.net> in July 2006.
351+
352+
These include cube(float8[], float8[]) and cleaning up the code to use
353+
the V1 call protocol instead of the deprecated V0 form.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp