# BigQuery Data Policy Service V1 API - Module Google::Cloud::Bigquery::DataPolicies::V1::DataMaskingPolicy::PredefinedExpression (v1.4.0)

1.4.0 (latest) 1.3.0 1.2.1 1.1.0 1.0.1 0.10.0 0.9.0 0.8.1 0.7.2 0.6.0 0.5.0 0.4.0 0.3.1 0.2.0 0.1.0 Reference documentation and code samples for the BigQuery Data Policy Service V1 API module Google::Cloud::Bigquery::DataPolicies::V1::DataMaskingPolicy::PredefinedExpression.

The available masking rules. Learn more here:
<https://cloud.google.com/bigquery/docs/column-data-masking-intro#masking_options>.

## Constants

### PREDEFINED_EXPRESSION_UNSPECIFIED

**value:** 0  
Default, unspecified predefined expression. No masking will take place
since no expression is specified.

### SHA256

**value:** 3  
Masking expression to replace data with SHA-256 hash.

### ALWAYS_NULL

**value:** 5  
Masking expression to replace data with NULLs.

### DEFAULT_MASKING_VALUE

**value:** 7  

Masking expression to replace data with their default masking values.
The default masking values for each type listed as below:

<br />

- STRING: ""
- BYTES: b''
- INTEGER: 0
- FLOAT: 0.0
- NUMERIC: 0
- BOOLEAN: FALSE
- TIMESTAMP: 1970-01-01 00:00:00 UTC
- DATE: 1970-01-01
- TIME: 00:00:00
- DATETIME: 1970-01-01T00:00:00
- GEOGRAPHY: POINT(0 0)
- BIGNUMERIC: 0
- ARRAY: \[\]
- STRUCT: NOT_APPLICABLE
- JSON: NULL

### LAST_FOUR_CHARACTERS

**value:** 9  

Masking expression shows the last four characters of text.
The masking behavior is as follows:

<br />

- If text length \> 4 characters: Replace text with XXXXX, append last four characters of original text.
- If text length \<= 4 characters: Apply SHA-256 hash.

### FIRST_FOUR_CHARACTERS

**value:** 10  

Masking expression shows the first four characters of text.
The masking behavior is as follows:

<br />

- If text length \> 4 characters: Replace text with XXXXX, prepend first four characters of original text.
- If text length \<= 4 characters: Apply SHA-256 hash.

### EMAIL_MASK

**value:** 12  
Masking expression for email addresses.
The masking behavior is as follows:


- Syntax-valid email address: Replace username with XXXXX. For example, cloudysanfrancisco@gmail.com becomes XXXXX@gmail.com.
- Syntax-invalid email address: Apply SHA-256 hash.

<br />

For more information, see [Email
mask](https://cloud.google.com/bigquery/docs/column-data-masking-intro#masking_options).

### DATE_YEAR_MASK

**value:** 13  
Masking expression to only show the year of `Date`,
`DateTime` and `TimeStamp`. For example, with the
year 2076:


- DATE : 2076-01-01
- DATETIME : 2076-01-01T00:00:00
- TIMESTAMP : 2076-01-01 00:00:00 UTC

<br />

Truncation occurs according to the UTC time zone. To change this, adjust
the default time zone using the `time_zone` system variable.
For more information, see the [a
href="https://cloud.google.com/bigquery/docs/reference/system-variables"](about:invalid#zCSafez)System
variables reference.