Skip to content

Conversation

@michaelzhan-db
Copy link
Contributor

What changes were proposed in this pull request?

Change column alias for current_database() to current_schema.

Why are the changes needed?

To better align with preferred usage of schema rather than database for three part namespace.

Does this PR introduce any user-facing change?

Yes, current_database() column alias is now current_schema().

How was this patch tested?

Unit tests pass.

Was this patch authored or co-authored using generative AI tooling?

No.

override def dataType: DataType = StringType
override def nullable: Boolean = false
override def prettyName: String = "current_database"
override def prettyName: String = "current_schema"
Copy link
Contributor

@beliefer beliefer Oct 7, 2023

Choose a reason for hiding this comment

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

If we change current_database to current_schema, we should rename CurrentDatabase to CurrentSchema.

How about using current_database as a unified name?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

CurrentDatabase was there since 1.6.0 and seems safer to not rename it now. The expression class name is not user-facing anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIK schema is a more standard name to reference to a namespace that keeps database objects.

Copy link
Contributor

Choose a reason for hiding this comment

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

So, how about using current_database as a unified name? it is consistent with class name.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I'm a bit confused. This PR tries to use the name schema more widely as it's more SQL standard. Are you saying no to this PR and want to stick with database?

Copy link
Contributor

Choose a reason for hiding this comment

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

I know this PR want to use the name schema here, it's okay. However, it caused inconsistent between the class name of the CurrentDatabase and its prettyName. Is this a problem? If not, then it's okay.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's fine, TruncTimestamp overrides prettyName as date_trunc

@zhengruifeng
Copy link
Contributor

also cc @cloud-fan @peter-toth

@beliefer beliefer changed the title [SPARK-45418] Change current_database() column alias to current_schema() [SPARK-45418][SQL][PYTHON][CONNECT] Change current_database() column alias to current_schema() Oct 9, 2023
@cloud-fan
Copy link
Contributor

thanks, merging to master!

@cloud-fan cloud-fan closed this in 12638b8 Oct 13, 2023
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.

4 participants