-
Notifications
You must be signed in to change notification settings - Fork 8
add the AddSchemaPrefix operator #498
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
Open
RemHero
wants to merge
13
commits into
thulab:main
Choose a base branch
from
RemHero:fixSchemaPrefix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5b0523b
add the AddSchemaPrefix operator
RemHero e336857
delete some useless code
RemHero e517ede
fix some problems
RemHero 9c40524
remove the parquet original schemaPrefix
RemHero 66d210e
fix the pathMatchPrefix() in QueryGenerator
RemHero 4435bab
fix the pathMatchPrefix() in QueryGenerator
RemHero 3fe52d5
add IT
RemHero b39d4a9
Merge branch 'main' into fixSchemaPrefix
RemHero 1092f6b
fix the OperatorType
RemHero bd62227
Merge remote-tracking branch 'origin/fixSchemaPrefix' into fixSchemaP…
RemHero 73e0d8d
fix the OperatorType
RemHero 960af36
Merge branch 'main' into fixSchemaPrefix
RemHero dd7022a
Merge branch 'main' into fixSchemaPrefix
RemHero File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...n/edu/tsinghua/iginx/engine/physical/memory/execute/stream/AddSchemaPrefixLazyStream.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package cn.edu.tsinghua.iginx.engine.physical.memory.execute.stream; | ||
|
||
import cn.edu.tsinghua.iginx.engine.physical.exception.PhysicalException; | ||
import cn.edu.tsinghua.iginx.engine.shared.data.read.Field; | ||
import cn.edu.tsinghua.iginx.engine.shared.data.read.Header; | ||
import cn.edu.tsinghua.iginx.engine.shared.data.read.Row; | ||
import cn.edu.tsinghua.iginx.engine.shared.data.read.RowStream; | ||
import cn.edu.tsinghua.iginx.engine.shared.operator.AddSchemaPrefix; | ||
import cn.edu.tsinghua.iginx.engine.shared.operator.Rename; | ||
import cn.edu.tsinghua.iginx.utils.StringUtils; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.regex.Pattern; | ||
|
||
public class AddSchemaPrefixLazyStream extends UnaryLazyStream { | ||
|
||
private final AddSchemaPrefix addSchemaPrefix; | ||
|
||
private Header header; | ||
|
||
public AddSchemaPrefixLazyStream(AddSchemaPrefix addSchemaPrefix, RowStream stream) { | ||
super(stream); | ||
this.addSchemaPrefix = addSchemaPrefix; | ||
} | ||
|
||
@Override | ||
public Header getHeader() throws PhysicalException { | ||
if (header == null) { | ||
Header header = stream.getHeader(); | ||
String schemaPrefix = addSchemaPrefix.getSchemaPrefix(); | ||
|
||
List<Field> fields = new ArrayList<>(); | ||
header.getFields().forEach(field -> { | ||
if (schemaPrefix != null) | ||
fields.add(new Field(schemaPrefix + "." + field.getName(), field.getType(), field.getTags())); | ||
else | ||
fields.add(new Field(field.getName(), field.getType(), field.getTags())); | ||
}); | ||
|
||
this.header = new Header(header.getKey(), fields); | ||
} | ||
return header; | ||
} | ||
|
||
@Override | ||
public boolean hasNext() throws PhysicalException { | ||
return stream.hasNext(); | ||
} | ||
|
||
@Override | ||
public Row next() throws PhysicalException { | ||
if (!hasNext()) { | ||
throw new IllegalStateException("row stream doesn't have more data!"); | ||
} | ||
|
||
Row row = stream.next(); | ||
if (header.hasKey()) { | ||
return new Row(header, row.getKey(), row.getValues()); | ||
} else { | ||
return new Row(header, row.getValues()); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
core/src/main/java/cn/edu/tsinghua/iginx/engine/shared/operator/AddSchemaPrefix.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package cn.edu.tsinghua.iginx.engine.shared.operator; | ||
|
||
import cn.edu.tsinghua.iginx.engine.shared.operator.type.OperatorType; | ||
import cn.edu.tsinghua.iginx.engine.shared.source.Source; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class AddSchemaPrefix extends AbstractUnaryOperator { | ||
|
||
private final String schemaPrefix;// 可以为 null | ||
|
||
public AddSchemaPrefix(Source source, String schemaPrefix) { | ||
super(OperatorType.AddSchemaPrefix, source); | ||
this.schemaPrefix = schemaPrefix; | ||
} | ||
|
||
@Override | ||
public Operator copy() { | ||
return new AddSchemaPrefix(getSource().copy(), schemaPrefix); | ||
} | ||
|
||
public String getSchemaPrefix() { | ||
return schemaPrefix; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.