cloud-fan commented on code in PR #40884: URL: https://github.com/apache/spark/pull/40884#discussion_r1179084897
########## docs/sql-ref-identifier-clause.md: ########## @@ -0,0 +1,70 @@ +--- +layout: global +title: Identifier clause +displayTitle: IDENTIFIER clause +license: | + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--- + +### Description + +Convert a STRING literal into an identifier or name. The IDENTIFIER clause can be used in many places instead of, or in combination with identifiers where identifiers or names are used. +The purpose of this clause is to allow for templating of identifiers in SQL statements without opening up the risk of SQL injection attacks. + +### Syntax + +```sql +IDENTIFIER ( str ) +``` + +### Parameters + +* str: A STRING literal. Typically, the literal represented by a placeholder construct, such as a hive variable reference. + +### Notes + +While constant string expressions are not supported you can combine multiple string literals into one by chaining them: ‘hello’ ‘world’ is equivalent to ‘helloworld’. +This allows parameterization of partial strings such as ‘prefix_’ ${ hivevar:x } ‘_postfix’. + +Different tools support different syntax for text substitution. For example a Notebook may use { { parameter } }. + +### Examples + +```sql +-- Using a Hive variable in Databricks Runtime +SET hivevar:tab = ‘T’; Review Comment: It's a common problem when we copy something from Google doc or Microsoft word. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
