public abstract static class Type.SchemalessStruct extends Object implements Type, SqlType.Struct
StructReader getters that require types. We don't
want users to need to specify the struct schema when the schema will be validated on calls to
StructReader methods on the struct.
Any attempts to interact with the schema will throw an exception.
For example the historical map data type uses this as follows:
Map<ByteString, List<Struct>> historicalMap =
resultSet.getMap(
"cf",
SqlType.mapOf(SqlType.bytes(), SqlType.arrayOf(SqlType.struct())));
Struct struct = historicalMap.get("column").get(0);
// Struct schema will be validated here so there's no need for users to pass the schema to getMap above
ByteString value = struct.getBytes("value");
Type.Array<Elem>, Type.Bool, Type.Bytes, Type.Date, Type.DefaultInstances, Type.Enum<T extends com.google.protobuf.ProtocolMessageEnum>, Type.Float32, Type.Float64, Type.Int64, Type.Map<K,V>, Type.Proto<T extends com.google.protobuf.AbstractMessage>, Type.SchemalessEnum, Type.SchemalessProto, Type.SchemalessStruct, Type.String, Type.StructWithSchema, Type.TimestampSqlType.Struct.FieldSqlType.Code, SqlType.Struct| Constructor and Description |
|---|
SchemalessStruct() |
| Modifier and Type | Method and Description |
|---|---|
static Type.SchemalessStruct |
create() |
SqlType.Code |
getCode() |
int |
getColumnIndex(String fieldName) |
List<SqlType.Struct.Field> |
getFields() |
SqlType<?> |
getType(int fieldIndex) |
SqlType<?> |
getType(String fieldName) |
String |
toString() |
public static Type.SchemalessStruct create()
public SqlType.Code getCode()
getCode in interface SqlType<Struct>SqlType.Code enum for this typepublic List<SqlType.Struct.Field> getFields()
getFields in interface SqlType.StructSqlType.Struct.Fields for the structpublic SqlType<?> getType(int fieldIndex)
getType in interface SqlType.StructfieldIndex - index of the fieldSqlType of the field at the given indexpublic SqlType<?> getType(String fieldName)
getType in interface SqlType.StructfieldName - name of the fieldSqlType of the field with the given namepublic int getColumnIndex(String fieldName)
getColumnIndex in interface SqlType.StructfieldName - name of the fieldCopyright © 2026 Google LLC. All rights reserved.