ElemDDLColDef is created in parser (sqlparser.y) as part of column_definition 
production
when a column is specified.
Fields are adjusted/populated in file ElemDDLCol.cpp in method 
setColumnAttribute.

My suggestion would be to go through sqlparser.y, ElemDDL*.cpp, 
StmtDDLCreate.cpp(and others),
and BindStmtDDL.cpp in parser dir to see the flow of how column definitions are 
created and set. 
Look at the code, go through the sequence in gdb, ask questions, etc before 
making changes. 

That will give a better understanding of the flow and will help in making 
better decision on
how/where to make changes. Should it be done in parser, in binder, in sqlcomp. 
Should it
be done when DDL is compiled or when it is executed.
Changes may still work but without an overall understanding of code flow in 
that area, 
you may miss something.

Emails are good to get idea and direction but ultimately understanding the 
architecture by
reading code and debugging is the way to go.

anoop

-----Original Message-----
From: Liu, Ming (Ming) <ming....@esgyn.cn> 
Sent: Monday, March 12, 2018 8:01 PM
To: dev@trafodion.apache.org
Subject: How and where the ElemDDLColDefault is converted into ElemDDLColDef ?

Hi, Trafodion developers,

I am trying to figure out the code path of building the default value of column 
definition.

In the parser yacc file, the default value is treated as type 
ElemDDLColDefault, for example:

                      | builtin_function_user
                                {
                                  $$ = new (PARSERHEAP())
                                    ElemDDLColDefault(
                                       ElemDDLColDefault::COL_DEFAULT,
                                       $1 /*builtin_function_user*/);
                                }

And later in the code CmpSeabaseDDL::buildColInfoArray, it all uses 
ElemDDLColDef for a given column. I cannot find where the population of 
ElemDDLColDef is done.
I need to transfer some information from parser to later phases for semantic 
checking. Reading the code for a while, but no good progress, anyone know this 
will help me a lot.

I modified the ElemDDLColDefault with an error code which can easily detected 
at parse time. Later, in semantic checking can properly report this error, 
since in the parser production, it is very hard to know the column name, have 
to postpone the error report in later phases. But DDL is not DML, there is no 
clear Bind phase, so I am lost here.

Thanks,
Ming

Reply via email to