1
HIVE SERDE REGEX:出力フォーマット - 出力のほんの数を使用したい文字列
エノ:: ENAME :: DEPTを次のように入力ファイルがある:: SAL
101 :: EMP1 :: COMP1 :: 2800000
201 :: EMP2 :: COMP2 :: 2800000
301 :: EMP3 :: COMP3 ::340万
401 :: emp4 :: COMP4 :: 3600000
501 :: emp5 :: COMP5 :: 400000
>create table emp(ename string,edept string)
> row format serde 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe'
> WITH SERDEPROPERTIES(
> "input.regex"="^([^\\::]+)\\::([^\\::]+)\\::([^\\::]+)\\::([^\\::]+)$",
> "output.format.string"="%2$s%3$s")
> ;
>load data local inpath '/home/cloudera/test/emp.txt' into table emp;
私はテーブルにのみ2番目と3番目のリテラルを引きたいです。だから "output.format.string" = "%2 $ s%3 $ s"を使って - これは正しいですか?
私のテーブルはeno & enameでロードされます。