You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by Shyam Sarkar <sh...@yahoo.com> on 2009/02/17 21:15:09 UTC

Need help on Hive.g and parser!

Hello,

Someone please explain the following build.xml spec for grammar build
(required and not required) ::

===================================================================

<uptodate property="grammarBuild.notRequired">
    <srcfiles dir= "${src.dir}/org/apache/hadoop/hive/ql/parse" includes="**/*.g"/>
    <mapper type="merge" to="${build.dir.hive}/ql/gen-java/org/apache/hadoop/hive/ql/parse/HiveParser.java"/>
  </uptodate>

  <target name="build-grammar" unless="grammarBuild.notRequired">
    <echo>Building Grammar ${src.dir}/org/apache/hadoop/hive/ql/parse/Hive.g  ....</echo>
    <java classname="org.antlr.Tool" classpathref="classpath" fork="true">
       <arg value="-fo" />
       <arg value="${build.dir.hive}/ql/gen-java/org/apache/hadoop/hive/ql/parse" />
       <arg value="${src.dir}/org/apache/hadoop/hive/ql/parse/Hive.g" />
    </java>
  </target>
=============================================================

Also can someone tell me which parser generator is used? I used JavaCC
in the past.

Thanks,
shyam_sarkar@yahoo.com



      

Re: Need help on Hive.g and parser!

Posted by Shyam Sarkar <sh...@yahoo.com>.
Thank you. I went through antlr. Just curious -- was there any comparison done between JavaCC and antlr ? How is the quality of code generated by antlr compared to JavaCC ? This could be an issue if in future we like to embed XML or java script inside Hive QL (not very important at this point).
Advanced SQL syntax embeds XML and Java scripts.

Thanks,
Shyam


--- On Tue, 2/17/09, Zheng Shao <zs...@gmail.com> wrote:

> From: Zheng Shao <zs...@gmail.com>
> Subject: Re: Need help on Hive.g and parser!
> To: hive-dev@hadoop.apache.org, shyam_sarkar@yahoo.com
> Date: Tuesday, February 17, 2009, 10:01 PM
> We are using antlr.
> 
> Basically, the rule checks the timestamp of
> HiveParser.java. If it's newer
> than Hive.g, then we don't need to regenerate
> HiveParse.java from Hive.g
> again.
> 
> Zheng
> 
> On Tue, Feb 17, 2009 at 12:15 PM, Shyam Sarkar
> <sh...@yahoo.com>wrote:
> 
> > Hello,
> >
> > Someone please explain the following build.xml spec
> for grammar build
> > (required and not required) ::
> >
> >
> ===================================================================
> >
> > <uptodate
> property="grammarBuild.notRequired">
> >    <srcfiles dir=
> "${src.dir}/org/apache/hadoop/hive/ql/parse"
> > includes="**/*.g"/>
> >    <mapper type="merge"
> >
> to="${build.dir.hive}/ql/gen-java/org/apache/hadoop/hive/ql/parse/HiveParser.java"/>
> >  </uptodate>
> >
> >  <target name="build-grammar"
> unless="grammarBuild.notRequired">
> >    <echo>Building Grammar
> ${src.dir}/org/apache/hadoop/hive/ql/parse/Hive.g
> >  ....</echo>
> >    <java classname="org.antlr.Tool"
> classpathref="classpath" fork="true">
> >       <arg value="-fo" />
> >       <arg
> >
> value="${build.dir.hive}/ql/gen-java/org/apache/hadoop/hive/ql/parse"
> />
> >       <arg
> value="${src.dir}/org/apache/hadoop/hive/ql/parse/Hive.g"
> />
> >    </java>
> >  </target>
> >
> =============================================================
> >
> > Also can someone tell me which parser generator is
> used? I used JavaCC
> > in the past.
> >
> > Thanks,
> > shyam_sarkar@yahoo.com
> >
> >
> >
> >
> >
> 
> 
> -- 
> Yours,
> Zheng


      

Re: Need help on Hive.g and parser!

Posted by Zheng Shao <zs...@gmail.com>.
We are using antlr.

Basically, the rule checks the timestamp of HiveParser.java. If it's newer
than Hive.g, then we don't need to regenerate HiveParse.java from Hive.g
again.

Zheng

On Tue, Feb 17, 2009 at 12:15 PM, Shyam Sarkar <sh...@yahoo.com>wrote:

> Hello,
>
> Someone please explain the following build.xml spec for grammar build
> (required and not required) ::
>
> ===================================================================
>
> <uptodate property="grammarBuild.notRequired">
>    <srcfiles dir= "${src.dir}/org/apache/hadoop/hive/ql/parse"
> includes="**/*.g"/>
>    <mapper type="merge"
> to="${build.dir.hive}/ql/gen-java/org/apache/hadoop/hive/ql/parse/HiveParser.java"/>
>  </uptodate>
>
>  <target name="build-grammar" unless="grammarBuild.notRequired">
>    <echo>Building Grammar ${src.dir}/org/apache/hadoop/hive/ql/parse/Hive.g
>  ....</echo>
>    <java classname="org.antlr.Tool" classpathref="classpath" fork="true">
>       <arg value="-fo" />
>       <arg
> value="${build.dir.hive}/ql/gen-java/org/apache/hadoop/hive/ql/parse" />
>       <arg value="${src.dir}/org/apache/hadoop/hive/ql/parse/Hive.g" />
>    </java>
>  </target>
> =============================================================
>
> Also can someone tell me which parser generator is used? I used JavaCC
> in the past.
>
> Thanks,
> shyam_sarkar@yahoo.com
>
>
>
>
>


-- 
Yours,
Zheng