Skip to content

Conversation

@larsbkrogvig
Copy link

I want to read a repeated string field from BigQuery, but there is no check for field mode in the BigQueryConverters class.

This adds such a check for STRING fields only. This should be made more general, though,

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added the cla: no The PR submitter does not have a CLA label Nov 3, 2019
@larsbkrogvig
Copy link
Author

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes The PR submitter has a CLA and removed cla: no The PR submitter does not have a CLA labels Nov 3, 2019
Copy link
Member

@sabhyankar sabhyankar left a comment

Choose a reason for hiding this comment

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

Thank you for the PR! Can you take a look at the comments and make the necessary corrections?

Comment on lines +388 to 416
switch (column.getMode()) {
case "NULLABLE":
case "REQUIRED":
String strValue = columnValue.toString();
valueBuilder.setStringValue(strValue);
boolean excludeFromIndexes = strValue.getBytes().length > MAX_STRING_SIZE_BYTES;
valueBuilder.setExcludeFromIndexes(excludeFromIndexes);
break;

case "REPEATED":

ArrayValue.Builder arrayValueBuilder = ArrayValue.newBuilder();
boolean excludeArrayFromIndexes = false;

@SuppressWarnings("unchecked")
List<Object> objectList = (List<Object>) columnValue;
for (Object object: objectList) {
String arrayStringValue = object.toString();
if (arrayStringValue.getBytes().length > MAX_STRING_SIZE_BYTES) {
excludeArrayFromIndexes = true;
}
arrayValueBuilder.addValues(Value.newBuilder().setStringValue(arrayStringValue).build());
}
valueBuilder.setArrayValue(arrayValueBuilder.build());
valueBuilder.setExcludeFromIndexes(excludeArrayFromIndexes);
break;

}
break;
Copy link
Member

Choose a reason for hiding this comment

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

If I am reading this correctly, we are only handling REQUIRED and REPEATED fields for STRING types? Why not extend this to the other supported data types (INT64, FLOAT etc)?

valueBuilder.setStringValue(strValue);
boolean excludeFromIndexes = strValue.getBytes().length > MAX_STRING_SIZE_BYTES;
valueBuilder.setExcludeFromIndexes(excludeFromIndexes);
switch (column.getMode()) {
Copy link
Member

Choose a reason for hiding this comment

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

Lets add unit test coverage as well.

@stale
Copy link

stale bot commented May 27, 2020

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the obsolete The PR hasn't had activity in 45 days label May 27, 2020
@stale stale bot closed this Jun 3, 2020
shreyakhajanchi pushed a commit that referenced this pull request Jan 23, 2025
* Dml integration (#53)

* Added extensive UT

Added extensive UT

* Cassandra pr bug fixes (#57)

* Cassandra Consolidate Unit Test case and Regression testing fixes (#58)

* Added Mapping fixes

* Added Spoltles fixes

* Added Consolidated fixes

* Added TODO

* Addess Data and Time

* Cassandra pr bug fixes (#64)

* Handle TypeHandler Parsing issue fixes (#65)

Co-authored-by: pawankashyapollion <v-pawan.kumar@ollion.com>

* Added Safe handle (#68)

* Handle LocalTime For Time Data Type In Cassandra (#69)

* Cassandra pr bug fixes (#70)

* Handle Timestamp Fixes (#72)

* Added Code Combined in a single way

* Address The Unwanted Hop

* Cassandra pr bug fixes (#75)

* Added PR Review Comments

* Remove NamesCol Dependecy as spannerTableName is same as In Given Mapping

* Added spannerTableId for fetching Mapping

* Removed SpannerToID and also Updated Session file with proper structure

* Timestamp in milisecond

* removed assertNotNull from UT wherever possible

* Added Fixes

* Added Note Instead of Question

* -- review fixes (#78)

* Added Bytes to hex to blob conversion

* Handling Bytes as Binary encoded As of now

* Passing Null Value to Primary Key as well for cassandra

* Added UT fixes

* Added UT refectoring

* Reverse merge confict fixes

---------

Co-authored-by: pawankashyapollion <v-pawan.kumar@ollion.com>
Co-authored-by: Akash Thawait <aakash@ollion.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes The PR submitter has a CLA obsolete The PR hasn't had activity in 45 days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants