drop table Orders, Salesmen, T456a;
| Durch diesen Befehl werden die drei genannten Tabellen gelöscht. |
Tab1:
Load * Inline [
Customer, Items, UnitPrice
Bob, 5, 1.50
];
Tab2:
LOAD Customer, Sum( Items * UnitPrice ) as Sales
resident Tab1
group by Customer;
drop table Tab1;
| Nachdem die Tabelle Tab2 erstellt wurde, wird Tab1 gelöscht. |
// Load mapping table of country codes:
map1:
mapping LOAD *
Inline [
CCode, Country
Sw, Sweden
Dk, Denmark
No, Norway
] ;
// Load list of salesmen, mapping country code to country
// If the country code is not in the mapping table, put Rest of the world
Salespersons:
LOAD *,
ApplyMap('map1', CCode,'Rest of the world') As Country
Inline [
CCode, Salesperson
Sw, John
Sw, Mary
Sw, Per
Dk, Preben
Dk, Olle
No, Ole
Sf, Risttu] ;
// We don't need the CCode anymore
Drop Field 'CCode';
Drop Mapping Table map1;
Metrics:
Load * Inline [
Transaction ID, Sales Amount, Sales Cost, City, Customer ID
1000012, 4509.33, 1234.22, Oslo, 250v9849
1000013, 1043.21, 180.23, Gothenburg, 195d5930
1000014, 6038.35, 1400.10, Copenhagen, 195d5930
];
| Dieses Beispiel zeigt die Verwendung der Variante Drop mapping table. Eine Mapping-Tabelle map1 wird erstellt und dann in einer nachfolgenden LOAD-Anweisung mit der Funktion ApplyMap verwendet. Nach der Verwendung der Mapping-Tabelle wird diese aus dem Speicher gelöscht, wodurch die RAM-Nutzung für die Daten optimiert wird, die in nachfolgende Tabellen der Skriptausführung geladen werden. In diesem Fall wäre die RAM-Optimierung bei nur wenigen Zeilen in der Mapping-Tabelle kaum feststellbar. Bei großen Mapping-Tabellen oder beim Erstellen von Mapping-Tabellen innerhalb von Schleifen kann die Leistung jedoch erheblich verbessert werden. |