Postgresql源码(127)投影ExecProject的表达式执行分析

无论是投影还是别的计算,表达式执行的入口和计算逻辑都是统一的,这里已投影为分析表达式执行的流程。

1 投影函数

用例

create table t1(i int primary key, j int, k int);
insert into t1 select i, i % 10, i % 100 from generate_series(1,10000000) t(i);
explain analyze select abs(k),abs(k),abs(k),abs(k),abs(k),exp(k),exp(k),exp(k),exp(k),exp(k) from t1;

对于这样这一条查询来说,每扫描一行,都会调用投影函数ExecProject,完成最终结果的构造。

投影函数:

static inline TupleTableSlot *
ExecProject(ProjectionInfo *projInfo)
{ExprContext *econtext = projInfo->pi_exprContext;ExprState  *state = &projInfo->pi_state;TupleTableSlot *slot = state->resultslot;bool		isnull;/** Clear any former contents of the result slot.  This makes it safe for* us to use the slot's Datum/isnull arrays as workspace.*/ExecClearTuple(slot);/* Run the expression, discarding scalar result from the last column. */(void) ExecEvalExprSwitchContext(state, econtext, &isnull);/** Successfully formed a result row.  Mark the result slot as containing a* valid virtual tuple (inlined version of ExecStoreVirtualTuple()).*/slot->tts_flags &= ~TTS_FLAG_EMPTY;slot->tts_nvalid = slot->tts_tupleDescriptor->natts;return slot;
}

总结:

  • projInfo->pi_exprContext记录了需要执行表达式的上下文信息
    • 具体存放:t1表扫出来的一行
    • 具体存放:表达式执行的内存上下文
  • projInfo->pi_state记录了表达式执行状态
    • 具体存放:表达式执行的每一个step,每一个step放到ExecInterpExpr中按顺序执行得到最终结果tuple。

2.1 表达式执行上下文结构ExprContext

其中ecxt_scantuple用来保存待处理输入tuple,通常指向一个 tuple table slot。

ExprContext *econtext = {type = T_ExprContext,ecxt_scantuple = 0x1520918,    <<<<<<<< 待处理tupleecxt_innertuple = 0x0,ecxt_outertuple = 0x0,ecxt_per_query_memory = 0x15203e0,ecxt_per_tuple_memory = 0x151e3d0,ecxt_param_exec_vals = 0x0,ecxt_param_list_info = 0x0,ecxt_aggvalues = 0x0,ecxt_aggnulls = 0x0,caseValue_datum = 0,caseValue_isNull = true,domainValue_datum = 0,domainValue_isNull = true,ecxt_estate = 0x15204e0,ecxt_callbacks = 0x0
}

2.2 表达式执行状态ExprState

ExprState  *state = {type = T_ExprState,flags = 6 '\006',resnull = false,resvalue = 0,resultslot = 0x151f278,steps = 0x1525c38,evalfunc = 0x74d749 <ExecInterpExprStillValid>,expr = 0x24c9618,evalfunc_private = 0x74af83 <ExecInterpExpr>,steps_len = 37,steps_alloc = 64,parent = 0x151e718,ext_params = 0x0,innermost_caseval = 0x0,innermost_casenull = 0x0,innermost_domainval = 0x0,innermost_domainnull = 0x0,escontext = 0x0
}

注意实际执行使用ExecInterpExpr函数完成表达式计算:

2.3 执行表达式

执行时,通过state->evalfunc函数完成具体的表达式计算动作。具体怎么计算流程放在steps中:

(gdb) p/x state->steps[0]->opcode
$15 = 0x74b0ad
(gdb) p/x state->steps[1]->opcode
$16 = 0x74b1ec
(gdb) p/x state->steps[2]->opcode
$17 = 0x74b784
(gdb) p/x state->steps[3]->opcode
$18 = 0x74b591
(gdb) p/x state->steps[4]->opcode
$19 = 0x74b1ec
(gdb) p/x state->steps[5]->opcode
$20 = 0x74b784
(gdb) p/x state->steps[6]->opcode
$21 = 0x74b591
(gdb) p/x state->steps[7]->opcode
$22 = 0x74b1ec
...
...

opcode需要再reverse_dispatch_table中确定当前计算走哪个ExecInterpExpr中的分支:

(这里不太方便调试因为这里把一个超大的switch case改成了goto,为了性能!)

p reverse_dispatch_table
$13 = {{opcode = 0x74b01a <ExecInterpExpr+151>,op = EEOP_DONE}, {opcode = 0x74b041 <ExecInterpExpr+190>,op = EEOP_INNER_FETCHSOME}, {opcode = 0x74b077 <ExecInterpExpr+244>,op = EEOP_OUTER_FETCHSOME}, {opcode = 0x74b0ad <ExecInterpExpr+298>,op = EEOP_SCAN_FETCHSOME}, {opcode = 0x74b0e6 <ExecInterpExpr+355>,op = EEOP_INNER_VAR}, {opcode = 0x74b169 <ExecInterpExpr+486>,op = EEOP_OUTER_VAR}, {opcode = 0x74b1ec <ExecInterpExpr+617>,op = EEOP_SCAN_VAR}, {opcode = 0x74b26f <ExecInterpExpr+748>,op = EEOP_INNER_SYSVAR}, {opcode = 0x74b29e <ExecInterpExpr+795>,op = EEOP_OUTER_SYSVAR}, {opcode = 0x74b2cd <ExecInterpExpr+842>,op = EEOP_SCAN_SYSVAR}, {opcode = 0x74b2fc <ExecInterpExpr+889>,op = EEOP_WHOLEROW}, {opcode = 0x74b32a <ExecInterpExpr+935>,op = EEOP_ASSIGN_INNER_VAR}, {opcode = 0x74b3f7 <ExecInterpExpr+1140>,op = EEOP_ASSIGN_OUTER_VAR}, {opcode = 0x74b4c4 <ExecInterpExpr+1345>,op = EEOP_ASSIGN_SCAN_VAR}, {opcode = 0x74b591 <ExecInterpExpr+1550>,op = EEOP_ASSIGN_TMP}, {opcode = 0x74b615 <ExecInterpExpr+1682>,op = EEOP_ASSIGN_TMP_MAKE_RO}, {opcode = 0x74b6e1 <ExecInterpExpr+1886>,op = EEOP_CONST}, {opcode = 0x74b717 <ExecInterpExpr+1940>,op = EEOP_FUNCEXPR}, {opcode = 0x74b784 <ExecInterpExpr+2049>,op = EEOP_FUNCEXPR_STRICT}, {opcode = 0x74b853 <ExecInterpExpr+2256>,op = EEOP_FUNCEXPR_FUSAGE}, {opcode = 0x74b881 <ExecInterpExpr+2302>,op = EEOP_FUNCEXPR_STRICT_FUSAGE}, {opcode = 0x74b8af <ExecInterpExpr+2348>,op = EEOP_BOOL_AND_STEP_FIRST}, {opcode = 0x74b8ba <ExecInterpExpr+2359>,op = EEOP_BOOL_AND_STEP}, {opcode = 0x74b92c <ExecInterpExpr+2473>,op = EEOP_BOOL_AND_STEP_LAST}, {opcode = 0x74b98f <ExecInterpExpr+2572>,op = EEOP_BOOL_OR_STEP_FIRST}, {opcode = 0x74b99a <ExecInterpExpr+2583>,op = EEOP_BOOL_OR_STEP}, {opcode = 0x74ba09 <ExecInterpExpr+2694>,op = EEOP_BOOL_OR_STEP_LAST}, {opcode = 0x74ba69 <ExecInterpExpr+2790>,op = EEOP_BOOL_NOT_STEP}, {opcode = 0x74bab3 <ExecInterpExpr+2864>,op = EEOP_QUAL}, {opcode = 0x74bb38 <ExecInterpExpr+2997>,op = EEOP_JUMP}, {opcode = 0x74bb63 <ExecInterpExpr+3040>,op = EEOP_JUMP_IF_NULL}, {opcode = 0x74bbae <ExecInterpExpr+3115>,op = EEOP_JUMP_IF_NOT_NULL}, {opcode = 0x74bbfc <ExecInterpExpr+3193>,op = EEOP_JUMP_IF_NOT_TRUE}, {opcode = 0x74bc61 <ExecInterpExpr+3294>,op = EEOP_NULLTEST_ISNULL}, {opcode = 0x74bc9d <ExecInterpExpr+3354>,op = EEOP_NULLTEST_ISNOTNULL}, {opcode = 0x74bcea <ExecInterpExpr+3431>,op = EEOP_NULLTEST_ROWISNULL}, {opcode = 0x74bd18 <ExecInterpExpr+3477>,op = EEOP_NULLTEST_ROWISNOTNULL}, {opcode = 0x74bd46 <ExecInterpExpr+3523>,op = EEOP_BOOLTEST_IS_TRUE}, {opcode = 0x74bd86 <ExecInterpExpr+3587>,op = EEOP_BOOLTEST_IS_NOT_TRUE}, {opcode = 0x74be01 <ExecInterpExpr+3710>,op = EEOP_BOOLTEST_IS_FALSE}, {opcode = 0x74be7c <ExecInterpExpr+3833>,op = EEOP_BOOLTEST_IS_NOT_FALSE}, {opcode = 0x74bebc <ExecInterpExpr+3897>,op = EEOP_PARAM_EXEC}, {opcode = 0x74beea <ExecInterpExpr+3943>,op = EEOP_PARAM_EXTERN}, {opcode = 0x74bf18 <ExecInterpExpr+3989>,op = EEOP_PARAM_CALLBACK}, {opcode = 0x74bf48 <ExecInterpExpr+4037>,op = EEOP_CASE_TESTVAL}, {opcode = 0x74bfbe <ExecInterpExpr+4155>,op = EEOP_DOMAIN_TESTVAL}, {opcode = 0x74c034 <ExecInterpExpr+4273>,op = EEOP_MAKE_READONLY}, {opcode = 0x74c08a <ExecInterpExpr+4359>,op = EEOP_IOCOERCE}, {opcode = 0x74c26c <ExecInterpExpr+4841>,op = EEOP_IOCOERCE_SAFE}, {opcode = 0x74c293 <ExecInterpExpr+4880>,op = EEOP_DISTINCT}, {opcode = 0x74c3a6 <ExecInterpExpr+5155>,op = EEOP_NOT_DISTINCT}, {opcode = 0x74c496 <ExecInterpExpr+5395>,op = EEOP_NULLIF}, {opcode = 0x74c57f <ExecInterpExpr+5628>,op = EEOP_SQLVALUEFUNCTION}, {opcode = 0x74c5a6 <ExecInterpExpr+5667>,op = EEOP_CURRENTOFEXPR}, {opcode = 0x74c5cd <ExecInterpExpr+5706>,op = EEOP_NEXTVALUEEXPR}, {opcode = 0x74c5f4 <ExecInterpExpr+5745>,op = EEOP_ARRAYEXPR}, {opcode = 0x74c61b <ExecInterpExpr+5784>,op = EEOP_ARRAYCOERCE}, {opcode = 0x74c649 <ExecInterpExpr+5830>,op = EEOP_ROW}, {opcode = 0x74c670 <ExecInterpExpr+5869>,op = EEOP_ROWCOMPARE_STEP}, {opcode = 0x74c7be <ExecInterpExpr+6203>,op = EEOP_ROWCOMPARE_FINAL}, {opcode = 0x74c8cf <ExecInterpExpr+6476>,op = EEOP_MINMAX}, {opcode = 0x74c8f6 <ExecInterpExpr+6515>,op = EEOP_FIELDSELECT}, {opcode = 0x74c924 <ExecInterpExpr+6561>,op = EEOP_FIELDSTORE_DEFORM}, {opcode = 0x74c952 <ExecInterpExpr+6607>,op = EEOP_FIELDSTORE_FORM}, {opcode = 0x74c980 <ExecInterpExpr+6653>,op = EEOP_SBSREF_SUBSCRIPTS}, {opcode = 0x74c9df <ExecInterpExpr+6748>,op = EEOP_SBSREF_OLD}, {opcode = 0x74c9e1 <ExecInterpExpr+6750>,op = EEOP_SBSREF_ASSIGN}, {opcode = 0x74c9e1 <ExecInterpExpr+6750>,op = EEOP_SBSREF_FETCH}, {opcode = 0x74ca11 <ExecInterpExpr+6798>,op = EEOP_CONVERT_ROWTYPE}, {opcode = 0x74ca3f <ExecInterpExpr+6844>,op = EEOP_SCALARARRAYOP}, {opcode = 0x74ca66 <ExecInterpExpr+6883>,op = EEOP_HASHED_SCALARARRAYOP}, {opcode = 0x74ca94 <ExecInterpExpr+6929>,op = EEOP_DOMAIN_NOTNULL}, {opcode = 0x74cabb <ExecInterpExpr+6968>,op = EEOP_DOMAIN_CHECK}, {opcode = 0x74cae2 <ExecInterpExpr+7007>,op = EEOP_XMLEXPR}, {opcode = 0x74cb09 <ExecInterpExpr+7046>,op = EEOP_JSON_CONSTRUCTOR}, {opcode = 0x74cb37 <ExecInterpExpr+7092>,op = EEOP_IS_JSON}, {opcode = 0x74cb5e <ExecInterpExpr+7131>,op = EEOP_JSONEXPR_PATH}, {opcode = 0x74cb9f <ExecInterpExpr+7196>,op = EEOP_JSONEXPR_COERCION}, {opcode = 0x74cbcd <ExecInterpExpr+7242>,op = EEOP_JSONEXPR_COERCION_FINISH}, {opcode = 0x74cbf4 <ExecInterpExpr+7281>,op = EEOP_AGGREF}, {opcode = 0x74cc82 <ExecInterpExpr+7423>,op = EEOP_GROUPING_FUNC}, {opcode = 0x74cca9 <ExecInterpExpr+7462>,op = EEOP_WINDOW_FUNC}, {opcode = 0x74cd40 <ExecInterpExpr+7613>,op = EEOP_MERGE_SUPPORT_FUNC}, {opcode = 0x74cd6e <ExecInterpExpr+7659>,op = EEOP_SUBPLAN}, {opcode = 0x74cd9c <ExecInterpExpr+7705>,op = EEOP_AGG_STRICT_DESERIALIZE}, {opcode = 0x74cdd7 <ExecInterpExpr+7764>,op = EEOP_AGG_DESERIALIZE}, {opcode = 0x74ce8a <ExecInterpExpr+7943>,op = EEOP_AGG_STRICT_INPUT_CHECK_ARGS}, {opcode = 0x74cf18 <ExecInterpExpr+8085>,op = EEOP_AGG_STRICT_INPUT_CHECK_NULLS}, {opcode = 0x74cf9f <ExecInterpExpr+8220>,op = EEOP_AGG_PLAIN_PERGROUP_NULLCHECK}, {opcode = 0x74d02c <ExecInterpExpr+8361>,op = EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYVAL}, {opcode = 0x74d147 <ExecInterpExpr+8644>,op = EEOP_AGG_PLAIN_TRANS_STRICT_BYVAL}, {opcode = 0x74d22c <ExecInterpExpr+8873>,op = EEOP_AGG_PLAIN_TRANS_BYVAL}, {opcode = 0x74d2fb <ExecInterpExpr+9080>,op = EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYREF}, {opcode = 0x74d413 <ExecInterpExpr+9360>,op = EEOP_AGG_PLAIN_TRANS_STRICT_BYREF}, {opcode = 0x74d4f5 <ExecInterpExpr+9586>,op = EEOP_AGG_PLAIN_TRANS_BYREF}, {opcode = 0x74d5c1 <ExecInterpExpr+9790>,op = EEOP_AGG_PRESORTED_DISTINCT_SINGLE}, {opcode = 0x74d648 <ExecInterpExpr+9925>,op = EEOP_AGG_PRESORTED_DISTINCT_MULTI}, {opcode = 0x74d6cf <ExecInterpExpr+10060>,op = EEOP_AGG_ORDERED_TRANS_DATUM}, {opcode = 0x74d6fd <ExecInterpExpr+10106>,op = EEOP_AGG_ORDERED_TRANS_TUPLE}}

翻译后

(gdb) p/x state->steps[0]->opcode
$15 = 0x74b0ad                       EEOP_SCAN_FETCHSOME
(gdb) p/x state->steps[1]->opcode
$16 = 0x74b1ec                       EEOP_SCAN_VAR
(gdb) p/x state->steps[2]->opcode
$17 = 0x74b784                       EEOP_FUNCEXPR_STRICT
(gdb) p/x state->steps[3]->opcode
$18 = 0x74b591                       EEOP_ASSIGN_TMP
(gdb) p/x state->steps[4]->opcode
$19 = 0x74b1ec                       EEOP_SCAN_VAR
(gdb) p/x state->steps[5]->opcode
$20 = 0x74b784                       EEOP_FUNCEXPR_STRICT
(gdb) p/x state->steps[6]->opcode
$21 = 0x74b591                       EEOP_ASSIGN_TMP
(gdb) p/x state->steps[7]->opcode
$22 = 0x74b1ec                       EEOP_SCAN_VAR
...
...
(gdb) p/x state->steps[34]->opcode
$27 = 0x74b784                       EEOP_FUNCEXPR_STRICT
(gdb) p/x state->steps[35]->opcode
$28 = 0x74b591                       EEOP_ASSIGN_TMP
(gdb) p/x state->steps[36]->opcode
$29 = 0x74b01a                       EEOP_DONE

可以看到表达式计算的流程:

第一步:EEOP_SCAN_FETCHSOME
  1. 从econtext->ecxt_scantuple读取到scanslot(当前要处理的一行数据)
  2. slot_getsomeattrs函数确保这一行数据中,至少有op->d.fetch.last_var个列是可以直接访问的(这里是3,因为t1表就三列,后面的处理可能需要访问这三列的任意一列)。为什么说有时不能直接访问,因为列有可能指向toast表。
		EEO_CASE(EEOP_SCAN_FETCHSOME){CheckOpSlotCompatibility(op, scanslot);slot_getsomeattrs(scanslot, op->d.fetch.last_var);EEO_NEXT();}
第二步:EEOP_SCAN_VAR

输入

p state->steps[1].d.fetch
$46 = {last_var = 2,fixed = 23,known_desc = 0x0,kind = 0x0
}

执行,从行中拿到第2列的值(0列、1列、2列)

		EEO_CASE(EEOP_SCAN_VAR){int			attnum = op->d.var.attnum;   // attnum = 2/* See EEOP_INNER_VAR comments */Assert(attnum >= 0 && attnum < scanslot->tts_nvalid);*op->resvalue = scanslot->tts_values[attnum];*op->resnull = scanslot->tts_isnull[attnum];EEO_NEXT();}

结果

(gdb) p state->steps[1].resvalue
$41 = (Datum *) 0x151f918
(gdb) p *state->steps[1].resvalue
$39 = 1(gdb) p state->steps[1].resnull
$42 = (_Bool *) 0x151f920
(gdb) p *state->steps[1].resnull
$40 = false
第三步:EEOP_FUNCEXPR_STRICT

输入

(gdb) p state->steps[2].d.func
$47 = {finfo = 0x151f8a8,fcinfo_data = 0x151f8f8,fn_addr = 0xa8ea89 <int4abs>,nargs = 1
}

执行

		EEO_CASE(EEOP_FUNCEXPR_STRICT){FunctionCallInfo fcinfo = op->d.func.fcinfo_data;NullableDatum *args = fcinfo->args;int			nargs = op->d.func.nargs;Datum		d;/* strict function, so check for NULL args */for (int argno = 0; argno < nargs; argno++){if (args[argno].isnull){*op->resnull = true;goto strictfail;}}fcinfo->isnull = false;d = op->d.func.fn_addr(fcinfo);*op->resvalue = d;*op->resnull = fcinfo->isnull;strictfail:EEO_NEXT();}

注意这里有一个地方很有意思,按理说EEOP_SCAN_VAR执行完才把值拿到,但从EEOP_FUNCEXPR_STRICT的执行来看,并没有发现把前一步的结果,放到函数args的步骤。

但是从GDB来看,函数的入参的地址和上一步取值后存放结果的地址是相同的,也就是上一步取值就是为了拿入参的args:

(gdb) p state->steps[4].resvalue
$59 = (Datum *) 0x151f9b8(gdb) p state->steps[5].d.func->fcinfo_data->args
$58 = 0x151f9b8

具体是怎么做到的呢?在构造steps时:
在这里插入图片描述
对于函数入参value会调用ExecInitExprRec去取值,在这个过程中,把参数的value指向新step的resvalue:
在这里插入图片描述
而这个新的step就是EEOP_SCAN_VAR:
在这里插入图片描述

第四步:暂存结果集

暂存结果集到resultslot中:

		EEO_CASE(EEOP_ASSIGN_TMP){int			resultnum = op->d.assign_tmp.resultnum;Assert(resultnum >= 0 && resultnum < resultslot->tts_tupleDescriptor->natts);resultslot->tts_values[resultnum] = state->resvalue;resultslot->tts_isnull[resultnum] = state->resnull;EEO_NEXT();}
第五步:继续上述流程直到执行完成
(gdb) p/x state->steps[0]->opcode
$15 = 0x74b0ad                       EEOP_SCAN_FETCHSOME   第一步
(gdb) p/x state->steps[1]->opcode
$16 = 0x74b1ec                       EEOP_SCAN_VAR         第二步
(gdb) p/x state->steps[2]->opcode
$17 = 0x74b784                       EEOP_FUNCEXPR_STRICT  第三步
(gdb) p/x state->steps[3]->opcode
$18 = 0x74b591                       EEOP_ASSIGN_TMP       第四步
(gdb) p/x state->steps[4]->opcode
$19 = 0x74b1ec                       EEOP_SCAN_VAR         第五步 和上述流程相同,每个函数的执行流程都是相似的
(gdb) p/x state->steps[5]->opcode
$20 = 0x74b784                       EEOP_FUNCEXPR_STRICT
(gdb) p/x state->steps[6]->opcode
$21 = 0x74b591                       EEOP_ASSIGN_TMP
(gdb) p/x state->steps[7]->opcode
$22 = 0x74b1ec                       EEOP_SCAN_VAR
...
...
(gdb) p/x state->steps[34]->opcode
$27 = 0x74b784                       EEOP_FUNCEXPR_STRICT
(gdb) p/x state->steps[35]->opcode
$28 = 0x74b591                       EEOP_ASSIGN_TMP
(gdb) p/x state->steps[36]->opcode
$29 = 0x74b01a                       EEOP_DONE

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/5558.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

STM32利用硬件I2C读取MPU6050陀螺仪数据

有了前面的基本配置&#xff0c;这节读取MPU6050的数据还算是简单&#xff0c;主要就是初始化时给MPU6050一些配置&#xff0c;取消睡眠模式&#xff0c;MPU6050开机是默认睡眠模式的&#xff0c;读写无效&#xff0c;所以上来就要先更改配置&#xff1a; MPU6050寄存器初始化…

Transformer算法组件详解

自2017年Google推出Transformer以来&#xff0c;基于其架构的语言模型便如雨后春笋般涌现&#xff0c;其中Bert、T5等备受瞩目&#xff0c;而近期风靡全球的大模型ChatGPT和LLaMa更是大放异彩。网络上关于Transformer的解析文章非常大。 前言 Transformer是谷歌在2017年的论文…

【webrtc】MessageHandler 7: 基于线程的消息处理:切换main线程向observer发出通知

以当前线程作为main线程 RemoteAudioSource 作为一个handler 仅实现一个退出清理的功能 首先on message的处理会切换到main 线程 :main_thread_其次,这里在main 线程对sink_ 做清理再次,在main 线程做出状态改变,并能通知给所有的observer 做出on changed 行为。对接mediac…

AC+AP三层组网实验(华为)

一&#xff0c;技术简介 APAC架构是一种常见的无线局域网&#xff08;WLAN&#xff09;组网方式&#xff0c;主要由接入点&#xff08;Access Point&#xff0c;简称AP&#xff09;和接入控制器&#xff08;Access Controller&#xff0c;简称AC&#xff09;组成。 在APAC架构…

AI大模型系列:自然语言处理,从规则到统计的演变

AI大模型系列文章目录 文明基石&#xff0c;文字与数字的起源与演变自然语言处理&#xff0c;从规则到统计的演变AI魔法师&#xff0c;提示工程的力量 自然语言处理&#xff0c;从规则到统计的演变 自然语言处理&#xff08;Natural Language Processing&#xff0c;NLP&…

前端 CSS

目录 选择器 复合选择器 伪类-超链接 结构伪装选择器 伪元素选择器 画盒子 字体属性 CSS三大属性 Emmet写法 背景属性 显示模式 盒子模型 盒子模型-组成 盒子模型-向外溢出 盒子模型-圆角 盒子模型-阴影 flex position定位 CSS小精灵 字体图标 垂直对齐方式…

数据库(MySQL)—— DML语句

数据库&#xff08;MySQL&#xff09;—— DML语句 什么是DML语句添加数据给全部字段添加数据批量添加数据 修改数据删除数据 什么是DML语句 在MySQL中&#xff0c;DML&#xff08;Data Manipulation Language&#xff0c;数据操纵语言&#xff09;语句主要用于对数据库中的数…

基础安全:CSRF攻击原理与防范

CSRF的概念 CSRF(Cross-Site Request Forgery)中文名为“跨站请求伪造”。这是一种常见的网络攻击手段,攻击者通过构造恶意请求,诱骗已登录的合法用户在不知情的情况下执行非本意的操作。这种攻击方式利用了Web应用程序中用户身份验证的漏洞,即浏览器在用户完成登录后会自…

eclipse导入工程提示Project has no explicit encoding set

eclipse导入工程提示Project has no explicit encoding set 文章目录 eclipse导入工程提示Project has no explicit encoding set一、Eclipse的工程导入二、可能的问题1.在工程名下有黄色叹号 一、Eclipse的工程导入 用Eclipse的导入可以将原有工程导入到新环境中 具体方法是&…

3.C++动态内存管理(超全)

目录 1 .C/C 内存分布 2. C语言中动态内存管理方式&#xff1a;malloc/calloc/realloc/free 3. C内存管理方式 3.1 new/delete操作内置类型 3.2 new和delete操作自定义类型 3.3 operator new函数 3.4 定位new表达式(placement-new) &#xff08;了解&#xff09; 4. 常…

Linux搭建靶场

提前准备&#xff1a; 文章中所使用到的Linux系统&#xff1a;Ubantu20.4sqlilabs靶场下载地址&#xff1a;GitHub - Audi-1/sqli-labs: SQLI labs to test error based, Blind boolean based, Time based. 一. 安装phpstudy phpstudy安装命令&#xff1a;wget -O install.sh h…

增强大模型高效检索:基于LlamaIndex ,构建一个轻量级带有记忆的 ColBERT 检索 Agent

在自然语言处理领域&#xff0c;高效检索相关信息的能力至关重要。将对话式记忆集成到文档检索系统中已经成为增强信息检索代理效果的强大技术。 在文中&#xff0c;我们专为 LlamaIndex 量身定制&#xff0c;将深入探讨构建一个轻量级的带有记忆的 ColBERT 检索代理&#xff…

后端方案设计文档结构模板可参考

文章目录 1 方案设计文档整体结构2 方案详细设计2.1 概要设计2.2 详细设计方案2.2.1 需求分析2.2.2 业务流程设计2.2.3 抽象类&#xff1a;实体对象建模2.2.4 接口设计2.2.5 存储设计 1 方案设计文档整体结构 一&#xff0c;现状&#xff1a;把项目的基本情况和背景都说清楚&a…

iA Writer for Mac:简洁强大的写作软件

在追求高效写作的今天&#xff0c;iA Writer for Mac凭借其简洁而强大的功能&#xff0c;成为了许多作家、记者和学生的首选工具。这款专为Mac用户打造的写作软件&#xff0c;以其独特的设计理念和实用功能&#xff0c;助你轻松打造高质量的文章。 iA Writer for Mac v7.1.2中文…

第2节:UIOTOS前端零代码应用 蓝图连线 信号值变化小示例02

目标 通过连线&#xff0c;实现信号值随机变化。 最终效果 实现过程 步骤1&#xff1a;接11节&#xff0c;选中底板设置其背景颜色 步骤2&#xff1a;拖入普通按钮V2组件&#xff0c;设置“text”值为“1”&#xff0c;并做form绑定 步骤3&#xff1a;选中按钮对输入框进行交…

Java 写一个死锁的例子

public class DeadLock {public static void main(String[] args) {Object lock1 new Object();Object lock2 new Object();new Thread(new A(lock1,lock2),"线程A").start();new Thread(new B(lock1,lock2),"线程B").start();} }class A implements Run…

Microsoft Universal Print 与 SAP 集成教程

引言 从 SAP 环境打印是许多客户的要求。例如数据列表打印、批量打印或标签打印。此类生产和批量打印方案通常使用专用硬件、驱动程序和打印解决方案来解决。 Microsoft Universal Print 是一种基于云的打印解决方案&#xff0c;它允许组织以集中化的方式管理打印机和打印机驱…

2023年蓝桥杯C++A组第三题:更小的数(双指针解法)

题目描述 小蓝有一个长度均为 n 且仅由数字字符 0 ∼ 9 组成的字符串&#xff0c;下标从 0 到 n − 1&#xff0c;你可以将其视作是一个具有 n 位的十进制数字 num&#xff0c;小蓝可以从 num 中选出一段连续的子串并将子串进行反转&#xff0c;最多反转一次。小蓝想要将选出的…

神经网络参数初始化

一、引入 在深度学习和机器学习的世界中&#xff0c;神经网络是构建智能系统的重要基石&#xff0c;参数初始化是神经网络训练过程中的一个重要步骤。在构建神经网络时&#xff0c;我们需要为权重和偏置等参数赋予初始值。对于偏置&#xff0c;通常可以将其初始化为0或者较小的…

【基础算法总结】滑动窗口一

滑动窗口 1.长度最小的字数组2.无重复字符的最长子串3.最大连续1的个数 III4.将 x 减到 0 的最小操作数 点赞&#x1f44d;&#x1f44d;收藏&#x1f31f;&#x1f31f;关注&#x1f496;&#x1f496; 你的支持是对我最大的鼓励&#xff0c;我们一起努力吧!&#x1f603;&…