@Test public void testModuloTransformFunction() { ExpressionContext expression = QueryContextConverterUtils.getExpression(String.format("mod(%s,%s)", INT_SV_COLUMN, LONG_SV_COLUMN)); TransformFunction transformFunction = TransformFunctionFactory.get(expression, _dataSourceMap); Assert.assertTrue(transformFunction instanceof ModuloTransformFunction); Assert.assertEquals(transformFunction.getName(), ModuloTransformFunction.FUNCTION_NAME); double[] expectedValues = new double[NUM_ROWS]; for (int i = 0; i < NUM_ROWS; i++) { expectedValues[i] = (double) _intSVValues[i] % (double) _longSVValues[i]; } testTransformFunction(transformFunction, expectedValues); expression = QueryContextConverterUtils.getExpression(String.format("mod(%s,%s)", LONG_SV_COLUMN, FLOAT_SV_COLUMN)); transformFunction = TransformFunctionFactory.get(expression, _dataSourceMap); Assert.assertTrue(transformFunction instanceof ModuloTransformFunction); for (int i = 0; i < NUM_ROWS; i++) { expectedValues[i] = (double) _longSVValues[i] % (double) _floatSVValues[i]; } testTransformFunction(transformFunction, expectedValues); expression = QueryContextConverterUtils.getExpression(String.format("mod(%s,%s)", FLOAT_SV_COLUMN, DOUBLE_SV_COLUMN)); transformFunction = TransformFunctionFactory.get(expression, _dataSourceMap); Assert.assertTrue(transformFunction instanceof ModuloTransformFunction); for (int i = 0; i < NUM_ROWS; i++) { expectedValues[i] = (double) _floatSVValues[i] % _doubleSVValues[i]; } testTransformFunction(transformFunction, expectedValues); expression = QueryContextConverterUtils.getExpression(String.format("mod(%s,%s)", DOUBLE_SV_COLUMN, STRING_SV_COLUMN)); transformFunction = TransformFunctionFactory.get(expression, _dataSourceMap); Assert.assertTrue(transformFunction instanceof ModuloTransformFunction); for (int i = 0; i < NUM_ROWS; i++) { expectedValues[i] = _doubleSVValues[i] % Double.parseDouble(_stringSVValues[i]); } testTransformFunction(transformFunction, expectedValues); expression = QueryContextConverterUtils.getExpression(String.format("mod(%s,%s)", STRING_SV_COLUMN, INT_SV_COLUMN)); transformFunction = TransformFunctionFactory.get(expression, _dataSourceMap); Assert.assertTrue(transformFunction instanceof ModuloTransformFunction); for (int i = 0; i < NUM_ROWS; i++) { expectedValues[i] = Double.parseDouble(_stringSVValues[i]) % (double) _intSVValues[i]; } testTransformFunction(transformFunction, expectedValues); expression = QueryContextConverterUtils.getExpression(String .format("mod(mod(mod(mod(mod(12,%s),%s),mod(mod(%s,%s),0.34)),%s),%s)", STRING_SV_COLUMN, DOUBLE_SV_COLUMN, FLOAT_SV_COLUMN, LONG_SV_COLUMN, INT_SV_COLUMN, DOUBLE_SV_COLUMN)); transformFunction = TransformFunctionFactory.get(expression, _dataSourceMap); Assert.assertTrue(transformFunction instanceof ModuloTransformFunction); for (int i = 0; i < NUM_ROWS; i++) { expectedValues[i] = (((((12d % Double.parseDouble(_stringSVValues[i])) % _doubleSVValues[i]) % ( ((double) _floatSVValues[i] % (double) _longSVValues[i]) % 0.34)) % (double) _intSVValues[i]) % _doubleSVValues[i]); } testTransformFunction(transformFunction, expectedValues); }
@Override public String getName() { return FUNCTION_NAME; }
ModuloTransformFunction extends BaseTransformFunction { @Override public String getName() { return FUNCTION_NAME; } }
ModuloTransformFunction extends BaseTransformFunction { @Override public String getName() { return FUNCTION_NAME; }  }
ModuloTransformFunction extends BaseTransformFunction { @Override public String getName() { return FUNCTION_NAME; }  @Override String getName(); @Override void init(List<TransformFunction> arguments, Map<String, DataSource> dataSourceMap); @Override TransformResultMetadata getResultMetadata(); @SuppressWarnings("Duplicates") @Override double[] transformToDoubleValuesSV(ProjectionBlock projectionBlock); }
ModuloTransformFunction extends BaseTransformFunction { @Override public String getName() { return FUNCTION_NAME; }  @Override String getName(); @Override void init(List<TransformFunction> arguments, Map<String, DataSource> dataSourceMap); @Override TransformResultMetadata getResultMetadata(); @SuppressWarnings("Duplicates") @Override double[] transformToDoubleValuesSV(ProjectionBlock projectionBlock); static final String FUNCTION_NAME; }