Skip to content

Conversation

@MaxGekk
Copy link
Member

@MaxGekk MaxGekk commented Aug 12, 2022

What changes were proposed in this pull request?

In the PR, I propose to update the doc page https://spark.apache.org/docs/latest/sql-ref-ansi-compliance.html#cast about new behaviour of CAST introduced by the following PRs:

  1. [SPARK-40008][SQL] Support casting of integrals to ANSI intervals
  2. [SPARK-39451][SQL] Support casting intervals to integrals in ANSI mode
  3. [SPARK-39470][SQL] Support cast of ANSI intervals to decimals
  4. [SPARK-40014][SQL] Support cast of decimals to ANSI intervals

Screenshot 2022-08-12 at 15 00 10

Why are the changes needed?

To inform Spark SQL about new behaviour of CAST.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

By building Spark SQL docs and check them manually:

$ SKIP_SCALADOC=1 SKIP_PYTHONDOC=1 SKIP_RDOC=1 bundle exec jekyll build

@github-actions github-actions bot added the DOCS label Aug 12, 2022
@MaxGekk MaxGekk changed the title [WIP][SQL][DOCS] Document cast of ANSI intervals [SPARK-40061][SQL][DOCS] Document cast of ANSI intervals Aug 12, 2022
@MaxGekk MaxGekk marked this pull request as ready for review August 12, 2022 18:56
@MaxGekk
Copy link
Member Author

MaxGekk commented Aug 13, 2022

Merging to master. Thank you, @HyukjinKwon for review.

@MaxGekk MaxGekk closed this in bc986c1 Aug 13, 2022
+---+
```

#### Rounding in cast
Copy link
Contributor

Choose a reason for hiding this comment

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

is it also the behavior of casting decimal to int?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, casting to int just removes the fraction part. @gengliangwang @srielau Maybe you what SQL standard says about rounding to int?

Copy link
Contributor

Choose a reason for hiding this comment

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

casting to int behavior is "implementation dependent" The standard makes no decision here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants