Skip to content

Commit 6555fef

Browse files
committed
rename bucketPath to nestedPath
1 parent e73b7d9 commit 6555fef

File tree

4 files changed

+34
-34
lines changed

4 files changed

+34
-34
lines changed

bridge/src/main/scala/app/softnetwork/elastic/sql/bridge/ElasticAggregation.scala

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ object ElasticAggregation {
308308
): Option[Aggregation] = {
309309
buckets.reverse.foldLeft(Option.empty[Aggregation]) { (current, bucket) =>
310310
// Determine the bucketPath of the current bucket
311-
val currentBucketPath = bucket.identifier.path
311+
val currentNestedPath = bucket.identifier.path
312312

313313
val aggScript =
314314
if (!bucket.isBucketScript && bucket.shouldBeScripted) {
@@ -366,15 +366,15 @@ object ElasticAggregation {
366366
bucketsDirection.get(bucket.identifier.identifierName) match {
367367
case Some(direction) =>
368368
DateHistogramAggregation(bucket.name, calendarInterval = interval)
369-
.field(currentBucketPath)
369+
.field(currentNestedPath)
370370
.minDocCount(1)
371371
.order(direction match {
372372
case Asc => HistogramOrder("_key", asc = true)
373373
case _ => HistogramOrder("_key", asc = false)
374374
})
375375
case _ =>
376376
DateHistogramAggregation(bucket.name, calendarInterval = interval)
377-
.field(currentBucketPath)
377+
.field(currentNestedPath)
378378
.minDocCount(1)
379379
}
380380
}
@@ -401,14 +401,14 @@ object ElasticAggregation {
401401
// Standard terms aggregation
402402
bucketsDirection.get(bucket.identifier.identifierName) match {
403403
case Some(direction) =>
404-
termsAgg(bucket.name, currentBucketPath)
404+
termsAgg(bucket.name, currentNestedPath)
405405
.minDocCount(1)
406406
.order(Seq(direction match {
407407
case Asc => TermsOrder("_key", asc = true)
408408
case _ => TermsOrder("_key", asc = false)
409409
}))
410410
case _ =>
411-
termsAgg(bucket.name, currentBucketPath)
411+
termsAgg(bucket.name, currentNestedPath)
412412
.minDocCount(1)
413413
}
414414
}
@@ -504,7 +504,7 @@ object ElasticAggregation {
504504
allElasticAggregations: Seq[ElasticAggregation]
505505
): String = {
506506

507-
val currentBucketPath = nested.map(_.bucketPath).getOrElse("")
507+
val currentNestedPath = nested.map(_.nestedPath).getOrElse("")
508508

509509
// No filtering
510510
val fullScript = MetricSelectorScript
@@ -514,7 +514,7 @@ object ElasticAggregation {
514514
.replaceAll("1 == 1", "")
515515
.trim
516516

517-
// println(s"[DEBUG] currentBucketPath = $currentBucketPath")
517+
// println(s"[DEBUG] currentNestedPath = $currentNestedPath")
518518
// println(s"[DEBUG] fullScript (complete) = $fullScript")
519519

520520
if (fullScript.isEmpty) {
@@ -536,17 +536,17 @@ object ElasticAggregation {
536536
) match {
537537
case Some(elasticAgg) =>
538538
val metricBucketPath = elasticAgg.nestedElement
539-
.map(_.bucketPath)
539+
.map(_.nestedPath)
540540
.getOrElse("")
541541

542542
// println(
543543
// s"[DEBUG] metricName = $metricName, metricBucketPath = $metricBucketPath, aggType = ${elasticAgg.agg.getClass.getSimpleName}"
544544
// )
545545

546-
val belongsToLevel = metricBucketPath == currentBucketPath
546+
val belongsToLevel = metricBucketPath == currentNestedPath
547547

548548
val isDirectChildAndAccessible =
549-
if (isDirectChild(metricBucketPath, currentBucketPath)) {
549+
if (isDirectChild(metricBucketPath, currentNestedPath)) {
550550
// Check if it's a "global" metric (cardinality, etc.)
551551
elasticAgg.isGlobalMetric
552552
} else {
@@ -562,7 +562,7 @@ object ElasticAggregation {
562562

563563
case None =>
564564
// println(s"[DEBUG] metricName = $metricName NOT FOUND")
565-
currentBucketPath.isEmpty
565+
currentNestedPath.isEmpty
566566
}
567567
}
568568
}
@@ -608,15 +608,15 @@ object ElasticAggregation {
608608
allAggregations: Seq[SQLAggregation]
609609
): Map[String, String] = {
610610
val currentBucketPath =
611-
bucketScriptAggregation.identifier.nestedElement.map(_.bucketPath).getOrElse("")
611+
bucketScriptAggregation.identifier.nestedElement.map(_.nestedPath).getOrElse("")
612612
// Extract ALL metrics paths
613613
val allMetricsPaths = bucketScriptAggregation.params.keys
614614
val result =
615615
allMetricsPaths.flatMap { metricName =>
616616
allAggregations.find(agg => agg.aggName == metricName || agg.field == metricName) match {
617617
case Some(sqlAgg) =>
618618
val metricBucketPath = sqlAgg.nestedElement
619-
.map(_.bucketPath)
619+
.map(_.nestedPath)
620620
.getOrElse("")
621621
if (metricBucketPath == currentBucketPath) {
622622
// Metric of the same level
@@ -659,7 +659,7 @@ object ElasticAggregation {
659659
allElasticAggregations: Seq[ElasticAggregation]
660660
): Map[String, String] = {
661661

662-
val currentBucketPath = nested.map(_.bucketPath).getOrElse("")
662+
val currentBucketPath = nested.map(_.nestedPath).getOrElse("")
663663

664664
// Extract ALL metrics paths
665665
val allMetricsPaths = criteria.extractAllMetricsPath
@@ -674,7 +674,7 @@ object ElasticAggregation {
674674
) match {
675675
case Some(elasticAgg) =>
676676
val metricBucketPath = elasticAgg.nestedElement
677-
.map(_.bucketPath)
677+
.map(_.nestedPath)
678678
.getOrElse("")
679679

680680
// println(

es6/bridge/src/main/scala/app/softnetwork/elastic/sql/bridge/ElasticAggregation.scala

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ object ElasticAggregation {
308308
): Option[Aggregation] = {
309309
buckets.reverse.foldLeft(Option.empty[Aggregation]) { (current, bucket) =>
310310
// Determine the bucketPath of the current bucket
311-
val currentBucketPath = bucket.identifier.path
311+
val currentNestedPath = bucket.identifier.path
312312

313313
val aggScript =
314314
if (!bucket.isBucketScript && bucket.shouldBeScripted) {
@@ -366,15 +366,15 @@ object ElasticAggregation {
366366
bucketsDirection.get(bucket.identifier.identifierName) match {
367367
case Some(direction) =>
368368
DateHistogramAggregation(bucket.name, interval = interval)
369-
.field(currentBucketPath)
369+
.field(currentNestedPath)
370370
.minDocCount(1)
371371
.order(direction match {
372372
case Asc => HistogramOrder("_key", asc = true)
373373
case _ => HistogramOrder("_key", asc = false)
374374
})
375375
case _ =>
376376
DateHistogramAggregation(bucket.name, interval = interval)
377-
.field(currentBucketPath)
377+
.field(currentNestedPath)
378378
.minDocCount(1)
379379
}
380380
}
@@ -401,14 +401,14 @@ object ElasticAggregation {
401401
// Standard terms aggregation
402402
bucketsDirection.get(bucket.identifier.identifierName) match {
403403
case Some(direction) =>
404-
termsAgg(bucket.name, currentBucketPath)
404+
termsAgg(bucket.name, currentNestedPath)
405405
.minDocCount(1)
406406
.order(Seq(direction match {
407407
case Asc => TermsOrder("_key", asc = true)
408408
case _ => TermsOrder("_key", asc = false)
409409
}))
410410
case _ =>
411-
termsAgg(bucket.name, currentBucketPath)
411+
termsAgg(bucket.name, currentNestedPath)
412412
.minDocCount(1)
413413
}
414414
}
@@ -504,7 +504,7 @@ object ElasticAggregation {
504504
allElasticAggregations: Seq[ElasticAggregation]
505505
): String = {
506506

507-
val currentBucketPath = nested.map(_.bucketPath).getOrElse("")
507+
val currentNestedPath = nested.map(_.nestedPath).getOrElse("")
508508

509509
// No filtering
510510
val fullScript = MetricSelectorScript
@@ -514,7 +514,7 @@ object ElasticAggregation {
514514
.replaceAll("1 == 1", "")
515515
.trim
516516

517-
// println(s"[DEBUG] currentBucketPath = $currentBucketPath")
517+
// println(s"[DEBUG] currentNestedPath = $currentNestedPath")
518518
// println(s"[DEBUG] fullScript (complete) = $fullScript")
519519

520520
if (fullScript.isEmpty) {
@@ -536,17 +536,17 @@ object ElasticAggregation {
536536
) match {
537537
case Some(elasticAgg) =>
538538
val metricBucketPath = elasticAgg.nestedElement
539-
.map(_.bucketPath)
539+
.map(_.nestedPath)
540540
.getOrElse("")
541541

542542
// println(
543543
// s"[DEBUG] metricName = $metricName, metricBucketPath = $metricBucketPath, aggType = ${elasticAgg.agg.getClass.getSimpleName}"
544544
// )
545545

546-
val belongsToLevel = metricBucketPath == currentBucketPath
546+
val belongsToLevel = metricBucketPath == currentNestedPath
547547

548548
val isDirectChildAndAccessible =
549-
if (isDirectChild(metricBucketPath, currentBucketPath)) {
549+
if (isDirectChild(metricBucketPath, currentNestedPath)) {
550550
// Check if it's a "global" metric (cardinality, etc.)
551551
elasticAgg.isGlobalMetric
552552
} else {
@@ -562,7 +562,7 @@ object ElasticAggregation {
562562

563563
case None =>
564564
// println(s"[DEBUG] metricName = $metricName NOT FOUND")
565-
currentBucketPath.isEmpty
565+
currentNestedPath.isEmpty
566566
}
567567
}
568568
}
@@ -608,15 +608,15 @@ object ElasticAggregation {
608608
allAggregations: Seq[SQLAggregation]
609609
): Map[String, String] = {
610610
val currentBucketPath =
611-
bucketScriptAggregation.identifier.nestedElement.map(_.bucketPath).getOrElse("")
611+
bucketScriptAggregation.identifier.nestedElement.map(_.nestedPath).getOrElse("")
612612
// Extract ALL metrics paths
613613
val allMetricsPaths = bucketScriptAggregation.params.keys
614614
val result =
615615
allMetricsPaths.flatMap { metricName =>
616616
allAggregations.find(agg => agg.aggName == metricName || agg.field == metricName) match {
617617
case Some(sqlAgg) =>
618618
val metricBucketPath = sqlAgg.nestedElement
619-
.map(_.bucketPath)
619+
.map(_.nestedPath)
620620
.getOrElse("")
621621
if (metricBucketPath == currentBucketPath) {
622622
// Metric of the same level
@@ -659,7 +659,7 @@ object ElasticAggregation {
659659
allElasticAggregations: Seq[ElasticAggregation]
660660
): Map[String, String] = {
661661

662-
val currentBucketPath = nested.map(_.bucketPath).getOrElse("")
662+
val currentBucketPath = nested.map(_.nestedPath).getOrElse("")
663663

664664
// Extract ALL metrics paths
665665
val allMetricsPaths = criteria.extractAllMetricsPath
@@ -674,7 +674,7 @@ object ElasticAggregation {
674674
) match {
675675
case Some(elasticAgg) =>
676676
val metricBucketPath = elasticAgg.nestedElement
677-
.map(_.bucketPath)
677+
.map(_.nestedPath)
678678
.getOrElse("")
679679

680680
// println(

sql/src/main/scala/app/softnetwork/elastic/sql/query/From.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ case class NestedElement(
218218
}
219219
}
220220

221-
lazy val bucketPath: String = {
221+
lazy val nestedPath: String = {
222222
parent match {
223-
case Some(p) => s"${p.bucketPath}>$innerHitsName"
223+
case Some(p) => s"${p.nestedPath}>$innerHitsName"
224224
case None => innerHitsName
225225
}
226226
}

sql/src/main/scala/app/softnetwork/elastic/sql/query/GroupBy.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ case class Bucket(
8989

9090
lazy val name: String = identifier.fieldAlias.getOrElse(sourceBucket.replace(".", "_"))
9191

92-
lazy val bucketPath: String = {
92+
lazy val nestedPath: String = {
9393
identifier.nestedElement match {
94-
case Some(ne) => ne.bucketPath
94+
case Some(ne) => ne.nestedPath
9595
case None => "" // Root level
9696
}
9797
}

0 commit comments

Comments
 (0)