tensorflow_io/core/kernels/avro/utils/avro_parser.cc
// Null will only resolve if
// -- the null appears in a union with a primitive type -- by construction
// (otherwise no default)
// -- the user supplied a scalar default tensor
// -- the user supplied a type that matches the primitive type
// For sparse tensors will null entries in their values or indices
// this will fail which is the correct behavior.
Null will only resolve if
the null appears in a union with a primitive type -- by construction
(otherwise no default)
the user supplied a scalar default tensor
the user supplied a type that matches the primitive type
For sparse tensors will null entries in their values or indices
this will fail which is the correct behavior.
Null will only resolve if the null appears in a union with a primitive type -- by construction ( otherwise no default ) the user supplied a scalar default tensor the user supplied a type that matches the primitive type For sparse tensors will null entries in their values or indices this will fail which is the correct behavior .
Status CheckValidDefault(const string& key,
                         const std::map<string, Tensor>& defaults,
                         DataType expected) {
  if (defaults.find(key) == defaults.end()) {
    return errors::InvalidArgument("For key '", key,
                                   "' cannot find a default value.");
  }
  const Tensor& default_value = defaults.at(key);
  if (!TensorShapeUtils::IsScalar(default_value.shape())) {
    return errors::InvalidArgument(
        "For key '", key,
        "' expected scalar default but got tensor with shape ",
        default_value.shape());
  }
  if (expected != default_value.dtype()) {
    return errors::InvalidArgument("For key '", key, "' expected data type ",
                                   expected, "' but got data type '",
                                   default_value.dtype(), "'.");
  }
  return Status::OK();
}
Status CheckValidDefault ( const string & key , const std :: map < string , Tensor > & defaults , DataType expected ) { if ( defaults . find ( key ) == defaults . end ( ) ) { return errors :: InvalidArgument ( " " , key , " " ) ; } const Tensor & default_value = defaults . at ( key ) ; if ( ! TensorShapeUtils :: IsScalar ( default_value . shape ( ) ) ) { return errors :: InvalidArgument ( " " , key , " " , default_value . shape ( ) ) ; } if ( expected != default_value . dtype ( ) ) { return errors :: InvalidArgument ( " " , key , " " , expected , " " , default_value . dtype ( ) , " " ) ; } return Status :: OK ( ) ; }
Null will only resolve if
 the null appears in a union with a primitive type -- by construction
(otherwise no default)
 the user supplied a scalar default tensor
 the user supplied a type that matches the primitive type
For sparse tensors will null entries in their values or indices
this will fail which is the correct behavior.
Null will only resolve if the null appears in a union with a primitive type -- by construction ( otherwise no default ) the user supplied a scalar default tensor the user supplied a type that matches the primitive type For sparse tensors will null entries in their values or indices this will fail which is the correct behavior .