Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.
Merged
Changes from 1 commit
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
Next Next commit
Fix ConnImplBenchmark test
  • Loading branch information
o-shevchenko committed Nov 14, 2024
commit 1f8c58394f371b93a53705c2c3ddaa3edf0e4e41
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ public void iterateRecordsWithBigQuery_Query(Blackhole blackhole) throws Interru
TableResult result = bigQuery.query(config);
long hash = 0L;
int cnt = 0;
System.out.print("\n Running");
System.out.println("\n Running");
// iterate al the records and compute the hash
long lastTime = System.currentTimeMillis();
for (FieldValueList row : result.iterateAll()) {
hash +=
row.get("vendor_id").getStringValue() == null
Expand All @@ -104,14 +105,6 @@ public void iterateRecordsWithBigQuery_Query(Blackhole blackhole) throws Interru
row.get("trip_distance").getValue() == null
? 0
: row.get("trip_distance").getDoubleValue();
hash +=
row.get("pickup_longitude").getValue() == null
? 0
: row.get("pickup_longitude").getDoubleValue();
hash +=
row.get("pickup_latitude").getValue() == null
? 0
: row.get("pickup_latitude").getDoubleValue();
hash +=
row.get("rate_code").getStringValue() == null
? 0
Expand All @@ -124,22 +117,6 @@ public void iterateRecordsWithBigQuery_Query(Blackhole blackhole) throws Interru
row.get("payment_type").getStringValue() == null
? 0
: row.get("payment_type").getStringValue().hashCode();
hash +=
row.get("pickup_location_id").getStringValue() == null
? 0
: row.get("pickup_location_id").getStringValue().hashCode();
hash +=
row.get("dropoff_location_id").getStringValue() == null
? 0
: row.get("dropoff_location_id").getStringValue().hashCode();
hash +=
row.get("dropoff_longitude").getValue() == null
? 0
: row.get("dropoff_longitude").getDoubleValue();
hash +=
row.get("dropoff_latitude").getValue() == null
? 0
: row.get("dropoff_latitude").getDoubleValue();
hash +=
row.get("fare_amount").getValue() == null ? 0 : row.get("fare_amount").getDoubleValue();
hash += row.get("extra").getValue() == null ? 0 : row.get("extra").getDoubleValue();
Expand All @@ -151,11 +128,32 @@ public void iterateRecordsWithBigQuery_Query(Blackhole blackhole) throws Interru
row.get("imp_surcharge").getValue() == null
? 0
: row.get("imp_surcharge").getDoubleValue();
hash +=
row.get("airport_fee").getValue() == null ? 0 : row.get("airport_fee").getDoubleValue();
hash +=
row.get("total_amount").getValue() == null ? 0 : row.get("total_amount").getDoubleValue();
hash +=
row.get("pickup_location_id").getStringValue() == null
? 0
: row.get("pickup_location_id").getStringValue().hashCode();
hash +=
row.get("dropoff_location_id").getStringValue() == null
? 0
: row.get("dropoff_location_id").getStringValue().hashCode();
hash +=
row.get("data_file_year").getValue() == null
? 0
: row.get("data_file_year").getLongValue();
hash +=
row.get("data_file_month").getValue() == null
? 0
: row.get("data_file_month").getLongValue();

if (++cnt % 100000 == 0) { // just to indicate the progress while long running benchmarks
System.out.print(".");
if (++cnt % 100_000 == 0) { // just to indicate the progress while long running benchmarks
long now = System.currentTimeMillis();
long duration = now - lastTime;
System.out.println("ROW " + cnt + " Time: " + duration + " ms");
lastTime = now;
}
}
System.out.println(cnt + " records processed using bigquery.query");
Expand Down Expand Up @@ -207,7 +205,9 @@ private long getResultHash(BigQueryResult bigQueryResultSet) throws SQLException
ResultSet rs = bigQueryResultSet.getResultSet();
long hash = 0L;
int cnt = 0;
System.out.print("\n Running");
System.out.println("\n Running");

long lastTime = System.currentTimeMillis();
while (rs.next()) {
hash += rs.getString("vendor_id") == null ? 0 : rs.getString("vendor_id").hashCode();
hash +=
Expand All @@ -218,22 +218,19 @@ private long getResultHash(BigQueryResult bigQueryResultSet) throws SQLException
: rs.getString("dropoff_datetime").hashCode();
hash += rs.getLong("passenger_count");
hash += rs.getDouble("trip_distance");
hash += rs.getDouble("pickup_longitude");
hash += rs.getDouble("pickup_latitude");
hash += rs.getString("rate_code") == null ? 0 : rs.getString("rate_code").hashCode();
hash +=
rs.getString("store_and_fwd_flag") == null
? 0
: rs.getString("store_and_fwd_flag").hashCode();
hash += rs.getDouble("dropoff_longitude");
hash += rs.getDouble("dropoff_latitude");
hash += rs.getString("payment_type") == null ? 0 : rs.getString("payment_type").hashCode();
hash += rs.getDouble("fare_amount");
hash += rs.getDouble("extra");
hash += rs.getDouble("mta_tax");
hash += rs.getDouble("tip_amount");
hash += rs.getDouble("tolls_amount");
hash += rs.getDouble("imp_surcharge");
hash += rs.getDouble("airport_fee");
hash += rs.getDouble("total_amount");
hash +=
rs.getString("pickup_location_id") == null
Expand All @@ -243,8 +240,14 @@ private long getResultHash(BigQueryResult bigQueryResultSet) throws SQLException
rs.getString("dropoff_location_id") == null
? 0
: rs.getString("dropoff_location_id").hashCode();
if (++cnt % 100000 == 0) { // just to indicate the progress while long running benchmarks
System.out.print(".");
hash += rs.getLong("data_file_year");
hash += rs.getLong("data_file_month");

if (++cnt % 100_000 == 0) { // just to indicate the progress while long running benchmarks
long now = System.currentTimeMillis();
long duration = now - lastTime;
System.out.println("ROW " + cnt + " Time: " + duration + " ms");
lastTime = now;
}
}
return hash;
Expand Down