[英]HiveQL ALTER TABLE: NullPointerException, INSERT INTO: MISSING table
我在使用INSERT INTO
和ALTER TABLE
命令时遇到问题。 我在笔记中发现了以下代码,这表明它可能在某些时候起作用。 但是,它现在不起作用。 谁能指出错误?
DROP TABLE anyoung.toytable_docs;
CREATE TABLE IF NOT EXISTS anyoung.toytable_docs
(
id INT COMMENT 'unique document ID',
rev INT,
content STRING
)
COMMENT 'Employee details';
以下两项也失败:
INSERT INTO anyoung.toytable_docs (`id`, `rev`, `content`) VALUES
('1', '1', 'The earth is flat'),
('2', '1', 'One hundred angels can dance on the head of a pin'),
('1', '2', 'The earth is flat and rests on a bull\'s horn'),
('1', '3', 'The earth is like a ball.');
use anyoung;
INSERT INTO toytable_docs (`id`, `rev`, `content`) VALUES
('1', '1', 'The earth is flat'),
('2', '1', 'One hundred angels can dance on the head of a pin'),
('1', '2', 'The earth is flat and rests on a bull\'s horn'),
('1', '3', 'The earth is like a ball.');
与: FAILED: ParseException line 1:12 missing TABLE at 'anyoung' near 'toytable_docs' in select clause
当我尝试ALTER TABLE
命令时,以下两项均失败:
ALTER TABLE anyoung.toytable_docs CHANGE content content STRING COMMENT 'The actual contents of the document';
use anyoung;
ALTER TABLE toytable_docs CHANGE content content STRING COMMENT 'The actual contents of the document';
有人有任何见解吗? 我已经用 Google 搜索过/SO 等。
缺少关键字 TABLE,它应该在表名之前:
use anyoung;
INSERT INTO TABLE toytable_docs VALUES
('1', '1', 'The earth is flat'),
('2', '1', 'One hundred angels can dance on the head of a pin'),
('1', '2', 'The earth is flat and rests on a bull\'s horn'),
('1', '3', 'The earth is like a ball.');
阅读有关插入语法的更多信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.