public static CompareFunctionsProcessor createFunctionsProcessorInstance(FunctionCall call, boolean nullComparatorSupported) { String functionName = call.getName(); CompareFunctionsProcessor evaluator = new CompareFunctionsProcessor(functionName); return createFunctionsProcessorInstanceInternal(call, nullComparatorSupported, evaluator); }
public static MaprDBCompareFunctionsProcessor createFunctionsProcessorInstance(FunctionCall call, boolean nullComparatorSupported) { String functionName = call.getName(); MaprDBCompareFunctionsProcessor evaluator = new MaprDBCompareFunctionsProcessor(functionName); return createFunctionsProcessorInstanceInternal(call, nullComparatorSupported, evaluator); }
/** * Converts specified function call to be pushed into maprDB JSON scan. * * @param call function call to be pushed * @return CompareFunctionsProcessor instance which contains converted function call */ public static CompareFunctionsProcessor process(FunctionCall call) { return processWithEvaluator(call, new CompareFunctionsProcessor(call.getName())); }
@Override public Void visitFunctionCall(FunctionCall call, StringBuilder sb) throws RuntimeException { ImmutableList<LogicalExpression> args = call.args; sb.append(call.getName()); sb.append("("); for (int i = 0; i < args.size(); i++) { if (i != 0) { sb.append(", "); } args.get(i).accept(this, sb); } sb.append(") "); return null; }
@Override public Boolean visitFunctionCall(FunctionCall call, LogicalExpression valueArg) { Matcher matcher = convertFromPattern.matcher(call.getName()); if (matcher.find()) { // convert function call to ConvertExpression ConvertExpression convert = new ConvertExpression(ConvertExpression.CONVERT_FROM, matcher.group(1), call.args.get(0), call.getPosition()); return visitConvertExpression(convert, valueArg); } return false; }
/** * Converts specified function call to be pushed into maprDB JSON scan. * For the case when timestamp value is used, it is converted to UTC timezone * before converting to {@link OTimestamp} instance. * * @param call function call to be pushed * @return CompareFunctionsProcessor instance which contains converted function call */ public static CompareFunctionsProcessor processWithTimeZoneOffset(FunctionCall call) { CompareFunctionsProcessor processor = new CompareFunctionsProcessor(call.getName()) { @Override protected boolean visitTimestampExpr(SchemaPath path, TimeStampExpression valueArg) { // converts timestamp value from local time zone to UTC since the record reader // reads the timestamp in local timezone if the readTimestampWithZoneOffset flag is enabled long timeStamp = valueArg.getTimeStamp() - DateUtility.TIMEZONE_OFFSET_MILLIS; this.value = KeyValueBuilder.initFrom(new OTimestamp(timeStamp)); this.path = path; return true; } }; return processWithEvaluator(call, processor); }
private static CompareFunctionsProcessor processWithEvaluator(FunctionCall call, CompareFunctionsProcessor evaluator) { String functionName = call.getName(); LogicalExpression nameArg = call.args.get(0); LogicalExpression valueArg = call.args.size() >= 2 ? call.args.get(1) : null; if (valueArg != null) { if (VALUE_EXPRESSION_CLASSES.contains(nameArg.getClass())) { LogicalExpression swapArg = valueArg; valueArg = nameArg; nameArg = swapArg; evaluator.functionName = COMPARE_FUNCTIONS_TRANSPOSE_MAP.get(functionName); } evaluator.success = nameArg.accept(evaluator, valueArg); } return evaluator; }
public static KafkaNodeProcessor process(FunctionCall call) { String functionName = call.getName(); LogicalExpression nameArg = call.args.get(0); LogicalExpression valueArg = call.args.size() >= 2? call.args.get(1) : null; KafkaNodeProcessor evaluator = new KafkaNodeProcessor(functionName); if (VALUE_EXPRESSION_CLASSES.contains(nameArg.getClass())) { LogicalExpression swapArg = valueArg; valueArg = nameArg; nameArg = swapArg; evaluator.functionName = COMPARE_FUNCTIONS_TRANSPOSE_MAP.get(functionName); } evaluator.success = nameArg.accept(evaluator, valueArg); return evaluator; }
@Override public HBaseScanSpec visitFunctionCall(FunctionCall call, Void value) throws RuntimeException { HBaseScanSpec nodeScanSpec = null; String functionName = call.getName(); ImmutableList<LogicalExpression> args = call.args;
@Override public HBaseScanSpec visitFunctionCall(FunctionCall call, Void value) throws RuntimeException { HBaseScanSpec nodeScanSpec = null; String functionName = call.getName(); ImmutableList<LogicalExpression> args = call.args;
String functionName = call.getName(); if (!functionName.equalsIgnoreCase("byte_substr")) { return false;
@Override public List<KafkaPartitionScanSpec> visitFunctionCall(FunctionCall call, Void value) throws RuntimeException { String functionName = call.getName(); if(KafkaNodeProcessor.isPushdownFunction(functionName)) { KafkaNodeProcessor kafkaNodeProcessor = KafkaNodeProcessor.process(call); if(kafkaNodeProcessor.isSuccess()) { switch (kafkaNodeProcessor.getPath()) { case "kafkaMsgTimestamp": return createScanSpecForTimestamp(kafkaNodeProcessor.getFunctionName(), kafkaNodeProcessor.getValue()); case "kafkaMsgOffset": return createScanSpecForOffset(kafkaNodeProcessor.getFunctionName(), kafkaNodeProcessor.getValue()); case "kafkaPartitionId": return createScanSpecForPartition(kafkaNodeProcessor.getFunctionName(), kafkaNodeProcessor.getValue()); } } } return null; //Return null, do not pushdown }
@Override public Void visitFunctionCall(FunctionCall call, Void v) throws RuntimeException { final String functionName = call.getName(); final String fieldName = FieldPathHelper.schemaPath2FieldPath(getSchemaPathArg(call.args.get(0))).asPathString(); switch(functionName) {
@Override public JsonScanSpec visitFunctionCall(FunctionCall call, Void value) throws RuntimeException { JsonScanSpec nodeScanSpec = null; String functionName = call.getName(); ImmutableList<LogicalExpression> args = call.args;
@Override public Boolean visitFunctionCall(FunctionCall call, LogicalExpression value) throws RuntimeException { if (!(value instanceof FunctionCall)) { return false; } if (!checkType(call, value)) { return false; } if (!call.getName().equals(((FunctionCall) value).getName())) { return false; } return checkChildren(call, value); }
public static MaprDBCompareFunctionsProcessor createFunctionsProcessorInstance(FunctionCall call, boolean nullComparatorSupported) { String functionName = call.getName(); MaprDBCompareFunctionsProcessor evaluator = new MaprDBCompareFunctionsProcessor(functionName); return createFunctionsProcessorInstanceInternal(call, nullComparatorSupported, evaluator); }
public static CompareFunctionsProcessor createFunctionsProcessorInstance(FunctionCall call, boolean nullComparatorSupported) { String functionName = call.getName(); CompareFunctionsProcessor evaluator = new CompareFunctionsProcessor(functionName); return createFunctionsProcessorInstanceInternal(call, nullComparatorSupported, evaluator); }
@Override public Boolean visitFunctionCall(FunctionCall call, LogicalExpression valueArg) { Matcher matcher = convertFromPattern.matcher(call.getName()); if (matcher.find()) { // convert function call to ConvertExpression ConvertExpression convert = new ConvertExpression(ConvertExpression.CONVERT_FROM, matcher.group(1), call.args.get(0), call.getPosition()); return visitConvertExpression(convert, valueArg); } return false; }
@Override public LogicalExpression visitFunctionCall(FunctionCall call, Void value) throws RuntimeException { List<LogicalExpression> args = Lists.newArrayList(); for (LogicalExpression arg : call.args) { args.add(arg.accept(this, null)); } return new FunctionCall(call.getName(), args, call.getPosition()); }