use of io.reactivex.rxjava3.functions in project cassandra by apache.
the class SchemaKeyspace method createUDAFromRow.
private static UDAggregate createUDAFromRow(UntypedResultSet.Row row, Functions functions, Types types) {
String ksName = row.getString("keyspace_name");
String functionName = row.getString("aggregate_name");
FunctionName name = new FunctionName(ksName, functionName);
List<AbstractType<?>> argTypes = row.getFrozenList("argument_types", UTF8Type.instance).stream().map(t -> CQLTypeParser.parse(ksName, t, types)).collect(toList());
AbstractType<?> returnType = CQLTypeParser.parse(ksName, row.getString("return_type"), types);
FunctionName stateFunc = new FunctionName(ksName, (row.getString("state_func")));
FunctionName finalFunc = row.has("final_func") ? new FunctionName(ksName, row.getString("final_func")) : null;
AbstractType<?> stateType = row.has("state_type") ? CQLTypeParser.parse(ksName, row.getString("state_type"), types) : null;
ByteBuffer initcond = row.has("initcond") ? Terms.asBytes(ksName, row.getString("initcond"), stateType) : null;
try {
return UDAggregate.create(functions, name, argTypes, returnType, stateFunc, finalFunc, stateType, initcond);
} catch (InvalidRequestException reason) {
return UDAggregate.createBroken(name, argTypes, returnType, initcond, reason);
}
}
use of io.reactivex.rxjava3.functions in project cassandra by apache.
the class SchemaKeyspace method createUDAFromRow.
private static UDAggregate createUDAFromRow(UntypedResultSet.Row row, Collection<UDFunction> functions, Types types) {
String ksName = row.getString("keyspace_name");
String functionName = row.getString("aggregate_name");
FunctionName name = new FunctionName(ksName, functionName);
List<AbstractType<?>> argTypes = row.getFrozenList("argument_types", UTF8Type.instance).stream().map(t -> CQLTypeParser.parse(ksName, t, types)).collect(toList());
AbstractType<?> returnType = CQLTypeParser.parse(ksName, row.getString("return_type"), types);
FunctionName stateFunc = new FunctionName(ksName, (row.getString("state_func")));
FunctionName finalFunc = row.has("final_func") ? new FunctionName(ksName, row.getString("final_func")) : null;
AbstractType<?> stateType = row.has("state_type") ? CQLTypeParser.parse(ksName, row.getString("state_type"), types) : null;
ByteBuffer initcond = row.has("initcond") ? Terms.asBytes(ksName, row.getString("initcond"), stateType) : null;
return UDAggregate.create(functions, name, argTypes, returnType, stateFunc, finalFunc, stateType, initcond);
}
use of io.reactivex.rxjava3.functions in project jOOQ by jOOQ.
the class FirebirdDatabase method getRoutines0.
@Override
protected List<RoutineDefinition> getRoutines0() throws SQLException {
Rdb$procedures p = RDB$PROCEDURES.as("p");
Rdb$functions fu = RDB$FUNCTIONS.as("fu");
Rdb$functionArguments fa = RDB$FUNCTION_ARGUMENTS.as("fa");
Rdb$fields fi = RDB$FIELDS.as("fi");
return create().select(p.RDB$PROCEDURE_NAME.trim(), inline(null, VARCHAR).as("t"), inline(null, SMALLINT).as("p"), inline(null, SMALLINT).as("s")).from(p).where(p.RDB$PROCEDURE_TYPE.eq((short) 2)).union(is30() ? select(fu.RDB$FUNCTION_NAME.trim(), FIELD_TYPE(fi).as("t"), coalesce(CHARACTER_LENGTH(fi), fi.RDB$FIELD_PRECISION).as("p"), FIELD_SCALE(fi).as("s")).from(fu).leftAntiJoin(p).on(fu.RDB$FUNCTION_NAME.eq(p.RDB$PROCEDURE_NAME)).join(fa).on(fu.RDB$FUNCTION_NAME.eq(fa.RDB$FUNCTION_NAME)).leftOuterJoin(fi).on(fa.RDB$FIELD_SOURCE.eq(fi.RDB$FIELD_NAME)).where(fa.RDB$ARGUMENT_POSITION.eq(inline((short) 0))) : select(inline(""), inline(""), inline((short) 0), inline((short) 0)).where(falseCondition())).orderBy(1).collect(mapping(r -> new FirebirdRoutineDefinition(getSchemata().get(0), r.get(0, String.class), r.get(1, String.class), r.get(2, Integer.class), r.get(3, Integer.class)), Collectors.<RoutineDefinition>toList()));
}
use of io.reactivex.rxjava3.functions in project RxJava by ReactiveX.
the class NotificationLiteTest method errorNotification.
@Test
public void errorNotification() {
Object o = NotificationLite.error(new TestException());
assertEquals("NotificationLite.Error[io.reactivex.rxjava3.exceptions.TestException]", o.toString());
assertTrue(NotificationLite.isError(o));
assertFalse(NotificationLite.isComplete(o));
assertFalse(NotificationLite.isDisposable(o));
assertFalse(NotificationLite.isSubscription(o));
assertTrue(NotificationLite.getError(o) instanceof TestException);
}
use of io.reactivex.rxjava3.functions in project RxJava by ReactiveX.
the class ObservableDematerializeTest method dematerialize3.
@Test
public void dematerialize3() {
Exception exception = new Exception("test");
Observable<Integer> o = Observable.error(exception);
Observable<Integer> dematerialize = o.materialize().dematerialize(Functions.<Notification<Integer>>identity());
Observer<Integer> observer = TestHelper.mockObserver();
dematerialize.subscribe(observer);
verify(observer, times(1)).onError(exception);
verify(observer, times(0)).onComplete();
verify(observer, times(0)).onNext(any(Integer.class));
}
Aggregations