序列化作用

序列化是对象转换为字节序列的过程。 反序列化是字节序列恢复为对象的过程。 对象的序列化主要有两种用途:对象的持久化,即把对象转换成字节序列后保存到文件中;对象数据的网络传送。 除了上面两点, hive的序列化的作用还包括:Hive的反序列化是对key/value反序列化成hive table的每个列的值。Hive可以方便的将数据加载到表中而不需要对数据进行转换,这样在处理海量数据时可以节省大量的时间。

SerDe说明hive如何去处理一条记录,包括Serialize/Deserilize两个功能, Serialize把hive使用的java object转换成能写入hdfs的字节序列,或者其他系统能识别的流文件。Deserilize把字符串或者二进制流转换成hive能识别的java object对象。比如:select语句会用到Serialize对象, 把hdfs数据解析出来;insert语句会使用Deserilize,数据写入hdfs系统,需要把数据序列化。

第92课作业,通过SerDes的方式对一下数据进行Hive的存储和查询操作:

0^^Hadoop^^America^^5000|8000|12000|level8^^male
1^^Spark^^America^^8000|10000|15000|level9^^famale
2^^Flink^^America^^7000|8000|13000|level10^^male
3^^Hadoop^^America^^9000|11000|12000|level10^^famale
4^^Spark^^America^^10000|11000|12000|level12^^male
5^^Flink^^America^^11000|12000|18000|level18^^famale
6^^Hadoop^^America^^15000|16000|19000|level16^^male
7^^Spark^^America^^18000|19000|20000|level20^^male
8^^Flink^^America^^15000|16000|19000|level19^^male

实现:inputformat格式编码解析,灵活对hive源数据进行清洗

1,按^^进行分割

2,同时也按|进行切分

实现步骤:

1,源数据位置:

root@master:/usr/local/IMF_testdata/hivestudy#ls

employeesinputformat.txt  IMFInputFormat2.jar

2,查看文件内容

root@master:/usr/local/IMF_testdata/hivestudy#cat employeesinputformat.txt

0^^Hadoop^^America^^5000|8000|12000|level8^^male

1^^Spark^^America^^8000|10000|15000|level9^^famale

2^^Flink^^America^^7000|8000|13000|level10^^male

3^^Hadoop^^America^^9000|11000|12000|level10^^famale

4^^Spark^^America^^10000|11000|12000|level12^^male

5^^Flink^^America^^11000|12000|18000|level18^^famale

6^^Hadoop^^America^^15000|16000|19000|level16^^male

7^^Spark^^America^^18000|19000|20000|level20^^male

8^^Flink^^America^^15000|16000|19000|level19^^male

3,开发inputformat代码,源代码附后.导出jar包IMFInputFormat2.jar

代码中使用了正则表达式对文本进行了解析:

String patternhive = "^(.*)\\^\\^(.*)\\^\\^(.*)\\^\\^(.*)\\|(.*)\\|(.*)\\|(.*)\\^\\^(.*)";

按^^及|进行解析,解析以后进行分组,依次获取各分组的值,然后使用"\u001"组拼接成字符串.

问题:使用"\t"拼接在hive中导入数据为null;

解决:使用"\u001"组拼接成字符串.,顺利导入数据到hive。

 

4,在hive中的操作:

删表:

drop table employee_inputformat;

导入jar包

add jar/usr/local/IMF_testdata/hivestudy/IMFInputFormat2.jar;

建立表

CREATE TABLEemployee_InputFormat(userid  INT,nameString,address String, salarys1 int ,salarys2 int ,salarys3 int ,salarys4string , gendre string)  stored asINPUTFORMAT 'com.dt.spark.hive.IMFInputFormat' OUTPUTFORMAT'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat';

加载数据

LOAD DATA LOCAL INPATH'/usr/local/IMF_testdata/hivestudy/employeesinputformat.txt' INTO TABLEemployee_InputFormat;

数据查询

select * from employee_InputFormat;

5,运行结果如下:

hive>    desc formatted employee_inputformat;

OK

# col_name              data_type               comment

userid                  int

name                    string

address                 string

salarys1                int

salarys2                int

salarys3                int

salarys4                string

gendre                  string

# Detailed Table Information

Database:               default

Owner:                  root

CreateTime:             Sun Dec 11 20:47:21 CST 2016

LastAccessTime:         UNKNOWN

Protect Mode:           None

Retention:              0

Location:              hdfs://master:9000/user/hive/warehouse/employee_inputformat

Table Type:             MANAGED_TABLE

Table Parameters:

COLUMN_STATS_ACCURATE   true

numFiles                1

totalSize               467

transient_lastDdlTime  1481460441

# Storage Information

SerDe Library:         org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe

InputFormat:           com.dt.spark.hive.IMFInputFormat

OutputFormat:           org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat

Compressed:             No

Num Buckets:            -1

Bucket Columns:         []

Sort Columns:           []

Storage Desc Params:

serialization.format    1

Time taken: 0.111 seconds, Fetched: 36row(s)

hive>

附件源代码:

package com.dt.spark.hive;

import java.io.IOException;

import org.apache.hadoop.io.LongWritable;

import org.apache.hadoop.io.Text;

import org.apache.hadoop.mapred.FileSplit;

import org.apache.hadoop.mapred.InputSplit;

import org.apache.hadoop.mapred.JobConf;

importorg.apache.hadoop.mapred.JobConfigurable;

importorg.apache.hadoop.mapred.RecordReader;

import org.apache.hadoop.mapred.Reporter;

importorg.apache.hadoop.mapred.TextInputFormat;

public class IMFInputFormat extends  TextInputFormat implements

JobConfigurable

{

public RecordReader<LongWritable,Text> getRecordReader(

InputSplit genericSplit, JobConfjob, Reporter reporter)

throws IOException {

reporter.setStatus(genericSplit.toString());

return new IMFRecordReader((FileSplit)genericSplit,job);

}

}

源代码:

package com.dt.spark.hive;

import java.io.IOException;

import java.io.InputStream;

import java.util.regex.Matcher;

import java.util.regex.Pattern;

import org.apache.hadoop.conf.Configuration;

import org.apache.hadoop.fs.FSDataInputStream;

import org.apache.hadoop.fs.FileSystem;

import org.apache.hadoop.fs.Path;

import org.apache.hadoop.io.LongWritable;

import org.apache.hadoop.io.Text;

import org.apache.hadoop.io.compress.CompressionCodec;

import org.apache.hadoop.io.compress.CompressionCodecFactory;

import org.apache.hadoop.mapred.FileSplit;

import org.apache.hadoop.util.LineReader;

import org.apache.hadoop.mapred.RecordReader;

public class IMFRecordReader implements RecordReader<LongWritable,Text> {

private CompressionCodecFactorycompressionCodecs = null;

private long start;

private long pos;

private long end;

private LineReaderlineReader;

int maxLineLength;

public IMFRecordReader(FileSplitinputSplit, Configuration job) throws IOException {

maxLineLength = job.getInt("mapred.IMFRecordReader.maxlength", Integer.MAX_VALUE);

start = inputSplit.getStart();

end = start + inputSplit.getLength();

final Pathfile = inputSplit.getPath();

compressionCodecs = new CompressionCodecFactory(job);

final CompressionCodeccodec = compressionCodecs.getCodec(file);

// Open file and seek to thestart of the split

FileSystem fs = file.getFileSystem(job);

FSDataInputStream fileIn =fs.open(file);

booleanskipFirstLine = false;

if (codec !=null) {

lineReader = new LineReader(codec.createInputStream(fileIn),job);

end = Long.MAX_VALUE;

else {

if (start != 0) {

skipFirstLine = true;

--start;

fileIn.seek(start);

}

lineReader = new LineReader(fileIn,job);

}

if (skipFirstLine) {

start += lineReader.readLine(new Text(), 0, (int) Math.min((long) Integer.MAX_VALUE,end - start));

}

this.pos =start;

}

public IMFRecordReader(InputStreamin, longoffset, longendOffset, intmaxLineLength) {

this.maxLineLength =maxLineLength;

this.lineReader =new LineReader(in);

this.start =offset;

this.pos =offset;

this.end =endOffset;

}

public IMFRecordReader(InputStreamin, longoffset, longendOffset, Configuration job) throws IOException {

this.maxLineLength =job.getInt("mapred.IMFRecordReader.maxlength", Integer.MAX_VALUE);

this.lineReader =new LineReader(in,job);

this.start =offset;

this.pos =offset;

this.end =endOffset;

}

public LongWritable createKey() {

return new LongWritable();

}

public Text createValue() {

return new Text();

}

/**

* Reads the next record inthe split. getusefull fields from the raw nginx

* log.

*

@param key

*            key of the record which will map tothe byte offset of the

*            record's line

@param value

*            the record in text format

@return true if a recordexisted, false otherwise

@throws IOException

*/

public synchronized boolean next(LongWritablekey, Text value)throws IOException {

// Stay within the split

while (pos <end) {

key.set(pos);

intnewSize = lineReader.readLine(value, maxLineLength,

Math.max((int) Math.min(Integer.MAX_VALUE,end - pos),maxLineLength));

if (newSize == 0)

return false;

String patternhive ="^(.*)\\^\\^(.*)\\^\\^(.*)\\^\\^(.*)\\|(.*)\\|(.*)\\|(.*)\\^\\^(.*)";

Pattern phive = Pattern.compile(patternhive);

String strhive = value.toString();

Matcher mhive = phive.matcher(strhive);

String resultstr = "defaultisblank";

while (mhive.find()) {

resultstr = mhive.group(1) + "\001" + mhive.group(2) + "\001" + mhive.group(3) + "\001" + mhive.group(4)

+ "\001" +mhive.group(5) + "\001" +mhive.group(6) + "\001" +"IMF" + mhive.group(7) +"\001"

+ mhive.group(8);

}

;

if (resultstr ==null || resultstr == "defaultisblank") {

else {

value.set(resultstr);

pos += newSize;

if (newSize <maxLineLength)

returntrue;

}

}

return false;

}

public float getProgress() {

if (start ==end) {

return 0.0f;

else {

return Math.min(1.0f, (pos -start) / (float) (end -start));

}

}

public synchronized long getPos() throws IOException {

returnpos;

}

public synchronized void close() throws IOException {

if (lineReader !=null)

lineReader.close();

}

}

HIVE Row Formats&SerDe

Serde是 Serializer/Deserializer的简写。hive使用Serde进行行对象的序列与反序列化。

What is a SerDe?

SerDe is a short name for "Serializer and Deserializer."
Hive uses SerDe (and FileFormat) to read and write table rows.
HDFS files --> InputFileFormat --> <key, value> --> Deserializer --> Row object
Row object --> Serializer --> <key, value> --> OutputFileFormat --> HDFS files
  • 1
  • 2
  • 3
  • 4
  • 5

当是读取hdfs文件时key部分将会被忽略,在写入hdfs时key总是一个常量,一般的行的数据是存储在value中的。

你可以创建表时使用用户自定义的Serde或者native Serde,如果 ROW FORMAT没有指定或者指定了 ROW FORMAT DELIMITED就会使用native Serde。hive已经实现了许多自定义的Serde,之前我们在介绍stored时也涉及到: 
Avro (Hive 0.9.1 and later) 
ORC (Hive 0.11 and later) 
RegEx 
Thrift 
Parquet (Hive 0.13 and later) 
CSV (Hive 0.14 and later) 
JsonSerDe (Hive 0.12 and later)

RegEx

ROW FORMAT SERDE
'org.apache.hadoop.hive.serde2.RegexSerDe'
WITH SERDEPROPERTIES
(
"input.regex" = "<regex>"
)
STORED AS TEXTFILE;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

使用正则来序列化行数据,如下例子

CREATE TABLE apachelog (host STRING,identity STRING,user STRING,time STRING,request STRING,status STRING,size STRING,referer STRING,agent STRING)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.RegexSerDe'
WITH SERDEPROPERTIES ("input.regex" = "([^]*) ([^]*) ([^]*) (-|\\[^\\]*\\]) ([^ \"]*|\"[^\"]*\") (-|[0-9]*) (-|[0-9]*)(?: ([^ \"]*|\".*\") ([^ \"]*|\".*\"))?"
)
STORED AS TEXTFILE;
  • json

按照json格式存储text文件

ROW FORMAT SERDE
'org.apache.hive.hcatalog.data.JsonSerDe'
STORED AS TEXTFILEADD JAR /usr/lib/hive-hcatalog/lib/hive-hcatalog-core.jar;CREATE TABLE my_table(a string, b bigint, ...)
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
STORED AS TEXTFILE;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

CSV/TSV

按照 CSV / TSV格式来存储text文件。 
ROW FORMAT SERDE 
‘org.apache.hadoop.hive.serde2.OpenCSVSerde’ 
STORED AS TEXTFILE

如下例子创建tsv文件,默认是csv文件的分隔符

CREATE TABLE my_table(a string, b string, ...)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
WITH SERDEPROPERTIES ("separatorChar" = "\t","quoteChar"     = "'","escapeChar"    = "\\"
)
STORED AS TEXTFILE;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

hive的CSVSerde基于csv-serde实现。

其他Serde

1.MetadataTypedColumnsetSerDe 
这个SerDe用来读写像csv文件那样的记录 
2.LazySimpleSerDe 
不指定Serde时,默认使用的Serde。 
3.ThriftSerDe 
读写Thrift对象或者文件,Thrift对象的类文件需要提前导入。 
4.DynamicSerDe 
也是用来读写Thrift对象或者文件。但是它能够理解Thrift DDL,因此可以再运行时提供 schema对象。 
若是想对以上serde有深入的了解,看源码。

最后附上Hive User Meeting August 2009 Facebook对serde的讲解。

Serialized format:Delimited format (tab, comma, ctrl-a …)Thrift ProtocolsProtocolBuffer*
Deserialized (in-memory) format:Java Integer/String/ArrayList/HashMapHadoop Writable classesUser-defined Java Classes (Thrift, ProtocolBuffer*)

参考文献

1.HIVE Row Formats & SerDe 
2.csv-serde 
3.DeveloperGuide-HiveSerDe 
4.hive-user-meeting-august-2009-facebook 
5.Hive SerDe 
6.apache Thrift

最近在 Google 上看到一篇在 Hive 中利用正则表达式来自定义反序列化处理文本文件。百度后发现这块知识目前还没有人系统的总结一下。

所以我就不才把之前记录的资料跟大家分享一下:

SerDe 是Serializer 和 Deserializer 的简称。它是 Hive用来处理记录并且将它们映射到 Hive 表中的字段数据类型。为了更好的阐述使用 SerDe 的场景,我们需要了解一下 Hive 是如何读数据的(类似于 HDFS 中数据的读写操作):
1. 从 HDFS 读取数据
2. 通过 InputFormat 来处理数据,根据定义的数据类型来将文件分割成键值对记录。在 Hive 中,我们可以通过 Create Table。。。Stored As <File_Format> 来指定使用哪种 InputFormat 来读取数据。
3. SerDe 中 JAVA 的 Deserializer 会被调用来格式化数据并且映射到表中对应的字段和数据类型。

对于数据读取,我们希望使用 JSON SerDe 来从 HDFS 中读取文本文件格式数据,并且根据正确的 schema 将 JSON每一行的属性和值与 Hive 表中的行进行转换。
如果写入数据:
1. 写入的数据(例如 Insert 语句)会通过 SerDe 定义的 Serlializer 类进行转换成 OutputFormat 类能够读取的格式。
2. 数据会被OutputFormat 继承类进行处理,创建 RecordWrite 对象。类似于 InputFormat 的实现。OutputFormat 的实现方法跟表写入数据的方式相同。
3.  将数据写入到表中(数据将保存在 HDFS)

在实际写入数据的时候,我们可以使用 JSON SerDe来 Hive 表中一个 行列转数据转换成 JSON 文本,保存到 HDFS 中。
Hive 近期发布的 org.apache.hadoop.hive.serde2 库,之前的的 org.apache.hadoop.hive.serde2 库已经摒弃不建议使用了。接下来我们将详细介绍一下 Hive 中常用的 SerDe :

SerDe 类型

具体应用
LazySimpleSerDe: 内置SerDe(org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe) ,用来处理文本文件格式:TEXTFILE 
 
jdbc:hive2://> CREATE TABLE test_serde_lz
. . . . . . .> STORED AS TEXTFILE AS
. . . . . . .> SELECT name from employee;
No rows affected (32.665 seconds)
ColumnarSerDe: 用来处理 RCFile 的内置 SerDe jdbc:hive2://> CREATE TABLE test_serde_cs
. . . . . . .> ROW FORMAT SERDE
. . . . . . .> 'org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe'
. . . . . . .> STORED ASRCFile AS
. . . . . . .> SELECT name from employee
No rows affected (27.187 seconds)
RegexSerDe: 用来处理文本文件的内置 JAVA 正则表达式 SerDe --Parse , seperate fields
jdbc:hive2://> CREATE TABLE test_serde_rex(
. . . . . . .> name string,
. . . . . . .> sex string,
. . . . . . .> age string
. . . . . . .> )
. . . . . . .> ROW FORMAT SERDE
. . . . . . .> 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe'
. . . . . . .> WITH SERDEPROPERTIES(
. . . . . . .> 'input.regex' = '([^,]*),([^,]*),([^,]*)',
. . . . . . .> 'output.format.string' = '%1$s %2$s %3$s'
. . . . . . .> )
. . . . . . .> STORED AS TEXTFILE;
No rows affected (0.266 seconds)
HBaseSerDe: 内置的 SerDe,可以让 Hive 跟 HBase 进行集成。我们可以利用 HBaseSerDe 来将 Hive 表存储到 HBase 中。
注意:前提是 HBase 已经安装
jdbc:hive2://> CREATE TABLE test_serde_hb(
. . . . . . .> id string,
. . . . . . .> name string,
. . . . . . .> sex string,
. . . . . . .> age string
. . . . . . .> )
. . . . . . .> ROW FORMAT SERDE
. . . . . . .> 'org.apache.hadoop.hive.hbase.HBaseSerDe'
. . . . . . .> STORED BY
. . . . . . .> 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
. . . . . . .> WITH SERDEPROPERTIES (
. . . . . . .> "hbase.columns.mapping"=
. . . . . . .> ":key,info:name,info:sex,info:age"
. . . . . . .> )
. . . . . . .> TBLPROPERTIES("hbase.table.name" = "test_serde");
No rows affected (0.387 seconds)
AvroSerDe: 用来在 Hive 表中读写 Avro 数据格式的内置 SerDe(参考:http://avro.apache.org/) 
Avro 是一个 RPC 和序列化框架,从 Hive 0.14.0 版本才本地支持 Avro :CREATE TABLE ... STORED AS AVRO 
jdbc:hive2://> CREATE TABLE test_serde_avro(
. . . . . . .> name string,
. . . . . . .> sex string,
. . . . . . .> age string
. . . . . . .> )
. . . . . . .> ROW FORMAT SERDE
. . . . . . .> 'org.apache.hadoop.hive.serde2.avro.AvroSerDe'
. . . . . . .> STORED AS INPUTFORMAT
. . . . . . .> 'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat'
. . . . . . .> OUTPUTFORMAT
. . . . . . .> 'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat'
. . . . . . .>;
No rows affected (0.31 seconds)
需要注意的是,上述方法是 Hive 0.14.0 版本以前的定义方法,如左边所示,我们可以轻松的使用 Stored as Avro 来指定存储为 Avro 格式。
详细内容请参考:https://cwiki.apache.org/confluence/display/Hive/AvroSerDe
ParquetHiveSerDe: 用来在 Hive 中读写 Parquet 数据格式的内置 SerDe。从 Hive 0.13.0 版本开始本地支持。 jdbc:hive2://> CREATE TABLE test_serde_parquet
. . . . . . .> STORED AS PARQUET AS
. . . . . . .> SELECT name from employee;
No rows affected (34.079 seconds)
OpenCSVSerDe: 用来读写 CSV 数据的 SerDe. 从 Hive 0.14.0 版本才发布的。
我们可以通过从 Github 中下载源码进行安装(https://github.com/ogrodnek/csv-serde )
jdbc:hive2://> CREATE TABLE test_serde_csv(
. . . . . . .> name string,
. . . . . . .> sex string,
. . . . . . .> age string
. . . . . . .>)
. . . . . . .> ROW FORMAT SERDE
. . . . . . .> 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
. . . . . . .> STORED AS TEXTFILE;
JSONSerDe: 这是一个第三方的 SerDe,用来利用 Hive 读取 JSON 数据记录。
你可以通知下载源码进行安装(https://github.com/rcongiu/Hive-JSON-Serde) 
jdbc:hive2://> CREATE TABLE test_serde_js(
. . . . . . .> name string,
. . . . . . .> sex string,
. . . . . . .> age string
. . . . . . .> )
. . . . . . .> ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
. . . . . . .> STORED AS TEXTFILE;
No rows affected (0.245 seconds)
 

最后,为了应对目前存在的各式各样的数据格式以及数据存储系统。Hive 允许用户可以自定义 SerDe 来处理自己的文件格式。更多关于 自定义SerDe 请参考:https://cwiki.apache.org/confluence/display/Hive/DeveloperGuide#DeveloperGuide-HowtoWriteYourOwnSerDe.

当然,为了呼应本次主题,特地跑到 Jira 上搜了一些各个 SerDe 的使用情况,随着大家对这些SerDe的深入研究,需求也越来越多,功能也逐渐被完善着:
LazySimpleSerDe :https://issues.apache.org/jira/browse/HIVE-292?jql=text%20~%20%22LazySimpleSerDe%22
ColumnarSerDe : https://issues.apache.org/jira/browse/HIVE-756?jql=text%20~%20%22ColumnarSerDe%22
RegexSerDe :https://issues.apache.org/jira/browse/HIVE-6336?jql=text%20~%20%22RegexSerDe%22
HBaseSerDe :https://issues.apache.org/jira/browse/HIVE-6677?jql=text%20~%20%22HBaseSerDe%22
AvroSerDe : https://issues.apache.org/jira/issues/?jql=text%20~%20%22AvroSerDe%22
ParquetHiveSerDe:https://issues.apache.org/jira/browse/HIVE-9333?jql=text%20~%20%22ParquetHiveSerde%22
OpenCSVSerDe :https://issues.apache.org/jira/browse/HIVE-7777?jql=text%20~%20%22OpenCSVSerDe%22
JSONSerDe : https://issues.apache.org/jira/browse/HIVE-6166?jql=text%20~%20%22JSONSerDe%22

这里自己为备注一下:
以后有时间再研究一下每个 SerDe 的源码
http://grepcode.com/file/repo1.maven.org/maven2/com.twitter/parquet-hive/1.2.1/parquet/hive/serde/ParquetHiveSerDe.java#ParquetHiveSerDe.initialize%28parquet.hive.serde.Configuration%2Cjava.util.Properties%29

Hive Serde相关推荐

  1. Hive Serde、Beeline、JDBC

    一.Hive Serde 用于做序列化和反序列化,构建在数据存储和执行引擎之间,对二者实现解耦. 创建表的2种规则row format:delimited和serde,正则匹配 创建表: CREATE ...

  2. hive serde 序列化与反序列化 - 一行数据写入hive表

    Hive-0.5中SerDe概述 一.背景 1.当进程在进行远程通信时,彼此可以发送各种类型的数据,无论是什么类型的数据都会以二进制序列的形式在网络上传送.发送方需要把对象转化为字节序列才可在网络上传 ...

  3. Hive 03_DML、SerDe、Beeline、JDBC

    Hive DML --LOAD DATA [LOCAL] INPATH 'filepath' [OVERWRITE] INTO TABLE tablename [PARTITION (partcol1 ...

  4. hive分区用2个字段有何限制_[Hive]新增字段(column)后,旧分区无法更新数据问题...

    问题描述: 实际应用中,常常存在修改数据表结构的需求,比如:增加一个新字段. 如果使用如下语句新增列,可以成功添加列col1.但如果数据表tb已经有旧的分区(例如:dt=20190101),则该旧分区 ...

  5. parquet to mysql_在hive中使用parquet (CDH4.3)

    hadoop版本 cdh4.3 使用impala创建parquet表后,查询会出错. [impala:21000] SELECT * FROM foo;Query: SELECT * FROM foo ...

  6. apache hive_Hive:使用Apache Hive查询客户最喜欢的搜索查询和产品视图计数

    apache hive 这篇文章介绍了如何使用Apache Hive查询Hadoop下存储的搜索点击数据. 我们将以示例的形式生成有关总产品浏览量的客户最爱搜索查询和统计信息. 继续之前的文章 使用大 ...

  7. Hive:使用Apache Hive查询客户最喜欢的搜索查询和产品视图计数

    这篇文章涵盖了使用Apache Hive查询存储在Hadoop下的搜索点击数据. 我们将以示例的方式生成有关总产品浏览量的客户排名靠前的搜索查询和统计信息. 继续之前的文章 使用大数据分析客户产品搜索 ...

  8. hive处理日志,自定义inputformat

    开放环境,hadoop-0.20.2,hive-0.6 1.日志分隔符 Xml代码   2010-05-31 10:50:17|||61.132.4.82|||http://www.360buy.co ...

  9. SmartNews:基于 Flink 加速 Hive 日表生产的实践

    简介: 将 Flink 无缝地集成到以 Airflow 和 Hive 为主的批处理系统的技术挑战和应对方案. 本文介绍了 SmartNews 利用 Flink 加速 Hive 日表的生产,将 Flin ...

最新文章

  1. Application Desktop Toolbars 桌面工具栏
  2. Spring Boot和Apache Camel
  3. FAL风控培训「六大场景下,模型分数如何应用?」
  4. 什么是互联网保险平台?
  5. 存储网络与存储系统架构分析
  6. 高中计算机会考excel试题及答案,高中计算机会考EXCEL会考练习试题
  7. 适合练手的10个前端实战项目(附视频+源码)
  8. 【得之我幸,失之我命】分享下研究生阶段, IEEE论文投稿的心态和心路历程
  9. mysql 100w 查询耗时4秒_MySql百万数据0秒筛选查询
  10. zabbix_sender用法实例
  11. linux中C编译命令,linux下命令行下编译c程式
  12. 虚实接口是当前元宇宙发展的重中之重
  13. 虚拟机安装---模板机准备1(最小化安装)
  14. 【哈夫曼树】牛客 哈夫曼树
  15. Java—飞花的糖果
  16. 【软考中级】多媒体应用设计师复习笔记第一章
  17. 一行python能做什么!
  18. 电脑打出,[转载]告诉你电脑上特殊符号怎么打出来?
  19. 华为CDN体验及常见问题
  20. 以前的的华为手机可不可以用鸿蒙系统_华为启用鸿蒙系统之后,之前的华为手机可以更换成鸿蒙系统吗?...

热门文章

  1. 哪里买. com最便宜?
  2. # 7-45 航空公司VIP客户查询 (25 分)
  3. 前端H5新增标签和CSS3高级
  4. “2019年新出的境外云闪付是什么?
  5. H3C 802.11n的频宽模式
  6. 民办教育未来10年的发展趋势
  7. 51nod 1629 B君的圆锥
  8. slamugv小车使用说明--1材料准备
  9. 【文末送书】知识体系目录
  10. NO.79——BFS,DFS,Astar,爬山法,最抖爬山法,模拟退火法解决八数码问题Python实现