@@ -42,7 +42,7 @@ class SearchAnalyticsIntegrationSpec extends SparkCassandraITFlatSpecBase with D
42
42
val typeIndex : String = s " $ks. $typesTable"
43
43
val weirdIndex : String = s " $ks. $weirdTable"
44
44
45
- skipIfNotDSE(conn) {
45
+ dseOnly {
46
46
conn.withSessionDo { session =>
47
47
48
48
val executor = getExecutor(session)
@@ -159,7 +159,7 @@ class SearchAnalyticsIntegrationSpec extends SparkCassandraITFlatSpecBase with D
159
159
}
160
160
161
161
162
- " SearchAnalytics" should " be able to use solr_query" in skipIfNotDSE(conn) {
162
+ " SearchAnalytics" should " be able to use solr_query" in dseOnly {
163
163
val df = spark.sql(s """ SELECT key,a,b,c FROM $table WHERE solr_query = '{"q": "*:*", "fq":["key:[500 TO *]", "a:1"]}' """ )
164
164
165
165
// Check that the correct data got through
@@ -174,7 +174,7 @@ class SearchAnalyticsIntegrationSpec extends SparkCassandraITFlatSpecBase with D
174
174
results.size should be(expected.size)
175
175
}
176
176
177
- it should " be able to use solr optimizations " in skipIfNotDSE(conn) {
177
+ it should " be able to use solr optimizations " in dseOnly {
178
178
val df = spark.sql(s " SELECT key,a,b,c FROM $table WHERE key >= 500 AND a == 1 " )
179
179
180
180
// Check that pushdown happened
@@ -196,7 +196,7 @@ class SearchAnalyticsIntegrationSpec extends SparkCassandraITFlatSpecBase with D
196
196
results.size should be(expected.size)
197
197
}
198
198
199
- it should " not use solr optimizations if there is a manual optimization" in skipIfNotDSE(conn) {
199
+ it should " not use solr optimizations if there is a manual optimization" in dseOnly {
200
200
val df = spark.sql(s " SELECT key,a,b,c FROM $table WHERE solr_query='key:[500 TO *]' AND a == 1 " )
201
201
val whereClause = df.getUnderlyingCqlWhereClause()
202
202
whereClause.predicates.head should include(" solr_query" )
@@ -217,7 +217,7 @@ class SearchAnalyticsIntegrationSpec extends SparkCassandraITFlatSpecBase with D
217
217
218
218
}
219
219
220
- it should " should choose solr clauses over clustering key clauses " in skipIfNotDSE(conn) {
220
+ it should " should choose solr clauses over clustering key clauses " in dseOnly {
221
221
val df = spark.sql(s " SELECT key,a,b,c FROM $table WHERE a > 2 " )
222
222
223
223
// Check that pushdown happened
@@ -236,7 +236,7 @@ class SearchAnalyticsIntegrationSpec extends SparkCassandraITFlatSpecBase with D
236
236
results.size should be(expected.size)
237
237
}
238
238
239
- it should " should be able to turn off solr optimization " in skipIfNotDSE(conn) {
239
+ it should " should be able to turn off solr optimization " in dseOnly {
240
240
val df = spark.sql(s " SELECT key,a,b,c FROM $tableNoSolr WHERE a > 2 " )
241
241
242
242
// Check that solr pushdown didn't happened
@@ -247,7 +247,7 @@ class SearchAnalyticsIntegrationSpec extends SparkCassandraITFlatSpecBase with D
247
247
results.size should be(3000 )
248
248
}
249
249
250
- it should " should correctly do negation filters " in skipIfNotDSE(conn) {
250
+ it should " should correctly do negation filters " in dseOnly {
251
251
val df = spark.sql(
252
252
s """ SELECT key,a,b,c FROM $table WHERE
253
253
|key > 998 AND
@@ -270,7 +270,7 @@ class SearchAnalyticsIntegrationSpec extends SparkCassandraITFlatSpecBase with D
270
270
results should contain theSameElementsAs (expected)
271
271
}
272
272
273
- it should " handle OR conjunctions when possible" in skipIfNotDSE(conn) {
273
+ it should " handle OR conjunctions when possible" in dseOnly {
274
274
val df = spark.sql(
275
275
s """ SELECT key,a,b,c FROM $table
276
276
|WHERE key < 10
@@ -295,7 +295,7 @@ class SearchAnalyticsIntegrationSpec extends SparkCassandraITFlatSpecBase with D
295
295
results should contain theSameElementsAs (expected)
296
296
}
297
297
298
- it should " handle conjunctions with LIKE clauses" in skipIfNotDSE(conn) {
298
+ it should " handle conjunctions with LIKE clauses" in dseOnly {
299
299
val df = spark.sql(
300
300
s """ SELECT key,a,b,c FROM $table
301
301
|WHERE c LIKE '%100%'
@@ -322,7 +322,7 @@ class SearchAnalyticsIntegrationSpec extends SparkCassandraITFlatSpecBase with D
322
322
results should contain theSameElementsAs (expected)
323
323
}
324
324
325
- it should " handle IN clauses" in skipIfNotDSE(conn) {
325
+ it should " handle IN clauses" in dseOnly {
326
326
val df = spark.sql(
327
327
s """ SELECT key,a,b,c FROM $table
328
328
|WHERE key IN (4, 8, 15, 16, 23, 42) """ .stripMargin)
@@ -342,7 +342,7 @@ class SearchAnalyticsIntegrationSpec extends SparkCassandraITFlatSpecBase with D
342
342
results should contain theSameElementsAs (expected)
343
343
}
344
344
345
- it should " handle IsNotNull on a partition key" in skipIfNotDSE(conn) {
345
+ it should " handle IsNotNull on a partition key" in dseOnly {
346
346
val df = spark.sql(
347
347
s """ SELECT key,a,b,c FROM $table WHERE key IS NOT NULL """ )
348
348
@@ -358,7 +358,7 @@ class SearchAnalyticsIntegrationSpec extends SparkCassandraITFlatSpecBase with D
358
358
results should contain theSameElementsAs (expected)
359
359
}
360
360
361
- it should " handle mixed partition key and solr restrictions" in skipIfNotDSE(conn) {
361
+ it should " handle mixed partition key and solr restrictions" in dseOnly {
362
362
val df = spark.sql(
363
363
s """ SELECT key,a,b,c FROM $table WHERE key = 4 AND b = 5 """ )
364
364
@@ -378,7 +378,7 @@ class SearchAnalyticsIntegrationSpec extends SparkCassandraITFlatSpecBase with D
378
378
results should contain theSameElementsAs (expected)
379
379
}
380
380
381
- it should " handle isNotNull all by itself" in skipIfNotDSE(conn) {
381
+ it should " handle isNotNull all by itself" in dseOnly {
382
382
val df = spark.sql(
383
383
s """ SELECT key,a,b,c FROM $table WHERE c IS NOT NULL """ )
384
384
@@ -390,7 +390,7 @@ class SearchAnalyticsIntegrationSpec extends SparkCassandraITFlatSpecBase with D
390
390
df.collect()
391
391
}
392
392
393
- it should " handle only partition key restrictions" in skipIfNotDSE(conn) {
393
+ it should " handle only partition key restrictions" in dseOnly {
394
394
val df = spark.sql(
395
395
s """ SELECT key,a,b,c FROM $table WHERE key = 4 """ )
396
396
@@ -407,7 +407,7 @@ class SearchAnalyticsIntegrationSpec extends SparkCassandraITFlatSpecBase with D
407
407
results should contain theSameElementsAs (expected)
408
408
}
409
409
410
- it should " handle primary key restrictions" in skipIfNotDSE(conn) {
410
+ it should " handle primary key restrictions" in dseOnly {
411
411
val df = spark.sql(
412
412
s """ SELECT key,a,b,c FROM $table WHERE key = 4 AND a > 2 """ )
413
413
@@ -425,7 +425,7 @@ class SearchAnalyticsIntegrationSpec extends SparkCassandraITFlatSpecBase with D
425
425
results should contain theSameElementsAs (expected)
426
426
}
427
427
428
- it should " handle Primary key restrictions and solr queries at the same time" in skipIfNotDSE(conn) {
428
+ it should " handle Primary key restrictions and solr queries at the same time" in dseOnly {
429
429
val df = spark.sql(
430
430
s """ SELECT key,a,b,c FROM $table WHERE key = 4 AND a > 2 AND b < 25 """ )
431
431
// Check that pushdown happened
@@ -443,7 +443,7 @@ class SearchAnalyticsIntegrationSpec extends SparkCassandraITFlatSpecBase with D
443
443
results should contain theSameElementsAs (expected)
444
444
}
445
445
446
- it should " optimize a count(*) without any predicates in " in skipIfNotDSE(conn) {
446
+ it should " optimize a count(*) without any predicates in " in dseOnly {
447
447
val df = spark.sql(s " SELECT COUNT(*) from $table" )
448
448
val whereClause = df.getUnderlyingCqlWhereClause()
449
449
val predicates = whereClause.predicates.head
@@ -461,63 +461,63 @@ class SearchAnalyticsIntegrationSpec extends SparkCassandraITFlatSpecBase with D
461
461
df.collect() should have size 1
462
462
}
463
463
464
- it should " work with ascii" in skipIfNotDSE(conn) {
464
+ it should " work with ascii" in dseOnly {
465
465
testType(""" a = 'one:\".'""" , " a:one" )
466
466
}
467
467
468
- it should " work with solr reserved words in ascii" in skipIfNotDSE(conn) {
468
+ it should " work with solr reserved words in ascii" in dseOnly {
469
469
testType(" a = 'OR'" , " a:\\\\ OR" )
470
470
}
471
471
472
- it should " work with bigint" in skipIfNotDSE(conn) {
472
+ it should " work with bigint" in dseOnly {
473
473
testType(" b = 1" , " b:1" )
474
474
}
475
475
476
- it should " work with date" in skipIfNotDSE(conn) {
476
+ it should " work with date" in dseOnly {
477
477
testType(" d = cast('2017-2-7' as date)" , """ d:2017\\ -02\\ -07""" )
478
478
}
479
479
480
- it should " work with decimal" in skipIfNotDSE(conn) {
480
+ it should " work with decimal" in dseOnly {
481
481
testType(" e > 1.0" , " 1.000000000000000000 TO *" )
482
482
}
483
483
484
- it should " work with double" in skipIfNotDSE(conn) {
484
+ it should " work with double" in dseOnly {
485
485
testType(" f = 2.0" , " f:2.0" )
486
486
}
487
487
488
- it should " work with inet" in skipIfNotDSE(conn) {
488
+ it should " work with inet" in dseOnly {
489
489
testType(" g = '8.8.8.8'" , " g:8.8.8.8" )
490
490
}
491
491
492
- it should " work with int" in skipIfNotDSE(conn) {
492
+ it should " work with int" in dseOnly {
493
493
testType(" h = 1" , " h:1" )
494
494
}
495
495
496
- it should " work with text" in skipIfNotDSE(conn) {
496
+ it should " work with text" in dseOnly {
497
497
testType(" i = 'one'" , " i:one" )
498
498
}
499
499
500
- it should " work with solr reserved words in text" in skipIfNotDSE(conn) {
500
+ it should " work with solr reserved words in text" in dseOnly {
501
501
testType(" i = 'OR'" , " i:\\\\ OR" )
502
502
}
503
503
504
- it should " work with timestamp" in skipIfNotDSE(conn) {
504
+ it should " work with timestamp" in dseOnly {
505
505
testType(" j < cast( \" 2000-01-01T00:08:20.000Z\" as timestamp)" , """ {"q":"*:*", "fq":["j:[* TO 2000\\ -01\\ -01T00\\ :08\\ :20Z}"]}""" )
506
506
}
507
507
508
- it should " work with varchar" in skipIfNotDSE(conn) {
508
+ it should " work with varchar" in dseOnly {
509
509
testType(" k = 'one'" , " k:one" )
510
510
}
511
511
512
- it should " work with varint" in skipIfNotDSE(conn) {
512
+ it should " work with varint" in dseOnly {
513
513
testType(" l = 1" , " l:1" )
514
514
}
515
515
516
- it should " work with uuid" in skipIfNotDSE(conn) {
516
+ it should " work with uuid" in dseOnly {
517
517
testType(" m = '10000000-0000-0000-0000-000000000000'" , """ "m:10000000\\ -0000\\ -0000\\ -0000\\ -000000000000"""" )
518
518
}
519
519
520
- it should " work with weird column names" in skipIfNotDSE(conn) {
520
+ it should " work with weird column names" in dseOnly {
521
521
val df : DataFrame = spark
522
522
.read
523
523
.cassandraFormat(weirdTable, ks)
@@ -538,14 +538,14 @@ class SearchAnalyticsIntegrationSpec extends SparkCassandraITFlatSpecBase with D
538
538
rows.head.getAs[String ](" MixEdCol" ) should be(" world" )
539
539
}
540
540
541
- " Automatic Solr Optimization" should " occur when the selected amount of data is less than the threshold" in skipIfNotDSE(conn) {
541
+ " Automatic Solr Optimization" should " occur when the selected amount of data is less than the threshold" in dseOnly {
542
542
val df = spark.sql(s " SELECT COUNT(*) from $tableAutoSolr where key < 5 " )
543
543
val whereClause = df.getUnderlyingCqlWhereClause()
544
544
val predicates = whereClause.predicates.head
545
545
predicates should include(""" solr_query""" )
546
546
}
547
547
548
- it should " not occur if the selected amount of data is greater than the threshold" in skipIfNotDSE(conn) {
548
+ it should " not occur if the selected amount of data is greater than the threshold" in dseOnly {
549
549
val df = spark.sql(s " SELECT COUNT(*) from $tableAutoSolr where key < 500 " )
550
550
val whereClause = df.getUnderlyingCqlWhereClause()
551
551
val predicates = whereClause.predicates
0 commit comments