You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by antoniosi <an...@gmail.com> on 2016/04/08 00:23:37 UTC
Is Hive CREATE DATABASE IF NOT EXISTS atomic
Hi,
I am using hiveContext.sql("create database if not exists <db name>") 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: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org
Re: Is Hive CREATE DATABASE IF NOT EXISTS atomic
Posted by Xiao Li <ga...@gmail.com>.
Hi,
Assuming you are using 1.6 or before, this is a native Hive command.
Basically, the execution of Database creation is completed by Hive.
Thanks,
Xiao Li
2016-04-07 15:23 GMT-07:00 antoniosi <an...@gmail.com>:
> Hi,
>
> I am using hiveContext.sql("create database if not exists <db name>") 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: user-unsubscribe@spark.apache.org
> For additional commands, e-mail: user-help@spark.apache.org
>
>
Re: Is Hive CREATE DATABASE IF NOT EXISTS atomic
Posted by Mich Talebzadeh <mi...@gmail.com>.
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 <TABLE_NAME> with <DATABASE_NAME>
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=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw
<https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw>*
http://talebzadehmich.wordpress.com
On 7 April 2016 at 23:23, antoniosi <an...@gmail.com> wrote:
> Hi,
>
> I am using hiveContext.sql("create database if not exists <db name>") 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: user-unsubscribe@spark.apache.org
> For additional commands, e-mail: user-help@spark.apache.org
>
>