← Winnitude! Search  ·  Reader Mode (1733 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 22 LINKS

feature: Added support for simple CAST by mlilius · Pull Request #39 · JavaScriptor/js-sql-parser

Repository navigation

feature: Added support for simple CAST - #39


Open
mlilius wants to merge 1 commit into JavaScriptor:master from mlilius:cast-support
Open

feature: Added support for simple CAST #39 mlilius wants to merge 1 commit into JavaScriptor:master from mlilius:cast-support

Conversation

mlilius commented May 20, 2020



Copy link Copy Markdown

This will not handle all versions of CAST but will handle a simple case like CAST(pct*100 AS int)

The query mentioned in #9 was used as the test.

select
    concat(dsw_cluster_name,',',logic_pod_name) as event_obj,
    concat(dsw_cluster_name,',',logic_pod_name, ' PFC STORM. 详情: ',
    '流量突跃 ',
    cast(FLOW_RX_BPS_RATE100 as int),
    '%(RX)',
    '; ',
    cast(FLOW_TX_BPS_RATE100 as int),
    '%(TX)',
    '; PFC 突增 ',
    cast(PFC_RX_PPS_RATE*100 as int),
    '%(RECV)') as brief
from SOURCE_BASIC_EVENT_POD_FLOW_AND_PFC_TREND
where win_end >= '2020-05-19 21:14:12'
    and win_end < '2020-05-20 21:14:12'
    and PFC_RX_PPS_RATE >= 100
    and (FLOW_RX_BPS_RATE <= -0.2 and FLOW_TX_BPS_RATE <= -0.2)
Added support for simple casts 09a5275 albin3 added the enhancement label May 21, 2020

albin3 commented May 21, 2020



Copy link Copy Markdown
Member

hello @mlilius , CHARACTER SET grammar should be supported in this feature follows https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html . see examples : "SELECT CAST('test' AS CHAR CHARACTER SET utf8 COLLATE utf8_bin);"

Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment

Labels

enhancement

2 participants