Hive - 内表和外表的区别

Hive内表与外表的区别 一、区别 1、创建表结构 ①在Hive里面创建一个表: hive> create table wyp(id int, > name string, > age int, > tele string) > ROW FORMAT DELIMITED > FIELDS TERMINATED BY '\t' &gt... 阅读详情
1. 内部表
create table zz (name string , age string) location '/input/table_data';  
注:hive默认创建的是内部表
此时,会在hdfs上新建一个zz表的数据存放地

load data inpath '/input/data' into table zz;  
会将hdfs上的/input/data目录下的数据转移到/input/table_data目录下。 删除zz表后,会将zz表的数据和元数据信息全部删除,即最后/input/table_data下无数据,当然/input/data下再上一步已经没有了数据!

     如果创建内部表时没有指定location,就会在/user/hive/warehouse/下新建一个表目录,其余情况同上。

    注:load data会转移数据


2. 外部表
create external table et (name string , age string);  
会在/user/hive/warehouse/新建一个表目录et

load data inpath '/input/edata' into table et;  
把hdfs上/input/edata/下的数据转到/user/hive/warehouse/et下 ,删除这个外部表后,/user/hive/warehouse/et下的数据不会删除,但是/input/edata/下的数据在上一步load后已经没有了! 数据的位置发生了变化!本质是load一个hdfs上的数据时会转移数据!

3. 小结
最后归纳一下Hive中表与外部表的区别:
     1、在导入数据到外部表,数据并没有移动到自己的数据仓库目录下(如果指定了location的话),也就是说外部表中的数据并不是由它自己来管理的!而内部表则不一样;
     2、在删除内部表的时候,Hive将会把属于表的元数据和数据全部删掉;而删除外部表的时候,Hive仅仅删除外部表的元数据,数据是不会删除的!

     3. 在创建内部表或外部表时加上location 的效果是一样的,只不过表目录的位置不同而已,加上partition用法也一样,只不过表目录下会有分区目录而已,load data local inpath直接把本地文件系统的数据上传到hdfs上,有location上传到location指定的位置上,没有的话上传到hive默认配置的数据仓库中。

ESXI添加硬盘时提示 无法创建 VMFS 数据存储 - 无法更改主机配置 ESXI添加硬盘时提示 无法创建 VMFS 数据存储 - 无法更改主机配置1.打开ESXI的SSH2.找到不能添加的硬盘路径3.用SSH操作 1.打开ESXI的SSH 2.找到不能添加的硬盘路径 我的是第一个,找到你要添加但是不能添加的那个硬盘,点进去。 完整的路劲为:1/2 比如我的: /vmfs/devices/disks/t10.ATA_____ST500LT0122D1DG142___________________________________S3PHRNHQ (比较长哈!) 3.用SSH 阅读详情

相关推荐

统信UOS服务器上,达梦DM8数据库安装避坑全记录(附大小写敏感设置)

本文详细介绍了在统信UOS服务器版上部署达梦DM8数据库的全过程,包括环境准备、安装流程、数据库实例初始化及关键参数配置,特别是大小写敏感设置的注意事项。提供了从系统配置到性能优化的完整指南,帮助用户避免常见问题,确保数据库稳定运行。

weixin_30647423的博客 332

内表,外表

一、内表 Internal Table 内表与结构体基本类似,它同样是程序运行中被临时创建的一个存储空间,它是一个可包含多条记录的数据表。 二、外表 外表(external table)就像普通的表对像一样,可以select等,只是它是只读的,数据库中只保存了表结构的描述,表数据却没有存放在数据库内,而是存放在了文件系统上。当用户想偶尔使用数据库外的结构化数据时,用起外表来就非常方便,

松门一枝花 1万+

Win10 LTSC 2021 CPU占用率飙升?KB5017308补丁修复全攻略

本文针对Windows 10 LTSC 2021系统中因wsappx进程导致的CPU占用率异常飙升问题,提供了详细的解决方案。核心在于安装微软官方发布的KB5017308补丁,该补丁能从根本上修复系统组件缺陷,使CPU占用恢复正常。文章详解了补丁的下载、安装步骤、注意事项及安装后的验证方法,是解决此问题的权威指南。

python9snake的博客 1267

内部表(管理表)和外部表详解

内部表也称为管理表,数据是存放在表中的,删除表后 表中数据会同步删除。常见于明细层表 应用层表等。如DM层 APP层,一般是通过SQL语句从其他表中抽取的数据。 外部表,建表时有external关键字,数据是从外部以文件的形式加载进表中,删除表后 数据文件依然存在,只是删除了该表的元数据信息。常见于贴源层表,如ODS层, 一般是直接加载上游系统推送过来的的数据文件。查看一个表是内部表或外部表,可用describe extended tablename(表名),若tableType后显示managed_t

m0_46786082的博客 1715

从ISCXTor2016到CICIDS2017:手把手教你下载和使用UNB的网络安全数据集

本文详细介绍了UNB大学发布的ISCXTor2016和CICIDS2017等网络安全数据集的下载与使用方法,特别适合加密流量识别和网络行为分析研究。文章提供了多种高效获取路径、文件结构解析及实战分析示例,帮助研究者快速上手这些真实场景捕获的精细标注数据集。

weixin_42524945的博客 632

DeepLearning tutorial(7)深度学习框架Keras的使用-进阶

上一篇文章总结了Keras的基本使用方法,相信用过的同学都会觉得不可思议,太简洁了。十多天前,我在github上发现这个框架的时候,关注Keras的人还比较少,这两天无论是github还是微薄,都看到越来越多的人关注和使用Keras。所以这篇文章就简单地再介绍一下Keras的使用,方便各位入门。主要包括以下三个内容: 训练CNN并保存训练好的模型。 将CNN用于特征提取,用提取出来的特征训练SVM。

wepon的专栏 2万+

Hive详解之内表、外表和分区

总结: 一、Hive的内表 Hive 的内表,就是正常创建的表,没有使用关键字External 二、Hive的外表 创建Hive 的外表,需要使用关键字External: CREATE EXTERNAL TABLE [IF NOT EXISTS] [db_name.]table_name [(col_name data_type [COMMENT col_com...

lixinkuan的博客 5135

Ragflow技术栈分析及二次开发指南

Ragflow是目前团队化部署大模型+RAG的优质方案,不过其仍不适合直接部署使用,本文将从实际使用的角度,对其进行二次开发

兴趣使然的创作者 1万+

Hive创建内表和外表的区别

Hive创建内表和外表的区别1.内部表2.外部表 1.内部表 内部表也称为管理表或临时表,Hive控制着整个表的生命周期,默认存放目录为/user/hive/warehouse,当删除一张表的时候表中的数据也会相应的删除。 缺点:在实际开发中,内部表不方便和其他工作共享数据,Hive在设计之初就不允许共享管理表中的数据,那应该如何来实现呢?Hive提供了外表表。 2.外部表 外部表中的数据生命周期不受Hive的控制,而且可以和其他外部表进行数据共享。 在创建外部表的时候需要加上external关键字 例:

不会打球的摄影师不是好程序员 857

Chronos时间序列预测实战:从零开始微调你的第一个大语言模型(附完整代码)

本文提供了一份详细的Chronos时间序列预测大语言模型微调实战指南。从环境搭建、数据预处理到模型配置与训练,手把手教你如何利用自己的数据微调Chronos模型,并完成评估与部署,助你快速掌握这一前沿技术。

zzz56的博客 300

英伟达DeepStream学习笔记7——DeepStream接入USB相机并实现广角摄像头的畸变矫正

deepstream官方提供了一个畸变矫正的例子,包含了鱼眼和普通广角的矫正。我目前准备做一个广角的畸变矫正,我已经使用opencv实现功能,目前增加到deepstream框架中。示例代码在\opt\nvidia\deepstream\deepstream-5.0\sources\apps\sample_apps\deepstream-dewarper-test 中,鱼眼矫正——deepstream官方版 https://developer.nvidia.com/blog/calibration-trans

耶律大石的博客 1602

mysql内表和外表_Hive内表和外表的区别

本文以例子的形式介绍一下Hive内表和外表的区别。例子共有4个:不带分区的内表、带分区的内表、不带分区的外表、带分区的外表。1 不带分区的内表#创建表create table innerTable(id int,name string) row format delimited fields terminated by ‘|’;(show tables发现没有innerTable,只有innert...

weixin_30764401的博客 1674

XCP实战系列介绍09-基于Vehicle Spy进行XCP测量步骤详解

详细介绍如何使用Vehicle Spy进行XCP测量

initiallizer的博客 1393

Hive内表和外表的区别

本文以例子的形式介绍一下Hive内表和外表的区别。例子共有4个:不带分区的内表、带分区的内表、不带分区的外表、带分区的外表。 1 不带分区的内表 #创建表 create table innerTable(id int,name string) row format delimited fields terminated by ‘|’;(show tables发现没有innerTa

静下心来,认真的研究技术。 7422

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

mysql内表和外表_hive内表和外表的创建、载入数据、区别

创建表创建内表create table customer(customerId int,firstName string,lastName STRING,birstDay timestamp) row format delimited fields terminated by ','创建外表CREATE EXTERNAL table salaries(gender string,age int ...

weixin_33974017的博客 834

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

mysql内表和外表区别_Hive内表和外表的区别

本文以例子的形式介绍一下Hive内表和外表的区别。例子共有4个:不带分区的内表、带分区的内表、不带分区的外表、带分区的外表。1 不带分区的内表#创建表create table innerTable(id int,name string) row format delimited fields terminated by '|';(show tables发现没有innerTable,只有innert...

weixin_34392511的博客 2844

HIVE内表与外表的区别

hive内外表的区别,主要总结六点区别

m0_70949976的博客 2572

Hive的内表和外表的区别

1.内部表 2.外部表 3.内部表和外部表的区别

luer_2017的博客 2331

Hive建外表操作以及其它修改表操作 hive外表与内表区别

hive创建外表,分区的删除、查看操作,一些插入,重命名和删除操作 数据类型map和struct的创建表操作

m0_57382185的博客 4318
上一篇: Hive - 简介
下一篇: Hive - 常用命令
张哲BJUT
博客等级 码龄15年 151粉丝 111原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值