问题描述
我浏览了Apache Calcite的文档。 relNode
是否正确用于BigQuery中的以下查询?
SELECT CONCAT('a or b',' ','\n',first_name)
FROM foo.schema.employee
WHERE first_name = 'name';
relNode = builder
.scan("schema.employee")
.filter(builder.call(sqlStdOperatorTable.EQUALS,builder.field("first_name"),builder.literal("name"))
.project(builder.call(sqlStdOperatorTable.CONCAT,builder.literal("a or b"),builder.literal(" "),builder.literal("\\n"),builder.field(first_name)))
.build()
解决方法
乍一看似乎正确。我建议您通过查看查询结果以及将if ( ! class_exists( 'CBC_Sermon_Notes_Module' ) ) {
class CBC_Sermon_Notes_Module {
/**
* Main constructor
*
* @since 1.0.0
*/
public function __construct() {
// Registers the shortcode in WordPress
add_shortcode( 'CBC_Sermon_Notes_Module',array( 'CBC_Sermon_Notes_Module','output' ) );
// Map shortcode to Visual Composer
if ( function_exists( 'vc_lean_map' ) ) {
vc_lean_map( 'CBC_Sermon_Notes_Module','map' ) );
}
}
/**
* Shortcode output
*
* @since 1.0.0
*/
public static function output( $atts,$content = null ) {
// Extract shortcode attributes (aka your module settings)
extract( vc_map_get_attributes( 'CBC_Sermon_Notes_Module',$atts ) );
// Define output
$output = '';
// Sermons are required
if ( empty( $questions ) ) {
return;
}
// Get repeatable field values
$questions = (array) vc_param_group_parse_atts( $questions );
$output .= '<div class="sermon-notes-section"><h2><span class="ticon ticon-pencil"></span> Sermon Notes</h2>';
// Loop through Lesson Questions
$count = 1;
foreach ( $questions as $key => $question ) {
// This will display the single question added through the Visual Composer Element
if ( ! empty( $question['question'] ) ) {
$output .= '<div class="sermon-single-notes">' . wpautop( $question['question'] );
}
// This will display the notes shortcode for each question
$title = strlen( $question['title'] ) > 0 ? $question['title'] : $question['question'];
$inline_notes_shortcode = do_shortcode( '[kc_ld_inline_notes id="' . $count . '" title="Question ' . $count . '"]');
$output .= $inline_notes_shortcode . '</div>';
$count = $count + 1;
}
$output .='</div>';
// Return output
return $output;
}
public static function map() {
return array(
'name' => esc_html__( 'Sermon Notes','locale' ),'description' => esc_html__( 'Displays the Sermon Notes','base' => 'CBC_Sermon_Notes_Module','params' => array(
array(
'type' => 'param_group','param_name' => 'questions','group' => __( 'Sermon Notes','total' ),'value' => urlencode( json_encode( array( ) ) ),'params' => array(
array(
'type' => 'textfield','heading' => __( 'Point Label','param_name' => 'question',),);
}
}
}
new CBC_Sermon_Notes_Module;
转换为SQL来确认。