Source code for the quality check function JAR package

Updated at:

When you create a quality check function, you must first package the sample code in this topic into a JAR package. This topic provides the required sample source code.

Sample code

You can use a Java developer tool to generate a JAR package named `PhoneNumberChecker`.

package com.aliyun.odps.udf.examples;

import com.aliyun.odps.udf.UDF;


public class PhoneNumberChecker extends UDF {
    public Long evaluate(String number, String eleMetaStr) {
        long j = 0;

        if ((number == null) || number.trim().isEmpty()) {
            return 1L;
        }

        if (number.length() < 11) {
            return 1L;
        }

        if (number.length() < 11) {
            return 1L;
        }

        String substring = number.substring(number.length() - 11);

        if (substring.length() != 11) {
            return 1L;
        }

        return Long.valueOf(j);
    }

    public static void main(String[] args) {
        System.out.println(new PhoneNumberChecker().evaluate(args[0], null));
    }
}
Note

A Java developer tool is required.