Guest User

Untitled

a guest
Apr 15th, 2018
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. [vagrant@c6801 ~]$ vim /tmp/mytestvalue.tsv
  2. [vagrant@c6801 ~]$ sudo -u hdfs hdfs dfs -put -f /tmp/mytestvalue.tsv /tmp && beeline -u 'jdbc:hive2://c6802.ambari.apache.org:2181,c6803.ambari.apache.org:2181,c6801.ambari.apache.org:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2' -n hdfs
  3. Connecting to jdbc:hive2://c6802.ambari.apache.org:2181,c6803.ambari.apache.org:2181,c6801.ambari.apache.org:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
  4. Connected to: Apache Hive (version 1.2.1000.2.5.3.0-37)
  5. Driver: Hive JDBC (version 1.2.1000.2.5.3.0-37)
  6. Transaction isolation: TRANSACTION_REPEATABLE_READ
  7. Beeline version 1.2.1000.2.5.3.0-37 by Apache Hive
  8. 0: jdbc:hive2://c6802.ambari.apache.org:2181,> create temporary table mytesttemp like mytesttable stored as textfile;
  9. No rows affected (0.29 seconds)
  10. 0: jdbc:hive2://c6802.ambari.apache.org:2181,> alter table mytesttemp set serdeproperties ('serialization.format'='\t', 'field.delim'='\t');
  11. No rows affected (0.036 seconds)
  12. 0: jdbc:hive2://c6802.ambari.apache.org:2181,> load data inpath '/tmp/mytestvalue.tsv' into table mytesttemp;
  13. INFO : Loading data to table default.mytesttemp from hdfs://mynameservice/tmp/mytestvalue.tsv
  14. INFO : Table default.mytesttemp stats: [numFiles=1, totalSize=17]
  15. No rows affected (0.123 seconds)
  16. 0: jdbc:hive2://c6802.ambari.apache.org:2181,> select * from mytesttemp;
  17. +-------------------+-------------------+--+
  18. | mytesttemp.mystr | mytesttemp.myint |
  19. +-------------------+-------------------+--+
  20. | myteststring | 123 |
  21. +-------------------+-------------------+--+
  22. 1 row selected (0.196 seconds)
  23. 0: jdbc:hive2://c6802.ambari.apache.org:2181,>
Add Comment
Please, Sign In to add comment