Esempio n. 1
0
    /*
     * validate and setup patternStr
     */
    private void validateAndSetupPatternStr(MatchPath evaluator, List<PTFExpressionDef> args)
        throws SemanticException {
      PTFExpressionDef symboPatternArg = args.get(0);
      ObjectInspector symbolPatternArgOI = symboPatternArg.getOI();

      if (!ObjectInspectorUtils.isConstantObjectInspector(symbolPatternArgOI)
          || (symbolPatternArgOI.getCategory() != ObjectInspector.Category.PRIMITIVE)
          || ((PrimitiveObjectInspector) symbolPatternArgOI).getPrimitiveCategory()
              != PrimitiveObjectInspector.PrimitiveCategory.STRING) {
        throwErrorWithSignature("Currently the symbol Pattern must be a Constant String.");
      }

      evaluator.patternStr =
          ((ConstantObjectInspector) symbolPatternArgOI).getWritableConstantValue().toString();
    }