File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed
bridge/src/main/scala/app/softnetwork/elastic/sql/bridge
es6/bridge/src/main/scala/app/softnetwork/elastic/sql/bridge
sql/src/main/scala/app/softnetwork/elastic/sql/function Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -159,7 +159,14 @@ object ElasticAggregation {
159159 val script = Script (s " $context$scriptSrc" ).lang(" painless" )
160160 buildScript(aggName, script)
161161 } else {
162- buildField(aggName, sourceField)
162+ aggType match {
163+ case th : WindowFunction if th.shouldBeScripted =>
164+ val context = PainlessContext ()
165+ val scriptSrc = th.identifier.painless(Some (context))
166+ val script = Script (s " $context$scriptSrc" ).lang(" painless" )
167+ buildScript(aggName, script)
168+ case _ => buildField(aggName, sourceField)
169+ }
163170 }
164171 }
165172
Original file line number Diff line number Diff line change @@ -159,7 +159,14 @@ object ElasticAggregation {
159159 val script = Script (s " $context$scriptSrc" ).lang(" painless" )
160160 buildScript(aggName, script)
161161 } else {
162- buildField(aggName, sourceField)
162+ aggType match {
163+ case th : WindowFunction if th.shouldBeScripted =>
164+ val context = PainlessContext ()
165+ val scriptSrc = th.identifier.painless(Some (context))
166+ val script = Script (s " $context$scriptSrc" ).lang(" painless" )
167+ buildScript(aggName, script)
168+ case _ => buildField(aggName, sourceField)
169+ }
163170 }
164171 }
165172
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ package object function {
3737
3838 trait FunctionWithIdentifier extends Function {
3939 def identifier : Identifier
40+
41+ override def shouldBeScripted : Boolean = identifier.shouldBeScripted
4042 }
4143
4244 trait FunctionWithValue [+ T ] extends Function with TokenValue {
You can’t perform that action at this time.
0 commit comments