@@ -263,7 +263,8 @@ class HiveShowCreateTableSuite extends ShowCreateTableSuite with TestHiveSinglet
263263 test(" simple hive table as spark" ) {
264264 withTable(" t1" ) {
265265 sql(
266- s """ CREATE TABLE t1 (
266+ s """
267+ |CREATE TABLE t1 (
267268 | c1 STRING COMMENT 'bla',
268269 | c2 STRING
269270 |)
@@ -281,7 +282,8 @@ class HiveShowCreateTableSuite extends ShowCreateTableSuite with TestHiveSinglet
281282 test(" show create table as spark can't work on data source table" ) {
282283 withTable(" t1" ) {
283284 sql(
284- s """ CREATE TABLE t1 (
285+ s """
286+ |CREATE TABLE t1 (
285287 | c1 STRING COMMENT 'bla',
286288 | c2 STRING
287289 |)
@@ -293,15 +295,16 @@ class HiveShowCreateTableSuite extends ShowCreateTableSuite with TestHiveSinglet
293295 checkCreateSparkTable(" t1" )
294296 }
295297
296- assert(cause.getMessage.contains(" Using `SHOW CREATE TABLE` instead" ))
298+ assert(cause.getMessage.contains(" Use `SHOW CREATE TABLE` instead" ))
297299 }
298300 }
299301
300302 test(" simple external hive table as spark" ) {
301303 withTempDir { dir =>
302304 withTable(" t1" ) {
303305 sql(
304- s """ CREATE TABLE t1 (
306+ s """
307+ |CREATE TABLE t1 (
305308 | c1 STRING COMMENT 'bla',
306309 | c2 STRING
307310 |)
@@ -321,7 +324,8 @@ class HiveShowCreateTableSuite extends ShowCreateTableSuite with TestHiveSinglet
321324 test(" hive table with STORED AS clause as spark" ) {
322325 withTable(" t1" ) {
323326 sql(
324- s """ CREATE TABLE t1 (
327+ s """
328+ |CREATE TABLE t1 (
325329 | c1 INT COMMENT 'bla',
326330 | c2 STRING
327331 |)
@@ -336,7 +340,8 @@ class HiveShowCreateTableSuite extends ShowCreateTableSuite with TestHiveSinglet
336340 test(" hive table with unsupported fileformat as spark" ) {
337341 withTable(" t1" ) {
338342 sql(
339- s """ CREATE TABLE t1 (
343+ s """
344+ |CREATE TABLE t1 (
340345 | c1 INT COMMENT 'bla',
341346 | c2 STRING
342347 |)
@@ -355,7 +360,8 @@ class HiveShowCreateTableSuite extends ShowCreateTableSuite with TestHiveSinglet
355360 test(" hive table with serde info as spark" ) {
356361 withTable(" t1" ) {
357362 sql(
358- s """ CREATE TABLE t1 (
363+ s """
364+ |CREATE TABLE t1 (
359365 | c1 INT COMMENT 'bla',
360366 | c2 STRING
361367 |)
@@ -373,10 +379,7 @@ class HiveShowCreateTableSuite extends ShowCreateTableSuite with TestHiveSinglet
373379 test(" hive view is not supported as spark" ) {
374380 withTable(" t1" ) {
375381 withView(" v1" ) {
376- sql(
377- s """
378- |CREATE TABLE t1 (c1 STRING, c2 STRING)
379- """ .stripMargin)
382+ sql(" CREATE TABLE t1 (c1 STRING, c2 STRING)" )
380383
381384 createRawHiveTable(
382385 s """
@@ -397,7 +400,8 @@ class HiveShowCreateTableSuite extends ShowCreateTableSuite with TestHiveSinglet
397400 test(" partitioned, bucketed hive table as spark" ) {
398401 withTable(" t1" ) {
399402 sql(
400- s """ CREATE TABLE t1 (
403+ s """
404+ |CREATE TABLE t1 (
401405 | emp_id INT COMMENT 'employee id', emp_name STRING,
402406 | emp_dob STRING COMMENT 'employee date of birth', emp_sex STRING COMMENT 'M/F'
403407 |)
@@ -413,4 +417,30 @@ class HiveShowCreateTableSuite extends ShowCreateTableSuite with TestHiveSinglet
413417 checkCreateSparkTable(" t1" )
414418 }
415419 }
420+
421+ test(" transactional hive table as spark" ) {
422+ withTable(" t1" ) {
423+ sql(
424+ s """
425+ |CREATE TABLE t1 (
426+ | c1 STRING COMMENT 'bla',
427+ | c2 STRING
428+ |)
429+ |TBLPROPERTIES (
430+ | 'transactional' = 'true',
431+ | 'prop1' = 'value1',
432+ | 'prop2' = 'value2'
433+ |)
434+ """ .stripMargin
435+ )
436+
437+
438+ val cause = intercept[AnalysisException ] {
439+ sql(" SHOW CREATE TABLE t1 AS SPARK" )
440+ }
441+
442+ assert(cause.getMessage.contains(
443+ " SHOW CRETE TABLE AS SPARK doesn't support transactional Hive table" ))
444+ }
445+ }
416446}
0 commit comments