Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,12 @@ google::cloud::StatusOr<JobConfig> JobConfig::ParseArgs(
flags_.push_back(
{"--use-int64-timestamp=", "outputs timestamp as usec int64",
[this](std::string const& v) { use_int64_timestamp = (v == "true"); }});
flags_.push_back(
{"--timestamp-output-format=",
"sets timestamp output format",
[this](std::string const& v) {
timestamp_output_format = v;
}});
Comment on lines 365 to 367

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The parser for --timestamp-output-format accepts any string value, but the comment on line 363 (// or validate v == "ISO8601_STRING") suggests that only specific values should be allowed. To improve robustness, please add validation to ensure the provided value is one of the supported timestamp formats. An error should be reported for invalid inputs.

flags_.push_back(
{"--min-creation-time=",
"min job creation time. If set, only jobs created after or at this "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ struct JobConfig : public Config {
int start_index = 0;
int timeout_ms;
bool use_int64_timestamp;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can't remove an existing variable like this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted

std::string timestamp_output_format;

bigquery_v2_minimal_internal::Projection projection;
bigquery_v2_minimal_internal::StateFilter state_filter;
Expand Down
1 change: 1 addition & 0 deletions google/cloud/bigquery/v2/minimal/internal/job_request.cc
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ std::string DataFormatOptions::DebugString(absl::string_view name,
int indent) const {
return internal::DebugFormatter(name, options, indent)
.Field("use_int64_timestamp", use_int64_timestamp)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int64 functionality should not be removed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted

.Field("timestamp_output_format",timestamp_output_format)
.Build();
}

Expand Down
4 changes: 3 additions & 1 deletion google/cloud/bigquery/v2/minimal/internal/job_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,14 @@ struct DataFormatOptions {
DataFormatOptions() = default;
bool use_int64_timestamp = false;

std::string timestamp_output_format = "FLOAT64";
std::string DebugString(absl::string_view name,
TracingOptions const& options = {},
int indent = 0) const;
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(DataFormatOptions,
use_int64_timestamp);
use_int64_timestamp,
timestamp_output_format);

// Indicates the type of compute mode for the query stage.
//
Expand Down
Loading