Java DSL for Specifying Filter Conditions
When loading data from HPE Ezmeral Data Fabric Database as an Apache Spark RDD, you can use Java DSL to specify filter conditions. This section shows examples of these filter conditions.
Condition | Example |
---|---|
equality |
|
greatherThan |
|
notexists |
|
IN |
|
typeof |
|
complex condition with and |
|
another complex condition |
|
The HPE Ezmeral Data Fabric Database OJAI Connector for Apache Spark supports these predicates:
is (LESS, LESS_OR_EQUAL, EQUAL, NOT_EQUAL, GREATER_OR_EQUAL, GREATER)
equals
and
exists
in
like
matches
notEquals
notExists
notIn
notLike
notMatches
notTypeOf
or
sizeOf
typeOf
Here are examples for these operators:
MapRDB.newCondition().is("a", QueryCondition.Op.GREATER, 10);
MapRDB.newCondition().is("a",QueryCondition.Op.GREATER_OR_EQUAL, 10);
MapRDB.newCondition().is("a", QueryCondition.Op.LESS, 10);
MapRDB.newCondition().is("a", QueryCondition.Op.LESS_OR_EQUAL, 10);
MapRDB.newCondition().is("a", QueryCondition.Op.EQUAL, 10);
MapRDB.newCondition().is("a", QueryCondition.Op.NOT_EQUAL, 10);
MapRDB.newCondition().exists("a");
MapRDB.newCondition().notIn("a", Arrays.asList(10, 20));
MapRDB.newCondition().in("a", Arrays.asList(10, 20));
MapRDB.newCondition().notExists("a");
MapRDB.newCondition().typeOf("a", Value.Type.INT);
MapRDB.newCondition().notTypeOf("a", Value.Type.INT);
MapRDB.newCondition().like("a", "%s");
MapRDB.newCondition().notLike("a", "%s");
MapRDB.newCondition().matches("a", "*s");
MapRDB.newCondition().notMatches("a", "*s");
For typeof
, these are the right-hand side values:
"INT"
"INTEGER"
"LONG"
"BOOLEAN"
"STRING"
"SHORT"
"BYTE"
"NULL"
"FLOAT"
"DOUBLE"
"DECIMAL"
"DATE"
"TIME"
"TIMESTAMP"
"INTERVAL"
"BINARY"
"MAP"
"ARRAY"
The sizeOf
operator can have the following operations:
MapRDB.newCondition().sizeOf("a", QueryCondition.Op.EQUAL, 10);
MapRDB.newCondition().sizeOf("a", QueryCondition.Op.LESS, 10);
MapRDB.newCondition().sizeOf("a", QueryCondition.Op.GREATER, 10);
MapRDB.newCondition().sizeOf("a", QueryCondition.Op.LESS_OR_EQUAL, 10);
MapRDB.newCondition().sizeOf("a", QueryCondition.Op.GREATER_OR_EQUAL, 10);
MapRDB.newCondition().sizeOf("a", QueryCondition.Op.NOT_EQUAL, 10);