@Test public void testRightNaNDate() throws SqlException { FunctionFactory factory = getFunctionFactory(); ObjList<Function> args = new ObjList<>(); args.add(new DateConstant(1, 10000L)); args.add(new DoubleConstant(2, Double.NaN)); Function function = factory.newInstance(args, 4, configuration); Assert.assertFalse(function.getBool(null)); }
@Override public Function newInstance(ObjList<Function> args, int position, CairoConfiguration configuration) { Function left = args.getQuick(0); Function right = args.getQuick(1); if (left.isConstant() && left.getType() == ColumnType.DOUBLE && Double.isNaN(left.getDouble(null))) { switch (right.getType()) { case ColumnType.INT: return new FuncIntIsNaN(position, right, isNegated); case ColumnType.LONG: return new FuncLongIsNaN(position, right, isNegated); case ColumnType.DATE: return new FuncDateIsNaN(position, right, isNegated); case ColumnType.TIMESTAMP: return new FuncTimestampIsNaN(position, right, isNegated); case ColumnType.FLOAT: return new FuncFloatIsNaN(position, right, isNegated); default: return new FuncDoubleIsNaN(position, right, isNegated); } } else if (right.isConstant() && right.getType() == ColumnType.DOUBLE && Double.isNaN(right.getDouble(null))) { switch (left.getType()) { case ColumnType.INT: return new FuncIntIsNaN(position, left, isNegated); case ColumnType.LONG: return new FuncLongIsNaN(position, left, isNegated); case ColumnType.DATE: return new FuncDateIsNaN(position, left, isNegated); case ColumnType.TIMESTAMP: return new FuncTimestampIsNaN(position, left, isNegated); case ColumnType.FLOAT: return new FuncFloatIsNaN(position, left, isNegated); default: return new FuncDoubleIsNaN(position, left, isNegated); } } return new Func(position, args.getQuick(0), args.getQuick(1), isNegated); }
EqDoubleFunctionFactory extends AbstractBooleanFunctionFactory implements FunctionFactory { @Override public Function newInstance(ObjList<Function> args, int position, CairoConfiguration configuration) { Function left = args.getQuick(0); Function right = args.getQuick(1); if (left.isConstant() && left.getType() == ColumnType.DOUBLE && Double.isNaN(left.getDouble(null))) { switch (right.getType()) { case ColumnType.INT: return new FuncIntIsNaN(position, right, isNegated); case ColumnType.LONG: return new FuncLongIsNaN(position, right, isNegated); case ColumnType.DATE: return new FuncDateIsNaN(position, right, isNegated); case ColumnType.TIMESTAMP: return new FuncTimestampIsNaN(position, right, isNegated); case ColumnType.FLOAT: return new FuncFloatIsNaN(position, right, isNegated); default: return new FuncDoubleIsNaN(position, right, isNegated); } } else if (right.isConstant() && right.getType() == ColumnType.DOUBLE && Double.isNaN(right.getDouble(null))) { switch (left.getType()) { case ColumnType.INT: return new FuncIntIsNaN(position, left, isNegated); case ColumnType.LONG: return new FuncLongIsNaN(position, left, isNegated); case ColumnType.DATE: return new FuncDateIsNaN(position, left, isNegated); case ColumnType.TIMESTAMP: return new FuncTimestampIsNaN(position, left, isNegated); case ColumnType.FLOAT: return new FuncFloatIsNaN(position, left, isNegated); default: return new FuncDoubleIsNaN(position, left, isNegated); } } return new Func(position, args.getQuick(0), args.getQuick(1), isNegated); } }
EqDoubleFunctionFactory extends AbstractBooleanFunctionFactory implements FunctionFactory { @Override public Function newInstance(ObjList<Function> args, int position, CairoConfiguration configuration) { Function left = args.getQuick(0); Function right = args.getQuick(1); if (left.isConstant() && left.getType() == ColumnType.DOUBLE && Double.isNaN(left.getDouble(null))) { switch (right.getType()) { case ColumnType.INT: return new FuncIntIsNaN(position, right, isNegated); case ColumnType.LONG: return new FuncLongIsNaN(position, right, isNegated); case ColumnType.DATE: return new FuncDateIsNaN(position, right, isNegated); case ColumnType.TIMESTAMP: return new FuncTimestampIsNaN(position, right, isNegated); case ColumnType.FLOAT: return new FuncFloatIsNaN(position, right, isNegated); default: return new FuncDoubleIsNaN(position, right, isNegated); } } else if (right.isConstant() && right.getType() == ColumnType.DOUBLE && Double.isNaN(right.getDouble(null))) { switch (left.getType()) { case ColumnType.INT: return new FuncIntIsNaN(position, left, isNegated); case ColumnType.LONG: return new FuncLongIsNaN(position, left, isNegated); case ColumnType.DATE: return new FuncDateIsNaN(position, left, isNegated); case ColumnType.TIMESTAMP: return new FuncTimestampIsNaN(position, left, isNegated); case ColumnType.FLOAT: return new FuncFloatIsNaN(position, left, isNegated); default: return new FuncDoubleIsNaN(position, left, isNegated); } } return new Func(position, args.getQuick(0), args.getQuick(1), isNegated); }  }
EqDoubleFunctionFactory extends AbstractBooleanFunctionFactory implements FunctionFactory { @Override public Function newInstance(ObjList<Function> args, int position, CairoConfiguration configuration) { Function left = args.getQuick(0); Function right = args.getQuick(1); if (left.isConstant() && left.getType() == ColumnType.DOUBLE && Double.isNaN(left.getDouble(null))) { switch (right.getType()) { case ColumnType.INT: return new FuncIntIsNaN(position, right, isNegated); case ColumnType.LONG: return new FuncLongIsNaN(position, right, isNegated); case ColumnType.DATE: return new FuncDateIsNaN(position, right, isNegated); case ColumnType.TIMESTAMP: return new FuncTimestampIsNaN(position, right, isNegated); case ColumnType.FLOAT: return new FuncFloatIsNaN(position, right, isNegated); default: return new FuncDoubleIsNaN(position, right, isNegated); } } else if (right.isConstant() && right.getType() == ColumnType.DOUBLE && Double.isNaN(right.getDouble(null))) { switch (left.getType()) { case ColumnType.INT: return new FuncIntIsNaN(position, left, isNegated); case ColumnType.LONG: return new FuncLongIsNaN(position, left, isNegated); case ColumnType.DATE: return new FuncDateIsNaN(position, left, isNegated); case ColumnType.TIMESTAMP: return new FuncTimestampIsNaN(position, left, isNegated); case ColumnType.FLOAT: return new FuncFloatIsNaN(position, left, isNegated); default: return new FuncDoubleIsNaN(position, left, isNegated); } } return new Func(position, args.getQuick(0), args.getQuick(1), isNegated); }  @Override String getSignature(); @Override Function newInstance(ObjList<Function> args, int position, CairoConfiguration configuration); }
EqDoubleFunctionFactory extends AbstractBooleanFunctionFactory implements FunctionFactory { @Override public Function newInstance(ObjList<Function> args, int position, CairoConfiguration configuration) { Function left = args.getQuick(0); Function right = args.getQuick(1); if (left.isConstant() && left.getType() == ColumnType.DOUBLE && Double.isNaN(left.getDouble(null))) { switch (right.getType()) { case ColumnType.INT: return new FuncIntIsNaN(position, right, isNegated); case ColumnType.LONG: return new FuncLongIsNaN(position, right, isNegated); case ColumnType.DATE: return new FuncDateIsNaN(position, right, isNegated); case ColumnType.TIMESTAMP: return new FuncTimestampIsNaN(position, right, isNegated); case ColumnType.FLOAT: return new FuncFloatIsNaN(position, right, isNegated); default: return new FuncDoubleIsNaN(position, right, isNegated); } } else if (right.isConstant() && right.getType() == ColumnType.DOUBLE && Double.isNaN(right.getDouble(null))) { switch (left.getType()) { case ColumnType.INT: return new FuncIntIsNaN(position, left, isNegated); case ColumnType.LONG: return new FuncLongIsNaN(position, left, isNegated); case ColumnType.DATE: return new FuncDateIsNaN(position, left, isNegated); case ColumnType.TIMESTAMP: return new FuncTimestampIsNaN(position, left, isNegated); case ColumnType.FLOAT: return new FuncFloatIsNaN(position, left, isNegated); default: return new FuncDoubleIsNaN(position, left, isNegated); } } return new Func(position, args.getQuick(0), args.getQuick(1), isNegated); }  @Override String getSignature(); @Override Function newInstance(ObjList<Function> args, int position, CairoConfiguration configuration);  }