by shigemk2

当面は技術的なことしか書かない

Hive

memo OpenCSVSerDe

memo OpenCSVSerDe 2019/04/09 AthenaにCSVデータを突っ込むときにデータに改行が混ざってるやつは対処できない。つまり、こういうデータは改行処理されるからSELECTするなどしたら死ぬ。 1,"ab\nc" 2,"ab\nc" これはAthenaの仕様じゃなくてOpenCSVSerdeの仕…

Hive データタイプ

Hiveのデータタイプ。Hiveのwikiに載っている。 LanguageManual Types - Apache Hive - Apache Software Foundation

memo OpenCSVSerde

OpenCSVSerdeの中身。結構あっさりしている。テストコードもあっさり。 CSV Serde - Apache Hive - Apache Software Foundation csv-serde/CSVSerde.java at master · ogrodnek/csv-serde · GitHub

LATERAL VIEW explode

もとのテーブルで配列とかJSONをexplodeしてレコードに分解するやつ SELECT myCol1, col2 FROM baseTable LATERAL VIEW explode(col1) myTable1 AS myCol1; https://cwiki.apache.org/confluence/display/Hive/LanguageManual+LateralViewhttps://cwiki.apac…

Hive create table with parquet

だいぶすっきりしてるね Hive 0.10 - 0.12 CREATE TABLE parquet_test ( id int, str string, mp MAP<STRING,STRING>, lst ARRAY<STRING>, strct STRUCT<A:STRING,B:STRING>) PARTITIONED BY (part string) ROW FORMAT SERDE 'parquet.hive.serde.ParquetHiveSerDe' STORED AS INPUTFORMAT 'parquet.hiv</a:string,b:string></string></string,string>…

hive explain

hive explain 意訳 hiveのexplainは読みづらい 下から順に読め How to understand and analyze Apache Hive query execution plan for performance debugging from DataWorks Summit/Hadoop Summit

hive-geoip

hive-geoip GeoIPをHiveで使うアレ。prestoで使えたら良かったのに。。

hive insert overwrite

hive insert overwrite Hiveではinsertは追加ではなく上書きで、partitionが動的に作成されている INSERT OVERWRITE TABLE テーブル名 [PARTITION (項目名=値, …)] SELECT文 FROM 元テーブル名 https://cwiki.apache.org/confluence/display/Hive/LanguageMa…

memo orc file format

memo orc file format The Optimized Row Columnar (ORC) file format provides a highly efficient way to store Hive data. It was designed to overcome limitations of the other Hive file formats. Using ORC files improves performance when Hive is…

msck

Recovers partitions and data associated with partitions. hiveですよhive prestoでmsckとかは使えないから。beeline経由でmsckとか使える https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-RecoverPartitions(MSC…

external table

externalはディレクトリ指定で、テーブルを消してもデータは消えないが、ふつうのcreate tableはテーブルを消したらデータも消える http://www.ne.jp/asahi/hishidama/home/tech/apache/hive/table.html

hive language manual

Hiveクエリのマニュアル https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL

apache hive official

これが公式。 Apache Hive TM

impala shell

impala-shellのオプションが記載されているページ。 csv出力は"で囲まないっぽい。 impala-shell Configuration Options

Hive Storage Format

The storage format to use when writing data to Hive can now be configured via the hive.storage-format option in your Hive catalog properties file. Valid options are RCBINARY, RCTEXT, SEQUENCEFILE and TEXTFILE. The default format if the pro…