Skip to content

Commit 27e6bfe

Browse files
committed
add system and nullable properties for all tokens, add nullValue for painless scripts, add input expr to all sql functions set by applying applyTo, add sql interval function to update out sql type, update painless script computation, implements coalesce and nullif logical functions, add fixes for parser, update sql types and validations
1 parent 32b78c1 commit 27e6bfe

File tree

15 files changed

+1228
-229
lines changed

15 files changed

+1228
-229
lines changed

es6/sql-bridge/src/test/scala/app/softnetwork/elastic/sql/SQLQuerySpec.scala

Lines changed: 293 additions & 38 deletions
Large diffs are not rendered by default.

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ import app.softnetwork.elastic.sql.{
1212
SQLExpression,
1313
SQLIn,
1414
SQLIsNotNull,
15-
SQLIsNull
15+
SQLIsNotNullCriteria,
16+
SQLIsNull,
17+
SQLIsNullCriteria
1618
}
1719
import com.sksamuel.elastic4s.ElasticApi._
1820
import com.sksamuel.elastic4s.requests.searches.queries.Query
@@ -69,6 +71,8 @@ case class ElasticQuery(filter: ElasticFilter) {
6971
case between: SQLBetween[Double] => between
7072
case geoDistance: ElasticGeoDistance => geoDistance
7173
case matchExpression: ElasticMatch => matchExpression
74+
case isNull: SQLIsNullCriteria => isNull
75+
case isNotNull: SQLIsNotNullCriteria => isNotNull
7276
case other =>
7377
throw new IllegalArgumentException(s"Unsupported filter type: ${other.getClass.getName}")
7478
}

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,20 @@ package object bridge {
341341
existsQuery(identifier.name)
342342
}
343343

344+
implicit def isNullCriteriaToQuery(
345+
isNull: SQLIsNullCriteria
346+
): Query = {
347+
import isNull._
348+
not(existsQuery(identifier.name))
349+
}
350+
351+
implicit def isNotNullCriteriaToQuery(
352+
isNotNull: SQLIsNotNullCriteria
353+
): Query = {
354+
import isNotNull._
355+
existsQuery(identifier.name)
356+
}
357+
344358
implicit def inToQuery[R, T <: SQLValue[R]](in: SQLIn[R, T]): Query = {
345359
import in._
346360
val _values: Seq[Any] = values.innerValues

0 commit comments

Comments
 (0)