Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select * join 버그 해결 #7

Merged
merged 2 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## Git Rule

### 커밋 룰
- 선 이슈 생성 & 후 개발

ex) `git commit -m "feat: ~~~"`
- `feat` 기능 구현
- `refactor` 리팩토링
- `fix` 버그 수정
- `test` 테스트코드
- `config` 빌드, 패키지, 환경변수 등의 수정
- `comment` 주석 추가 및 변경
- `docs` 문서 수정
- `rename` 파일/폴더명 수정
- `remove` 파일/폴더 삭제
- `etc` → 그 외

### 브랜치 룰
- `[이름 이니셜]/[수행한 작업]`

ex) `kms/select-join-fix`

### Merge 룰
- `개인브랜치 → (PR) → develop`, `develop → main` 방향으로만 머지한다
31 changes: 8 additions & 23 deletions src/com/holub/database/ConcreteTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,11 @@
private transient boolean isDirty = false;
private transient LinkedList transactionStack = new LinkedList();

/*
Getter
*/

public LinkedList getRowSet() {
return rowSet;
}

public String[] getColumnNames() {
return columnNames;
}

public String getTableName() {
return tableName;
}

/**********************************************************************
* Create a table with the given name and columns.
*
* @param tableName the name of the table.
* @param an array of Strings that specify the column names.
*/
public ConcreteTable(String tableName, String[] columnNames) {
this.tableName = tableName;
Expand Down Expand Up @@ -479,13 +463,14 @@ public Table select(Selector where, String[] requestedColumns, // {=ConcreteTabl
// iterators for each table involved in the join.

// Fix point - join 했을 때의 모든 컬럼 불러오기
if (requestedColumns == null){
ArrayList<String> tempList = new ArrayList<String>();
requestedColumns = tempList.toArray(String[]::new);
for (Table table : allTables){
ConcreteTable concreteTable = (ConcreteTable) table;
requestedColumns = Stream.concat(Arrays.stream(requestedColumns), Arrays.stream(concreteTable.getColumnNames())).toArray(String[]::new);
}
if (Objects.isNull(requestedColumns)) {
Set<String> cols = new LinkedHashSet<>();

for(Table table : allTables)
for(int i = 0; i < table.rows().columnCount(); i++)
cols.add(table.rows().columnName(i));

requestedColumns = cols.toArray(new String[cols.size()]);
}

Table resultTable = new ConcreteTable(null, requestedColumns);
Expand Down