博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Hive TIPS
阅读量:5279 次
发布时间:2019-06-14

本文共 1498 字,大约阅读时间需要 4 分钟。

LOAD DATA LOCAL INPATH '${env:HOME}/california-employees'

OVERWRITE INTO TABLE employees
PARTITION (country = 'US', state = 'CA');

 

If the LOCAL keyword is used, the path is assumed to be in the local filesystem. The data

is copied into the final location. If LOCAL is omitted, the path is assumed to be in the
distributed filesystem. In this case, the data is moved from the path to the final location.

 

FROM staged_employees se

  INSERT OVERWRITE TABLE employees
  PARTITION (country = 'US', state = 'OR')
  SELECT * WHERE se.cnty = 'US' AND se.st = 'OR'
  INSERT OVERWRITE TABLE employees
  PARTITION (country = 'US', state = 'CA')
  SELECT * WHERE se.cnty = 'US' AND se.st = 'CA'
  INSERT OVERWRITE TABLE employees
  PARTITION (country = 'US', state = 'IL')
  SELECT * WHERE se.cnty = 'US' AND se.st = 'IL';

扫描一遍

 

Furthermore, Hive will attempt to run other operations in local mode if the

hive.exec.mode.local.auto property is set to true :
set hive.exec.mode.local.auto=true;

but unfortunately it’s not valid:

hive> SELECT name, salary, deductions["Federal Taxes"],
>
salary * (1 - deductions["Federal Taxes"]) as salary_minus_fed_taxes
> FROM employees
> WHERE round(salary_minus_fed_taxes) > 70000;
FAILED: Error in semantic analysis: Line 4:13 Invalid table alias or
column reference 'salary_minus_fed_taxes': (possible column names are:
name, salary, subordinates, deductions, address)

Use nested select

 

Take care about FLOAT V DOUBLE!!  0.2

转载于:https://www.cnblogs.com/briller/p/3539741.html

你可能感兴趣的文章
python语法学习之数据结构
查看>>
Android学习CursorWrapper与Decorator模式
查看>>
【SQL】视图
查看>>
【编程之美】2.8 找符合条件的整数
查看>>
Android-多线程:AsyncTask多线程使用
查看>>
poj1062 昂贵的礼物(dijkstra+枚举)
查看>>
NOIP练习赛题目1
查看>>
找出全部最长连续反复子串及其个数
查看>>
从数据集输出艺术家
查看>>
Linux云计算面试会被问到的常见问题,linux运维课程学习
查看>>
Spring Boot实践教程:开篇
查看>>
感动世界的英雄妈妈
查看>>
DML语言DDL
查看>>
专题讨论:敏捷软件开发和传统软件工程
查看>>
深入探究VC —— 链接器link.exe(4)【转】http://blog.csdn.net/wangningyu/article/details/4849452...
查看>>
mfc的WM_PAINT笔记
查看>>
苹果应用商店AppStore审核规则指南
查看>>
第五节课-神经网络2
查看>>
使用idea启动node项目的问题
查看>>
mysql 存储过程
查看>>