MAPREDUCE服务 MRS-自定义Hive表行分隔符:操作步骤

时间:2024-10-22 09:17:14

操作步骤

  1. 创建表时指定inputFormat和outputFormat:

    CREATE [TEMPORARY] [EXTERNAL] TABLE [IF NOT EXISTS] [db_name.]table_name [(col_name data_type [COMMENT col_comment], ...)] [ROW FORMAT row_format] STORED AS inputformat 'org.apache.hadoop.hive.contrib.fileformat.SpecifiedDelimiterInputFormat' outputformat 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat';

  2. 查询之前指定配置项:

    set hive.textinput.record.delimiter='!@!';

    Hive会以‘!@!’为行分隔符查询数据。

support.huaweicloud.com/cmpntguide-mrs/mrs_01_0955.html