- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
如果表是 ORC,则执行 show create table
然后执行生成的 create table
语句时出现问题。
使用 show create table
,您会得到:
STORED AS INPUTFORMAT
‘org.apache.hadoop.hive.ql.io.orc.OrcInputFormat’
OUTPUTFORMAT
‘org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat’
但是,如果您使用这些子句创建表,则在选择时会出现转换错误。错误喜欢:
Failed with exception java.io.IOException:java.lang.ClassCastException: org.apache.hadoop.hive.ql.io.orc.OrcStruct cannot be cast to org.apache.hadoop.io.BinaryComparable
要解决此问题,只需将 create table
语句更改为 STORED AS ORC
但是,正如类似问题中的答案所说: What is the difference between 'InputFormat, OutputFormat' & 'Stored as' in Hive? .
我想不通原因。
最佳答案
STORED AS
意味着 3 件事:
您只定义了最后 2 个,留下 SERDE 由 hive.default.serde 定义
hive.default.serde
Default Value: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
Added in: Hive 0.14 with HIVE-5976
The default SerDe Hive will use for storage formats that do not specify a SerDe.
Storage formats that currently do not specify a SerDe include 'TextFile, RcFile'.
hive.default.serde
set hive.default.serde;
hive.default.serde=org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
存储为 ORC
create table mytable (i int)
stored as orc;
show create table mytable;
请注意,SERDE 是 'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
CREATE TABLE `mytable`(
`i` int)
ROW FORMAT SERDE
'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
STORED AS INPUTFORMAT
'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'
LOCATION
'file:/home/cloudera/local_db/mytable'
TBLPROPERTIES (
'COLUMN_STATS_ACCURATE'='{\"BASIC_STATS\":\"true\"}',
'numFiles'='0',
'numRows'='0',
'rawDataSize'='0',
'totalSize'='0',
'transient_lastDdlTime'='1496982059')
存储为输入格式...输出格式...
create table mytable2 (i int)
STORED AS
INPUTFORMAT
'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'
;
show create table mytable2
;
请注意,SERDE 是 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
CREATE TABLE `mytable2`(
`i` int)
ROW FORMAT SERDE
'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
STORED AS INPUTFORMAT
'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'
LOCATION
'file:/home/cloudera/local_db/mytable2'
TBLPROPERTIES (
'COLUMN_STATS_ACCURATE'='{\"BASIC_STATS\":\"true\"}',
'numFiles'='0',
'numRows'='0',
'rawDataSize'='0',
'totalSize'='0',
'transient_lastDdlTime'='1496982426')
关于hadoop - Hive中 'Stored as InputFormat, OutputFormat'和 'Stored as'的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44443697/
我是 Hadoop 的新手,我正在尝试学习它并遇到了 InputFormat 的两个版本。 org/apache/hadoop/mapred/InputFormat org/apache/hadoop
我正在尝试创建一个仅生成数据而无需从外部读取数据的InputFormat。它从配置中读取关闭前要生成多少数据。这是为了帮助在非测试环境中分析OutputFormat。不幸的是,我找不到有关使用生成器I
尽管这是一个更笼统的问题,但我无法在此处找到有关特定情况的详细帮助。我有大量大文件(每个平均 2GB)。这些文件包含以自定义格式编码的条目,必须由另一个库读取以解析为单独的条目。现在我想用 MapRe
我有一个自定义的 MyInputFormat 可以处理 multi-lined inputs 的记录边界问题.但是当我将 MyInputFormat 放入我的 UDF 加载函数时。如下: import
我在 Hadoop 上开始使用我的第一个 map-reduce 代码时遇到问题。我从“Hadoop:权威指南”中复制了以下代码,但我无法在我的单节点 Hadoop 安装上运行它。 我的代码片段: 主要
我需要为 Hadoop MapReduce 应用程序实现自定义(服务)输入源。我 google 和 SO 发现继续进行的一种方法是实现自定义 InputFormat。对吗? 显然根据http://ha
假设我有两个文件,我想以不同的格式进行映射。一个是序列文件,另一个是纯文本文件。有没有办法分别为每个指定一个-inputFormat?或者我应该做些什么来映射两者? 最佳答案 这就是 Multiple
我正在使用 Hadoop,我必须创建自定义 InputFormat。 为此,我覆盖了 InputFormat 和 RecordReader 类,就像解释的那样 here 我想访问作业的配置(在运行作业
我正在尝试将键值数据库集成到 Spark 中并有一些问题。我是 Spark 初学者,阅读了很多书并运行了一些示例,但什么也没有复杂。 场景: 我正在使用小型 hdfs 集群将传入消息存储在数据库中。集
我正在为 Spark 开发一个文件解析器,它基本上可以一次读取 n 行,并将所有这些行作为数据帧中的一行放置。 我知道我需要使用 InputFormat 来尝试指定这一点,但我在 Python 中找不
我的 hadoop 作业需要知道每条记录的输入路径。 例如,假设我在 S3 对象集合上运行一个作业: s3://bucket/file1 s3://bucket/file2 s3://bucket/f
我正在尝试探索 Apache Spark,作为其中的一部分,我想自定义 InputFormat。就我而言,我想阅读 xml文件并转换每次出现的 到新记录。 我确实写了定制TextInputFormat
我想编写一个可以处理文本和 zip 文件的 MapReduce 应用程序。为此,我想使用不同的输入格式,一种用于文本,另一种用于 zip。有可能吗? 最佳答案 从@ChrisWhite 的回答中扩展一
我开发了一个 map-reduce 程序。我编写了自定义 RecordReader 和 InputFormat 类。 我正在使用 MR Unit 和 Mockito 对 mapper 和 reduce
考虑一个正在运行的 Hadoop 作业,其中自定义 InputFormat 需要向驱动程序类(即具有启 Action 业),从其覆盖的 getSplits() 方法中,使用新的 mapreduce A
我目前正在尝试将自定义 InputSplit 和 RecordReader 与 Apache Spark 的 SparkContext hadoopRDD() 函数结合使用。 我的问题如下: Inpu
我正在编写自定义 InputFormat(具体来说,org.apache.hadoop.mapred.FileInputFormat 的子类)、OutputFormat 和 SerDe,用于通过 Ap
我有一个应用程序需要读取一个文件,该文件是 ArrayList 的序列化结果。(ArrayList,此列表中有 50000 条记录,大小:20MB)我不知道如何将数据读入 hadoop 平台。我只是觉
我需要通过 Spark 处理一个 .warc 文件,但我似乎无法找到一种直接的方法。我宁愿使用 Python 而不是通过 wholeTextFiles() 将整个文件读入 RDD(因为整个文件将在单个
我正在做一个项目,使用cassandra 1.2,hadoop 1.2 我已经创建了我的普通 cassandra 映射器和缩减器,但我想创建我自己的输入格式类,它将从 cassandra 读取记录,我
我是一名优秀的程序员,十分优秀!