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

Introduce Values to support expressions #409

Merged

Conversation

krishnangovindraj
Copy link
Member

@krishnangovindraj krishnangovindraj commented Apr 11, 2023

What is the goal of this PR?

Introduce the 'Value' type, which is returned as the result of an expression's computation. This change follows from typedb/typeql#260, which outlines the capabilities of the new expression syntax.

Values (representing any of Long, Double, Boolean, String, or DateTime) are returned as part of ConceptMap answers and are subtypes of Concept for the time being. Their main API is made of the .getValue() method and .getValueType() method, along with all the standard safe downcasting methods to convert a Concept into a Value, using Concept.isValue() and Concept.asValue().

We also move the import location of ValueType from being nested in AttributeType to Concept.

What are the changes implemented in this PR?

  • Introduces the Value concept and the required ValueImpl that implements it
  • Refactor ValueType to no longer live within AttributeType - now it exists in Concept.ValueType
  • Updates the test framework for tests involving values, including the new ExpressionTest behaviour scenarios, which we also add to CI

@typedb-bot
Copy link
Member

typedb-bot commented Apr 11, 2023

PR Review Checklist

Do not edit the content of this comment. The PR reviewer should simply update this comment by ticking each review item below, as they get completed.


Trivial Change

  • This change is trivial and does not require a code or architecture review.

Code

  • Packages, classes, and methods have a single domain of responsibility.
  • Packages, classes, and methods are grouped into cohesive and consistent domain model.
  • The code is canonical and the minimum required to achieve the goal.
  • Modules, libraries, and APIs are easy to use, robust (foolproof and not errorprone), and tested.
  • Logic and naming has clear narrative that communicates the accurate intent and responsibility of each module (e.g. method, class, etc.).
  • The code is algorithmically efficient and scalable for the whole application.

Architecture

  • Any required refactoring is completed, and the architecture does not introduce technical debt incidentally.
  • Any required build and release automations are updated and/or implemented.
  • Any new components follows a consistent style with respect to the pre-existing codebase.
  • The architecture intuitively reflects the application domain, and is easy to understand.
  • The architecture has a well-defined hierarchy of encapsulated components.
  • The architecture is extensible and scalable.

@krishnangovindraj
Copy link
Member Author

Tests are red because the cluster artifact doesn't support arithmetic.

@Override
public Concept.Remote asRemote(TypeDBTransaction transaction) {
throw new TypeDBClientException(VALUECONCEPT_HAS_NO_REMOTE);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Value concepts are ephemeral and have no remote.

@flyingsilverfin flyingsilverfin marked this pull request as draft April 11, 2023 10:54
@krishnangovindraj krishnangovindraj changed the title Add datastructures & methods needed for arithmetic Introduce the value concept Apr 11, 2023
@flyingsilverfin flyingsilverfin force-pushed the arithmetic-add-value-concept branch 2 times, most recently from 6ecf2eb to 64456a3 Compare May 23, 2023 13:36
@flyingsilverfin flyingsilverfin marked this pull request as ready for review May 23, 2023 15:53
@flyingsilverfin flyingsilverfin changed the title Introduce the value concept Implement value responses May 24, 2023
@flyingsilverfin flyingsilverfin changed the title Implement value responses Implement the new Value response type May 24, 2023
@flyingsilverfin flyingsilverfin changed the title Implement the new Value response type Implement Value concepts May 26, 2023
@flyingsilverfin flyingsilverfin changed the title Implement Value concepts Introduce Values to support expressions May 26, 2023
@flyingsilverfin flyingsilverfin merged commit 16c2364 into typedb:master May 26, 2023
dmitrii-ubskii added a commit that referenced this pull request Aug 22, 2023
## What is the goal of this PR?

We update the Rust driver to support the features introduced in driver
Java since v2.19 in effort to preserve the feature set when
transitioning from the JVM-native implementation to the Rust JNI
implementation.

## What are the changes implemented in this PR?

Changes in master since branching (#417):

Reimplemented in Rust and made available in Java over JNI:
- #409 
- #421 
- 1f396a6 Improve method unavailable error message
- #430 
- #431: partial, since `tonic` does not report SSL errors to the same
granularity

Cherry-picked directly:
- #415
- 42800e7 Update VERSION to 2.18.1
- 7cd0a5a Add eclipsesource-minimal-json to maven dependencies (#423)
- 63614ec Update CODEOWNERS
- #424

Dropped entirely (Java-specific or obsolete):
- #422 
- 8c0caa1 Update VERSION and release notes

---------

Co-authored-by: Benjamin Small <benjaminasmall@gmail.com>
Co-authored-by: joshua <joshua@vaticle.com>
Co-authored-by: Krishnan Govindraj <krishnangovindraj@users.noreply.github.com>
@krishnangovindraj krishnangovindraj deleted the arithmetic-add-value-concept branch October 13, 2023 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants