Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 66 additions & 4 deletions x-pack/plugin/esql/compute/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,26 @@ def prop(Name, Type, type, Wrapper, TYPE, BYTES, Array, Hash) {
]
}

def propWithoutExtra(prop1) {
def res = [ "hasExtra": "" ]
for ( e in prop1 ) {
res.put(e.key, e.value)
res.put("Extra" + e.key, "")
}
return res
}

def propWithExtra(prop1, prop2) {
def res = [ "hasExtra": "true" ]
for ( e in prop1 ) {
res.put(e.key, e.value)
}
for ( e in prop2 ) {
res.put("Extra" + e.key, e.value)
}
return res
}

def addOccurrence(props, Occurrence) {
def newProps = props.collectEntries { [(it.key): it.value] }
newProps["Occurrence"] = Occurrence
Expand Down Expand Up @@ -651,6 +671,28 @@ tasks.named('stringTemplates').configure {
it.outputFile = "org/elasticsearch/compute/aggregation/ValuesBytesRefAggregator.java"
}

File sparklineAggregatorInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/aggregation/X-SparklineAggregator.java.st")
template {
it.properties = intProperties
it.inputFile = sparklineAggregatorInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/SparklineIntAggregator.java"
}
template {
it.properties = longProperties
it.inputFile = sparklineAggregatorInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/SparklineLongAggregator.java"
}
template {
it.properties = floatProperties
it.inputFile = sparklineAggregatorInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/SparklineFloatAggregator.java"
}
template {
it.properties = doubleProperties
it.inputFile = sparklineAggregatorInputFile
it.outputFile = "org/elasticsearch/compute/aggregation/SparklineDoubleAggregator.java"
}

File stdDevAggregatorInputFile = file("src/main/java/org/elasticsearch/compute/aggregation/X-StdDevAggregator.java.st")
template {
it.properties = intProperties
Expand Down Expand Up @@ -875,25 +917,45 @@ tasks.named('stringTemplates').configure {

File bucketedSortInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/data/sort/X-BucketedSort.java.st")
template {
it.properties = intProperties
it.properties = propWithoutExtra(intProperties)
it.inputFile = bucketedSortInputFile
it.outputFile = "org/elasticsearch/compute/data/sort/IntBucketedSort.java"
}
template {
it.properties = longProperties
it.properties = propWithoutExtra(longProperties)
it.inputFile = bucketedSortInputFile
it.outputFile = "org/elasticsearch/compute/data/sort/LongBucketedSort.java"
}
template {
it.properties = floatProperties
it.properties = propWithoutExtra(floatProperties)
it.inputFile = bucketedSortInputFile
it.outputFile = "org/elasticsearch/compute/data/sort/FloatBucketedSort.java"
}
template {
it.properties = doubleProperties
it.properties = propWithoutExtra(doubleProperties)
it.inputFile = bucketedSortInputFile
it.outputFile = "org/elasticsearch/compute/data/sort/DoubleBucketedSort.java"
}
template {
it.properties = propWithExtra(longProperties, intProperties)
it.inputFile = bucketedSortInputFile
it.outputFile = "org/elasticsearch/compute/data/sort/LongIntBucketedSort.java"
}
template {
it.properties = propWithExtra(longProperties, longProperties)
it.inputFile = bucketedSortInputFile
it.outputFile = "org/elasticsearch/compute/data/sort/LongLongBucketedSort.java"
}
template {
it.properties = propWithExtra(longProperties, floatProperties)
it.inputFile = bucketedSortInputFile
it.outputFile = "org/elasticsearch/compute/data/sort/LongFloatBucketedSort.java"
}
template {
it.properties = propWithExtra(longProperties, doubleProperties)
it.inputFile = bucketedSortInputFile
it.outputFile = "org/elasticsearch/compute/data/sort/LongDoubleBucketedSort.java"
}

File enrichResultBuilderInput = file("src/main/java/org/elasticsearch/compute/operator/lookup/X-EnrichResultBuilder.java.st")
template {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ private MethodSpec addIntermediateInput() {
declarationType,
requireVoidType(),
requireName("combineIntermediate"),
requireArgs(
requireArgsStartsWith(
Stream.concat(
Stream.of(aggState.declaredType()), // aggState
intermediateState.stream().map(IntermediateStateDesc::combineArgType) // intermediate state
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading