Get source.schema within a {@link InputType#RECORD} type.
The source.schema is represented by a {@link JsonArray}
@return
4799
public JsonArray getDataTypeValues() {
    if (this.type.equals(RECORD)) {
      return getDataType().get(RECORD_FIELDS_KEY).getAsJsonArray();
    }
    return new JsonArray();
  }
1261461
private synchronized Schema getInputPathAvroSchema() throws IOException {
        if (inputPathAvroSchema == null) {
            // No need to query Hadoop more than once as this shouldn't change mid-run,
            // thus, we can lazily initialize and cache the result.
            inputPathAvroSchema = AvroUtils.getAvroSchemaFromPath(getInputPath());
        }
        return inputPathAvroSchema;
    }
666194
public JsonNode getRefSchemaNode(String ref) {
        JsonSchema schema = findAncestor();
        JsonNode node = schema.getSchemaNode();

        if (ref.startsWith("#/")) {
            // handle local ref
            String[] keys = ref.substring(2).split("/");
            for (String key : keys) {
                try {
                    key = URLDecoder.decode(key, "utf-8");
                } catch (UnsupportedEncodingException e) {
                }
                Matcher matcher = intPattern.matcher(key);
                if (matcher.matches()) {
                    node = node.get(Integer.parseInt(key));
                } else {
                    node = node.get(key);
                }
                if (node == null){
                    JsonSchema subSchema = schema.fetchSubSchemaNode(validationContext);
                    if (subSchema != null) {
                        node = subSchema.getRefSchemaNode(ref);
                    }
                }
                if (node == null){
                    break;
                }
            }
        }
        return node;
    }
463646
public static List<FieldMetadata> getFieldMetadata(Schema schema) {
    List<Field> superclassFields = Arrays.asList(Weaver.getWovenFields(schema.getClass().getSuperclass()));

    List<FieldMetadata> fields = new ArrayList<>();
    // Fields up to but not including Schema
    for (Field field : Weaver.getWovenFields(schema.getClass())) {
      FieldMetadata fmd = FieldMetadata.createIfApiAnnotation(schema, field, superclassFields);
      if (null != fmd) // skip transient or other non-annotated fields
        fields.add(fmd);  // NOTE: we include non-JSON fields here; remove them later if we don't want them
    }
    return fields;
  }
906279
final public JSType Schema() throws ParseException {
  List defs = new ArrayList();
  Map refs = new HashMap();
  JSType top, one;
    top = TypeDecl(refs);
    label_1:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 1:
        ;
        break;
      default:
        jj_la1[0] = jj_gen;
        break label_1;
      }
      jj_consume_token(1);
      one = TypeDecl(refs);
                                                  defs.add(one);
    }
    reconcile(top, defs, refs);
    {if (true) return top;}
    throw new Error("Missing return statement in function");
  }
620377
Schema schema() {
    if (schema == null) {
      synchronized (this) {
        if (schema == null) {
          schema = new Schema(datasource, context, strictTraceId);
        }
      }
    }
    return schema;
  }
1312423
private JsonObject parse(JsonObject record, JsonSchema schema)
      throws DataConversionException {
      JsonObject output = new JsonObject();
      for (int i = 0; i < schema.fieldsCount(); i++) {
        JsonSchema schemaElement = schema.getFieldSchemaAt(i);
        String columnKey = schemaElement.getColumnName();
        JsonElement parsed;
        if (!record.has(columnKey)) {
          output.add(columnKey, JsonNull.INSTANCE);
          continue;
        }

        JsonElement columnValue = record.get(columnKey);
        switch (schemaElement.getType()) {
          case UNION:
            parsed = parseUnionType(schemaElement, columnValue);
            break;
          case ENUM:
            parsed = parseEnumType(schemaElement, columnValue);
            break;
          default:
            if (columnValue.isJsonArray()) {
              parsed = parseJsonArrayType(schemaElement, columnValue);
            } else if (columnValue.isJsonObject()) {
              parsed = parseJsonObjectType(schemaElement, columnValue);
            } else {
              parsed = parsePrimitiveType(schemaElement, columnValue);
            }
        }
        output.add(columnKey, parsed);
      }
      return output;
  }
457281
public static List<Writable> toRecord(Schema schema, List<Object> source){
        final List<Writable> record = new ArrayList<>(source.size());
        final List<ColumnMetaData> columnMetaData = schema.getColumnMetaData();

        if(columnMetaData.size() != source.size()){
            throw new IllegalArgumentException("Schema and source list don't have the same length!");
        }

        for (int i = 0; i < columnMetaData.size(); i++) {
            final ColumnMetaData metaData = columnMetaData.get(i);
            final Object data = source.get(i);
            if(!metaData.isValid(data)){
                throw new IllegalArgumentException("Element "+i+": "+data+" is not valid for Column \""+metaData.getName()+"\" ("+metaData.getColumnType()+")");
            }

            try {
                final Writable writable;
                switch (metaData.getColumnType().getWritableType()){
                    case Float:
                        writable = new FloatWritable((Float) data);
                        break;
                    case Double:
                        writable = new DoubleWritable((Double) data);
                        break;
                    case Int:
                        writable = new IntWritable((Integer) data);
                        break;
                    case Byte:
                        writable = new ByteWritable((Byte) data);
                        break;
                    case Boolean:
                        writable = new BooleanWritable((Boolean) data);
                        break;
                    case Long:
                        writable = new LongWritable((Long) data);
                        break;
                    case Null:
                        writable = new NullWritable();
                        break;
                    case Bytes:
                        writable = new BytesWritable((byte[]) data);
                        break;
                    case NDArray:
                        writable = new NDArrayWritable((INDArray) data);
                        break;
                    case Text:
                        if(data instanceof String)
                            writable = new Text((String) data);
                        else if(data instanceof Text)
                            writable = new Text((Text) data);
                        else if(data instanceof byte[])
                            writable = new Text((byte[]) data);
                        else
                            throw new IllegalArgumentException("Element "+i+": "+data+" is not usable for Column \""+metaData.getName()+"\" ("+metaData.getColumnType()+")");
                        break;
                    default:
                        throw new IllegalArgumentException("Element "+i+": "+data+" is not usable for Column \""+metaData.getName()+"\" ("+metaData.getColumnType()+")");
                }
                record.add(writable);
            } catch (ClassCastException e) {
                throw new IllegalArgumentException("Element "+i+": "+data+" is not usable for Column \""+metaData.getName()+"\" ("+metaData.getColumnType()+")", e);
            }
        }

        return record;
    }
789723
public BBContainer pollSchema() {
        BBContainer schemaCont = null;
        long segmentIndex = -1;
        if (m_memoryDeque.peek() != null) {
            StreamBlock sb = m_memoryDeque.peek();
            BBContainer cont = sb.getSchemaContainer();
            if (cont != null) {
                return cont;
            }
            segmentIndex = sb.getSegmentIndex();
        }
        try {
            schemaCont = m_reader.getExtraHeader(segmentIndex);
        } catch (IOException e) {
            exportLog.error("Failed to poll schema: " + e);
        }
        return schemaCont;

    }
577026
public Csv schema(TypeInformation<Row> schemaType) {
		Preconditions.checkNotNull(schemaType);
		internalProperties.putString(FORMAT_SCHEMA, TypeStringUtils.writeTypeInfo(schemaType));
		return this;
	}
676945
private static Schema getActualRecord(Schema inputSchema) {
    if (Type.RECORD.equals(inputSchema.getType())) {
      return inputSchema;
    }

    Preconditions.checkArgument(Type.UNION.equals(inputSchema.getType()), "Nested schema is only support with either record or union type of null with record");
    Preconditions.checkArgument(inputSchema.getTypes().size() <= 2,
        "For union type in nested record, it should only have NULL and Record type");

    for (Schema inner : inputSchema.getTypes()) {
      if (Type.NULL.equals(inner.getType())) {
        continue;
      }
      Preconditions.checkArgument(Type.RECORD.equals(inner.getType()), "For union type in nested record, it should only have NULL and Record type");
      return inner;

    }
    throw new IllegalArgumentException(inputSchema + " is not supported.");
  }
824195
def schema(self):
        
        if self._schema is None:
            try:
                self._schema = _parse_datatype_json_string(self._jdf.schema().json())
            except AttributeError as e:
                raise Exception(
                    "Unable to parse datatype from schema. %s" % e)
        return self._schema
472702
public static FieldMapping parseFieldMapping(String source, JsonNode mappingNode) {
    ValidationException.check(mappingNode.isObject(),
        "A column mapping must be a JSON record");

    ValidationException.check(mappingNode.has(TYPE),
        "Column mappings must have a %s.", TYPE);
    String type = mappingNode.get(TYPE).asText();

    // return easy cases
    if ("occVersion".equals(type)) {
      return FieldMapping.version(source);
    } else if ("key".equals(type)) {
      return FieldMapping.key(source);
    }

    String family = null;
    String qualifier = null;
    String prefix = null;

    // for backward-compatibility, check for "value": "fam:qual"
    if (mappingNode.has(VALUE)) {
      // avoids String#split because of odd cases, like ":".split(":")
      String value = mappingNode.get(VALUE).asText();
      Iterator<String> values = VALUE_SPLITTER.split(value).iterator();
      if (values.hasNext()) {
        family = values.next();
      }
      if (values.hasNext()) {
        if ("keyAsColumn".equals(type)) {
          prefix = values.next();
          if (prefix.isEmpty()) {
            prefix = null;
          }
        } else {
          qualifier = values.next();
        }
      }
    }

    // replace any existing values with explicit family and qualifier
    if (mappingNode.has(FAMILY)) {
      family = mappingNode.get(FAMILY).textValue();
    }
    if (mappingNode.has(QUALIFIER)) {
      qualifier = mappingNode.get(QUALIFIER).textValue();
    }

    if ("column".equals(type)) {
      ValidationException.check(family != null && !family.isEmpty(),
          "Column mapping %s must have a %s", source, FAMILY);
      ValidationException.check(qualifier != null && !qualifier.isEmpty(),
          "Column mapping %s must have a %s", source, QUALIFIER);
      return FieldMapping.column(source, family, qualifier);

    } else if ("keyAsColumn".equals(type)) {
      ValidationException.check(family != null && !family.isEmpty(),
          "Column mapping %s must have a %s", source, FAMILY);
      ValidationException.check(qualifier == null,
          "Key-as-column mapping %s cannot have a %s", source, QUALIFIER);
      if (mappingNode.has(PREFIX)) {
        prefix = mappingNode.get(PREFIX).asText();
        if (prefix.isEmpty()) {
          prefix = null;
        }
      }
      return FieldMapping.keyAsColumn(source, family, prefix);

    } else if ("counter".equals(type)) {
      ValidationException.check(family != null && !family.isEmpty(),
          "Counter mapping %s must have a %s", source, FAMILY);
      ValidationException.check(qualifier != null && !qualifier.isEmpty(),
          "Counter mapping %s must have a %s", source, QUALIFIER);
      return FieldMapping.counter(source, family, qualifier);

    } else {
      throw new ValidationException("Invalid mapping type: " + type);
    }
  }
417159
@Override
  public Schema convertSchema(SI inputSchema, WorkUnitState workUnit) throws SchemaConversionException {
    Preconditions.checkArgument(workUnit.contains(ConfigurationKeys.CONVERTER_AVRO_SCHEMA_KEY));
    this.schema = new Schema.Parser().parse(workUnit.getProp(ConfigurationKeys.CONVERTER_AVRO_SCHEMA_KEY));
    return this.schema;
  }
525666
public Schema schema(TableSchema schema) {
		tableSchema.clear();
		lastField = null;
		for (int i = 0; i < schema.getFieldCount(); i++) {
			field(schema.getFieldName(i).get(), schema.getFieldType(i).get());
		}
		return this;
	}
141744
@Override
    public Schema schema() {
        LOG.ok("Schema retrieving");

        final Provisioning provisioning = connection.getProvisioning();

        if (provisioning == null) {
            throw new IllegalStateException("Web Service client not found");
        }

        if (wsAttributes != null) {
            wsAttributes.clear();
        }
        wsAttributes = new HashMap<String, WSAttribute>();

        final Set<AttributeInfo> attributes = new HashSet<AttributeInfo>();
        final List<WSAttribute> wsAttrs = provisioning.schema();
        for (WSAttribute attribute : wsAttrs) {

            wsAttributes.put(getAttributeName(attribute), attribute);

            if (LOG.isOk()) {
                LOG.ok("\nAttribute: "
                        + "\n\tName: " + attribute.getName()
                        + "\n\tType: " + attribute.getType()
                        + "\n\tIsKey: " + attribute.isKey()
                        + "\n\tIsPassword: " + attribute.isPassword()
                        + "\n\tIsNullable: " + attribute.isNullable());
            }

            try {
                attributes.add(buildAttribute(attribute));
            } catch (IllegalArgumentException ila) {

                LOG.error("Invalid attribute " + attribute.getName(), ila);
            }
        }

        final SchemaBuilder schemaBld = new SchemaBuilder(getClass());

        final ObjectClassInfoBuilder objectclassInfoBuilder = new ObjectClassInfoBuilder();
        objectclassInfoBuilder.setType(ObjectClass.ACCOUNT_NAME);
        objectclassInfoBuilder.addAllAttributeInfo(attributes);

        final ObjectClassInfo objectclassInfo = objectclassInfoBuilder.build();
        schemaBld.defineObjectClass(objectclassInfo);

        /*
         * Note: AuthenticateOp, and all the 'SPIOperation'-s are by default added by Reflection API to the Schema.
         *
         * See for details: FrameworkUtil.getDefaultSupportedOperations() ReflectionUtil.getAllInterfaces(connector); is
         * the line that *does* acquire the implemented interfaces by the connector class.
         */
        if (!provisioning.isAuthenticationSupported()) {
            LOG.ok("Authentication is not supported.");

            schemaBld.removeSupportedObjectClass(AuthenticateOp.class, objectclassInfo);
        }

        if (!provisioning.isSyncSupported()) {
            LOG.ok("Synchronization is not supported.");

            schemaBld.removeSupportedObjectClass(SyncOp.class, objectclassInfo);
        }

        schema = schemaBld.build();
        return schema;
    }
901018
public SystemInputDef getSystemInputDef()
    {
    JsonValidationService service = JsonValidationService.newInstance();
    JsonSchema schema = service.readSchema( getClass().getResourceAsStream( "/schema/system-input-schema.json"));
    ProblemHandler handler = ProblemHandler.throwing();
    try( JsonReader reader = service.createReader( stream_, schema, handler))
      {
      JsonObject json;
      try
        {
        json = reader.readObject();
        }
      catch( Exception e)
        {
        throw new SystemInputException( "Invalid system input definition", e);
        }

      return SystemInputJson.asSystemInputDef( json);
      }
    }