@Test public void testStringPadTransformFunction() { int padLength = 50; String padString = "#"; ExpressionContext expression = QueryContextConverterUtils .getExpression(String.format("lpad(%s, %d, '%s')", STRING_ALPHANUM_SV_COLUMN, padLength, padString)); TransformFunction transformFunction = TransformFunctionFactory.get(expression, _dataSourceMap); Assert.assertTrue(transformFunction instanceof ScalarTransformFunctionWrapper); Assert.assertEquals(transformFunction.getName(), "lpad"); String[] expectedValues = new String[NUM_ROWS]; for (int i = 0; i < NUM_ROWS; i++) { expectedValues[i] = StringUtils.leftPad(_stringAlphaNumericSVValues[i], padLength, padString); } testTransformFunction(transformFunction, expectedValues); expression = QueryContextConverterUtils .getExpression(String.format("rpad(%s, %d, '%s')", STRING_ALPHANUM_SV_COLUMN, padLength, padString)); transformFunction = TransformFunctionFactory.get(expression, _dataSourceMap); Assert.assertTrue(transformFunction instanceof ScalarTransformFunctionWrapper); Assert.assertEquals(transformFunction.getName(), "rpad"); expectedValues = new String[NUM_ROWS]; for (int i = 0; i < NUM_ROWS; i++) { expectedValues[i] = StringUtils.rightPad(_stringAlphaNumericSVValues[i], padLength, padString); } testTransformFunction(transformFunction, expectedValues); }
@Override public String getName() { return _name; }
ScalarTransformFunctionWrapper extends BaseTransformFunction { @Override public String getName() { return _name; } }
ScalarTransformFunctionWrapper extends BaseTransformFunction { @Override public String getName() { return _name; } ScalarTransformFunctionWrapper(FunctionInfo functionInfo); }
ScalarTransformFunctionWrapper extends BaseTransformFunction { @Override public String getName() { return _name; } ScalarTransformFunctionWrapper(FunctionInfo functionInfo); @Override String getName(); @Override void init(List<TransformFunction> arguments, Map<String, DataSource> dataSourceMap); @Override TransformResultMetadata getResultMetadata(); @Override int[] transformToIntValuesSV(ProjectionBlock projectionBlock); @Override long[] transformToLongValuesSV(ProjectionBlock projectionBlock); @Override float[] transformToFloatValuesSV(ProjectionBlock projectionBlock); @Override double[] transformToDoubleValuesSV(ProjectionBlock projectionBlock); @Override String[] transformToStringValuesSV(ProjectionBlock projectionBlock); @Override byte[][] transformToBytesValuesSV(ProjectionBlock projectionBlock); }
ScalarTransformFunctionWrapper extends BaseTransformFunction { @Override public String getName() { return _name; } ScalarTransformFunctionWrapper(FunctionInfo functionInfo); @Override String getName(); @Override void init(List<TransformFunction> arguments, Map<String, DataSource> dataSourceMap); @Override TransformResultMetadata getResultMetadata(); @Override int[] transformToIntValuesSV(ProjectionBlock projectionBlock); @Override long[] transformToLongValuesSV(ProjectionBlock projectionBlock); @Override float[] transformToFloatValuesSV(ProjectionBlock projectionBlock); @Override double[] transformToDoubleValuesSV(ProjectionBlock projectionBlock); @Override String[] transformToStringValuesSV(ProjectionBlock projectionBlock); @Override byte[][] transformToBytesValuesSV(ProjectionBlock projectionBlock);  }