Skip to content
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

Looker Model metadata #37

Closed
wants to merge 22 commits into from

Conversation

olivrlee
Copy link

@olivrlee olivrlee commented Aug 4, 2023

No description provided.

julianhyde and others added 14 commits June 21, 2023 14:28
This allows dependent projects to run tests using Bazel. (Previously,
DiffRepository would give errors because Bazel has packaged the .xml
files it needs inside JAR files.)

Close apache#2750
…pache#7)

Related to CALCITE-5346.

Previously we relied on the parser to map unrecognized datatypes to a known type using SqlAlienSystemTypeNameSpec. This worked but made it difficult to change or add new types as necessary. One would have to update at least 3 different parsers (babel, core, server) to make a change.

This change allows for declaring user-defined types at the root of a schema model and allows for easy type alias mapping. These data types are shared by all schema in the model so cast and DDL expressions do not need to scope data type references to a particular sub-schema.

For example:
```
inline: {
  version: '1.0',
  types: [
    {
      name: 'BOOL',
      type: 'BOOLEAN'
    },
    {
      name: 'BYTES',
      type: 'VARBINARY'
    },
...
  ],
```
Allows for `CAST("true" as BOOL)`
…de node) (apache#28)

* Add tests to fix later

* Update test

* Add in type field to RelJson.toJson and update tests

* CALCITE-5607 / Serialize return type during RelJson.toJson(RexNode node)

* Update test comment

---------

Co-authored-by: Oliver Lee <oliverlee@google.com>
…K, WEEK(WEEKDAY) (apache#32)

* [CALCITE-5449] Allow EXTRACT() to accept time frames

* Fix getMonotonicity() override

* Lint

* Refactor DAYOFWEEK, DAYOFYEAR

---------

Co-authored-by: tanclary <116591231+tanclary@users.noreply.github.com>
Co-authored-by: Tanner Clary <tannerclary@google.com>
Copy link
Collaborator

@tanclary tanclary left a comment

Choose a reason for hiding this comment

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

Forgot to submit, here you go!

build.gradle.kts Outdated Show resolved Hide resolved
core/src/main/java/org/apache/calcite/schema/Table.java Outdated Show resolved Hide resolved
@@ -284,6 +295,52 @@ protected static Connection getRemoteConnection() throws SQLException {
.returns(CalciteAssert.checkResultContains("COLUMN_NAME=EMPNO"));
}

@Test void testRemoteColumnsMetadata() throws SQLException {
final Connection connection =
Copy link

Choose a reason for hiding this comment

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

nit: arrange your tests in AAA form: http://go/unit-testing-practices#structure

sqlline_edited Outdated Show resolved Hide resolved
* Gets Looker Explore metadata if available.
*/
default HashMap<String, Object> getTableMetadata() {
HashMap<String, Object> map = new HashMap<>();
Copy link

Choose a reason for hiding this comment

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

Let's avoid hash maps in APIs whenever possible, even internal ones. This is how helltool ended up with so many functions with a single hash map argument instead of individual arguments.

The best thing for here is probably to define a new data class called ExtraTableMetadata that functions like the hash map, but with all the expected fields spelled out.

…hen instantiating tables in the CalciteMetaImpl tables() call

// Got a RedundantModifier alert, however CalciteMetaImpl does need this constructor to be
// explicitly public in order to create an instance.
// CHECKSTYLE: IGNORE 2
Copy link
Author

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants