private List toList()

in src/main/java/com/google/cloud/spanner/pgadapter/parsers/ArrayParser.java [102:138]


  private List<?> toList(Value value, Code arrayElementType) {
    switch (arrayElementType) {
      case BOOL:
        return value.getBoolArray();
      case DATE:
        return value.getDateArray();
      case PG_JSONB:
        return value.getPgJsonbArray();
      case BYTES:
        return value.getBytesArray();
      case INT64:
      case PG_OID:
        return value.getInt64Array();
      case STRING:
      case PG_NUMERIC:
        // Get numeric arrays as a string array instead of as an array of BigDecimal, as numeric
        // arrays could contain 'NaN' values, which are not supported by BigDecimal.
        return value.getStringArray();
      case UUID:
        return value.getUuidArray();
      case TIMESTAMP:
        return value.getTimestampArray();
      case INTERVAL:
        return value.getIntervalArray();
      case FLOAT32:
        return value.getFloat32Array();
      case FLOAT64:
        return value.getFloat64Array();
      case NUMERIC: // Only PG_NUMERIC is supported
      case ARRAY:
      case STRUCT:
      default:
        throw SpannerExceptionFactory.newSpannerException(
            ErrorCode.INVALID_ARGUMENT,
            String.format("Array of %s is not supported", arrayElementType));
    }
  }