Skip to content

Commit

Permalink
feat: g4测试编写
Browse files Browse the repository at this point in the history
  • Loading branch information
ruY9527 committed Oct 29, 2023
1 parent 910571d commit 5adb06f
Show file tree
Hide file tree
Showing 12 changed files with 35,447 additions and 0 deletions.
18 changes: 18 additions & 0 deletions boot-base/boot-basic-io/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,24 @@
<version>32.1.1-jre</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.antlr/antlr4-runtime -->
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.7</version>
</dependency>

<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-catalyst_2.12</artifactId>
<version>3.0.1</version>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package com.iyang.bootbasicio.sql;

import lombok.extern.slf4j.Slf4j;
import org.antlr.v4.runtime.tree.ParseTree;

import java.util.ArrayList;
import java.util.List;

/***
* @author: yang_bao
* @date: 2023/10/30
* @desc:
***/

@Slf4j
public class IcebergVisitor extends SqlBaseBaseVisitor {


private List<String> tableList = new ArrayList<>();

@Override
public List<String> visitSingleStatement(SqlBaseParser.SingleStatementContext ctx) {
super.visitSingleStatement(ctx);


return tableList;
}


@Override
public List<String> visitTableIdentifier(SqlBaseParser.TableIdentifierContext ctx) {
String db = ctx.db.getText();
String table = ctx.table.getText();

System.out.println("1111");
log.info("the visitTableIdentifier db value is --> {} , table is ---> {} " , db, table);
return tableList;
}


@Override
public Object visitInsertOverwriteTable(SqlBaseParser.InsertOverwriteTableContext ctx) {

return super.visitInsertOverwriteTable(ctx);
}

/* @Override
public Object visitSingleInsertQuery(SqlBaseParser.SingleInsertQueryContext ctx) {
String queryTermText = ctx.queryTerm().getText();
String queryStart = ctx.queryTerm().getStart().getText();
String queryStop = ctx.queryTerm().getStop().getText();
SqlBaseParser.QueryTermContext termContext = ctx.queryTerm();
log.info("the visitSingleInsertQuery.queryTerm() --> {}, start ---> {} , stop ---> {} ", queryTermText, queryStart, queryStop);
return super.visitSingleInsertQuery(ctx);
}*/

@Override
public Object visitUpdateTable(SqlBaseParser.UpdateTableContext ctx) {


return super.visitUpdateTable(ctx);
}


@Override
public Object visitDeleteFromTable(SqlBaseParser.DeleteFromTableContext ctx) {
return super.visitDeleteFromTable(ctx);
}
}
Loading

0 comments on commit 5adb06f

Please sign in to comment.