Build a mapping between column names and types.
964147
def _CalculateAttributeStorageTypes(self):
    """"""
    self.attribute_types = {}

    for attribute in itervalues(aff4.Attribute.PREDICATES):
      self.attribute_types[attribute.predicate] = (
          attribute.attribute_type.data_store_type)
1012965
def _compile_update_columns(self, values):
        
        columns = []

        for key, value in values.items():
            columns.append("%s = %s" % (self.wrap(key), self.parameter(value)))

        return ", ".join(columns)
709638
def restore_type(self, type):
        

        # Mapping
        mapping = {
            'BOOLEAN': 'boolean',
            'DATE': 'date',
            'DATETIME': 'datetime',
            'INTEGER': 'integer',
            'FLOAT': 'number',
            'STRING': 'string',
            'TIME': 'time',
        }

        # Not supported type
        if type not in mapping:
            message = 'Type %s is not supported' % type
            raise tableschema.exceptions.StorageError(message)

        return mapping[type]
462962
def map_columns(col):
    
    if col.startswith('7'):
        # spectral data
        try:
            return VARIABLE_MAP[col]
        except KeyError:
            return col
    try:
        variable_name = VARIABLE_MAP[col[:3]]
        variable_number = col[3:]
        return variable_name + '_' + variable_number
    except KeyError:
        return col
1057042
def column_types_equal(a_coltype: TypeEngine, b_coltype: TypeEngine) -> bool:
      # noqa
    return str(a_coltype) == str(b_coltype)
1188446
protected void registerColumnType(String columnType, int jdbcType) {
        columnTypeMatchers.add(new ColumnTypeMatcher(columnType));
        jdbcTypes.put(columnType, jdbcType);
    }
1360092
def types_(self, col: str) -> pd.DataFrame:
        
        cols = self.df.columns.values
        all_types = {}
        for col in cols:
            local_types = []
            for i, val in self.df[col].iteritems():
                #print(i, val, type(val))
                t = type(val).__name__
                if t not in local_types:
                    local_types.append(t)
            all_types[col] = (local_types, i)
        df = pd.DataFrame(all_types, index=["type", "num"])
        return df
692747
def schema_map(schema):
    """"""
    mapper = {}
    for name in getFieldNames(schema):
        mapper[name] = name
    return mapper
1286053
def convert_type(self, type):
        

        # Mapping
        mapping = {
            'any': 'STRING',
            'array': None,
            'boolean': 'BOOLEAN',
            'date': 'DATE',
            'datetime': 'DATETIME',
            'duration': None,
            'geojson': None,
            'geopoint': None,
            'integer': 'INTEGER',
            'number': 'FLOAT',
            'object': None,
            'string': 'STRING',
            'time': 'TIME',
            'year': 'INTEGER',
            'yearmonth': None,
        }

        # Not supported type
        if type not in mapping:
            message = 'Type %s is not supported' % type
            raise tableschema.exceptions.StorageError(message)

        return mapping[type]
758890
def row_from_cols(self, values):
		
		row = self.RowType()
		for c, t, v in zip(self.dbcolumnnames, self.dbcolumntypes, values):
			if t in ligolwtypes.IDTypes:
				v = ilwd.ilwdchar(v)
			setattr(row, c, v)
		return row
773797
def buildType(columns=[], extra=[]):
        
        return Type(id="epics:nt/NTTable:1.0",
                    spec=[
                    ('labels', 'as'),
                    ('value', ('S', None, columns)),
                    ('descriptor', 's'),
                    ('alarm', alarm),
                    ('timeStamp', timeStamp),
                    ] + extra)
1038171
def _col_type_set(self, col, df):
        
        type_set = set()
        if df[col].dtype == np.dtype(object):
            unindexed_col = list(df[col])
            for i in range(0, len(df[col])):
                if unindexed_col[i] == np.nan:
                    continue
                else:
                    type_set.add(type(unindexed_col[i]))
            return type_set
        else:
            type_set.add(df[col].dtype)
            return type_set
1300157
protected static void reOrganizeType(QueryColumnImpl column) {
	if ((column.type == Types.OTHER) && !column.typeChecked) {
	    column.typeChecked = true;
	    if (column.size() > 0) {
		checkOther(column, column.data[0]);

		// get Type
		for (int i = 1; i < column.size(); i++) {
		    switch (column.type) {
		    case Types.NULL:
			checkOther(column, column.data[i]);
			break;
		    case Types.TIMESTAMP:
			checkDate(column, column.data[i]);
			break;
		    // case Types.DATE:checkDate(column.data[i]);break;
		    case Types.BOOLEAN:
			checkBoolean(column, column.data[i]);
			break;
		    case Types.DOUBLE:
			checkDouble(column, column.data[i]);
			break;
		    case Types.VARCHAR:
			checkBasic(column, column.data[i]);
			break;
		    default:
			break;
		    }
		}
	    }
	}
    }
830917
def juggle_types(data):
    """"""
    # Data is a list of lists (2D) and not a single column table (1D)
    if isinstance(data[0], list):
        return [[force_int(col) for col in row] for row in data]

    # Data is 1D
    elif isinstance(data, list):
        return [force_int(i) for i in data]
    else:
        return data
800057
private Map<Integer, Integer> getColumnPosSqlTypes() {
    try {
      final Map<Integer, Integer> columnPosSqlTypes = Maps.newHashMap();
      ParameterMetaData pMetaData = this.insertPstmtForFixedBatch.getParameterMetaData();
      for (int i = 1; i <= pMetaData.getParameterCount(); i++) {
        columnPosSqlTypes.put(i, pMetaData.getParameterType(i));
      }
      return columnPosSqlTypes;
    } catch (SQLException e) {
      throw new RuntimeException("Cannot retrieve columns types for batch insert", e);
    }
  }
211313
def _get_cols(fields, schema):
  
  typemap = {
    'STRING': 'string',
    'INT64': 'number',
    'INTEGER': 'number',
    'FLOAT': 'number',
    'FLOAT64': 'number',
    'BOOL': 'boolean',
    'BOOLEAN': 'boolean',
    'DATE': 'date',
    'TIME': 'timeofday',
    'DATETIME': 'datetime',
    'TIMESTAMP': 'datetime'
  }
  cols = []
  for col in fields:
    if schema:
      f = schema[col]
      t = 'string' if f.mode == 'REPEATED' else typemap.get(f.data_type, 'string')
      cols.append({'id': f.name, 'label': f.name, 'type': t})
    else:
      # This will only happen if we had no rows to infer a schema from, so the type
      # is not really important, except that GCharts will choke if we pass such a schema
      # to a chart if it is string x string so we default to number.
      cols.append({'id': col, 'label': col, 'type': 'number'})
  return cols
710078
private String[] selectColumnNames(List<String> names, ColumnType[] types) {
        List<String> header = new ArrayList<>();
        for (int i = 0; i < types.length; i++) {
            if (types[i] != SKIP) {
                String name = names.get(i);
                name = name.trim();
                header.add(name);
            }
        }
        String[] result = new String[header.size()];
        return header.toArray(result);
    }