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,9 @@ 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; }});
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";
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the best default value for this would be "TIMESTAMP_OUTPUT_FORMAT_UNSPECIFIED".

Copy link
Contributor

Choose a reason for hiding this comment

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

Move this up a line so that the data members are next to each other and there is a blank like separating them from the member function.

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
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ TEST(PostQueryRequestTest, DebugString) {
R"( parameter_value { value: "query-parameter-value" } })"
R"( labels { key: "lk1" value: "lv1" } labels { key: "lk2" value: "lv2" })"
R"( default_dataset { project_id: "2" dataset_id: "1" })"
R"( format_options { use_int64_timestamp: true })"
R"( format_options { use_int64_timestamp: true timestamp_output_format: FLOAT64 })"
R"( job_creation_mode { value: "JOB_CREATION_MODE_UNSPECIFIED" } } })");

EXPECT_EQ(
Expand All @@ -1049,7 +1049,7 @@ TEST(PostQueryRequestTest, DebugString) {
R"( parameter_value { value: "query-p...<truncated>..." } })"
R"( labels { key: "lk1" value: "lv1" } labels { key: "lk2" value: "lv2" })"
R"( default_dataset { project_id: "2" dataset_id: "1" })"
R"( format_options { use_int64_timestamp: true })"
R"( format_options { use_int64_timestamp: true timestamp_output_format: FLOAT64 })"
R"( job_creation_mode { value: "JOB_CRE...<truncated>..." } } })");

EXPECT_EQ(request.DebugString("PostQueryRequest", TracingOptions{}.SetOptions(
Expand Down Expand Up @@ -1103,6 +1103,7 @@ TEST(PostQueryRequestTest, DebugString) {
}
format_options {
use_int64_timestamp: true
timestamp_output_format: FLOAT64
}
job_creation_mode {
value: "JOB_CREATION_MODE_UNSPECIFIED"
Expand Down
Loading