1.10版本中发现连续Join时抛出数组越界异常

Open
#304 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java, sql

Research direction

Start in com.dtstack.flink.sql.side.ParserJoinField, specifically getAllField(JoinScope scope) around lines 124-127, and reproduce the reported query with two joins to the same dimension table. Compare field.getFieldNames() with field.getTotalFields() when the field contains a Row, then verify that the query no longer raises an array-index error.

Written by the indexing model from the issue text.

Description

我将flinkStreamSql从1.8.1升级到1.10,原来可以运行的Join语句出错了。
tableA是源表, tableB 是维表,执行下面的语句
CREATE VIEW v_a_join_b AS
SELECT A.col_a1,A.col_a2,A.col_a3,B1.col_b as col_b1,B2.col_b as col_b2
FROM tableA AS A
LEFT JOIN tableB AS B1 ON A.col_a1 = B1.col_b
LEFT JOIN tableB AS B2 ON A.col_a2 = B2.col_b;
在com.dtstack.flink.sql.side.ParserJoinField类的
private static List getAllField(JoinScope scope) 方法中
会出现124行,String[] fieldNames = field.getFieldNames(); 只有两个字段f1,f2,其中f1是true,f2是Row其实包含了很多字段。 但是在126行,field.getTotalFields()会是实际包含的字段数,这样在127行, String fieldName = fieldNames[i]; 就会抛出数组越界的异常。 这个问题只在 多次Join需要进行表转流,流转表的时候才会遇到。
UI5M81IRAH)Y3YB NRF6726

Dominant language
Java
Stars
2k
Forks
913
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DTStack/flinkStreamSQL

All issues in DTStack/flinkStreamSQL

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.