我是Hadoop
的新手。我已经在Hive
中创建了employee表,并使用文本文件加载了其中的数据,现在我正在尝试加载保存在表中的数据,但得到了跟踪。我到处都找过了,但什么也没找到。有人能帮我一下吗?
hive> select * from employee;
-chgrp: 'LONEWOLF\Sudarshan' does not match expected pattern for group
Usage: hadoop fs [generic options]
[-appendToFile <localsrc> ... <dst>]
[-cat [-ignoreCrc] <src> ...]
[-checksum <src> ...]
[-chgrp [-R] GROUP PATH...]
[-chmod [-R] <MODE[,MODE]... | OCTALMODE> PATH...]
[-chown [-R] [OWNER][:[GROUP]] PATH...]
[-copyFromLocal [-f] [-p] [-l] [-d] <localsrc> ... <dst>]
[-copyToLocal [-f] [-p] [-ignoreCrc] [-crc] <src> ... <localdst>]
[-count [-q] [-h] [-v] [-t [<storage type>]] [-u] [-x] <path> ...]
[-cp [-f] [-p | -p[topax]] [-d] <src> ... <dst>]
[-createSnapshot <snapshotDir> [<snapshotName>]]
[-deleteSnapshot <snapshotDir> <snapshotName>]
[-df [-h] [<path> ...]]
[-du [-s] [-h] [-x] <path> ...]
[-expunge]
[-find <path> ... <expression> ...]
[-get [-f] [-p] [-ignoreCrc] [-crc] <src> ... <localdst>]
[-getfacl [-R] <path>]
[-getfattr [-R] {-n name | -d} [-e en] <path>]
[-getmerge [-nl] [-skip-empty-file] <src> <localdst>]
[-help [cmd ...]]
[-ls [-C] [-d] [-h] [-q] [-R] [-t] [-S] [-r] [-u] [<path> ...]]
[-mkdir [-p] <path> ...]
[-moveFromLocal <localsrc> ... <dst>]
[-moveToLocal <src> <localdst>]
[-mv <src> ... <dst>]
[-put [-f] [-p] [-l] [-d] <localsrc> ... <dst>]
[-renameSnapshot <snapshotDir> <oldName> <newName>]
[-rm [-f] [-r|-R] [-skipTrash] [-safely] <src> ...]
[-rmdir [--ignore-fail-on-non-empty] <dir> ...]
[-setfacl [-R] [{-b|-k} {-m|-x <acl_spec>} <path>]|[--set <acl_spec> <path>]]
[-setfattr {-n name [-v value] | -x name} <path>]
[-setrep [-R] [-w] <rep> <path> ...]
[-stat [format] <path> ...]
[-tail [-f] <file>]
[-test -[defsz] <path>]
[-text [-ignoreCrc] <src> ...]
[-touchz <path> ...]
[-truncate [-w] <length> <path> ...]
[-usage [cmd ...]]
Generic options supported are
-conf <configuration file> specify an application configuration file
-D <property=value> use value for given property
-fs <file:///|hdfs://namenode:port> specify default filesystem URL to use, overrides 'fs.defaultFS'
property from configurations.
-jt <local|resourcemanager:port> specify a ResourceManager
-files <comma separated list of files> specify comma separated files to be copied to the map
reduce cluster
-libjars <comma separated list of jars> specify comma separated jar files to include in the
classpath.
-archives <comma separated list of archives> specify comma separated archives to be unarchived on
the compute machines.
The general command line syntax is
command [genericOptions] [commandOptions]
Usage: hadoop fs [generic options] -chgrp [-R] GROUP PATH...
OK
4 rows selected (3.61 seconds)
hive>
奇怪的是,它占用了4行空间,并显示为空白。
不明白发生了什么吗?
表创建:
create table employee (Id int, Name string , Salary float)
row format delimited
fields terminated by ',' ;
将数据加载到表中:
load data local inpath 'C:\employee.txt' into table employee;
employee.txt
文件
1 "Anurag" 40000.0
2 "Ayush" 42000.0
3 "Akhil" 44000.0
4 "Aarav" 46000.0
发布于 2020-05-02 20:20:30
当您使用','
delimited fields
创建表时,这意味着源必须具有字段以',‘分隔的行
您的源文件
1 "Anurag" 40000.0
2 "Ayush" 42000.0
3 "Akhil" 44000.0
4 "Aarav" 46000.0
是一个空格分隔的字段,应该是
1,"Anurag",40000.0
2,"Ayush",42000.0
3,"Akhil",44000.0
4,"Aarav",46000.0
或者你创建的表应该是
create table employee (Id int, Name string , Salary float)
row format delimited
fields terminated by ' ' ;
https://stackoverflow.com/questions/61523288
复制相似问题