- Apache Pig 教程
- Apache Pig - 首頁
- Apache Pig 簡介
- Apache Pig - 概述
- Apache Pig - 架構
- Apache Pig 環境
- Apache Pig - 安裝
- Apache Pig - 執行
- Apache Pig - Grunt Shell
- Pig Latin
- Pig Latin - 基礎
- 載入 & 儲存運算子
- Apache Pig - 讀取資料
- Apache Pig - 儲存資料
- 診斷運算子
- Apache Pig - 診斷運算子
- Apache Pig - Describe 運算子
- Apache Pig - Explain 運算子
- Apache Pig - Illustrate 運算子
- 分組 & 連線
- Apache Pig - Group 運算子
- Apache Pig - Cogroup 運算子
- Apache Pig - Join 運算子
- Apache Pig - Cross 運算子
- Pig Latin 內建函式
- Apache Pig - 評估函式
- 載入 & 儲存函式
- Apache Pig - Bag & Tuple 函式
- Apache Pig - 字串函式
- Apache Pig - 日期時間函式
- Apache Pig - 數學函式
- Apache Pig 有用資源
- Apache Pig - 快速指南
- Apache Pig - 有用資源
- Apache Pig - 討論
Apache Pig - EXP() 函式
Pig Latin 的EXP()函式用於獲取尤拉數e的x次冪(給定表示式)。
語法
以下是EXP()函式的語法。
grunt> EXP(expression)
示例
假設在HDFS目錄/pig_data/中有一個名為math.txt的檔案。此檔案包含如下所示的整數和浮點值。
math.txt
5 16 9 2.5 5.9 3.1
我們已使用名為math_data的關係將此檔案載入到 Pig 中,如下所示。
grunt> math_data = LOAD 'hdfs://:9000/pig_data/math.txt' USING PigStorage(',')
as (data:float);
現在讓我們使用EXP()函式計算math.txt檔案內容的exp值,如下所示。
grunt> exp_data = foreach math_data generate (data), EXP(data);
上述語句將結果儲存在名為exp_data的關係中。使用Dump運算子驗證關係的內容,如下所示。
grunt> Dump exp_data; (5.0,148.4131591025766) (16.0,8886110.520507872) (9.0,8103.083927575384) (2.5,12.182493960703473) (5.9,365.0375026780162) (3.1,22.197949164480132)
apache_pig_math_functions.htm
廣告