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
import sqlparse | |
import sys | |
import re | |
parsed = sqlparse.parse(sys.argv[1]) | |
print(parsed[0]) | |
for t in parsed[0].tokens: | |
print(type(t), t.ttype, t) |
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
; ModuleID = '/var/lib/postgresql/12/main/1985.21.bc' | |
source_filename = "pg" | |
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" | |
target triple = "x86_64-pc-linux-gnu" | |
%struct.ExprState = type { %struct.Node, i8, i8, i64, %struct.TupleTableSlot*, %struct.ExprEvalStep*, i64 (%struct.ExprState*, %struct.ExprContext*, i8*)*, %struct.Expr*, i8*, i32, i32, %struct.PlanState*, %struct.ParamListInfoData*, i64*, i8*, i64*, i8* } | |
%struct.Node = type { i32 } | |
%struct.TupleTableSlot = type { i32, i16, i16, %struct.TupleTableSlotOps*, %struct.TupleDescData*, i64*, i8*, %struct.MemoryContextData*, %struct.ItemPointerData, i32 } | |
%struct.TupleTableSlotOps = type { i64, void (%struct.TupleTableSlot*)*, void (%struct.TupleTableSlot*)*, void (%struct.TupleTableSlot*)*, {}*, i64 (%struct.TupleTableSlot*, i32, i8*)*, void (%struct.TupleTableSlot*)*, void (%struct.TupleTableSlot*, %struct.TupleTableSlot*)*, %struct.HeapTupleData* (%struct.TupleTableSlot*)*, %struct.MinimalTupleData* (%struct.TupleTableSlot*)*, %struct.Heap |
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
; ModuleID = '/var/lib/postgresql/12/main/3410.0.bc' | |
source_filename = "pg" | |
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" | |
target triple = "x86_64-pc-linux-gnu" | |
%struct.ExprState = type { %struct.Node, i8, i8, i64, %struct.TupleTableSlot*, %struct.ExprEvalStep*, i64 (%struct.ExprState*, %struct.ExprContext*, i8*)*, %struct.Expr*, i8*, i32, i32, %struct.PlanState*, %struct.ParamListInfoData*, i64*, i8*, i64*, i8* } | |
%struct.Node = type { i32 } | |
%struct.TupleTableSlot = type { i32, i16, i16, %struct.TupleTableSlotOps*, %struct.TupleDescData*, i64*, i8*, %struct.MemoryContextData*, %struct.ItemPointerData, i32 } | |
%struct.TupleTableSlotOps = type { i64, void (%struct.TupleTableSlot*)*, void (%struct.TupleTableSlot*)*, void (%struct.TupleTableSlot*)*, {}*, i64 (%struct.TupleTableSlot*, i32, i8*)*, void (%struct.TupleTableSlot*)*, void (%struct.TupleTableSlot*, %struct.TupleTableSlot*)*, %struct.HeapTupleData* (%struct.TupleTableSlot*)*, %struct.MinimalTupleData* (%struct.TupleTableSlot*)*, %struct.HeapT |
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
/* Provide Declarations */ | |
#include <stdarg.h> | |
#include <setjmp.h> | |
#include <limits.h> | |
#include <stdint.h> | |
#include <math.h> | |
#ifndef __cplusplus | |
typedef unsigned char bool; | |
#endif |
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
; ModuleID = '/var/lib/postgresql/12/main/2832.0.bc' | |
source_filename = "pg" | |
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" | |
target triple = "x86_64-pc-linux-gnu" | |
%struct.ExprState = type { %struct.Node, i8, i8, i64, %struct.TupleTableSlot*, %struct.ExprEvalStep*, i64 (%struct.ExprState*, %struct.ExprContext*, i8*)*, %struct.Expr*, i8*, i32, i32, %struct.PlanState*, %struct.ParamListInfoData*, i64*, i8*, i64*, i8* } | |
%struct.Node = type { i32 } | |
%struct.TupleTableSlot = type { i32, i16, i16, %struct.TupleTableSlotOps*, %struct.TupleDescData*, i64*, i8*, %struct.MemoryContextData*, %struct.ItemPointerData, i32 } | |
%struct.TupleTableSlotOps = type { i64, void (%struct.TupleTableSlot*)*, void (%struct.TupleTableSlot*)*, void (%struct.TupleTableSlot*)*, {}*, i64 (%struct.TupleTableSlot*, i32, i8*)*, void (%struct.TupleTableSlot*)*, void (%struct.TupleTableSlot*, %struct.TupleTableSlot*)*, %struct.HeapTupleData* (%struct.TupleTableSlot*)*, %struct.MinimalTupleData* (%struct.TupleTableSlot*)*, %struct.HeapT |
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
public class JdbcTest { | |
private final static String CONNECTION_URL = "jdbc:calcite:model=target/test-classes/model.json"; | |
@BeforeClass | |
public static void setUpOnce() throws ClassNotFoundException { | |
Class.forName("org.apache.calcite.jdbc.Driver"); | |
} | |
@Test |
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
@Override | |
public void onMatch(RelOptRuleCall call) { | |
LogicalProject project = call.rel(0); | |
AvroTableScan scan = call.rel(1); | |
Integer[] fields = getProjectFields(project.getProjects()); | |
call.transformTo( | |
new AvroTableScan(scan.getCluster(), scan.getTable(), fields) | |
); | |
} |
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
public class AvroProjectTableScanRule extends RelOptRule { | |
static final AvroProjectTableScanRule INSTANCE = new AvroProjectTableScanRule(); | |
public AvroProjectTableScanRule() { | |
super(RelOptRule.operand( | |
LogicalProject.class, | |
RelOptRule.operand(AvroTableScan.class, RelOptRule.none()) | |
), "AvroProjectTableScanRule"); | |
} |
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
@Override | |
public Result implement(EnumerableRelImplementor implementor, Prefer pref) { | |
PhysType physType = PhysTypeImpl.of(implementor.getTypeFactory(), getRowType(), pref.preferArray()); | |
return implementor.result(physType, Blocks.toBlock( | |
Expressions.call( | |
this.table.getExpression(AvroTable.class), | |
"project", | |
implementor.getRootExpression(), | |
Expressions.constant(this.fields) | |
) |
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
@Override | |
public void register(RelOptPlanner planner) { | |
planner.addRule(AvroProjectTableScanRule.INSTANCE); | |
} |
NewerOlder