hive - 在配置单元中创建一个带有时间戳作为注释的表
问题描述
我想在 hive 中创建一个表,里面的注释包括创建日期(current_timestamp 函数)。像这样的东西:
CREATE TABLE IF NOT EXISTS ex.tb_test ( field1 int, field2 String) COMMENT current_timestamp STORED AS TEXTFILE;
但它返回错误:ILED: ParseException line 2: 8 mismatched input 'current_timestamp' expecting StringLiteral near 'COMMENT'
你知道有什么方法可以在评论中添加表格的创建日期吗?
解决方案
表 DDL 中不支持函数。您可以将预先计算的时间戳作为--hiveconf
参数传递并使用例如:( comment '${hiveconf:ts}'
它应该被引用),这样的参数将在命令执行之前被解析为字符串文字。
BTW Hive 存储 CreateTime。
describe formatted table_name
命令输出CreateTime
以及其他表信息。
推荐阅读
- azure - 如何使用 go 从 Azure 队列订阅接收消息
- forms - ASP.NET MVC 登录后如何使用用户的数据
- mysql - 通过比较 SQL 中的 2 行进行过滤
- python - NetworkX read_dot 不继承属性
- html - 如何在 select 中内联选项标签并使用 optgroup 划分它们?
- ios - 如何知道我将从 Apple 应用内购买中收到的确切金额
- c# - 如何在 IIS 中使用的 Azure 中使用“wwwroot”文件夹
- c++ - .h 中定义的 constexpr 数据成员仅在 -std=c++14 及以下版本中未在 .cpp 中解析
- amazon-web-services - 某些位置的网站响应缓慢
- ruby-on-rails - PG::DatatypeMismatch:错误:WHERE 的参数必须是布尔类型,而不是整数类型