Java Code Examples for org.apache.calcite.sql.SqlSyntax#SPECIAL

The following examples show how to use org.apache.calcite.sql.SqlSyntax#SPECIAL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FindPartitionConditions.java    From Bats with Apache License 2.0 5 votes vote down vote up
private boolean isHolisticExpression(RexCall call) {
  /* If we are already processing a holistic expression then all
   * nested expressions should be treated holistically as well
   */
  if (holisticExpression > 0) {
    return true;
  }

  if (call.getOperator().getSyntax() == SqlSyntax.SPECIAL ||
      call.getOperator().getSyntax() == SqlSyntax.FUNCTION) {
    return true;
  }
  return false;
}
 
Example 2
Source File: HiveSqlOperatorTable.java    From marble with Apache License 2.0 5 votes vote down vote up
private SqlSyntax[] getSqlSyntaxInCalcite(Class hiveUDFClass) {
  if (GenericUDFBaseBinary.class.isAssignableFrom(hiveUDFClass)) {
    return new SqlSyntax[]{SqlSyntax.BINARY, SqlSyntax.FUNCTION};
  } else if (GenericUDFBaseUnary.class.isAssignableFrom(hiveUDFClass)) {
    return new SqlSyntax[]{SqlSyntax.PREFIX, SqlSyntax.FUNCTION};
  } else if (hiveUDFClass.equals(UDFRegExp.class)) {
    //rlike
    return new SqlSyntax[]{SqlSyntax.SPECIAL, SqlSyntax.FUNCTION};
  } else {
    //we treat other udf classes as SqlSyntax.FUNCTION
    return new SqlSyntax[]{SqlSyntax.FUNCTION};
  }
}
 
Example 3
Source File: FindPartitionConditions.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
private boolean isHolisticExpression(RexCall call) {
  /* If we are already processing a holistic expression then all
   * nested expressions should be treated holistically as well
   */
  if (holisticExpression > 0) {
    return true;
  }

  if (call.getOperator().getSyntax() == SqlSyntax.SPECIAL ||
      call.getOperator().getSyntax() == SqlSyntax.FUNCTION) {
    return true;
  }
  return false;
}
 
Example 4
Source File: SchemaField.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public RexNode visitCall(RexCall call) {
  final boolean isItem = call.getOperator().getSyntax() == SqlSyntax.SPECIAL && call.getOperator() == SqlStdOperatorTable.ITEM;
  if(isItem){
    return visitCandidate(call);
  }
  return super.visitCall(call);
}
 
Example 5
Source File: SchemaField.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public SchemaPath visitCall(RexCall call) {
  if(call.getOperator().getSyntax() != SqlSyntax.SPECIAL || call.getOperator() != SqlStdOperatorTable.ITEM){
    return null;
  }
  LogicalExpression logExpr = call.getOperands().get(0).accept(this);

  if (!(logExpr instanceof SchemaPath)) {
    return (SchemaPath) logExpr;
  }

  SchemaPath left = (SchemaPath) logExpr;
  final RexLiteral literal = (RexLiteral) call.getOperands().get(1);
  switch(literal.getTypeName()){
  case DECIMAL:
  case INTEGER:
    switch(indexMode){
    case ALLOW:
      return left.getChild(((BigDecimal)literal.getValue()).intValue());
    case SKIP:
      return left;
    case DISALLOW:
    default:
      return null;
    }

  case CHAR:
  case VARCHAR:
    return left.getChild(literal.getValue2().toString());
  default:
    // fall through
  }

  return null;
}
 
Example 6
Source File: SqlCaseOperator.java    From Bats with Apache License 2.0 4 votes vote down vote up
public SqlSyntax getSyntax() {
  return SqlSyntax.SPECIAL;
}
 
Example 7
Source File: SqlRowOperator.java    From Bats with Apache License 2.0 4 votes vote down vote up
public SqlSyntax getSyntax() {
  // Function syntax would work too.
  return SqlSyntax.SPECIAL;
}
 
Example 8
Source File: SqlCastFunction.java    From Bats with Apache License 2.0 4 votes vote down vote up
public SqlSyntax getSyntax() {
  return SqlSyntax.SPECIAL;
}
 
Example 9
Source File: SqlDatetimeSubtractionOperator.java    From Bats with Apache License 2.0 4 votes vote down vote up
public SqlSyntax getSyntax() {
  return SqlSyntax.SPECIAL;
}
 
Example 10
Source File: SqlDatetimePlusOperator.java    From Bats with Apache License 2.0 4 votes vote down vote up
public SqlSyntax getSyntax() {
  return SqlSyntax.SPECIAL;
}
 
Example 11
Source File: SqlCaseOperator.java    From calcite with Apache License 2.0 4 votes vote down vote up
public SqlSyntax getSyntax() {
  return SqlSyntax.SPECIAL;
}
 
Example 12
Source File: SqlCastFunction.java    From calcite with Apache License 2.0 4 votes vote down vote up
public SqlSyntax getSyntax() {
  return SqlSyntax.SPECIAL;
}