QnaList > Groups > Spark-User > Apr 2016
faq

Is Hive CREATE DATABASE IF NOT EXISTS Atomic

Hi,
I am using hiveContext.sql("create database if not exists ") to
create a hive db. Is this statement atomic?
Thanks.
Antonio.
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Is-Hive-CREATE-DATABASE-IF-NOT-EXISTS-atomic-tp26706.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

asked Apr 7 2016 at 15:23

antoniosi 's gravatar image



1 Replies for : Is Hive CREATE DATABASE IF NOT EXISTS Atomic
If you are using hiveContext to create a Hive database it will work.
In general you should use Hive to create a Hive database and create tables
within the already existing Hive database from Spark.
Make sure that you qualify  with 
sql("DROP TABLE IF EXISTS accounts.ll_18740868")
var sqltext : String = ""
sqltext = """
CREATE TABLE accounts.ll_18740868 (
TransactionDate            DATE
,TransactionType           String
,SortCode                  String
,AccountNumber             String
,TransactionDescription    String
,DebitAmount               Double
,CreditAmount              Double
,Balance                   Double
)
COMMENT 'from csv file from excel sheet'
STORED AS ORC
TBLPROPERTIES ( "orc.compress"="ZLIB" )
"""
sql(sqltext)
HTH
Dr Mich Talebzadeh
LinkedIn * https://www.linkedin.com/profile/view?id�EAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw
<https://www.linkedin.com/profile/view?id�EAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw>*
http://talebzadehmich.wordpress.com

answered Apr 7 2016 at 16:24

Mich Talebzadeh 's gravatar image


Related discussions

Tagged

Group Spark-user

asked Apr 7 2016 at 15:23

active Apr 7 2016 at 16:24

posts:2

users:2

Spark-dev

Spark-user

©2013 QnaList.com