[GH-ISSUE #2737] 在impala-shell粘贴比较长的sql语句,会自动丢失一部分字符,执行报错 #1784

Open
opened 2026-02-27 00:04:50 +03:00 by kerem · 2 comments
Owner

Originally created by @ygzhong000 on GitHub (Jan 30, 2023).
Original GitHub issue: https://github.com/electerm/electerm/issues/2737

Electerm Version and download file extension(Electerm版本和下载文件后缀)

electerm-1.25.12-win-x64-installer.exe

Platform detail (平台详情)

Windows 11 X64

What steps will reproduce the bug?(重新问题的详细步骤)

在impala-shell粘贴比较长的sql语句,会自动丢失一部分字符,执行报错
1
这是原始的sql语句:
2

What should have happened?(期望的结果)

期望在electerm粘贴比较长的字符时,不要丢失部分字符。如下图:
3

Would this happen in other terminal app(是否能够在其他同类软件重现这个问题)

其他同类软件不会出现此类问题。

Additional information(其他任何相关信息)

No response

Originally created by @ygzhong000 on GitHub (Jan 30, 2023). Original GitHub issue: https://github.com/electerm/electerm/issues/2737 ### Electerm Version and download file extension(Electerm版本和下载文件后缀) electerm-1.25.12-win-x64-installer.exe ### Platform detail (平台详情) Windows 11 X64 ### What steps will reproduce the bug?(重新问题的详细步骤) 在impala-shell粘贴比较长的sql语句,会自动丢失一部分字符,执行报错 ![1](https://user-images.githubusercontent.com/9987446/215424241-f2c38d8e-9547-4bd3-8526-d668f2b2f4fc.png) 这是原始的sql语句: ![2](https://user-images.githubusercontent.com/9987446/215424386-5a642fa6-037a-4d0f-aa33-3bd9973b30fa.png) ### What should have happened?(期望的结果) 期望在electerm粘贴比较长的字符时,不要丢失部分字符。如下图: ![3](https://user-images.githubusercontent.com/9987446/215425687-35eb233c-47c5-40ac-8f61-710386fcde2d.png) ### Would this happen in other terminal app(是否能够在其他同类软件重现这个问题) 其他同类软件不会出现此类问题。 ### Additional information(其他任何相关信息) _No response_
Author
Owner

@zxdong262 commented on GitHub (Jan 30, 2023):

可以提供一个测试sql语句不,可以复现这个问题的

<!-- gh-comment-id:1408678751 --> @zxdong262 commented on GitHub (Jan 30, 2023): 可以提供一个测试sql语句不,可以复现这个问题的
Author
Owner

@ygzhong000 commented on GitHub (Jan 30, 2023):

可以提供一个测试sql语句不,可以复现这个问题的

select
8,
6,
'FUBON',
'ConsumerLoan',
a.TrustCode,
'2022-10-22',
ISNULL(TotalCPB,0) as TotalCPB,
ISNULL(LoanCount,0) as LoanCount,
ISNULL(CustomerCount,0) as CustomerCount,
ISNULL(cast(TotalCPB/(case when countsInDuration=0 then 1 else countsInDuration end) as decimal(18,4)),0) AS AverageCurrentPrincipalBalance,
CurrentPricipalBalanceRange,
CurrentRateRange,
RemainTermRange,
ISNULL(WeightedAverageSeasoning,0) as WeightedAverageSeasoning,
ISNULL(cast(WeightedAverageLoanTerm as decimal(18,4)),0) as WeightedAverageLoanTerm,
WeightedAverageCurrentRate,
WeightedAverageRemainTerm,
ISNULL(cast(CustomerCountWithCrediting/case when CustomerCount=0 then 1 else CustomerCount END as decimal(18,4)),0) as WithCreditingCustomerPercentage,
isnull(TotalApproveAmount,0) as TotalApproveAmount,
ApproveAmountRange,
LoanTermRange,
ISNULL(WeightedAverageAge,0) as WeightedAverageAge,
ISNULL(InArrearsCPB,0) as InArrearsCurrentPrincipalBalance,
ISNULL(InArrearsLoanCount,0) as InArrearsLoanCount,
ISNULL(InArrearsCoustomerCount,0) as InArrearsCustomerCount,
ISNULL(cast(InArrearsCPB/ case when InArrearsCoustomerCount =0 then 1 else InArrearsCoustomerCount end as decimal(18,4)),0) as AverageArrearsAmount, --逾期金额含义改为逾期资产剩余本金,原先含义保留,计算时使用剩余本金
ISNULL(AverageDaysInArrears,0) as AverageDaysInArrears,
ISNULL(cast(InArrearsCPB/case when NoRefundedPrincipal=0 then 1 else NoRefundedPrincipal end as decimal(18,4)),0) AS ArrearsRate,
ISNULL(ArrearsAmount,0) as ArrearsAmount
from(
select
ISNULL(Trustcode,'UNK') AS Trustcode,
concat('[',cast(cast(min(ApprovalAmount) as decimal(18,2)) as string),'-',cast(cast(max(ApprovalAmount) as decimal(18,2)) as string),']') AS ApproveAmountRange
,concat('[',cast(cast( min(CurrentRate100) as decimal(18,2)) as string),'-',cast(cast( max(CurrentRate100) as decimal(18,2)) as string),']') AS CurrentRateRange,
concat('[',cast(cast( min( LoanTerm) as int) as string),'-',cast(cast( max(LoanTerm) as int) as string),']') AS LoanTermRange,
sum(ApprovalAmount) AS TotalApproveAmount
,count(1) AS LoanCount
,cast(SUM(ApprovalAmountCurrentRate100)/NULLIF(SUM(ApprovalAmount),0) as decimal(18,4)) AS WeightedAverageCurrentRate-- 这里需要年化利率
,cast(SUM(ApprovalAmountLoanTerm)/NULLIF(SUM(ApprovalAmount),0) as decimal(18,4)) AS WeightedAverageLoanTerm
,count(1) AS countsInDuration
,sum(CurrentPrincipalBalance) AS TotalCPB
,sum(CurrentPrincipalBalance) AS NoRefundedPrincipal
,concat('[',cast(cast(min(CurrentPrincipalBalance) as decimal(18,2)) as string),'-',cast(cast(max(CurrentPrincipalBalance) as decimal(18,2)) as string),']') as CurrentPricipalBalanceRange
,concat('[',cast(cast( min( RemainingTerm) as int) as string),'-',cast(cast( max(RemainingTerm) as int) as string),']') as RemainTermRange
,cast(SUM(Seasoning
CurrentPrincipalBalance)/NULLIF(SUM(CurrentPrincipalBalance),0) as decimal(18,4)) AS WeightedAverageSeasoning
,cast(SUM(RemainingTerm*CurrentPrincipalBalance)/NULLIF(SUM(CurrentPrincipalBalance),0) as decimal(18,4)) AS WeightedAverageRemainTerm
,count(1) AS TotalApproveCount
from adc.tblloan fl
where fl.AssetType = 'ConsumerLoan' and fl.DimOrganisationID = 6 and fl.reportingdate='2022-10-22' and datasourceid=8
GROUP BY TrustCode
)a left JOIN(
select ISNULL(fl.Trustcode ,'UNK') AS Trustcode
,count(distinct fl.Code) AS CustomerCount
,round(sum((cast(year(now()) as int)-fl.YearOfBirth)ApprovalAmount) / NULLIF(SUM(ApprovalAmount),0),4) AS WeightedAverageAge
--into #customerStatistics
from adc.tblloan fl
--inner join dbo.tblFactLoanCustomer flc on flc.DimCustomerID=dc.DimCustomerID and dc.DimOrganisationID=flc.DimOrganisationID
--inner join dbo.tblFactLoan fl on flc.DimLoanID=fl.DimLoanID and flc.DimOrganisationID=fl.DimOrganisationID and flc.DimReportingDateID=fl.DimReportingDateID
where fl.AssetType = 'ConsumerLoan' and fl.DimOrganisationID = 6 and fl.reportingdate='2022-10-22' and datasourceid=8
GROUP BY fl.TrustCode
)b on a.TrustCode = b.TrustCode
left join(
select ISNULL(fl.Trustcode ,'UNK') AS Trustcode,
count(distinct code) AS CustomerCountWithCrediting
--INTO #CustomerCountWithCrediting
from adc.tblloan fl
--inner join dbo.tblFactLoanCustomer flc on flc.DimCustomerID=dc.DimCustomerID and dc.DimOrganisationID=flc.DimOrganisationID
--inner join dbo.tblFactLoan fl on flc.DimLoanID=fl.DimLoanID and flc.DimOrganisationID=fl.DimOrganisationID and flc.DimReportingDateID=fl.DimReportingDateID
where fl.AssetType = 'ConsumerLoan' and fl.DimOrganisationID = 6 and fl.reportingdate='2022-10-22' and datasourceid=8
and fl.CollateralMethod is not null and fl.CollateralMethod!='-1'
GROUP BY fl.TrustCode
)c on a.TrustCode = c.TrustCode
left join(
select ISNULL(fl.Trustcode ,'UNK') AS Trustcode,count(distinct fl.Code) AS InArrearsCoustomerCount -- 身份证号
--into #InArrearsCoustomerCount
from adc.tblloan fl
--inner join dbo.tblFactLoanCustomer flc on flc.DimCustomerID=dc.DimCustomerID and dc.DimOrganisationID=flc.DimOrganisationID
--inner join dbo.tblFactLoan fl on flc.DimLoanID=fl.DimLoanID and flc.DimOrganisationID=fl.DimOrganisationID and flc.DimReportingDateID=fl.DimReportingDateID
where fl.AssetType = 'ConsumerLoan' and fl.DimOrganisationID = 6 and fl.reportingdate='2022-10-22' and datasourceid=8
and fl.DaysInarrears > 0
GROUP BY fl.TrustCode
)d on a.TrustCode = d.TrustCode
left join(
select ISNULL(fl.Trustcode ,'UNK') AS Trustcode
,isnull(sum(CurrentPrincipalBalance),0) AS InArrearsCPB
,isnull(sum(ArrearsAmount1),0) AS ArrearsAmount -- 逾期金额
,count(1) AS InArrearsLoanCount
,isnull(sum(CurrentPrincipalBalance
DaysInarrears)/NULLIF(sum(CurrentPrincipalBalance),0),0) AS AverageDaysInArrears
--INTO #arrearsStatistics
from adc.tblloan fl
where fl.AssetType = 'ConsumerLoan' and fl.DimOrganisationID = 6 and fl.reportingdate='2022-10-22' and datasourceid=8
and fl.DaysInarrears > 0
GROUP BY TrustCode
)e on a.TrustCode = e.TrustCode

<!-- gh-comment-id:1408749984 --> @ygzhong000 commented on GitHub (Jan 30, 2023): > 可以提供一个测试sql语句不,可以复现这个问题的 select 8, 6, 'FUBON', 'ConsumerLoan', a.TrustCode, '2022-10-22', ISNULL(TotalCPB,0) as TotalCPB, ISNULL(LoanCount,0) as LoanCount, ISNULL(CustomerCount,0) as CustomerCount, ISNULL(cast(TotalCPB/(case when countsInDuration=0 then 1 else countsInDuration end) as decimal(18,4)),0) AS AverageCurrentPrincipalBalance, CurrentPricipalBalanceRange, CurrentRateRange, RemainTermRange, ISNULL(WeightedAverageSeasoning,0) as WeightedAverageSeasoning, ISNULL(cast(WeightedAverageLoanTerm as decimal(18,4)),0) as WeightedAverageLoanTerm, WeightedAverageCurrentRate, WeightedAverageRemainTerm, ISNULL(cast(CustomerCountWithCrediting/case when CustomerCount=0 then 1 else CustomerCount END as decimal(18,4)),0) as WithCreditingCustomerPercentage, isnull(TotalApproveAmount,0) as TotalApproveAmount, ApproveAmountRange, LoanTermRange, ISNULL(WeightedAverageAge,0) as WeightedAverageAge, ISNULL(InArrearsCPB,0) as InArrearsCurrentPrincipalBalance, ISNULL(InArrearsLoanCount,0) as InArrearsLoanCount, ISNULL(InArrearsCoustomerCount,0) as InArrearsCustomerCount, ISNULL(cast(InArrearsCPB/ case when InArrearsCoustomerCount =0 then 1 else InArrearsCoustomerCount end as decimal(18,4)),0) as AverageArrearsAmount, --逾期金额含义改为逾期资产剩余本金,原先含义保留,计算时使用剩余本金 ISNULL(AverageDaysInArrears,0) as AverageDaysInArrears, ISNULL(cast(InArrearsCPB/case when NoRefundedPrincipal=0 then 1 else NoRefundedPrincipal end as decimal(18,4)),0) AS ArrearsRate, ISNULL(ArrearsAmount,0) as ArrearsAmount from( select ISNULL(Trustcode,'UNK') AS Trustcode, concat('[',cast(cast(min(ApprovalAmount) as decimal(18,2)) as string),'-',cast(cast(max(ApprovalAmount) as decimal(18,2)) as string),']') AS ApproveAmountRange ,concat('[',cast(cast( min(CurrentRate*100) as decimal(18,2)) as string),'-',cast(cast( max(CurrentRate*100) as decimal(18,2)) as string),']') AS CurrentRateRange, concat('[',cast(cast( min( LoanTerm) as int) as string),'-',cast(cast( max(LoanTerm) as int) as string),']') AS LoanTermRange, sum(ApprovalAmount) AS TotalApproveAmount ,count(1) AS LoanCount ,cast(SUM(ApprovalAmount*CurrentRate*100)/NULLIF(SUM(ApprovalAmount),0) as decimal(18,4)) AS WeightedAverageCurrentRate-- 这里需要年化利率 ,cast(SUM(ApprovalAmount*LoanTerm)/NULLIF(SUM(ApprovalAmount),0) as decimal(18,4)) AS WeightedAverageLoanTerm ,count(1) AS countsInDuration ,sum(CurrentPrincipalBalance) AS TotalCPB ,sum(CurrentPrincipalBalance) AS NoRefundedPrincipal ,concat('[',cast(cast(min(CurrentPrincipalBalance) as decimal(18,2)) as string),'-',cast(cast(max(CurrentPrincipalBalance) as decimal(18,2)) as string),']') as CurrentPricipalBalanceRange ,concat('[',cast(cast( min( RemainingTerm) as int) as string),'-',cast(cast( max(RemainingTerm) as int) as string),']') as RemainTermRange ,cast(SUM(Seasoning*CurrentPrincipalBalance)/NULLIF(SUM(CurrentPrincipalBalance),0) as decimal(18,4)) AS WeightedAverageSeasoning ,cast(SUM(RemainingTerm*CurrentPrincipalBalance)/NULLIF(SUM(CurrentPrincipalBalance),0) as decimal(18,4)) AS WeightedAverageRemainTerm ,count(1) AS TotalApproveCount from adc.tblloan fl where fl.AssetType = 'ConsumerLoan' and fl.DimOrganisationID = 6 and fl.reportingdate='2022-10-22' and datasourceid=8 GROUP BY TrustCode )a left JOIN( select ISNULL(fl.Trustcode ,'UNK') AS Trustcode ,count(distinct fl.Code) AS CustomerCount ,round(sum((cast(year(now()) as int)-fl.YearOfBirth)*ApprovalAmount) / NULLIF(SUM(ApprovalAmount),0),4) AS WeightedAverageAge --into #customerStatistics from adc.tblloan fl --inner join dbo.tblFactLoanCustomer flc on flc.DimCustomerID=dc.DimCustomerID and dc.DimOrganisationID=flc.DimOrganisationID --inner join dbo.tblFactLoan fl on flc.DimLoanID=fl.DimLoanID and flc.DimOrganisationID=fl.DimOrganisationID and flc.DimReportingDateID=fl.DimReportingDateID where fl.AssetType = 'ConsumerLoan' and fl.DimOrganisationID = 6 and fl.reportingdate='2022-10-22' and datasourceid=8 GROUP BY fl.TrustCode )b on a.TrustCode = b.TrustCode left join( select ISNULL(fl.Trustcode ,'UNK') AS Trustcode, count(distinct code) AS CustomerCountWithCrediting --INTO #CustomerCountWithCrediting from adc.tblloan fl --inner join dbo.tblFactLoanCustomer flc on flc.DimCustomerID=dc.DimCustomerID and dc.DimOrganisationID=flc.DimOrganisationID --inner join dbo.tblFactLoan fl on flc.DimLoanID=fl.DimLoanID and flc.DimOrganisationID=fl.DimOrganisationID and flc.DimReportingDateID=fl.DimReportingDateID where fl.AssetType = 'ConsumerLoan' and fl.DimOrganisationID = 6 and fl.reportingdate='2022-10-22' and datasourceid=8 and fl.CollateralMethod is not null and fl.CollateralMethod!='-1' GROUP BY fl.TrustCode )c on a.TrustCode = c.TrustCode left join( select ISNULL(fl.Trustcode ,'UNK') AS Trustcode,count(distinct fl.Code) AS InArrearsCoustomerCount -- 身份证号 --into #InArrearsCoustomerCount from adc.tblloan fl --inner join dbo.tblFactLoanCustomer flc on flc.DimCustomerID=dc.DimCustomerID and dc.DimOrganisationID=flc.DimOrganisationID --inner join dbo.tblFactLoan fl on flc.DimLoanID=fl.DimLoanID and flc.DimOrganisationID=fl.DimOrganisationID and flc.DimReportingDateID=fl.DimReportingDateID where fl.AssetType = 'ConsumerLoan' and fl.DimOrganisationID = 6 and fl.reportingdate='2022-10-22' and datasourceid=8 and fl.DaysInarrears > 0 GROUP BY fl.TrustCode )d on a.TrustCode = d.TrustCode left join( select ISNULL(fl.Trustcode ,'UNK') AS Trustcode ,isnull(sum(CurrentPrincipalBalance),0) AS InArrearsCPB ,isnull(sum(ArrearsAmount1),0) AS ArrearsAmount -- 逾期金额 ,count(1) AS InArrearsLoanCount ,isnull(sum(CurrentPrincipalBalance*DaysInarrears)/NULLIF(sum(CurrentPrincipalBalance),0),0) AS AverageDaysInArrears --INTO #arrearsStatistics from adc.tblloan fl where fl.AssetType = 'ConsumerLoan' and fl.DimOrganisationID = 6 and fl.reportingdate='2022-10-22' and datasourceid=8 and fl.DaysInarrears > 0 GROUP BY TrustCode )e on a.TrustCode = e.TrustCode
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/electerm#1784
No description provided.