Returns the schema of the B-tree leaf records.

@param keyType
the type of the indexed field

@return the schema of the index records
493103
static Schema schema(SearchKeyType keyType) {
		Schema sch = new Schema();
		for (int i = 0; i < keyType.length(); i++)
			sch.addField(keyFieldName(i), keyType.get(i));
		sch.addField(SCH_RID_BLOCK, BIGINT);
		sch.addField(SCH_RID_ID, INTEGER);
		return sch;
	}
151120
protected TableSchema getSchema() {
    List<TableFieldSchema> fields = new ArrayList<>();
    for (Map.Entry<String, FieldInfo<InputT>> entry : fieldInfo.entrySet()) {
      String key = entry.getKey();
      FieldInfo<InputT> fcnInfo = entry.getValue();
      String bqType = fcnInfo.getFieldType();
      fields.add(new TableFieldSchema().setName(key).setType(bqType));
    }
    return new TableSchema().setFields(fields);
  }
694138
public static JsonNode.Type getMapValueType(JsonNode schema) {
        JsonNode.Type type = JsonNode.Type.valueOf(schema.get("type").asString().toUpperCase());
        JsonNode child;
        if (type == JsonNode.Type.OBJECT && (child = schema.get("additionalProperties")) != null) {
            return getFirstNonArrayValueType(child);
        }
        return null;
    }
1079288
public Collection<String> getKeysForType(Class<? extends XAttribute> type) {
		Collection<XAttribute> typeCollection = getAttributesForType(type);
		Set<String> keySet = new HashSet<String>();
		for(XAttribute attribute : typeCollection) {
			keySet.add(attribute.getKey());
		}
		return Collections.unmodifiableCollection(keySet);
	}
1086852
public static String getMapFieldType(Field field) {
        String k = getMapFieldKeyType(field);
        String v = getMapFieldValueType(field);
        return "java.util.Map<" + k + ", " + v + ">";
    }
988090
private JdbcType lookupJdbcType()
    {
        JdbcType result = null;
        String columnType = getColumnType();
        // if sql type was not set in metadata we use reflection
        // to determine sql type by reflection
        if (columnType == null)
        {
            try
            {
                result = JdbcTypesHelper.getJdbcTypeByReflection(m_PersistentField.getType().getName());
            }
            catch(Exception e)
            {
                String eol = SystemUtils.LINE_SEPARATOR;
                throw new OJBRuntimeException("Can't automatically assign a jdbc field-type for field: "
                        + eol + this.toXML() + eol + "in class: " + eol + getClassDescriptor(), e);
            }
        }
        else
        {
            try
            {
                result = JdbcTypesHelper.getJdbcTypeByName(columnType);
            }
            catch(Exception e)
            {
                String eol = SystemUtils.LINE_SEPARATOR;
                throw new OJBRuntimeException("Can't assign the specified jdbc field-type '"+columnType+"' for field: "
                        + eol + this.toXML() + eol + "in class: " + eol + getClassDescriptor(), e);
            }
        }
        return result;
    }
572660
protected <T> Schema<T> newSchema(Class<T> typeClass)
    {
        // check if this is part of a group
        if(primaryGroup != null)
        {
            // only pojos created by runtime schema support groups
            final Schema<T> s = primaryGroup.getSchemaWrapper(
                    typeClass, true).getSchema();
            if(s instanceof RuntimeSchema)
            {
                final RuntimeSchema<T> rs = (RuntimeSchema<T>)s;
                
                final ArrayList<Field<T>> fields = new ArrayList<MappedSchema.Field<T>>(
                        rs.fields.length);
                
                for(Field<T> f : rs.fields)
                {
                    final int groupFilter = f.groupFilter;
                    if(groupFilter != 0)
                    {
                        final int set; // set for exclusion
                        if(groupFilter > 0)
                        {
                            // inclusion
                            set = ~groupFilter & 0x7FFFFFFF;
                        }
                        else
                        {
                            // exclusion
                            set = -groupFilter;
                        }
                        
                        if(0 != (groupId & set))
                        {
                            // this field is excluded on the current group id
                            continue;
                        }
                    }
                    
                    fields.add(f);
                }
                
                final int size = fields.size();
                if(size == rs.fields.length)
                {
                    // nothing is excluded
                    return rs;
                }
                
                if(size == 0)
                {
                    throw new RuntimeException("All fields were excluded for " + 
                            rs.messageFullName() + " on group " + groupId);
                }
                
                return new RuntimeSchema<T>(typeClass, fields, 
                        // the last field
                        fields.get(size-1).number, rs.instantiator);
            }
            
            return s;
        }

        return RuntimeSchema.createFrom(typeClass, this);
    }
596080
public static org.apache.arrow.vector.types.pojo.Schema toArrowSchema(Schema schema) {
        List<Field> fields = new ArrayList<>(schema.numColumns());
        for(int i = 0; i < schema.numColumns(); i++) {
            fields.add(getFieldForColumn(schema.getName(i),schema.getType(i)));
        }

        return new org.apache.arrow.vector.types.pojo.Schema(fields);
    }
73088
@Pure
	public DBaseFieldType getDBFFieldType(int index) {
		if (this.fieldCount != -1) {
			try {
				final DBaseFileField field = this.fields.get(index);
				if (field != null) {
					return field.getType();
				}
			} catch (Exception exception) {
				//
			}
		}
		return null;
	}
14200
public static byte schemaToColumnType(Schema s) {
    Schema.Type typ =  s.getType();
    switch (typ) {
      case BOOLEAN:
      case INT:
      case LONG:
      case FLOAT:
      case DOUBLE:
        return Vec.T_NUM;
      case ENUM:
        return Vec.T_CAT;
      case STRING:
        return Vec.T_STR;
      case NULL:
        return Vec.T_BAD;
      case BYTES:
        return Vec.T_STR;
      case UNION: // Flattenize the union
        List<Schema> unionSchemas = s.getTypes();
        if (unionSchemas.size() == 1) {
          return schemaToColumnType(unionSchemas.get(0));
        } else if (unionSchemas.size() == 2) {
          Schema s1 = unionSchemas.get(0);
          Schema s2 = unionSchemas.get(1);
          if (s1.getType().equals(Schema.Type.NULL)) return schemaToColumnType(s2);
          else if (s2.getType().equals(Schema.Type.NULL)) return schemaToColumnType(s1);
        }
      default:
        throw new IllegalArgumentException("Unsupported Avro schema type: " + s);
    }
  }
658459
public ResourceSchema getSchema(String location, Job job) throws IOException
    {
        setLocation(location, job);
        CfInfo cfInfo = getCfInfo(loadSignature);
        CfDef cfDef = cfInfo.cfDef;
        if (cfDef.column_type.equals("Super"))
            return null;
        /*
        Our returned schema should look like this:
        (key, index1:(name, value), index2:(name, value), columns:{(name, value)})
        Which is to say, columns that have metadata will be returned as named tuples, but unknown columns will go into a bag.
        This way, wide rows can still be handled by the bag, but known columns can easily be referenced.
         */

        // top-level schema, no type
        ResourceSchema schema = new ResourceSchema();

        // get default marshallers and validators
        Map<MarshallerType, AbstractType> marshallers = getDefaultMarshallers(cfDef);
        Map<ByteBuffer,AbstractType> validators = getValidatorMap(cfDef);

        // add key
        ResourceFieldSchema keyFieldSchema = new ResourceFieldSchema();
        keyFieldSchema.setName("key");
        keyFieldSchema.setType(getPigType(marshallers.get(MarshallerType.KEY_VALIDATOR)));

        ResourceSchema bagSchema = new ResourceSchema();
        ResourceFieldSchema bagField = new ResourceFieldSchema();
        bagField.setType(DataType.BAG);
        bagField.setName("columns");
        // inside the bag, place one tuple with the default comparator/validator schema
        ResourceSchema bagTupleSchema = new ResourceSchema();
        ResourceFieldSchema bagTupleField = new ResourceFieldSchema();
        bagTupleField.setType(DataType.TUPLE);
        ResourceFieldSchema bagcolSchema = new ResourceFieldSchema();
        ResourceFieldSchema bagvalSchema = new ResourceFieldSchema();
        bagcolSchema.setName("name");
        bagvalSchema.setName("value");
        bagcolSchema.setType(getPigType(marshallers.get(MarshallerType.COMPARATOR)));
        bagvalSchema.setType(getPigType(marshallers.get(MarshallerType.DEFAULT_VALIDATOR)));
        bagTupleSchema.setFields(new ResourceFieldSchema[] { bagcolSchema, bagvalSchema });
        bagTupleField.setSchema(bagTupleSchema);
        bagSchema.setFields(new ResourceFieldSchema[] { bagTupleField });
        bagField.setSchema(bagSchema);

        // will contain all fields for this schema
        List<ResourceFieldSchema> allSchemaFields = new ArrayList<ResourceFieldSchema>();
        // add the key first, then the indexed columns, and finally the bag
        allSchemaFields.add(keyFieldSchema);

        if (!widerows && (cfInfo.compactCqlTable || !cfInfo.cql3Table))
        {
            // defined validators/indexes
            for (ColumnDef cdef : cfDef.column_metadata)
            {
                // make a new tuple for each col/val pair
                ResourceSchema innerTupleSchema = new ResourceSchema();
                ResourceFieldSchema innerTupleField = new ResourceFieldSchema();
                innerTupleField.setType(DataType.TUPLE);
                innerTupleField.setSchema(innerTupleSchema);
                innerTupleField.setName(new String(cdef.getName()));

                ResourceFieldSchema idxColSchema = new ResourceFieldSchema();
                idxColSchema.setName("name");
                idxColSchema.setType(getPigType(marshallers.get(MarshallerType.COMPARATOR)));

                ResourceFieldSchema valSchema = new ResourceFieldSchema();
                AbstractType validator = validators.get(cdef.name);
                if (validator == null)
                    validator = marshallers.get(MarshallerType.DEFAULT_VALIDATOR);
                valSchema.setName("value");
                valSchema.setType(getPigType(validator));

                innerTupleSchema.setFields(new ResourceFieldSchema[] { idxColSchema, valSchema });
                allSchemaFields.add(innerTupleField);
            }   
        }

        // bag at the end for unknown columns
        allSchemaFields.add(bagField);

        // add top-level index elements if needed
        if (usePartitionFilter)
        {
            for (ColumnDef cdef : getIndexes())
            {
                ResourceFieldSchema idxSchema = new ResourceFieldSchema();
                idxSchema.setName("index_" + new String(cdef.getName()));
                AbstractType validator = validators.get(cdef.name);
                if (validator == null)
                    validator = marshallers.get(MarshallerType.DEFAULT_VALIDATOR);
                idxSchema.setType(getPigType(validator));
                allSchemaFields.add(idxSchema);
            }
        }
        // top level schema contains everything
        schema.setFields(allSchemaFields.toArray(new ResourceFieldSchema[allSchemaFields.size()]));
        return schema;
    }
723882
def get_schemas(cls, schema_types=None, sort=True):
        
        result = filter(lambda x: not x.is_inline_array, cls._schemas.values())
        if schema_types:
            result = filter(lambda x: x.schema_type in schema_types, result)
        if sort:
            result = sorted(result, key=attrgetter('name'))
        return result
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
485774
public TypeInfo getSchemaTypeInfo() {
	// dynamic load to support jre 1.4 and 1.5
	try {
	    Method m = element.getClass().getMethod("getSchemaTypeInfo", new Class[] {});
	    return (TypeInfo) m.invoke(element, ArrayUtil.OBJECT_EMPTY);
	}
	catch (Exception e) {
	    throw new PageRuntimeException(Caster.toPageException(e));
	}
    }
925676
def schema_root(self) -> "SchemaTreeNode":
        """"""
        sn = self
        while sn.parent:
            sn = sn.parent
        return sn
1100907
public FieldType getField()
   {
      FieldType result = null;
      if (m_index < m_fields.length)
      {
         result = m_fields[m_index++];
      }

      return result;
   }
1056750
def from_arrow_schema(arrow_schema):
    
    return StructType(
        [StructField(field.name, from_arrow_type(field.type), nullable=field.nullable)
         for field in arrow_schema])