function get_udf_project_and_dataset()

in cicd/unit_test_utils.js [92:111]


function get_udf_project_and_dataset(udf_name) {
  // This function returns either a missing project_id or dataset_id
  // from the user-provided udf_name. Any missing IDs are added using data
  // from the dataform.json config file.
  const regexp = /\./g; // Check for periods in udf_name
  const matches = [...udf_name.matchAll(regexp)];
  if (matches.length === 0) {
    // No periods in udf_name means project and dataset must be added
    // for a fully-qualified UDF invocation.
    return `\`${dataform.projectConfig.defaultDatabase}.${dataform.projectConfig.defaultSchema}\`.`;
  } else if (matches.length === 1) {
    // Only one period in udf_name means the project must be added
    // for a fully-qualified UDF invocation.
    return `\`${dataform.projectConfig.defaultDatabase}\`.`;
  } else if (matches.length === 2) {
    // Two periods in the udf_name means the user has already provided
    // both project and dataset. No change is necessary.
    return '';
  }
}