创建表格异常(Create table exception)
在运行以下命令时:
CREATE EXTERNAL TABLE zips (zip int, city String) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LOCATION ’/tutorial/input';
我有一个例外:
在表位置规范中,不匹配的输入'/'在'LOCATION'附近期望StringLiteral
我搜索了这个问题,并尝试使用这样的OCT代码:
CREATE EXTERNAL TABLE zips (zip int, city String) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\054' LOCATION ’/tutorial/input';
我是Hive新手。 如何解决这个问题?
While running the following commands:
CREATE EXTERNAL TABLE zips (zip int, city String) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LOCATION ’/tutorial/input';
I got an exception:
mismatched input '/' expecting StringLiteral near 'LOCATION' in table location specification
I searched about the issue and I tried to use OCT code like this:
CREATE EXTERNAL TABLE zips (zip int, city String) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\054' LOCATION ’/tutorial/input';
I am new to Hive. How to resolve this issue?
原文:https://stackoverflow.com/questions/50869159
更新时间:2023-05-19 12:05
最满意答案
你需要一个UDF。 Klout在包砖房下有一堆开源的HivUDFS。 这里是github链接 。 他们有一堆UDF完全符合你的目的。 下载,构建并添加JAR。 这是一个例子
CREATE TEMPORARY FUNCTION combine AS 'brickhouse.udf.collect.CombineUDF'; CREATE TEMPORARY FUNCTION combine_unique AS 'brickhouse.udf.collect.CombineUniqueUDAF'; select combine_unique(combine(array('a','b','c'), array('b','c','d'))) from reqtable; OK ["d","b","c","a"]
You will need a UDF for this. Klout has a bunch of opensource HivUDFS under the package brickhouse. Here is the github link. They have a bunch of UDF's that exactly serves your purpose. Download,build and add the JAR. Here is an example
CREATE TEMPORARY FUNCTION combine AS 'brickhouse.udf.collect.CombineUDF'; CREATE TEMPORARY FUNCTION combine_unique AS 'brickhouse.udf.collect.CombineUniqueUDAF'; select combine_unique(combine(array('a','b','c'), array('b','c','d'))) from reqtable; OK ["d","b","c","a"]
相关问答
更多-
hive not in 通过什么实现[2022-11-05]
目前hive不支持 in或not in 中包含查询子句的语法,所以只能通过left join实现。 假设有一个登陆表login(当天登陆记录,只有一个uid),和一个用户注册表regusers(当天注册用户,字段只有一个uid),这两个表都包含一个字段,uid。 in查询 如果要查询当天登陆的注册用户,需要用in查询,hive sql如下: select login.uid from login left outer join regusers on login.uid=regusers.uid where ... -
数组是有序结构, concat_ws(
, ) 此函数将使用分隔符将所有数组元素连接成一个字符串。 create table arrayDemo( id bigint, list array ); create table dummy( a int ); insert into table dummy values ( 1 ) ; insert into arraydemo select 1, array("Paperino", "Topoli ... -
相反的相交()(The opposite of Intersect())[2023-07-16]
如上所述,如果你想得到4的结果,你可以这样做: var nonintersect = array2.Except(array1); 如果你想要真正的非交叉(也是1和4),那么这应该是诀窍: var nonintersect = array1.Except(array2).Union( array2.Except(array1)); 这不是最有效的解决方案,但对于小列表,它应该可以正常工作。 As stated, if you want to get 4 as the result, you can do ... -
是的,有一种方法: INSERT OVERWRITE TABLE
PARTITION( ) SELECT 在执行此类操作之前,需要将hive.exec.dynamic.partition设置为true 。 请在此处查看详细信息: Hive语言手册DML - 动态分区 Yes, there is a way: INSERT OVERWRITE TABLE PARTITION( 数组相交PHP(Array Intersect PHP)[2022-01-27]
交叉点保持索引。 请执行下列操作 $result = array_intersect($arrayone,$arraytwo); $result = array_values($result); 然后你可以用$result[0];访问$result[0]; the intersection maintains index. do the following $result = array_intersect($arrayone,$arraytwo); $result = array_values($res ...Ravendb数组相交(Ravendb Array intersect)[2022-02-24]
不允许使用Array交集,但您可以按如下方式编写查询: var colors = session.Query() .Where(c => c.colorArray.Any(x => x == "r") && c.colorArray.Any(x => x == "e") && c.colo ... 检查函数isset并用is_array测试对象是否为数组。 例如这个 if(isset($temp['VernNamesSelected']['Family']) && is_array($temp['VernNamesSelected']['Family']) && isset($temp['GenusSelected']['Family']) && is_array($temp['GenusSelected']['Family']) && isset($temp['SpeciesSelected'][' ...相交数组按数组php排序(intersect arrays sort by array php)[2022-02-17]
通过array2和array1反转array_intersect $array1 = array(1, 2, 5, 6, 8, 9); $array2 = array(2, 8, 5); $array3 = array_intersect ($array2, $array1); print_r($array3); 现在你可以得到结果 Array ( [0] => 2 [1] => 8 [2] => 5 ) Just Reverse the array_intersect by array2 and ar ...数组相交Hive(Array intersect Hive)[2022-04-08]
你需要一个UDF。 Klout在包砖房下有一堆开源的HivUDFS。 这里是github链接 。 他们有一堆UDF完全符合你的目的。 下载,构建并添加JAR。 这是一个例子 CREATE TEMPORARY FUNCTION combine AS 'brickhouse.udf.collect.CombineUDF'; CREATE TEMPORARY FUNCTION combine_unique AS 'brickhouse.udf.collect.CombineUniqueUDAF'; select ...hive和hbase中的数组(Array in hive and hbase)[2024-02-13]
我用这段代码做到了: Put p =new Put(Bytes.toBytes("12345")); byte delimiter = 0x02; byte[] a1=Bytes.toBytes("ali"); byte[] bytes = new byte[2*a1.length+1]; //byte[] ...相关文章
更多- java Exception异常处理实例
- EXT4 Store Load For Gird Exception
- EXT4 Store Batch Sync Exception
- Lua table(表、数组、字典)
- Lua 元表(Metatable)改变table的行为
- Guava学习笔记:Guava新集合-Table等
- Guava集合工具类-Table接口映射处理
- table-Oceanus配置说明
- 求教一个 table的css
- Hive 终端产生的问题 (Failed to start database 'metastore_db', see the next exception for details.)
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。