Pig FLOOR基础教程文档

收录于 2023-04-20 00:10:05 · بالعربية · English · Español · हिंदीName · 日本語 · Русский язык · 中文繁體

Apache Pig FLOOR 函数

Apache Pig FLOOR 函数用于返回小于或等于给定数字的最大整数。

语法

FLOOR(expression)

FLOOR 函数示例

在此示例中,我们返回给定数字的下限值。

执行 FLOOR 的步骤功能

在本地计算机中创建一个文本文件并插入值。
$ nano mathfloor.txt
Apache Pig FLOOR Function 检查插入到文本文件中的值。
$ cat mathfloor.txt
Apache Pig FLOOR Function 上传特定目录下 HDFS 上的文本文件。
 $ hdfs dfs-put mathfloor.txt /pigexample
开启猪 MapReduce 运行模式。
$ pig
加载包含数据的文件。
grunt> A = LOAD '/pigexample/mathfloor.txt' AS (a1:float);
现在,执行并验证数据。
grunt> DUMP A;
Apache Pig FLOOR Function 让我们返回下限值。
grunt> Result = FOREACH A GENERATE FLOOR(a1);
grunt> DUMP Result;
Apache Pig FLOOR Function
在这里,我们得到了想要的输出。