WO2017097125A1 - 一种执行代码生成方法及设备 - Google Patents
一种执行代码生成方法及设备 Download PDFInfo
- Publication number
- WO2017097125A1 WO2017097125A1 PCT/CN2016/107410 CN2016107410W WO2017097125A1 WO 2017097125 A1 WO2017097125 A1 WO 2017097125A1 CN 2016107410 W CN2016107410 W CN 2016107410W WO 2017097125 A1 WO2017097125 A1 WO 2017097125A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- execution
- statement
- code
- value
- environment
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
Definitions
- the present application relates to the field of communications technologies, and in particular, to a method for generating a code.
- the application also relates to an execution code generation device.
- mainstream streaming computing service platforms that support linear scalability, high throughput, and high availability generally support SQL (Structured Query Language), and can also build an incremental computation model of MRM (Map Reduce Merge).
- SQL Structured Query Language
- MRM Map Reduce Merge
- the user offline environment calculates a SQL statement through a tool development stream of a type text editor, and debugs the developed SQL statement locally;
- S102 The user performs packet processing through the RPM package manager.
- the user installs the RPM package manager (RPM Package Manager) to the production pre-launch machine, and modifies the configuration of the data source table and the result table in the SQL statement, and runs the flow calculation task comparison by using the online real data source table. The output of the results table.
- RPM package manager RPM Package Manager
- S104 Install the RPM package manager into the production environment, and run the task after modifying the configuration of the data source table and the result table in the SQL statement.
- the inventor of the present application found in the process of implementing the present application that the development and production environment of the existing stream computing ETL development is physically isolated on the network, and the development link cannot simulate the real Data source. After a certain piece of execution code is developed and debugged, the developer also needs to modify the configuration information of the source and result tables before the package is released. If you forget to modify these configuration information, it will cause a production failure.
- the present application provides an execution code generation method for improving the processing efficiency of existing execution code in different execution environments, reducing labor consumption and avoiding losses caused by manual errors.
- the method includes:
- the execution code is executed in accordance with the execution environment.
- the original code is split into an input table statement, an output table statement, and a data conversion logic statement, specifically:
- variable value in the input table statement is replaced with the replacement value, specifically:
- the value is taken as the replacement value, and the variable value is subjected to variable replacement according to the replacement value.
- executing the execution code according to the execution environment is specifically:
- the execution environment is a development environment, redirecting data of the output table of the execution code to an output stream, and executing the execution code after the data verification of the output stream is correct;
- the execution code is executed if the execution environment is a production environment.
- an execution code generating device including:
- Determining a module determining a value of the variable in the input table statement, and a replacement value corresponding to the current execution environment
- the generating module generates an execution code according to the execution environment, the replaced input table statement, the output table statement, and the data conversion logic statement.
- the method further comprises:
- Execution module executes the execution code according to the execution environment.
- the splitting module is specifically configured to:
- the replacement module is specifically configured to:
- the value is taken as the replacement value, and the variable value is subjected to variable replacement according to the replacement value.
- the execution module is specifically configured to:
- the execution environment is a development environment, redirecting data of the output table of the execution code to an output stream, and executing the execution code after the data verification of the output stream is correct;
- the execution code is executed if the execution environment is a production environment.
- the variable value in the input table statement is determined and corresponding to the current execution environment.
- the replacement value replaces the value of the variable in the input table statement with the replacement value, and generates execution code according to the execution environment, the replaced input table statement, the output table statement, and the data conversion logic statement, thereby realizing different through a unified platform.
- the execution environment realizes the automatic generation of execution code, improves the processing efficiency of the existing execution code, and avoids the problems caused by manual processing of the code.
- FIG. 1 is a schematic flowchart of a method for generating a code according to the present application
- FIG. 2 is a structural diagram of a system of a stream computing development platform in a specific embodiment of the present application
- FIG. 3 is a flowchart of a flow job execution according to a specific embodiment of the present application.
- FIG. 4 is a schematic structural diagram of an execution code generating device according to the present application.
- the present application proposes an execution code generation method. After applying the technical solution of the present application, a technician can subscribe to the same data source table in both the development environment and the production environment, and simultaneously calculate the flow.
- the data source table and the result table are isolated from each other in the development environment and the production environment, and do not affect each other. That is, through a platform to develop, debug, release, and execute stream computing operations.
- a schematic flowchart of a method for generating a code generated by the present application includes the following steps:
- S101 Split the original code into an input table statement, an output table statement, and a data conversion logic statement.
- the input table statement is mainly used to construct the source data of the streaming calculation, and subscribe to the real-time data through this statement.
- the output table statement is mainly used to construct the final result data table of the stream calculation, and the data conversion logic will write the data to the result table in real time.
- the step first acquires the original code, performs structured query language SQL parsing for the original code, and generates the input table statement according to the parsing result.
- the output table statement and the data conversion logic statement are the structured query language SQL parsing for the original code.
- the system structure diagram of the stream computing development platform in the specific embodiment of the present application is a product form visible to the user in the cloud (flow computing platform).
- Galaxy is a stream computing engine.
- TT a stream computing engine.
- Hbase a stream computing engine.
- MetaQ a data source of the flow calculation engine.
- the platform will automatically help the user to create two project spaces galaxy_dev and galaxy_prod. These two projects are primarily used to isolate flow calculations for development and production.
- a subscription to TT and Metaq cannot be used by multiple galaxy streaming jobs at the same time.
- the user needs to apply for the subscriptions of subscribe1 and subscribe2 for the same data source, which brings great inconvenience to the user's code execution. Therefore, in the specific embodiment shown in FIG. 3, after inputting sql, the galaxy sql parsing is started. Specifically, the code is separately divided into three parts by lexical and syntax parsing: input table, output table, and data conversion. logic.
- the real-time data source is specified by variables.
- the user specifies the exact value of the real-time data source in the configuration file (such as Table 1). There are four values in Table 1, two to replace the development environment, and two to replace the production environment.
- This step therefore facilitates the processing of subsequent steps by determining the value of the variable in the input table statement and the replacement value corresponding to the current production environment.
- the replacement value corresponding to the current production environment may be preset, so that the value of the variable in the input table statement is acquired at the same time after the previous step is parsed. It is also possible to combine the execution of the environment configuration with the variable value after determining the value of the variable in the input table statement, which are all within the scope of protection of the present application.
- the above is the input table statement, which is mainly used to construct the source data of the streaming calculation, and subscribe to the real-time data through this statement.
- the above is the output table statement, which is mainly used to construct the final result data table of the stream calculation, and the data conversion logic will write the data to the result table in real time.
- Sub_id_dev 1224145515U8LLY8M4512 Access_key_dev 14569d37-b1fa-4603-a496-7600a554d1201
- Sub_id_prod 1224145515U8LLY8M4613 Access_key_prod 14569d37-b1fa-4603-a496-7600a554d1202
- sub_id_dev and access_key_dev in Table 2 are replacement values corresponding to the development environment
- Sub_id_prod and access_key_prod are replacement values for the production environment. Only develop and produce two environments.
- the above is the data conversion logic, which is mainly used to process the input data, and the final result is written to the output table.
- the step can quickly and automatically replace and generate the execution code based on the current execution environment.
- the replacement process is as follows:
- Step a) acquiring a configuration file corresponding to the execution environment, where the configuration file is pre-set with a value corresponding to the variable value;
- Step b) takes the value as the replacement value and performs variable substitution on the variable value according to the replacement value.
- S104 Generate an execution code according to the execution environment, the replaced input table statement, the output table statement, and the data conversion logic statement.
- the original code can be quickly rewritten and the variable replacement can be performed, mainly replacing the sub_id according to the execution environment (development environment, production environment).
- the value of access_key is rewritten as follows:
- the first part is the input form, as follows:
- the second part is the output table, as follows:
- the third part is the data conversion logic, as follows:
- the isolation problem of the input table of the development environment and the production environment has been solved by code rewriting in the specific embodiment of S103.
- the development and production of shared production tables can cause problems in data coverage by development operations. Therefore, the specific embodiment of the present application introduces a stream computing engine memory mode. In this mode, the output table data is not directly written into the storage, but is redirected to an output stream through the log, and the user can view the output stream verification data. Is it accurate?
- SQL lexical, syntax parsing and SQL rewriting to isolate the development and production environment of the stream computing operation, the user completes the development, release, and production environment operation of the stream computing operation on one platform.
- real data sources can be used.
- an execution code generating device as shown in FIG. 4, including:
- the splitting module 410 splits the original code into an input table statement, an output table statement, and a data conversion logic statement;
- the determining module 420 is configured to determine a variable value in the input table statement and a replacement value corresponding to the current execution environment
- a replacement module 430 replacing the variable value in the input table statement with the replacement value
- the generating module 440 generates an execution code according to the execution environment, the replaced input table statement, the output table statement, and the data conversion logic statement.
- Execution module executes the execution code according to the execution environment.
- the splitting module is specifically configured to:
- the replacement module is specifically configured to:
- the value is taken as the replacement value, and the variable value is subjected to variable replacement according to the replacement value.
- the execution module is specifically configured to:
- the execution environment is a development environment, redirecting data of the output table of the execution code to an output stream, and executing the execution code after the data verification of the output stream is correct;
- the execution code is executed if the execution environment is a production environment.
- the present application can be implemented by hardware, or by software plus a necessary general hardware platform.
- the technical solution of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including several The instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform the various implementation scenarios described in this application. Methods.
- modules in the apparatus in the implementation scenario may be distributed in the apparatus for implementing the scenario according to the implementation scenario description, or may be correspondingly changed in one or more devices different from the implementation scenario.
- the modules of the above implementation scenarios may be combined into one module, or may be further split into multiple sub-modules.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Devices For Executing Special Programs (AREA)
- Stored Programmes (AREA)
Abstract
一种执行代码生成方法及设备,所述方法包括:将原始代码拆分为输入表语句、输出表语句以及数据转换逻辑语句(S101),确定所述输入表语句中的变量值以及与当前的执行环境对应的替换值(S102),将输入表语句中的变量值替换为替换值(S103),根据执行环境、替换后的输入表语句、输出表语句以及数据转换逻辑语句生成执行代码(S104)。从而实现了通过统一的平台在不同的执行环境实现执行代码的自动生成,提高了现有执行代码的处理效率,避免了人工处理代码所带来的问题。
Description
本申请要求2015年12月07日递交的申请号为201510889462.8、发明名称为“一种执行代码生成方法及设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及通信技术领域,特别涉及一种执行代码生成方法。本申请同时还涉及一种执行代码生成设备。
传统的数据操作首先需要将数据采集并存储在DBMS(数据库管理系统,Database Management System)中,然后与DBMS进行交互进行数据处理,进而才能得到用户所需要的结果。在这整个过程中用户是主动的,而DBMS系统是被动的。但是对于现在大量存在的实时数据,比如股票交易的数据,这类数据实时性强,数据量大,没有止境,传统的架构并不合适。而流计算就是专门针对这种数据类型准备的,在流数据不断变化的运动过程中实时地进行分析,捕捉到可能对用户有用的信息,并把结果发送出去。
得益于高速的数据处理特性,互联网的服务提供商或平台运营商针对流计算平台越来越予以重视。目前,支持可线性扩展、高吞吐和高可用的主流流计算服务化平台一般都支持SQL(Structured Query Language,结构化查询语言),同时可构建MRM(Map Reduce Merge)的增量计算模型。在利用增量技术解决了中间数据集容错效率的问题后,用户可在云端方便的管理和配置任务,并且能够提供稳定、容错和可扩展的云端流计算服务能力,接入交易、点击、搜索等各种实时数据源以构建实时数据仓库,为数据化运营、实时ETL(Extract-Transform-Load,抽取转换装载)、个性化推荐、流数据挖掘等各种实时数据分析和应用提供秒级甚至毫秒级的流计算服务。
目前,传统流计算ETL开发过程包括以下步骤:
S101,用户在线下环境通过类型为文本编辑器的工具开发流计算SQL语句,并在本地调试开发的SQL语句;
S102,用户通过RPM软件包管理器进行打包处理。
S103,用户安装RPM软件包管理器(RPM Package Manager)至生产的预发机器,并修改SQL语句中的数据源表和结果表的配置,通过使用线上真实数据源表运行流计算任务比对结果表的产出。
S104,将RPM软件包管理器安装至生产环境,在修改SQL语句中的数据源表和结果表的配置后运行此任务。
结合上述流程以及现有的开发经验,本申请的发明人在实现本申请的过程中发现,现有的流计算ETL开发中开发和生产环境在网络上是物理隔离的,导致开发环节无法模拟真实的数据源。某一段执行代码在开发、调试通过后,开发人员还需要在打包发布前修改源头表和结果表的配置信息。如果忘记对这些配置信息进行修改,就会造成生产故障。
由此可见,现有的开发和生产的流计算数据源无法共享,导致开发环境不能完全模拟生产数据,并且开发和生产的代码无法统一,用户需要在生产环境修改部分配置时非常容易出错。因此,如何提高现有的流计算ETL开发过程的效率,节省人力以及避免由于人工失误带来的损失,成为本领域技术人员亟待解决的技术问题。
发明内容
本申请提供了一种执行代码生成方法,用以提高现有的执行代码在不同执行环境下的处理效率,减少人力消耗以及避免人工失误带来的损失。该方法包括:
将原始代码拆分为输入表语句、输出表语句以及数据转换逻辑语句;
确定所述输入表语句中的变量值,以及与当前的执行环境对应的替换值;
将所述输入表语句中的所述变量值替换为所述替换值,并根据所述执行环境、替换后的输入表语句、输出表语句以及所述数据转换逻辑语句生成执行代码;
根据所述执行环境执行所述执行代码。
优选地,将原始代码拆分为输入表语句、输出表语句以及数据转换逻辑语句,具体为:
获取所述原始代码;
对所述原始代码进行结构化查询语言SQL解析,根据解析结果生成所述输入表语句、所述输出表语句以及所述数据转换逻辑语句。
优选地,将所述输入表语句中的所述变量值替换为所述替换值,具体为:
获取与所述执行环境对应的配置文件,所述配置文件预设与所述变量值对应的数值;
将所述数值作为所述替换值,并根据所述替换值对所述变量值进行变量替换。
优选地,根据所述执行环境执行所述执行代码,具体为:
若所述执行环境为开发环境,将所述执行代码的输出表的数据重定向至输出流,并在所述输出流的数据验证正确之后执行所述执行代码;
若所述执行环境为生产环境,执行所述执行代码。
相应地,本申请还提出了一种执行代码生成设备,包括:
拆分模块,将原始代码拆分为输入表语句、输出表语句以及数据转换逻辑语句;
确定模块,确定所述输入表语句中的变量值,以及与当前的执行环境对应的替换值;
替换模块,将所述输入表语句中的所述变量值替换为所述替换值;
生成模块,根据所述执行环境、替换后的输入表语句、输出表语句以及所述数据转换逻辑语句生成执行代码。
优选地,还包括:
执行模块,根据所述执行环境执行所述执行代码。
优选地,所述拆分模块具体用于:
获取所述原始代码;
对所述原始代码进行结构化查询语言SQL解析,根据解析结果生成所述输入表语句、所述输出表语句以及所述数据转换逻辑语句。
优选地,所述替换模块具体用于:
获取与所述执行环境对应的配置文件,所述配置文件预设与所述变量值对应的数值;
将所述数值作为所述替换值,并根据所述替换值对所述变量值进行变量替换。
优选地,所述执行模块具体用于:
若所述执行环境为开发环境,将所述执行代码的输出表的数据重定向至输出流,并在所述输出流的数据验证正确之后执行所述执行代码;
若所述执行环境为生产环境,执行所述执行代码。
由此可见,通过应用本申请的技术方案,在将原始代码拆分为输入表语句、输出表语句以及数据转换逻辑语句之后,确定所述输入表语句中的变量值以及与当前的执行环境对应的替换值,将输入表语句中的变量值替换为替换值,并根据执行环境、替换后的输入表语句、输出表语句以及数据转换逻辑语句生成执行代码,从而实现了通过统一的平台在不同的执行环境实现执行代码的自动生成,提高了现有执行代码的处理效率,避免了人工处理代码所带来的问题。
图1为本申请提出的一种执行代码生成方法的流程示意图;
图2为本申请具体实施例中的流计算开发平台系统结构图;
图3为本申请具体实施例提出的一种流作业执行流程图;
图4为本申请提出的一种执行代码生成设备的结构示意图。
有鉴于背景技术中的问题,本申请提出了一种执行代码生成方法,在应用本申请的技术方案之后,技术人员无论是在开发环境还是生产环境都可以订阅相同一个数据源表,同时流计算数据源表和结果表在开发环境和生产环境互相隔离,互相不影响。即通过一个平台实现开发、调试、发布、执行流计算作业。
如图1所示,为本申请提出的一种执行代码生成方法的流程示意图,包括以下步骤:
S101,将原始代码拆分为输入表语句、输出表语句以及数据转换逻辑语句。输入表语句主要用来构建流式计算的源头数据,通过此语句订阅实时的数据。输出表语句主要用来构建流计算最终结果数据表,数据转换逻辑会把数据实时的写到结果表。
由于执行代码在根据当前的不同执行环境选择不同的变量以执行,而不同的变量存在于代码的不同部分,因此在将原始的执行代码执行之前,需要针对原始代码进行拆分处理,并且获取其中最为重要的输入表语句、输出表语句以及数据转换逻辑语句这三个部分。
由于目前的执行代码大多采用SQL语句组成,因此在本申请的优选实施例中,该步骤首先获取原始代码,并针对原始代码进行结构化查询语言SQL解析,根据解析结果生成所述输入表语句、所述输出表语句以及所述数据转换逻辑语句。
需要说明的是,尽管以上通过SQL解析的方式举例说明了执行代码的解析过程以及具体各个部分的获取方式,但是本申请并不仅限于此,在后续面对其他类型语句或是格式的执行代码时,技术人员亦可基于实际情况采取其他实现方式,这些均属于本申请的保护范围。
如图2所示,为本申请具体实施例中流计算开发平台系统结构图,在云端(流计算平台)是对用户可见的产品形态。Galaxy是流计算引擎。TT、Hbase、MetaQ、Mysql等是
流计算引擎的数据源。在用户申请开通流计算时,平台会自动帮助用户建立两个项目空间galaxy_dev以及galaxy_prod。这两个项目主要用于隔离开发和生产的流计算作业。以目前的技术来说,TT和Metaq的一个订阅无法同时被多个galaxy流作业使用。用户在构建流作业之前,针对同一个数据源需要申请subscribe1以及subscribe2这两个订阅,这样给用户的代码执行带来了极大的不便。因此在图3所示的具体实施例中,当输入sql之后,即开始进行galaxy sql解析,具体地,通过词法以及语法解析将代码分别拆分成三个部分:输入表、输出表、数据转换逻辑。
S102,确定所述输入表语句中的变量值,以及与当前的执行环境对应的替换值。
由于不同的执行环境对于执行代码所体现的区别主要在于输入表的语句中的实时数据源存在不同,为了保证开发和生产环境代码保持一致,通过变量来指定实时数据源。用户在配置文件(如表1)中具体指定实时数据源的确切值。表1中四个值,有两个用来替换开发环境,有两个用来替换生产环境。因此该步骤通过确定输入表语句中的变量值以及与当前的生产环境对应的替换值,以便于后续步骤的处理。需要说明的是,在该步骤中,与当前的生产环境对应的替换值可以预先设置好,这样在上一步骤解析完成后与输入表语句中的变量值同时获取。也可以是在确定输入表语句中的变量值之后再按照变量值结合执行环境配置,这些均属于本申请的保护范围。
以图3为例,假设通过SQL解析得到的输入表的代码如下:
以上为输入表语句,其主要用来构建流式计算的源头数据,通过此语句订阅实时的数据
基于上述代码,进行输入表语句的解析所得到的结构化信息如下表1所示:
| key | value |
| input.type | tt |
| galaxy.semantic.source.timetunnel.logname | aplus_text |
| galaxy.semantic.source.timetunnel.subid | ${sub_id} |
| galaxy.semantic.source.timetunnel.accesskey | ${access_key} |
表1
相应地,当前执行环境的输出表的代码如下:
以上为输出表语句,其主要用来构建流计算最终结果数据表,数据转换逻辑会把数据实时的写到结果表。
通过采用本具体实施例提供的数据转换逻辑进行配置文件解析,得到的结构化数据如下表2所示:
| key | value |
| sub_id_dev | 1224145515U8LLY8M4512 |
| access_key_dev | 14569d37-b1fa-4603-a496-7600a554d1201 |
| sub_id_prod | 1224145515U8LLY8M4613 |
| access_key_prod | 14569d37-b1fa-4603-a496-7600a554d1202 |
表2
其中,表2中的sub_id_dev和access_key_dev是开发环境对应的替换值;
而sub_id_prod和access_key_prod则是生产环境对应的替换值。只有开发和生产两个环境。
完成以上处理的数据处理逻辑代码如下,需要说明的是,该代码仅为本申请所提出的一种优选实施方案,对本申请的保护范围并没有影响:
以上为数据转换逻辑,其主要用于加工输入数据,最终结果写到输出表。
S103,将所述输入表语句中的所述变量值替换为所述替换值。
在通过S102分析得到了原始代码的变量值和与之对应的替换值之后,该步骤可基于当前的执行环境快速的自动替换并生成执行代码。在本申请的优选实施例中,替换过程如下:
步骤a)获取与所述执行环境对应的配置文件,所述配置文件中预设有与所述变量值对应的数值;
步骤b)将所述数值作为所述替换值,并根据所述替换值对所述变量值进行变量替换。
S104,根据所述执行环境、替换后的输入表语句、输出表语句以及所述数据转换逻辑语句生成执行代码。
在图3所示的具体实施例中,基于S101和S102中的的词法和语法分析,可以快速的重写原始代码并进行变量替换,主要是根据执行环境(开发环境、生产环境)替换sub_id和access_key的值。相应的不同执行环境的代码重写后如下所示:
(1)针对开发环境,由表2可知,其对应的替换值为sub_id_dev和access_key_dev,因此针对开发环境,根据表1和表2,将输入表中的galaxy.semantic.source.timetunnel.subid的值替换为表2中的sub_id_dev的值,即1224145515U8LLY8M4512,同时将输入表中的galaxy.semantic.source.timetunnel.accesskey的值替换为表2中access_key_dev的值,即14569d37-b1fa-4603-a496-7600a554d1201,由此,结合上述输出表以及数据转换逻辑,开发环境代码重写后如下,按先后次序分为三个部分:
第一部分为输入表,具体如下:
第二部分为输出表,具体如下:
第三部分为数据转换逻辑,具体如下:
(2)针对生产环境,由表2可知,其对应的替换值为sub_id_prod和access_key_prod,因此针对生产环境,根据表1和表2,将输入表中的galaxy.semantic.source.timetunnel.subid的值替换为表2中的sub_id_prod的值,即1224145515U8LLY8M4613,同时将输入表中的galaxy.semantic.source.timetunnel.accesskey的值替换为表2中access_key_prod的值,即14569d37-b1fa-4603-a496-7600a554d1202,由此,结合上述输出表以及数据转换逻辑,生产环境代码重写后如下,与开发环境代码重写相同,也按先后次序分为三个部分:分别为输入表,输出表和数据转换逻辑。
通过上述代码重写,至此代码本身的处理过程已经完成,后续可基于不同的执行环境对代码进行处理。在本申请的优选实施例中,根据不同执行环境执行所述执行代码的具体方式如下:
(1)若所述执行环境为开发环境,将所述执行代码的输出表的数据重定向至输出流,并在所述输出流的数据验证正确之后执行所述执行代码;
(2)若所述执行环境为生产环境,执行所述执行代码。
通过S103的具体实施例中的代码重写已经解决了开发环境和生产环境的输入表的隔离问题。但是开发和生产共享生产表,会造成数据被开发作业覆盖的问题。因此本申请该具体实施例引入了流计算引擎内存模式,在这种模式下,输出表数据不会直接写入存储,而是通过日志重定向到一个输出流,用户可以查看这个输出流验证数据是否准确。
通过采用上述技术方案,SQL词法、语法解析及SQL重写来隔离流计算作业的开发和生产环境,使得用户在一个平台上完成流计算作业的开发、发布、生产环境运行。在环境隔离的情况下,又能使用真实的数据源。
为达到以上技术目的,本申请还提出了一种执行代码生成设备,如图4所示,包括:
拆分模块410,将原始代码拆分为输入表语句、输出表语句以及数据转换逻辑语句;
确定模块420,确定所述输入表语句中的变量值,以及与当前的执行环境对应的替换值;
替换模块430,将所述输入表语句中的所述变量值替换为所述替换值;
生成模块440,根据所述执行环境、替换后的输入表语句、输出表语句以及所述数据转换逻辑语句生成执行代码。
在具体的应用场景中,还包括:
执行模块,根据所述执行环境执行所述执行代码。
在具体的应用场景中,所述拆分模块具体用于:
获取所述原始代码;
对所述原始代码进行结构化查询语言SQL解析,根据解析结果生成所述输入表语句、所述输出表语句以及所述数据转换逻辑语句。
在具体的应用场景中,所述替换模块具体用于:
获取与所述执行环境对应的配置文件,所述配置文件预设与所述变量值对应的数值;
将所述数值作为所述替换值,并根据所述替换值对所述变量值进行变量替换。
在具体的应用场景中,所述执行模块具体用于:
若所述执行环境为开发环境,将所述执行代码的输出表的数据重定向至输出流,并在所述输出流的数据验证正确之后执行所述执行代码;
若所述执行环境为生产环境,执行所述执行代码。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到本申请可以通过硬件实现,也可以借助软件加必要的通用硬件平台的方式来实现。基于这样的理解,本申请的技术方案可以以软件产品的形式体现出来,该软件产品可以存储在一个非易失性存储介质(可以是CD-ROM,U盘,移动硬盘等)中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施场景所述
的方法。
本领域技术人员可以理解附图只是一个优选实施场景的示意图,附图中的模块或流程并不一定是实施本申请所必须的。
本领域技术人员可以理解实施场景中的装置中的模块可以按照实施场景描述进行分布于实施场景的装置中,也可以进行相应变化位于不同于本实施场景的一个或多个装置中。上述实施场景的模块可以合并为一个模块,也可以进一步拆分成多个子模块。
上述本申请序号仅仅为了描述,不代表实施场景的优劣。
以上公开的仅为本申请的几个具体实施场景,但是,本申请并非局限于此,任何本领域的技术人员能思之的变化都应落入本申请的保护范围。
Claims (10)
- 一种执行代码生成方法,其特征在于,包括:将原始代码拆分为输入表语句、输出表语句以及数据转换逻辑语句;确定所述输入表语句中的变量值,以及与当前的执行环境对应的替换值;将所述输入表语句中的所述变量值替换为所述替换值;根据所述执行环境、替换后的输入表语句、输出表语句以及所述数据转换逻辑语句生成执行代码。
- 如权利要求1所述的方法,其特征在于,在根据所述执行环境、替换后的输入表语句、输出表语句以及所述数据转换逻辑语句生成执行代码之后,还包括:根据所述执行环境执行所述执行代码。
- 如权利要求1所述的方法,其特征在于,将原始代码拆分为输入表语句、输出表语句以及数据转换逻辑语句,具体为:获取所述原始代码;对所述原始代码进行结构化查询语言SQL解析,根据解析结果生成所述输入表语句、所述输出表语句以及所述数据转换逻辑语句。
- 如权利要求1所述的方法,其特征在于,将所述输入表语句中的所述变量值替换为所述替换值,具体为:获取与所述执行环境对应的配置文件,所述配置文件预设与所述变量值对应的数值;将所述数值作为所述替换值,并根据所述替换值对所述变量值进行变量替换。
- 如权利要求2所述的方法,其特征在于,根据所述执行环境执行所述执行代码,具体为:若所述执行环境为开发环境,将所述执行代码的输出表的数据重定向至输出流,并在所述输出流的数据验证正确之后执行所述执行代码;若所述执行环境为生产环境,执行所述执行代码。
- 一种执行代码生成设备,其特征在于,包括:拆分模块,将原始代码拆分为输入表语句、输出表语句以及数据转换逻辑语句;确定模块,确定所述输入表语句中的变量值,以及与当前的执行环境对应的替换值;替换模块,将所述输入表语句中的所述变量值替换为所述替换值;生成模块,根据所述执行环境、替换后的输入表语句、输出表语句以及所述数据转换逻辑语句生成执行代码。
- 如权利要求6所述的设备,其特征在于,还包括:执行模块,根据所述执行环境执行所述执行代码。
- 如权利要求6所述的设备,其特征在于,所述拆分模块具体用于:获取所述原始代码;对所述原始代码进行结构化查询语言SQL解析,根据解析结果生成所述输入表语句、所述输出表语句以及所述数据转换逻辑语句。
- 如权利要求6所述的设备,其特征在于,所述替换模块具体用于:获取与所述执行环境对应的配置文件,所述配置文件预设与所述变量值对应的数值;将所述数值作为所述替换值,并根据所述替换值对所述变量值进行变量替换。
- 如权利要求7所述的设备,其特征在于,所述执行模块具体用于:若所述执行环境为开发环境,将所述执行代码的输出表的数据重定向至输出流,并在所述输出流的数据验证正确之后执行所述执行代码;若所述执行环境为生产环境,执行所述执行代码。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510889462.8 | 2015-12-07 | ||
| CN201510889462.8A CN106843822B (zh) | 2015-12-07 | 2015-12-07 | 一种执行代码生成方法及设备 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2017097125A1 true WO2017097125A1 (zh) | 2017-06-15 |
Family
ID=59012689
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2016/107410 Ceased WO2017097125A1 (zh) | 2015-12-07 | 2016-11-28 | 一种执行代码生成方法及设备 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN106843822B (zh) |
| WO (1) | WO2017097125A1 (zh) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115617326A (zh) * | 2022-10-18 | 2023-01-17 | 浪潮通信信息系统有限公司 | 基于Flink的可视化编程方法及系统 |
Families Citing this family (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109582353A (zh) * | 2017-09-26 | 2019-04-05 | 北京国双科技有限公司 | 嵌入数据采集代码的方法及装置 |
| CN109726213B (zh) * | 2018-12-10 | 2021-11-19 | 阿里巴巴(中国)有限公司 | 一种程序代码转换方法、装置、介质和计算设备 |
| CN109656543B (zh) * | 2018-12-21 | 2022-03-29 | 苏州绿控传动科技股份有限公司 | 一种基于文件关键字替换的自动代码生成方法 |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1501235A (zh) * | 2002-11-14 | 2004-06-02 | 深圳市中兴通讯股份有限公司上海第二 | 基于纯文本的命令脚本文件的人机命令实现方法 |
| CN101859303A (zh) * | 2009-04-07 | 2010-10-13 | 中国移动通信集团湖北有限公司 | 元数据管理方法及管理系统 |
| CN102043624A (zh) * | 2010-12-17 | 2011-05-04 | 青岛海信网络科技股份有限公司 | 中间件通讯接口自动编程方法及装置 |
| CN102289460A (zh) * | 2011-07-13 | 2011-12-21 | 中国工商银行股份有限公司 | 一种向测试环境进行报表元数据同步的方法及系统 |
| US20150278701A1 (en) * | 2012-12-10 | 2015-10-01 | Viditeck Ag | Rules based data processing system and method |
| CN105045912A (zh) * | 2015-08-13 | 2015-11-11 | 浪潮通用软件有限公司 | 一种关系型数据库数据分发的方法 |
Family Cites Families (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102508660A (zh) * | 2011-10-26 | 2012-06-20 | 青岛海信宽带多媒体技术有限公司 | 可执行文件的生成方法及生成装置 |
| CN104346378B (zh) * | 2013-07-31 | 2019-02-05 | 腾讯科技(深圳)有限公司 | 一种实现复杂数据处理的方法、装置及系统 |
| CN103473108A (zh) * | 2013-08-12 | 2013-12-25 | 福建富士通信息软件有限公司 | 一种Java代码生成方法 |
| CN103631601A (zh) * | 2013-12-10 | 2014-03-12 | 北京中电普华信息技术有限公司 | 一种代码生成方法和装置 |
| CN104050261B (zh) * | 2014-06-16 | 2018-01-05 | 深圳先进技术研究院 | 基于Storm的可变逻辑的通用数据处理系统及方法 |
-
2015
- 2015-12-07 CN CN201510889462.8A patent/CN106843822B/zh active Active
-
2016
- 2016-11-28 WO PCT/CN2016/107410 patent/WO2017097125A1/zh not_active Ceased
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1501235A (zh) * | 2002-11-14 | 2004-06-02 | 深圳市中兴通讯股份有限公司上海第二 | 基于纯文本的命令脚本文件的人机命令实现方法 |
| CN101859303A (zh) * | 2009-04-07 | 2010-10-13 | 中国移动通信集团湖北有限公司 | 元数据管理方法及管理系统 |
| CN102043624A (zh) * | 2010-12-17 | 2011-05-04 | 青岛海信网络科技股份有限公司 | 中间件通讯接口自动编程方法及装置 |
| CN102289460A (zh) * | 2011-07-13 | 2011-12-21 | 中国工商银行股份有限公司 | 一种向测试环境进行报表元数据同步的方法及系统 |
| US20150278701A1 (en) * | 2012-12-10 | 2015-10-01 | Viditeck Ag | Rules based data processing system and method |
| CN105045912A (zh) * | 2015-08-13 | 2015-11-11 | 浪潮通用软件有限公司 | 一种关系型数据库数据分发的方法 |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115617326A (zh) * | 2022-10-18 | 2023-01-17 | 浪潮通信信息系统有限公司 | 基于Flink的可视化编程方法及系统 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN106843822B (zh) | 2020-07-31 |
| CN106843822A (zh) | 2017-06-13 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11442942B2 (en) | Modified representational state transfer (REST) application programming interface (API) including a customized GraphQL framework | |
| CN108037973B (zh) | 一种与数据处理工具交互的数据流建模和处理系统 | |
| JP6050272B2 (ja) | Apache hadoop用の低レイテンシクエリエンジン | |
| US8572575B2 (en) | Debugging a map reduce application on a cluster | |
| CN106897322B (zh) | 一种数据库和文件系统的访问方法和装置 | |
| Hummel et al. | A collection of software engineering challenges for big data system development | |
| US10310828B2 (en) | System and method for providing and executing a domain-specific language for cloud services infrastructure | |
| JP2014194769A6 (ja) | Apache hadoop用の低レイテンシクエリエンジン | |
| US11379499B2 (en) | Method and apparatus for executing distributed computing task | |
| CN104216766B (zh) | 对流数据进行处理的方法及装置 | |
| Pääkkönen | Feasibility analysis of AsterixDB and Spark streaming with Cassandra for stream-based processing | |
| US9747339B2 (en) | Server-based management for querying eventually-consistent database | |
| US20130014082A1 (en) | Method of configuring business logic supporting multi-tenancy | |
| WO2017097125A1 (zh) | 一种执行代码生成方法及设备 | |
| CN113656471A (zh) | 方案处理方法、装置、计算机设备和存储介质 | |
| CN108268512B (zh) | 一种标签查询方法及装置 | |
| US10664248B2 (en) | Systems and methods for comparing computer scripts | |
| CN113918595A (zh) | 数据查询方法及装置 | |
| CN104781814A (zh) | 从单个表到多个表的引用数据分割 | |
| US9426197B2 (en) | Compile-time tuple attribute compression | |
| US20140372488A1 (en) | Generating database processes from process models | |
| CN119396466A (zh) | 业务系统向低代码平台的迁移方法、装置、设备及介质 | |
| US12360990B2 (en) | Transliteration of machine interpretable languages for enhanced compaction | |
| CN118427218A (zh) | 状态信息配置方法及装置、电子设备、存储介质和计算机程序产品 | |
| Lafi et al. | Metamodel matching techniques evaluation and benchmarking |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 16872317 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 16872317 Country of ref document: EP Kind code of ref document: A1 |









