Examples | CALCMATRIX | Teradata Vantage - Example: One Input Matrix, Single SQL Statement - Analytics Database - Teradata Vantage

SQL Operators and User-Defined Functions

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-04-05
dita:mapPath
xub1628111590556.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
drp1544241916620
lifecycle
latest
Product Category
Teradata Vantage™
In the following example, table T has 1 billion rows of weather data. It has 1 geometry column representing the point (latitude/longitude) of the observation, and these REAL columns:
  • temperature
  • air_pressure
  • rainfall.

Use an SQL statement that invokes CALCMATRIX twice, once for the LOCAL phase and once for the COMBINE phase, as follows:

select * from CALCMATRIX( ON (
   select 1 as p, X.* from CALCMATRIX( ON (select temperature,       air_pressure, rainfall from T) 
   USING PHASE('LOCAL') )X )
   HASH BY p
   USING PHASE('COMBINE')
   )Y;

The result set would be the SSCP matrix for the weather data. The following table shows the result set. n means the numeric result of the calculation.

rownum rowname temperature air_pressure rainfall
1 temperature n n n
2 air_pressure n n n
3 rainfall n n n