Source:
public static void validate(Schema schema) { schema.validate(); Set<String> transformedColumns = new HashSet<>(); Set<String> argumentColumns = new HashSet<>(); Set<String> primaryKeyColumnCandidates = new HashSet<>(); for (FieldSpec fieldSpec : schema.getAllFieldSpecs()) { if (!fieldSpec.isVirtualColumn()) { String column = fieldSpec.getName(); String transformFunction = fieldSpec.getTransformFunction(); if (transformFunction != null) { try { List<String> arguments = FunctionEvaluatorFactory.getExpressionEvaluator(fieldSpec).getArguments(); Preconditions.checkState(!arguments.contains(column), "The arguments of transform function %s should not contain the destination column %s", transformFunction, column); transformedColumns.add(column); argumentColumns.addAll(arguments); } catch (Exception e) { throw new IllegalStateException( "Exception in getting arguments for transform function '" + transformFunction + "' for column '" + column + "'", e); } } else if (fieldSpec.getFieldType().equals(FieldSpec.FieldType.TIME) && fieldSpec.getFieldType() .equals(FieldSpec.FieldType.DATE_TIME)) { primaryKeyColumnCandidates.add(column); } if (fieldSpec.getFieldType().equals(FieldSpec.FieldType.TIME)) { validateTimeFieldSpec(fieldSpec); } if (fieldSpec.getFieldType().equals(FieldSpec.FieldType.DATE_TIME)) { validateDateTimeFieldSpec(fieldSpec); } } } Preconditions.checkState(Collections.disjoint(transformedColumns, argumentColumns), "Columns: %s are a result of transformations, and cannot be used as arguments to other transform functions", transformedColumns.retainAll(argumentColumns)); if (schema.getPrimaryKeyColumns() != null) { for (String primaryKeyColumn : schema.getPrimaryKeyColumns()) { Preconditions.checkState(primaryKeyColumnCandidates.contains(primaryKeyColumn), "The primary key column must exist and cannot be a time column"); } } }

Target:
public static void validate(Schema schema) { schema.validate(); Set<String> transformedColumns = new HashSet<>(); Set<String> argumentColumns = new HashSet<>(); Set<String> primaryKeyColumnCandidates = new HashSet<>(); for (FieldSpec fieldSpec : schema.getAllFieldSpecs()) { if (!fieldSpec.isVirtualColumn()) { String column = fieldSpec.getName(); primaryKeyColumnCandidates.add(column); String transformFunction = fieldSpec.getTransformFunction(); if (transformFunction != null) { try { List<String> arguments = FunctionEvaluatorFactory.getExpressionEvaluator(fieldSpec).getArguments(); Preconditions.checkState(!arguments.contains(column), "The arguments of transform function %s should not contain the destination column %s", transformFunction, column); transformedColumns.add(column); argumentColumns.addAll(arguments); } catch (Exception e) { throw new IllegalStateException( "Exception in getting arguments for transform function '" + transformFunction + "' for column '" + column + "'", e); } } if (fieldSpec.getFieldType().equals(FieldSpec.FieldType.TIME)) { validateTimeFieldSpec(fieldSpec); } if (fieldSpec.getFieldType().equals(FieldSpec.FieldType.DATE_TIME)) { validateDateTimeFieldSpec(fieldSpec); } } } Preconditions.checkState(Collections.disjoint(transformedColumns, argumentColumns), "Columns: %s are a result of transformations, and cannot be used as arguments to other transform functions", transformedColumns.retainAll(argumentColumns)); if (schema.getPrimaryKeyColumns() != null) { for (String primaryKeyColumn : schema.getPrimaryKeyColumns()) { Preconditions.checkState(primaryKeyColumnCandidates.contains(primaryKeyColumn), "The primary key column must exist"); } } }