Hi,
Sorry to be a bother, but I've been sitting on this for quite a while now
and would really like to clear it. So I've been trying to use the
RelBuilder for building relational expressions.
1. I'm trying to build the relational expressions for using Trim()
function. This si what I've done so far:
RelNode node =
builder.scan("emp").project(builder.call(SqlStdOperatorTable.TRIM,
builder.getRexBuilder().makeFlag(Flag.BOTH),builder.literal(" "),
builder.field("EMPNAME"))).build();
Query Explain:
LogicalProject($f0=[TRIM(FLAG(BOTH), ' ', $2)])
  LogicalTableScan(table=[[hr, emp]])
Corresponding Mysql Query:
SELECT TRIM(BOTH ' ' FROM `EMPNAME`) AS `$f0`
FROM `hr`.`emp`
Could somebody tell me what I'm doing wrong here?
2. How can I convert the following Mysql Query:
SELECT DATE_FORMAT(HIRE_DATE,'%Y/%m/%d'), EMPNAME FROM `emp` WHERE
DATE_FORMAT(HIRE_DATE,'%Y/%m/%d') = DATE_FORMAT(NOW(),'%Y/%m/%d');
to its corresponding Relational Algebra using RelBuilder? Simply put how
can i convert the date formats in RelBuilder?

Thanks and Regards,
RamKrishna.

Reply via email to