hive表输出在查询时显示一个不存在的空值

gmxoilav  于 2021-06-27  发布在  Hive
关注(0)|答案(1)|浏览(309)

我知道有人问过类似的问题,但是我对配置单元表的select查询返回所有正确的列和一个额外的空列。
我已经创建了一个配置单元表,现在尝试使用select查询它
ddl地址:
表ddl:

CREATE TABLE IF NOT EXISTS family (name STRING COMMENT 'Member Name', 
Age INT COMMENT 'Age of the Member', 
floor INT COMMENT 'Residence floor', 
salary float COMMENT 'per month salary', 
birthplace STRING COMMENT 'State of birth', 
education STRING, 
gender STRING )
COMMENT 'basic details of fmaily members'
LOCATION " /user/hive/warehouse/family/MANJREKAR"
TBLPROPERTIES ('creator'='Sarang', 'created_at'='2019-10-06 14:00:00') ;

dml公司:

LOAD DATA LOCAL INPATH '/Users/tcssig/Documents/Hive/warehouse/Imports' OVERWRITE INTO TABLE family;

要加载的数据

A   50  3   90000   Maharshtra  UG  M
B   46  3   40000   Maharshtra  UG  F
C   15  3   0   MP          HS  F
D   24  3   10000   Maharshtra  PG  F
E   85  3   7000    Maharshtra  HS  F
F   28  2   60000   MP          UG  M
G   59  2   60000   Maharshtra  UG  M
H   21  2   0   MP          HS  F
I   28  2   25000   Maharshtra  PHD F
J   32  1   30000   Maharshtra  PG  M
K   26  1   0   MP          UG  F
L   58  1   55000   Maharshtra  UG  F
M   63  1   25000   Maharshtra  UG  M

从家庭中选择姓名、薪水;
输出:

"A",50,3,90000,"Maharshtra","UG","M"    NULL
"B",46,3,40000,"Maharshtra","UG","F"    NULL
"C",15,3,0,"MP","HS","F"    NULL
"D",24,3,10000,"Maharshtra","PG","F"    NULL
"E",85,3,7000,"Maharshtra","HS","F" NULL
"F",28,2,60000,"MP","UG","M"    NULL
"G",59,2,60000,"Maharshtra","UG","M"    NULL
"H",21,2,0,"MP","HS","F"    NULL
"I",28,2,25000,"Maharshtra","PHD","F"   NULL
"J",32,1,30000,"Maharshtra","PG","M"    NULL
"K",26,1,0,"MP","UG","F"    NULL
"L",58,1,55000,"Maharshtra","UG","F"    NULL
"M",63,1,25000,"Maharshtra","UG","M"    NULL

如何仅获取用于查询的选定列?

xmq68pz9

xmq68pz91#

它会将您的整行放在“名称”字段中。所有其他字段都为空。
因为这是第一个字段,所以我打赌文件中的分隔符不是代码中指定的分隔符。
您似乎有逗号分隔的数据,这不是配置单元表的默认值。
下面是一个关于声明表的正确语法的示例:https://stackoverflow.com/a/48616635

相关问题