-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TableInfo and related model classes #423
Conversation
} | ||
|
||
/** | ||
* Creates an {@code ExternalDataConfiguration} object. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
…unction models and tests
- TableSchema renamed to Schema - FieldSchema renamed to Field - Add class Type to Field to represent the field's type (and wrap record subfields) - Add factory method and setter from varargs for Schema - Better javadoc for CsvOptions and Field - Update tests according to changes
Fixed the comments, main changes are:
|
} | ||
|
||
/** | ||
* Creates an {@code Field} object. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Looks good. Few more comments and suggestions. |
See my comment regarding Also, I feel like an open comment regarding |
I see where you are going with the hierarchies. The fact is that i really don't like that the user has to cast values to get to real data. It might be me but I really consider casting an unnecessary pain in the neck. The main point is that if we have: @SuppressWarnings("unchecked")
public <F extends FormatOptions> F formatOptions() {
return (F) formatOptions;
} To use this method a user must not only read its javadoc but he needs also to be aware of the The same reasoning (even worse maybe) applies to public abstract class TableType {
static class Table extends TableType {
// ...
}
static class View {
// ...
}
static class External {
// ...
}
public static Table of(Schema schema);
public static View of (String query, List<UserDefinedFunction> functions);
public static External of(ExternalDataConfiguration configuration);
}
public class TableInfo {
// ...
public static Builder builder(TableType type);
public static ViewInfo of(TableType type);
} This is ok but if you ask me I would not remove all To sum things up: I am in favor of using hierarchies to make it easier for the user to build an object right, I am not in favor of having getters that require type-checking. I am open for discussion :)
It got lost in fact, my answer is here. |
I think javadoc, which shoes class hierarchies, and making the set of format type constants more public (maybe not enum, but there are other ways can do it) could help with knowing which one should be used. Also, I would expect the user to know it as (similar to the schema) it probably set it.
If someone was calling If we assume that more and more formats are going to be supported (which, I think, is the reason we don't use enum for As for |
…lDataConfiguration
- Move schema from TableInfo to TableType - Add TableType.View class with attributes: view, userDefinedFunctions - Add TableType.ExternalTable class with attributes: ExternalDataConfiguration - Fix return null in TableInfo.description/friendlyName/expirationTime
I obey :) Kidding, I don't completely agree but we could discuss this for days and there's no point in stalling this any longer.
|
I like this one better! (but still have few suggestions). Next time when you do not completely agree I suggest you create an issue (marked as question) and we can continue to discuss it there (and solicit more opinions) while keeping the code as is. |
Some more changes:
|
I really like it!! Few nits. |
Add TableInfo and related model classes
…onfig to v1.5.0 (#423) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-shared-config](https://togithub.com/googleapis/java-shared-config) | `1.4.0` -> `1.5.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-config/1.5.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-config/1.5.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-config/1.5.0/compatibility-slim/1.4.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-config/1.5.0/confidence-slim/1.4.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>googleapis/java-shared-config</summary> ### [`v1.5.0`](https://togithub.com/googleapis/java-shared-config/blob/HEAD/CHANGELOG.md#​150-httpsgithubcomgoogleapisjava-shared-configcomparev140v150-2022-06-10) [Compare Source](https://togithub.com/googleapis/java-shared-config/compare/v1.4.0...v1.5.0) ##### Features - add build scripts for native image testing in Java 17 ([#​1440](https://togithub.com/googleapis/java-shared-config/issues/1440)) ([#​475](https://togithub.com/googleapis/java-shared-config/issues/475)) ([e4dfc1b](https://togithub.com/googleapis/java-shared-config/commit/e4dfc1ba29295158c78c8fcf94467d2a6a33538a)) - to produce Java 8 compatible bytecode when using JDK 9+ ([2468276](https://togithub.com/googleapis/java-shared-config/commit/2468276145cdfe1ca911b52f765e026e77661a09)) ##### Dependencies - update surefire.version to v3.0.0-m7 ([bbfe663](https://togithub.com/googleapis/java-shared-config/commit/bbfe66393af3e49612c9c1e4334ba39c133ea1d0)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-security-private-ca).
* feat: add v3 client * 🦉 Updates from OwlBot * fix declared dependencies Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
🤖 I have created a release \*beep\* \*boop\* --- ## [0.119.0](https://www.github.com/googleapis/java-resourcemanager/compare/v0.118.12...v0.119.0) (2021-04-09) ### Features * add v3 client ([googleapis#423](https://www.github.com/googleapis/java-resourcemanager/issues/423)) ([8ed404a](https://www.github.com/googleapis/java-resourcemanager/commit/8ed404a58b030b81b78cc9304f388279c81f4705)) * introduce bom artifact and make this a multi-module project ([googleapis#419](https://www.github.com/googleapis/java-resourcemanager/issues/419)) ([61a6fc3](https://www.github.com/googleapis/java-resourcemanager/commit/61a6fc3da74b239d0d7e1f231d7c2763ea67c177)) ### Dependencies * update dependency com.google.apis:google-api-services-cloudresourcemanager to v1-rev20210328-1.31.0 ([googleapis#411](https://www.github.com/googleapis/java-resourcemanager/issues/411)) ([2301059](https://www.github.com/googleapis/java-resourcemanager/commit/2301059465d98455bc55be9e08d167a6e54baf74)) * update dependency com.google.errorprone:error_prone_annotations to v2.6.0 ([googleapis#417](https://www.github.com/googleapis/java-resourcemanager/issues/417)) ([8f1295f](https://www.github.com/googleapis/java-resourcemanager/commit/8f1295f1470f72f49f2489b16a345e2656cdc653)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Source-Link: googleapis/synthtool@e122cb0 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:387835a1375a0049ec44e02542c844302854c732d8291bdf8e472c0ff70a8f67
🤖 I have created a release *beep* *boop* --- ### Updating meta-information for bleeding-edge SNAPSHOT release. --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
…s#1687) (googleapis#423) * chore(java): add a note in README for migrated split repos Disable renovate bot and flaky bot for split repositories that have moved to the Java monorepo. The Java monorepo will pass the "monorepo=True" parameter to java.common_templates method in its owlbot.py files so that the migration note will not appear in the README in the monorepo. Co-authored-by: Jeff Ching <[email protected]> Source-Link: https://togithub.com/googleapis/synthtool/commit/d4b291604f148cde065838c498bc8aa79b8dc10e Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:edae91ccdd2dded2f572ec341a768ad180305a3e8fbfd93064b28e237d35920a
The commit are broken down to make it clear which parts are autogenerated and which parts had to be manually edited.
This is a very big PR (but most of it is javadocs and tests) that adds
TableInfo
model class and all related classes:TableSchema
FieldSchema
CsvOptions
ExternalDataConfiguration
UserDefinedFunction
Unit tests are also added.
Remarks
I added the
TableSchema
class to wrap schema information as it also appears elsewhere (Query results). Schema is just a list ofFieldSchema
objects so if you prefer we can drop the class and just useList<FieldSchema>
. I have no strong preferences.