Giter Site home page Giter Site logo

oceanbase / sql-lifecycle-management Goto Github PK

View Code? Open in Web Editor NEW
64.0 64.0 14.0 8.28 MB

SQL-Lifecycle-Management is an intelligent diagnosis and optimization product focusing on the SQL field.

License: Apache License 2.0

Makefile 0.27% Python 90.70% Shell 0.05% HTML 0.14% Go 8.71% Dockerfile 0.13%
database mysql oceanbase optimization parser python sql

sql-lifecycle-management's Introduction

OceanBase Logo

English doc Chinese doc last commit stars building status license

Join Slack Stack Overflow

English | 中文版

OceanBase Database is a distributed relational database. It is developed entirely by Ant Group. The OceanBase Database is built on a common server cluster. Based on the Paxos protocol and its distributed structure, the OceanBase Database provides high availability and linear scalability. The OceanBase Database is not dependent on specific hardware architectures.

Key features

  • Transparent Scalability: 1,500 nodes, PB data and a trillion rows of records in one cluster.
  • Ultra-fast Performance: TPC-C 707 million tmpC and TPC-H 15.26 million QphH @30000GB.
  • Cost Efficiency: saves 70%–90% of storage costs.
  • Real-time Analytics: supports HTAP without additional cost.
  • Continuous Availability: RPO = 0(zero data loss) and RTO < 8s(recovery time)
  • MySQL Compatible: easily migrated from MySQL database.

See also key features for more details.

Quick start

See also Quick experience or Quick Start (Simplified Chinese) for more details.

🔥 Start with all-in-one

You can quickly deploy a stand-alone OceanBase Database to experience with the following commands:

Note: Linux Only

# download and install all-in-one package (internet connection is required)
bash -c "$(curl -s https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/download-center/opensource/oceanbase-all-in-one/installer.sh)"
source ~/.oceanbase-all-in-one/bin/env.sh

# quickly deploy OceanBase database
obd demo

🐳 Start with docker

Note: We provide images on dockerhub, quay.io and ghcr.io. If you have problems pulling images from dockerhub, please try the other two registries.

  1. Start an OceanBase Database instance:

    # Deploy a mini standalone instance.
    docker run -p 2881:2881 --name oceanbase-ce -e MODE=mini -d oceanbase/oceanbase-ce
    
    # Deploy a mini standalone instance using image from quay.io.
    # docker run -p 2881:2881 --name oceanbase-ce -e MODE=mini -d quay.io/oceanbase/oceanbase-ce
    
    # Deploy a mini standalone instance using image from ghcr.io.
    # docker run -p 2881:2881 --name oceanbase-ce -e MODE=mini -d ghcr.io/oceanbase/oceanbase-ce
  2. Connect to the OceanBase Database instance:

    docker exec -it oceanbase-ce obclient -h127.0.0.1 -P2881 -uroot # Connect to the root user of the sys tenant.

See also Docker Readme for more details.

☸️ Start with Kubernetes

You can deploy and manage OceanBase Database instance in kubernetes cluster with ob-operator quickly. Refer to the document Quick Start for ob-operator to see details.

👨‍💻 Start developing

See OceanBase Developer Document to learn how to compile and deploy a manually compiled observer.

Roadmap

For future plans, see Product Iteration Progress. See also OceanBase Roadmap for more details.

Case study

OceanBase has been serving more than 1000 customers and upgraded their database from different industries, including Financial Services, Telecom, Retail, Internet, and more.

See also success stories and Who is using OceanBase for more details.

System architecture

Introduction to system architecture

Contributing

Contributions are highly appreciated. Read the development guide to get started.

License

OceanBase Database is licensed under the Mulan Public License, Version 2. See the LICENSE file for more info.

Community

Join the OceanBase community via:

sql-lifecycle-management's People

Contributors

archerny avatar caifeizhi avatar dependabot[bot] avatar ifffff avatar luliwjc avatar qidi1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

sql-lifecycle-management's Issues

[Bug]: Stitching sql error

(SELECT CAST(CONCAT('{"columns": [',IFNULL(@cols,''),'], "indexes": [',IFNULL(@indexes,''),'], "tables":[',IFNULL(@tbls,''),'],
    "version": "', VERSION(), '"}') AS CHAR) as metadata_json FROM
    (SELECT (@cols:=NULL), (SELECT (0) FROM information_schema.columns cols
    WHERE table_schema = 'mes_cert' AND table_name in ('exhaust_upload_history,cert_print_history')
    AND (0x00) IN (@cols:=CONCAT_WS(',', @cols, CONCAT('{"schema":"',cols.table_schema,'","table":"',cols.table_name,'",
    "name":"', replace(cols.column_name,'"', '\"'), '","type":"', cols.column_type, '","nullable":',
    IF(cols.IS_NULLABLE = 'YES', 'true', 'false'),  '}')))) ) cols,
    (SELECT (@indexes:=NULL), (SELECT (0) FROM information_schema.statistics indexes
    WHERE table_schema = 'mes_cert' AND table_name in ('exhaust_upload_history,cert_print_history')
    AND (0x00) IN (@indexes:=CONCAT_WS(',', @indexes, CONCAT('{"schema":"',indexes.table_schema,'","table":"',indexes.table_name,'",
    "name":"', indexes.index_name, '","column":"', indexes.column_name, '",
    "cardinality":', indexes.cardinality, ',"unique":', IF(indexes.non_unique = 1, 'false', 'true'), '}')))) ) indexes,
    (SELECT (@tbls:=NULL), (SELECT (0) FROM information_schema.tables tbls
    WHERE table_schema = 'mes_cert' AND table_name in ('exhaust_upload_history,cert_print_history') AND (0x00) IN
    (@tbls:=CONCAT_WS(',', @tbls, CONCAT('{', '"schema":"', `TABLE_SCHEMA`, '",', '"table":"', `TABLE_NAME`, '",', '"rows":',
    IFNULL(`TABLE_ROWS`, 0), ',', '"engine":"', IFNULL(`ENGINE`, ''), '"}')))) tbls) x);

front end stitching error

[Bug]: parser error in table alias

Describe the bug

select 
  count(1) as job_count, 
  date_format(y.gmtdate, '%m-%d') as time_node 
from 
  (
    (
      select 
        a.tenant_id, 
        a.namespace_id, 
        a.project_id, 
        a.group_name, 
        a.flow_name, 
        a.script_type, 
        a.status, 
        a.is_deleted, 
        a.task_name, 
        a.task_id, 
        a.owner, 
        a.activity_name, 
        a.schedule_type, 
        a.task_type, 
        a.gmt_create, 
        b.rule_type, 
        b.activity_inst_id, 
        b.biz_date 
      from 
        (
          select 
            rule_type, 
            task_id, 
            activity_inst_id, 
            biz_date 
          from 
            jss_alarm_log 
          where 
            1 = 1 
            and rule_type = 5 
          group by 
            activity_inst_id
        ) b 
        inner join (
          select 
            a1.tenant_id, 
            a1.namespace_id, 
            a1.project_id, 
            a1.group_name, 
            a1.flow_id, 
            a2.flow_name, 
            a2.script_type, 
            a2.status, 
            a2.task_name, 
            a2.task_id, 
            a2.owner, 
            a2.activity_name, 
            a2.schedule_type, 
            a2.task_type, 
            a2.gmt_create, 
            a2.is_deleted 
          from 
            (
              select 
                a11.tenant_id, 
                a11.namespace_id, 
                a11.project_id, 
                a11.group_name, 
                a12.flow_name as flow_name_1, 
                a12.id as flow_id 
              from 
                (
                  select 
                    p.tenant_id, 
                    p.namespace_id, 
                    p.project_id, 
                    q.group_name 
                  from 
                    jss_user_group_relation p 
                    inner join jss_cdf_group_def q on p.group_id = q.group_id 
                    and p.tenant_id = '0000070002' 
                    and p.namespace_id = 'e96d6777-d7fd-478f-ab8c-8df25877dff5'
                ) a11 
                inner join jss_cdf_flow_def a12 on a11.group_name = a12.group_name
            ) a1 
            inner join jss_task_define a2 on a1.flow_name_1 = a2.flow_name 
            and a2.activity_name <> 'startactivity' 
            and a2.is_deleted = 0 
            and a2.owner = '0005293676'
        ) a on a.task_id = b.task_id
    ) x 
    inner join ods_phoenix_task_inst y on x.activity_inst_id = y.task_id 
    and y.dag_type = 0
  ) 
group by 
  bizdate 
order by 
  bizdate

an error happened when parser this sql.

SyntaxError: The current version does not support this SQL 6 (x)

[Bug]: length of columns in some meta table need to be longer

Check Before Asking

  • Please check the issue list and confirm this bug is encountered for the first time.
  • Please try full text in English and attach precise description.

Environment

No response

Fast Reproduce Steps

host_ip varchar(32) DEFAULT NULL COMMENT 'DB服务器地址,pull授权必填'

In some cases, we may use dns instead of ip, so this column's length may be too short. Please change this init.sql and make it more suitable.

Actual Behavior

host_ip varchar(32) DEFAULT NULL COMMENT 'DB服务器地址,pull授权必填'

In some cases, we may use dns instead of ip, so this column's length may be too short. Please change this init.sql and make it more suitable.

Expected Behavior

No response

Other Information

No response

[Bug]: double type is not supported in oceanbase parser module

Check Before Asking

  • Please check the issue list and confirm this bug is encountered for the first time.
  • Please try full text in English and attach precise description.

Environment

v0.1.0

Fast Reproduce Steps

sql = """
SELECT Winner FROM table_11621915_1 WHERE Purse > 964017.2297960471 AND Date_ds = "may 28"
"""
sql = Utils.remove_sql_text_affects_parser(sql)
result = oceanbase_parser.parse(sql)

Actual Behavior

E SyntaxError: The current version does not support this SQL 56 (.)
E select winner from table_11621915_1 where purse > 964017.2297960471 and date_ds = "may 28"

Expected Behavior

No response

Other Information

No response

[Bug]: filter_column_list needs to consider the between operator

 select max(`successRate`) AS `successRate` from `table_850d` where `period` between '2022-07-11 00:00:00' and '2022-07-11 23:59:59' and `successRate` < 0.35;

Expected Behavior:
filter_column_list = [{'column_name': 'period', 'opt': 'between'},{'column_name': 'successRate', 'opt': '<'}]}

[Bug]: update set_list parameterize problem

Check Before Asking

  • Please check the issue list and confirm this bug is encountered for the first time.
  • Please try full text in English and attach precise description.

Environment

0.1.0

Fast Reproduce Steps

def test_update_parameterize(self):
    sql = """
        UPDATE `t1` SET `c`='11' WHERE (`id`='1111111')        
    """
    statement_node = ParserUtils.parameterized_query(parser.parse(sql))
    statement = format_sql(statement_node, 0)

Actual Behavior

statement = 'UPDATE t1 SET c = '11' WHERE id = ?'

Expected Behavior

statement = 'UPDATE t1 SET c = ? WHERE id = ?'

Other Information

No response

[Bug]: parse union SyntaxError

Check Before Asking

  • Please check the issue list and confirm this bug is encountered for the first time.
  • Please try full text in English and attach precise description.

Environment

v0.1.0

Fast Reproduce Steps

sql = """
( select 球员id from 球员夺冠次数 order by 冠军次数 asc limit 3 ) union ( select 球员id from 球员夺冠次数 order by 亚军次数 desc limit 5 )
"""
sql = Utils.remove_sql_text_affects_parser(sql)
result = oceanbase_parser.parse(sql)
assert isinstance(result, Statement)

Actual Behavior

E SyntaxError: The current version does not support this SQL 47 (union)
E ( select 球员id from 球员夺冠次数 order by 冠军次数 asc ) union ( select 球员id from 球员夺冠次数 order by 亚军次数 desc )

Expected Behavior

No response

Other Information

No response

[Bug]: Predicate does not support vector expressions

Check Before Asking

  • Please check the issue list and confirm this bug is encountered for the first time.
  • Please try full text in English and attach precise description.

Environment

V0.1.0

Fast Reproduce Steps

select id from table where ((id) > ('29')) order by id asc limit 199,1

Actual Behavior

parse

Expected Behavior

No response

Other Information

No response

[Bug]: set_list NullLiteral error

Check Before Asking

  • Please check the issue list and confirm this bug is encountered for the first time.
  • Please try full text in English and attach precise description.

Environment

v0.1.0

Fast Reproduce Steps

UPDATE table SET consumer_server_ip = NULL WHERE biz_date = '2021-08-13 00:00:00' AND consumer_server_ip = 'xxxx'

Actual Behavior

NullLiteral object has no attribute 'value'

Expected Behavior

No response

Other Information

No response

cardinality null cause wrong meta_json,this may cause wrong Optimization.

Describe the bug
image

Environment

  • OS Version and CPU Arch(uname -a):
    Linux sqless 3.10.0-957.27.2.el7.x86_64 #1 SMP Mon Jul 29 17:46:05 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • Component Version:
    latest

Fast Reproduce Steps(Required)
cardinality null cause wrong result.
image

Steps to reproduce the behavior:

Expected behavior
{"schema":"DB1","table":"TABLE1",
"name":"INDEX1","column":"COL1",
"cardinality":RIGHT NUMBER,"unique":false}
Actual Behavior
wrong result
Additional context
image

[Doc]: Docs about architecture is needed

Through the official website(Chinese), you can find all the documents about OceanBase.

Description
New beginners like me will be at loss in face to the bulk of code. I think this project needs some docs that introduces its code, how to contribute, architecture and so on.

Documentation Links
No.

Additional context
No.

[Bug]: lead function is not support

Describe the bug

select 
    distinct t.num as ConsecutiveNums 
from
(
    select
        num, 
        lag(num, 1, null) over(order by id) as lag_num, 
        lead(num, 1, null) over(order by id) as lead_num
    from Logs
) t
where t.num = t.lag_num and t.num = t.lead_num

an error happened when parser this sql.

E           SyntaxError: The current version does not support this SQL 30 (() 
E                    lag(num, 1, null) over(order by id) as lag_num, 

[Bug]: format_sql() should remove the last newline

Check Before Asking

  • Please check the issue list and confirm this bug is encountered for the first time.
  • Please try full text in English and attach precise description.

Environment

0.1.0

Fast Reproduce Steps

def test_update_parameterize(self):
    sql = """
        UPDATE `t1` SET `c`='11' WHERE (`id`='1111111')          
    """
    statement_node = ParserUtils.parameterized_query(parser.parse(sql))
    statement = format_sql(statement_node, 0)

Actual Behavior

statement == """UPDATE t1 SET c = ? WHERE id = ?
"""

Expected Behavior

statement == """UPDATE t1 SET c = ? WHERE id = ?"""

Other Information

No response

[Bug]: parser_error

select t2.biz_date as biz_date, f1.calculate_field / t2.calculate_field1 as 1d_remain_rate from ( select t1.biz_date as biz_date , count(DISTINCT if(t1.biz_date_is_visit = '1', t1.user_id, null)) as calculate_field1 from ( select * from pets_user_miaowa_galileo_visit_user_di ) t1 where t1.appname in ('AppPetWXSS', 'HelloPet') and t1.biz_date between date_format(date_sub(date_format(date_sub(curdate(), interval 1 day), '%Y%m%d'), interval 1 day), '%Y%m%d') and date_format(date_sub(curdate(), interval 1 day), '%Y%m%d') group by t1.biz_date ) t2 left join ( select date_format(date_format(date_add(t1.biz_date, interval -1 day), '%Y%m%d'), '%Y%m%d') as biz_date , count(DISTINCT if(datediff(t1.biz_date, t1.last_visit_date) = 1 and t1.biz_date_is_visit = '1', t1.user_id, null)) as calculate_field from ( select * from pets_user_miaowa_galileo_visit_user_di ) t1 where t1.appname in ('AppPetWXSS', 'HelloPet') and t1.biz_date between date_format(date_sub(date_format(date_sub(curdate(), interval 1 day), '%Y%m%d'), interval 1 day), '%Y%m%d') and date_format(date_sub(curdate(), interval 1 day), '%Y%m%d') group by date_format(date_format(date_add(t1.biz_date, interval -1 day), '%Y%m%d'), '%Y%m%d') ) f1 on t2.biz_date = f1.biz_date order by biz_date asc limit 0, 1000

[Bug]: Make limit and offset belong to Query

Describe the bug

A SQL like that

select a from test1 union select b from test2 order by a limit 4

the order by and limit is for the table after UNION, not the test2 table.

test1 data test2 data sql execute result

But now in sql-lifecycle-management, the order by belong to the table after UNION, limit belong to the test2 table.

def p_set_operation_stmt_w_order_limit(p):
    r"""set_operation_stmt_w_order_limit :  set_operation_stmt_subquery order_by limit_stmt
    | subquery order_by limit_stmt
    """
    offset, limit = 0, 0
    if p[3]:
        offset, limit = p[3][0], p[3][1]
    p[0] = Query(
        p.lineno(1),
        p.lexpos(1),
        with_=None,
        query_body=p[1],
        order_by=p[2],
        offset=offset,
        limit=limit,
    )

[Feat.]: deploy with conda

Check Before Asking

  • Please check the issue list and confirm this feature is encountered for the first time.
  • Please try full text in English and attach precise description.

Description

There are too many python versions, use docker deploy to reduce installation dependencies

Other Information

No response

What's the real name of this tool?[Doc]:

Check Before Asking

  • Please check the issue list and confirm this issue is encountered for the first time.

Description

Why the logo and title of home page is SQL Less?

Documentation Links

......

Are you willing to submit a pull request?

  • Yes I am willing to submit a pull request.

[Bug]: order by has parentheses SyntaxError

Check Before Asking

  • Please check the issue list and confirm this bug is encountered for the first time.
  • Please try full text in English and attach precise description.

Environment

No response

Fast Reproduce Steps

sql = """
SELECT channel_code , contact_number FROM customer_contact_channels WHERE active_to_date - active_from_date = (SELECT active_to_date - active_from_date FROM customer_contact_channels ORDER BY (active_to_date - active_from_date) DESC LIMIT 1)
"""
sql = Utils.remove_sql_text_affects_parser(sql)
result = oceanbase_parser.parse(sql)
assert isinstance(result, Statement)

Actual Behavior

SyntaxError

Expected Behavior

No response

Other Information

No response

[Bug]: order_list error for functioncall

Check Before Asking

  • Please check the issue list and confirm this bug is encountered for the first time.
  • Please try full text in English and attach precise description.

Environment

v0.1.0

Fast Reproduce Steps

select department_id , count ( * ),max(gid) from staff_department_assignments group by department_id order by count ( * ) desc,max(gid)

Actual Behavior

order_list has no gid column

Expected Behavior

No response

Other Information

No response

[Bug]: cast function is not supported

SELECT DISTINCT T1.PATIENT FROM conditions AS T1 INNER JOIN all_prevalences AS T2 ON lower(T2.ITEM) = lower(T1.DESCRIPTION) WHERE T2.PREVALENC = CAST(18.8 AS float)

[Bug]: `CONTACT` keyword is not support

Describe the bug
When parsing the following SQL using parser:

SELECT  IF(husband_user_id>wife_user_id,CONCAT(husband_user_id,'-',wife_user_id),CONCAT(wife_user_id,'-',husband_user_id)) AS uniq_id
        ,'1' AS couple_flag
FROM    dws_rel_sns_couple_dd
WHERE   dt = MAX_PT('dws_rel_sns_couple_dd')
AND     p_level in ('S','AAA','AA')
GROUP BY IF(husband_user_id>wife_user_id,CONCAT(husband_user_id,'-',wife_user_id),CONCAT(wife_user_id,'-',husband_user_id))

An error occurred

State  : 594
Stack  : SELECT qualified_name LPAREN call_list COMMA . LexToken(CONCAT,'concat',1,40)
ERROR: Error  : SELECT qualified_name LPAREN call_list COMMA . LexToken(CONCAT,'concat',1,40

It caused by CONTACT keyword is not support.

[Bug]: select boolean expression parse error

SELECT T1.list_followers, T2.user_subscriber = 1 FROM lists AS T1 INNER JOIN lists_users AS T2 ON T1.user_id = T2.user_id AND T2.list_id = T2.list_id WHERE T2.user_id = 4208563 ORDER BY T1.list_followers DESC LIMIT 1

image

[Bug]: CURRENT_DATE() SyntaxError

Check Before Asking

  • Please check the issue list and confirm this bug is encountered for the first time.
  • Please try full text in English and attach precise description.

Environment

0.1.0

Fast Reproduce Steps

oceanbase_parser.parse("""
select req_node_id, resp_node_id, interface_name from tr_flow where req_node_id not in ('sccore') and flow_last_data > (CURRENT_DATE() - INTERVAL 30 day)+'0' and resp_node_id = 'finmember'
""")

Actual Behavior

SyntaxError: The current version does not support this SQL 140 (()
select req_node_id, resp_node_id, interface_name from tr_flow where req_node_id not in ('sccore') and flow_last_data > (CURRENT_DATE() - INTERVAL 30 day)+'0' and resp_node_id = 'finmember'

Expected Behavior

No response

Other Information

No response

[Bug]: create statement parser error

CREATE TABLE `train_order_info` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `order_serial_no` varchar(64) NOT NULL DEFAULT '' COMMENT '订单号',
  `transaction_serial_no` varchar(64) NOT NULL DEFAULT '' COMMENT '交易流水号',
  `wisdom_travel_serial_no` varchar(160) NOT NULL DEFAULT '' COMMENT '彗星订单号',
  `electronic_serial_no` varchar(160) NOT NULL DEFAULT '' COMMENT '电子订单号',
  `train_serial_no` varchar(100) NOT NULL DEFAULT '' COMMENT '12306流水号',
  `merchant_serial_no` varchar(100) NOT NULL DEFAULT '' COMMENT '供应商订单流水号',
  `relation_order_serial_no` varchar(64) NOT NULL DEFAULT '' COMMENT '联程关联订单号,方便分片库查询',
  `connect_type` int(11) NOT NULL DEFAULT '0' COMMENT '联程类型',
  `order_source` int(11) NOT NULL DEFAULT '0' COMMENT '订单来源',
  `occupy_type` int(11) NOT NULL DEFAULT '0' COMMENT '占座模式',
  `ability_require` int(11) NOT NULL DEFAULT '0' COMMENT '能力项,位操作',
  `resign_count` int(11) NOT NULL DEFAULT '0' COMMENT '分单次数',
  `order_state` int(11) NOT NULL DEFAULT '0' COMMENT '订单状态',
  `lock_state` int(11) NOT NULL DEFAULT '0' COMMENT '锁定状态',
  `merchant_sync_state` int(11) NOT NULL DEFAULT '0' COMMENT '同步供应商状态',
  `customer_sync_state` int(11) NOT NULL DEFAULT '0' COMMENT '同步c端状态',
  `merchant_sync_count` int(11) NOT NULL DEFAULT '0' COMMENT '同步供应商供次数',
  `customer_sync_count` int(11) NOT NULL DEFAULT '0' COMMENT '同步c端次数',
  `contact_name` varchar(20) NOT NULL DEFAULT '' COMMENT '联系人姓名',
  `contact_phone` varchar(20) NOT NULL DEFAULT '' COMMENT '联系电话',
  `contact_other_phone` varchar(20) NOT NULL DEFAULT '' COMMENT '其他联系人电话',
  `contact_email` varchar(50) NOT NULL DEFAULT '' COMMENT '联系人邮箱',
  `merchant_id` varchar(50) NOT NULL DEFAULT '' COMMENT '供应商id',
  `merchant_code` varchar(50) NOT NULL DEFAULT '' COMMENT '供应商code',
  `merchant_type` int(10) NOT NULL DEFAULT '0' COMMENT '供应商类型',
  `ticket_machine_id` varchar(50) NOT NULL DEFAULT '' COMMENT '票机id',
  `window_no` varchar(50) NOT NULL DEFAULT '' COMMENT '票机窗口',
  `gmt_created` datetime NOT NULL DEFAULT '1900-01-01 00:00:00' COMMENT '下单时间',
  `gmt_expired` datetime NOT NULL DEFAULT '1900-01-01 00:00:00' COMMENT '过期时间',
  `gmt_canceled` datetime NOT NULL DEFAULT '1900-01-01 00:00:00' COMMENT '订单取消时间',
  `gmt_booked` datetime NOT NULL DEFAULT '1900-01-01 00:00:00' COMMENT '预订完成时间',
  `gmt_issue_end` datetime NOT NULL DEFAULT '1900-01-01 00:00:00' COMMENT '出票截至时间',
  `gmt_arrive` datetime NOT NULL DEFAULT '1900-01-01 00:00:00' COMMENT '抵达时间',
  `gmt_departure` datetime NOT NULL DEFAULT '1900-01-01 00:00:00' COMMENT '出发时间',
  `departure_station` varchar(30) NOT NULL DEFAULT '' COMMENT '出发车站名称',
  `arrival_station` varchar(30) NOT NULL DEFAULT '' COMMENT '抵达车站名称',
  `train_code` varchar(10) NOT NULL DEFAULT '' COMMENT '车次号',
  `customize_type` int(10) NOT NULL DEFAULT '0' COMMENT '定制类型',
  `customize_content` varchar(100) NOT NULL DEFAULT '' COMMENT '定制内容',
  `accept_other` int(10) NOT NULL DEFAULT '0' COMMENT '是否接收其他坐席',
  `accept_no_seat` int(10) NOT NULL DEFAULT '0' COMMENT '是否接收无座',
  `back_up_seat_class` varchar(50) NOT NULL DEFAULT '' COMMENT '备选座位等级',
  `pay_type` int(10) NOT NULL DEFAULT '0' COMMENT '支付方式',
  `pay_serial_no` varchar(50) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '电子支付流水号',
  `passenger_info` varchar(300) NOT NULL DEFAULT '' COMMENT '乘客信息',
  `total_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '供应商出票总价',
  `total_fee` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '供应商出票总费用',
  `total_ticket_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '供应商总票面价',
  `remark` varchar(255) NOT NULL DEFAULT '' COMMENT '客服备注',
  `ext` varchar(2000) NOT NULL DEFAULT '' COMMENT '订单扩展属性',
  `is_delete` int(11) NOT NULL DEFAULT '0' COMMENT '是否删除(0:未删除 / 1:已删除)',
  `CreateTime` datetime NOT NULL DEFAULT '1900-01-01 00:00:00' COMMENT '创建时间',
  `UpdateTime` datetime NOT NULL DEFAULT '1900-01-01 00:00:00' COMMENT '修改时间',
  `env` varchar(18) NOT NULL DEFAULT 'prod' COMMENT '生产:prod,预发:stage,测试:qa,dev测试:test,集成测试:uat',
  `gmt_occupied` datetime NOT NULL DEFAULT '1900-01-01 00:00:00' COMMENT '占座时间',
  `phone_verify_type` int(11) NOT NULL DEFAULT '0' COMMENT '乘客手机号核验类型(1-仅需一个码,2-需多个码,3-获取验证码或修改手机号)',
  `phone_verify_status` int(11) NOT NULL DEFAULT '0' COMMENT '乘客手机号核验状态(0-默认无需核验 1-待核验 2-需重新发送验证码 3-短信验证码已回填 4-已核验)',
  `origin_pay_serial_no` varchar(50) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '支付流水(自动获取)',
  `gmt_distribute` datetime NOT NULL DEFAULT '1900-01-01 00:00:00' COMMENT '分单时间',
  `gmt_finished` datetime NOT NULL DEFAULT '1900-01-01 00:00:00' COMMENT '订单完结时间',
  `related_seat` int(11) NOT NULL DEFAULT '0' COMMENT '是否连坐(0-未知,1-是,2-否)',
  `origin_electronic_serial_no` varchar(160) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '原始电子订单号',
  `is_modify` int(11) NOT NULL DEFAULT '0' COMMENT '是否修改(0:未修改 / 1:已修改)',
  `origin_train_serial_no` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '原始12306流水号',
  `abilities` varchar(512) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '能力项code,多个英文逗号符分割',
  `total_servicefee` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '供应商服务费',
  `gmt_notify_issue` datetime NOT NULL DEFAULT '1900-01-01 00:00:00' COMMENT '通知出票时间',
  `gmt_latest_issue` datetime NOT NULL DEFAULT '1900-01-01 00:00:00' COMMENT '最晚出票时间',
  `gmt_locked` datetime NOT NULL DEFAULT '1900-01-01 00:00:00' COMMENT '锁单时间',
  `relation_transaction_serial_no` varchar(64) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '关联交易流水号',
  `merchant_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '供应商名称',
  `merchant_short_name` varchar(50) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '供应商简称',
  `inquire_type` int(11) NOT NULL DEFAULT '0' COMMENT '查询单类型0:不是,1查询单',
  `passenger_count` int(11) NOT NULL DEFAULT '0' COMMENT '乘客数量',
  `merchant_business_type` int(4) NOT NULL DEFAULT '0' COMMENT '供应商业务类型0普通,1港铁',
  `total_foreign_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '票面总价外币价格',
  `rebate_foreign_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '返点的外币价格',
  `currency` varchar(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'CNY' COMMENT '币种',
  `roe` decimal(10,2) NOT NULL DEFAULT '1.00' COMMENT '汇率',
  `price_check` int(4) NOT NULL DEFAULT '0' COMMENT '是否有差额,0没有,1有',
  `passenger_credit` varchar(64) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '乘客证件类型',
  `area_code` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '地区编码',
  `account_manager` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '客户经理',
  PRIMARY KEY (`id`) ,
  KEY `ix_k_order_serial_no` (`order_serial_no`),
  KEY `i_order_serial` (`order_state`,`order_serial_no`,`merchant_id`),
  KEY `i_occupy_order_state` (`occupy_type`,`order_state`,`gmt_issue_end`,`gmt_created`),
  KEY `i_occupy_order_gmt_departure` (`occupy_type`,`order_state`,`env`,`gmt_departure`),
  KEY `i_occupy_state_machine` (`occupy_type`,`order_state`,`ticket_machine_id`,`merchant_id`,`env`),
  KEY `i_order_state_gmt_created_env` (`order_state`,`gmt_created`,`env`),
  KEY `i_gmt_issue_end_gmt_issue_end` (`gmt_issue_end`,`gmt_created`),
  KEY `i_state_id_distribute` (`order_state`,`ticket_machine_id`,`merchant_id`,`env`,`gmt_distribute`,`gmt_created`),
  KEY `i_merchant_pay_serial_no` (`merchant_id`,`pay_serial_no`),
  KEY `i_ticket_machine_id_merchant_id` (`ticket_machine_id`,`merchant_id`),
  KEY `i_order_customer_UpdateTime` (`order_state`,`customer_sync_state`,`UpdateTime`),
  KEY `i_gmt_finished` (`gmt_finished`),
  KEY `i_gmt_notify_issue` (`gmt_notify_issue`),
  KEY `i_state_id_gmt_distribute` (`order_state`,`merchant_id`,`env`,`gmt_distribute`),
  KEY `i_env_gmt_distribute` (`env`,`gmt_distribute`),
  KEY `i_merchant_gmt_distribute` (`merchant_id`,`gmt_distribute`),
  KEY `i_state_merchant_gmt_distribute` (`order_state`,`merchant_id`,`gmt_distribute`),
  KEY `i_CreateTime_env` (`env`,`CreateTime`),
  KEY `i_env_gmt_created` (`env`,`gmt_created`),
  KEY `i_env_distribute_created` (`env`,`gmt_distribute`,`gmt_created`),
  KEY `i_order_state_id_env_gmt_finished` (`order_state`,`merchant_id`,`ticket_machine_id`,`env`,`gmt_finished`,`gmt_booked`),
  KEY `i_env_gmt_distribute_type` (`env`,`gmt_distribute`,`inquire_type`),
  KEY `i_state_env_distribute_merchant` (`order_state`,`env`,`gmt_distribute`,`merchant_business_type`,`gmt_created`),
  KEY `i__env_distribute_merchant` (`env`,`gmt_distribute`,`merchant_business_type`,`gmt_created`),
  KEY `i_id_distribute_gmt_created` (`ticket_machine_id`,`merchant_id`,`env`,`gmt_distribute`,`gmt_created`),
  KEY `i_type_state` (`occupy_type`,`order_state`,`ticket_machine_id`,`merchant_id`,`env`,`gmt_created`),
  KEY `i_type_state_id` (`occupy_type`,`order_state`,`ticket_machine_id`,`merchant_id`,`env`,`gmt_distribute`),
  KEY `I_machine_id_state_type_env_created` (`ticket_machine_id`,`merchant_id`,`order_state`,`occupy_type`,`env`,`gmt_created`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=3529344021213246782 COMMENT='订单表:订单相关信息存储' 

[Bug]: `with` keyword is not support

Describe the bug
Paser the sql

WITH xm_gl AS ( SELECT * FROM products WHERE pname IN ( '小米电视机', '格力空调' ) ) SELECT avg( price ) FROM xm_gl

Fast Reproduce Steps(Required)

Steps to reproduce the behavior:

Expected behavior

success parser

Actual Behavior

Syntax error in input! Parser State:0 . LexToken(WITH,'WITH',1,0)

[Bug]: error parser cast function

Describe the bug

When parser sql with cast function, an error will happen.

Syntax error in input! Parser State:363 SELECT select_items FROM table_reference . LexToken(LPAREN,'(',1,18

[Doc]: there is no init.sql file in init directory

Check Before Asking

  • Please check the issue list and confirm this issue is encountered for the first time.

Description

image
image

Documentation Links

No response

Are you willing to submit a pull request?

  • Yes I am willing to submit a pull request.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.