Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use user-defined variables in DataSphere Studio

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail how to use user-defined variables in DataSphere Studio, and the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.

The variable function of DataSphere Studio is very powerful. At present, it supports two kinds of variables: self-contained variables and user-defined variables. The scope of variables is divided into global level, workflow level and node level.

01

-

Bring your own variables

What is a built-in variable? The system comes with user variables that can be used directly without additional definition. Currently, six native variables are supported: run_date,run_date_std,run_month_begin,run_month_begin_std,run_month_end,run_month_end_std. The format of the date without the _ std suffix is yyyyMMdd, such as 20171109; the format of the date with the _ std suffix is yyyy-MM-dd, such as 2017-11-09. As shown below:

Details:

1. Run_date is the core with its own date variable, which supports user-defined date, if it is not specified, the default is the day before the current system time.

2. Other variables are derived from the definition of date variables: the other five date variables are calculated relative to run_date. Once the run_date changes, the values of other variables will automatically change.

3. Built-in variables support richer usage scenarios: ${run_date-1} is the day before run_data; ${run_month_begin-1} is the first day of run_month_begin last month, where-1 means minus one month.

02

-

Custom variable

What is a custom variable? A user variable that is defined before it is used.

User-defined variables temporarily support the definition of string, integer and floating-point variables, where strings support + method, and integers and floating-point numbers support +-* / methods.

User-defined variables do not conflict with the syntax of set variables supported by SparkSQL and HQL themselves, but the same name is not allowed.

How do I define and use custom variables? As shown below:

03

-

Scope of variables

Whether they are self-contained variables or custom variables, their scope is divided into global level, workflow level and node level. If the three scopes define the same variable at the same time, the priority of replacement is: node level > workflow level > global level, that is, when a node carries out variable replacement, it first looks for whether the node defines the variable, and then goes to the workflow to look for it. When the global variable is not defined, an exception will be thrown.

How do I use global variables? Top menu bar = > Linkis console, as shown below:

How do I use workflow-level variables? Workflow = > parameters, as shown below:

On how to use user-defined variables in DataSphere Studio to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 247

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report